@johpaz/hive-agents 0.0.29 → 0.0.31

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.
Files changed (183) hide show
  1. package/README.md +27 -17
  2. package/dist/hive.js +9325 -10084
  3. package/dist/ui/assets/AgentCreateForm-BmRLLGIL.js +1 -0
  4. package/dist/ui/assets/AgentDetailPage-BOVOgECU.js +1 -0
  5. package/dist/ui/assets/AgentNewPage-BCMuhksF.js +1 -0
  6. package/dist/ui/assets/AgentsPage-BYGTwib8.js +10 -0
  7. package/dist/ui/assets/BridgePage-CEMpmdql.js +1 -0
  8. package/dist/ui/assets/CanvasPage-Dcmx4S1-.js +33 -0
  9. package/dist/ui/assets/ChannelsPage-B_PiavjN.js +8 -0
  10. package/dist/ui/assets/DashboardPage-sSu1NU7V.js +6 -0
  11. package/dist/ui/assets/LoginPage-D1kejzak.js +1 -0
  12. package/dist/ui/assets/LogsPage-CaD4OOff.js +1 -0
  13. package/dist/ui/assets/MeetingPage-C0iKxHOI.js +1 -0
  14. package/dist/ui/assets/NotFound-CBnwE5nh.js +1 -0
  15. package/dist/ui/assets/ProjectsPage-DGliWwpu.js +1 -0
  16. package/dist/ui/assets/ProvidersPage-_O0WMMVK.js +1 -0
  17. package/dist/ui/assets/RecoverPage-DVESenp8.js +1 -0
  18. package/dist/ui/assets/SettingsPage-BKCZqIq2.js +9 -0
  19. package/dist/ui/assets/SetupPage-IjKq_kLj.js +1 -0
  20. package/dist/ui/assets/WebChatPage-D-zO53Yt.js +16 -0
  21. package/dist/ui/assets/accordion-_sozXeaB.js +1 -0
  22. package/dist/ui/assets/activity-BB8JBT7a.js +1 -0
  23. package/dist/ui/assets/alert-Bgqky__w.js +1 -0
  24. package/dist/ui/assets/alert-dialog-B12geoBt.js +1 -0
  25. package/dist/ui/assets/arrow-left-WQsWOWW_.js +1 -0
  26. package/dist/ui/assets/badge-BY-VUaxL.js +1 -0
  27. package/dist/ui/assets/calendar-D_GHXR8q.js +1 -0
  28. package/dist/ui/assets/card-CE_kGxdL.js +1 -0
  29. package/dist/ui/assets/chevron-down-DLfCQOQA.js +1 -0
  30. package/dist/ui/assets/chevron-left-5XF9hbEm.js +1 -0
  31. package/dist/ui/assets/chevron-right-B60x0b2L.js +1 -0
  32. package/dist/ui/assets/chevron-up-GfewdYph.js +1 -0
  33. package/dist/ui/assets/circle-DLFOVgkH.js +1 -0
  34. package/dist/ui/assets/circle-alert-Qf59MV-u.js +1 -0
  35. package/dist/ui/assets/circle-check-BhwUUu4Z.js +1 -0
  36. package/dist/ui/assets/circle-minus-BcF7EW2K.js +1 -0
  37. package/dist/ui/assets/circle-x-C55wB-DP.js +1 -0
  38. package/dist/ui/assets/cpu-BxFtjoPn.js +1 -0
  39. package/dist/ui/assets/dialog-CWlGzRqi.js +1 -0
  40. package/dist/ui/assets/download-DRO1cmbw.js +1 -0
  41. package/dist/ui/assets/dropdown-menu-CdulmYlU.js +1 -0
  42. package/dist/ui/assets/es-JYPdzK5t.js +1 -0
  43. package/dist/ui/assets/external-link-BULKsDvk.js +1 -0
  44. package/dist/ui/assets/eye-SOUMoM2-.js +1 -0
  45. package/dist/ui/assets/file-text-CxAwK_Ze.js +1 -0
  46. package/dist/ui/assets/folder-open-BnXDc8BG.js +1 -0
  47. package/dist/ui/assets/format-CR2WWfql.js +1 -0
  48. package/dist/ui/assets/gauge-DYmZYnET.js +1 -0
  49. package/dist/ui/assets/globe-C7sirxEy.js +1 -0
  50. package/dist/ui/assets/hexagon-BGGuDxI7.js +1 -0
  51. package/dist/ui/assets/history-vA8Y7XQq.js +1 -0
  52. package/dist/ui/assets/index-9GZvkGGW.css +2 -0
  53. package/dist/ui/assets/index-B4lS14UW.js +116 -0
  54. package/dist/ui/assets/info-CFGdNsZs.js +1 -0
  55. package/dist/ui/assets/key-DFIqRGXl.js +1 -0
  56. package/dist/ui/assets/label-CplWBwSz.js +1 -0
  57. package/dist/ui/assets/loader-circle-BaadtldT.js +1 -0
  58. package/dist/ui/assets/lock-DUwqtzEo.js +1 -0
  59. package/dist/ui/assets/pause-BsToEchU.js +1 -0
  60. package/dist/ui/assets/play-Rmf5Px63.js +1 -0
  61. package/dist/ui/assets/plus-CqJyiQvM.js +1 -0
  62. package/dist/ui/assets/progress-CFpWXmru.js +1 -0
  63. package/dist/ui/assets/refresh-cw-Yf5FGfA5.js +1 -0
  64. package/dist/ui/assets/save-Diu387yr.js +1 -0
  65. package/dist/ui/assets/scroll-area-B3bGhGnD.js +1 -0
  66. package/dist/ui/assets/search-CnhAnemg.js +1 -0
  67. package/dist/ui/assets/send-CU73wLDC.js +1 -0
  68. package/dist/ui/assets/settings-OcD7AWkq.js +1 -0
  69. package/dist/ui/assets/slider-B7ibzqE3.js +14 -0
  70. package/dist/ui/assets/sparkles-Dnx_Tpre.js +1 -0
  71. package/dist/ui/assets/square-PyIpnS-W.js +1 -0
  72. package/dist/ui/assets/switch-CQf9jQKN.js +1 -0
  73. package/dist/ui/assets/table-CN6cGA9v.js +1 -0
  74. package/dist/ui/assets/terminal-CNLY74vg.js +1 -0
  75. package/dist/ui/assets/textarea-CPuZn8Rg.js +1 -0
  76. package/dist/ui/assets/trash-2-CUqHaFaC.js +1 -0
  77. package/dist/ui/assets/triangle-alert-vUtWDfZd.js +1 -0
  78. package/dist/ui/assets/useProviders-77fYN2hY.js +1 -0
  79. package/dist/ui/assets/vendor-charts-Bu2lyBKP.js +65 -0
  80. package/dist/ui/assets/vendor-query-DsWPbQdG.js +1 -0
  81. package/dist/ui/assets/vendor-radix-JY4ncZrD.js +63 -0
  82. package/dist/ui/assets/vendor-react-CscwQerf.js +1 -0
  83. package/dist/ui/assets/vendor-router-4QM6Fwg6.js +3 -0
  84. package/dist/ui/assets/volume-2-B8dkjcEZ.js +1 -0
  85. package/dist/ui/assets/wifi-DK-RxSqc.js +1 -0
  86. package/dist/ui/assets/zap-BD57u2UH.js +1 -0
  87. package/dist/ui/dist/assets/AgentCreateForm-BmRLLGIL.js +1 -0
  88. package/dist/ui/dist/assets/AgentDetailPage-BOVOgECU.js +1 -0
  89. package/dist/ui/dist/assets/AgentNewPage-BCMuhksF.js +1 -0
  90. package/dist/ui/dist/assets/AgentsPage-BYGTwib8.js +10 -0
  91. package/dist/ui/dist/assets/BridgePage-CEMpmdql.js +1 -0
  92. package/dist/ui/dist/assets/CanvasPage-Dcmx4S1-.js +33 -0
  93. package/dist/ui/dist/assets/ChannelsPage-B_PiavjN.js +8 -0
  94. package/dist/ui/dist/assets/DashboardPage-sSu1NU7V.js +6 -0
  95. package/dist/ui/dist/assets/LoginPage-D1kejzak.js +1 -0
  96. package/dist/ui/dist/assets/LogsPage-CaD4OOff.js +1 -0
  97. package/dist/ui/dist/assets/MeetingPage-C0iKxHOI.js +1 -0
  98. package/dist/ui/dist/assets/NotFound-CBnwE5nh.js +1 -0
  99. package/dist/ui/dist/assets/ProjectsPage-DGliWwpu.js +1 -0
  100. package/dist/ui/dist/assets/ProvidersPage-_O0WMMVK.js +1 -0
  101. package/dist/ui/dist/assets/RecoverPage-DVESenp8.js +1 -0
  102. package/dist/ui/dist/assets/SettingsPage-BKCZqIq2.js +9 -0
  103. package/dist/ui/dist/assets/SetupPage-IjKq_kLj.js +1 -0
  104. package/dist/ui/dist/assets/WebChatPage-D-zO53Yt.js +16 -0
  105. package/dist/ui/dist/assets/accordion-_sozXeaB.js +1 -0
  106. package/dist/ui/dist/assets/activity-BB8JBT7a.js +1 -0
  107. package/dist/ui/dist/assets/alert-Bgqky__w.js +1 -0
  108. package/dist/ui/dist/assets/alert-dialog-B12geoBt.js +1 -0
  109. package/dist/ui/dist/assets/arrow-left-WQsWOWW_.js +1 -0
  110. package/dist/ui/dist/assets/badge-BY-VUaxL.js +1 -0
  111. package/dist/ui/dist/assets/calendar-D_GHXR8q.js +1 -0
  112. package/dist/ui/dist/assets/card-CE_kGxdL.js +1 -0
  113. package/dist/ui/dist/assets/chevron-down-DLfCQOQA.js +1 -0
  114. package/dist/ui/dist/assets/chevron-left-5XF9hbEm.js +1 -0
  115. package/dist/ui/dist/assets/chevron-right-B60x0b2L.js +1 -0
  116. package/dist/ui/dist/assets/chevron-up-GfewdYph.js +1 -0
  117. package/dist/ui/dist/assets/circle-DLFOVgkH.js +1 -0
  118. package/dist/ui/dist/assets/circle-alert-Qf59MV-u.js +1 -0
  119. package/dist/ui/dist/assets/circle-check-BhwUUu4Z.js +1 -0
  120. package/dist/ui/dist/assets/circle-minus-BcF7EW2K.js +1 -0
  121. package/dist/ui/dist/assets/circle-x-C55wB-DP.js +1 -0
  122. package/dist/ui/dist/assets/cpu-BxFtjoPn.js +1 -0
  123. package/dist/ui/dist/assets/dialog-CWlGzRqi.js +1 -0
  124. package/dist/ui/dist/assets/download-DRO1cmbw.js +1 -0
  125. package/dist/ui/dist/assets/dropdown-menu-CdulmYlU.js +1 -0
  126. package/dist/ui/dist/assets/es-JYPdzK5t.js +1 -0
  127. package/dist/ui/dist/assets/external-link-BULKsDvk.js +1 -0
  128. package/dist/ui/dist/assets/eye-SOUMoM2-.js +1 -0
  129. package/dist/ui/dist/assets/file-text-CxAwK_Ze.js +1 -0
  130. package/dist/ui/dist/assets/folder-open-BnXDc8BG.js +1 -0
  131. package/dist/ui/dist/assets/format-CR2WWfql.js +1 -0
  132. package/dist/ui/dist/assets/gauge-DYmZYnET.js +1 -0
  133. package/dist/ui/dist/assets/globe-C7sirxEy.js +1 -0
  134. package/dist/ui/dist/assets/hexagon-BGGuDxI7.js +1 -0
  135. package/dist/ui/dist/assets/history-vA8Y7XQq.js +1 -0
  136. package/dist/ui/dist/assets/index-9GZvkGGW.css +2 -0
  137. package/dist/ui/dist/assets/index-B4lS14UW.js +116 -0
  138. package/dist/ui/dist/assets/info-CFGdNsZs.js +1 -0
  139. package/dist/ui/dist/assets/key-DFIqRGXl.js +1 -0
  140. package/dist/ui/dist/assets/label-CplWBwSz.js +1 -0
  141. package/dist/ui/dist/assets/loader-circle-BaadtldT.js +1 -0
  142. package/dist/ui/dist/assets/lock-DUwqtzEo.js +1 -0
  143. package/dist/ui/dist/assets/pause-BsToEchU.js +1 -0
  144. package/dist/ui/dist/assets/play-Rmf5Px63.js +1 -0
  145. package/dist/ui/dist/assets/plus-CqJyiQvM.js +1 -0
  146. package/dist/ui/dist/assets/progress-CFpWXmru.js +1 -0
  147. package/dist/ui/dist/assets/refresh-cw-Yf5FGfA5.js +1 -0
  148. package/dist/ui/dist/assets/save-Diu387yr.js +1 -0
  149. package/dist/ui/dist/assets/scroll-area-B3bGhGnD.js +1 -0
  150. package/dist/ui/dist/assets/search-CnhAnemg.js +1 -0
  151. package/dist/ui/dist/assets/send-CU73wLDC.js +1 -0
  152. package/dist/ui/dist/assets/settings-OcD7AWkq.js +1 -0
  153. package/dist/ui/dist/assets/slider-B7ibzqE3.js +14 -0
  154. package/dist/ui/dist/assets/sparkles-Dnx_Tpre.js +1 -0
  155. package/dist/ui/dist/assets/square-PyIpnS-W.js +1 -0
  156. package/dist/ui/dist/assets/switch-CQf9jQKN.js +1 -0
  157. package/dist/ui/dist/assets/table-CN6cGA9v.js +1 -0
  158. package/dist/ui/dist/assets/terminal-CNLY74vg.js +1 -0
  159. package/dist/ui/dist/assets/textarea-CPuZn8Rg.js +1 -0
  160. package/dist/ui/dist/assets/trash-2-CUqHaFaC.js +1 -0
  161. package/dist/ui/dist/assets/triangle-alert-vUtWDfZd.js +1 -0
  162. package/dist/ui/dist/assets/useProviders-77fYN2hY.js +1 -0
  163. package/dist/ui/dist/assets/vendor-charts-Bu2lyBKP.js +65 -0
  164. package/dist/ui/dist/assets/vendor-query-DsWPbQdG.js +1 -0
  165. package/dist/ui/dist/assets/vendor-radix-JY4ncZrD.js +63 -0
  166. package/dist/ui/dist/assets/vendor-react-CscwQerf.js +1 -0
  167. package/dist/ui/dist/assets/vendor-router-4QM6Fwg6.js +3 -0
  168. package/dist/ui/dist/assets/volume-2-B8dkjcEZ.js +1 -0
  169. package/dist/ui/dist/assets/wifi-DK-RxSqc.js +1 -0
  170. package/dist/ui/dist/assets/zap-BD57u2UH.js +1 -0
  171. package/dist/ui/dist/index.html +30 -25
  172. package/dist/ui/index.html +30 -25
  173. package/package.json +3 -5
  174. package/dist/ui/assets/index-CS7uWSOk.js +0 -344
  175. package/dist/ui/assets/index-DUIt49UX.css +0 -2
  176. package/dist/ui/assets/react-C63RN3Ve.js +0 -1
  177. package/dist/ui/assets/ui-CHpVij2M.css +0 -1
  178. package/dist/ui/assets/ui-Ra3lIxcJ.js +0 -22
  179. package/dist/ui/dist/assets/index-CS7uWSOk.js +0 -344
  180. package/dist/ui/dist/assets/index-DUIt49UX.css +0 -2
  181. package/dist/ui/dist/assets/react-C63RN3Ve.js +0 -1
  182. package/dist/ui/dist/assets/ui-CHpVij2M.css +0 -1
  183. package/dist/ui/dist/assets/ui-Ra3lIxcJ.js +0 -22
@@ -0,0 +1,8 @@
1
+ import{r as e,t}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as n}from"./vendor-charts-Bu2lyBKP.js";import{o as r}from"./vendor-query-DsWPbQdG.js";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d}from"./switch-CQf9jQKN.js";import{t as f}from"./circle-alert-Qf59MV-u.js";import{t as p}from"./circle-check-BhwUUu4Z.js";import{n as m,t as h}from"./eye-SOUMoM2-.js";import{t as g}from"./loader-circle-BaadtldT.js";import{t as _}from"./plus-CqJyiQvM.js";import{t as v}from"./refresh-cw-Yf5FGfA5.js";import{t as ee}from"./settings-OcD7AWkq.js";import{t as y}from"./zap-BD57u2UH.js";import{c as b}from"./vendor-router-4QM6Fwg6.js";import{H as x,N as S,P as C,X as te,Z as w,f as ne,n as re,tt as T,u as ie}from"./index-B4lS14UW.js";import{t as E}from"./label-CplWBwSz.js";import{n as ae,t as oe}from"./alert-Bgqky__w.js";var se=T(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),D=e(n(),1),O=r();function ce({channel:e,onEdit:t,onToggle:n}){e.status;let r=e.isConfigured===!1,i=e.status===`connected`||e.status===`connecting`;return(0,O.jsxs)(`div`,{onClick:()=>t(e),className:`hive-card group transition-all duration-500 cursor-pointer ${i?`hive-card--active border-emerald-500/20`:r?`opacity-50 border-dashed hover:opacity-80 hover:border-blue-500/30`:`opacity-60 grayscale-[0.8] hover:opacity-100 hover:grayscale-0`}`,children:[(0,O.jsxs)(`div`,{className:`hive-card-body relative overflow-hidden`,children:[(0,O.jsxs)(`div`,{className:`flex items-start justify-between mb-8`,children:[(0,O.jsx)(`div`,{className:`h-12 w-12 rounded-xl flex items-center justify-center border transition-all duration-500 ${i?`bg-emerald-500/10 border-emerald-500/30 text-emerald-400 shadow-[0_0_15px_rgba(16,185,129,0.2)]`:r?`bg-blue-500/5 border-blue-500/20 text-blue-400/40`:`bg-white/5 border-white/10 text-white/30`}`,children:(0,O.jsx)(te,{className:`h-6 w-6`})}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i&&(0,O.jsx)(`span`,{className:`text-[9px] font-black tracking-widest text-emerald-500 shadow-emerald-glow`,children:e.status===`connecting`?`CONECTANDO`:`CONECTADO`}),r?(0,O.jsx)(`span`,{className:`text-[9px] font-black tracking-widest text-blue-400/60 uppercase`,children:`DISPONIBLE`}):(0,O.jsx)(d,{checked:e.enabled,onCheckedChange:t=>n(e.id,t),onClick:e=>e.stopPropagation(),className:`data-[state=checked]:bg-emerald-500 scale-75 origin-right`})]})]}),(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h3`,{className:`text-xl font-black text-white uppercase tracking-tighter mb-1 line-clamp-1 group-hover:text-emerald-400 transition-colors`,children:e.type}),(0,O.jsx)(`p`,{className:`text-[10px] text-white/20 font-black tracking-[0.2em] mb-4`,children:r?`CLICK PARA CONFIGURAR`:`ID: ${e.id.substring(0,12).toUpperCase()}`})]}),(0,O.jsxs)(`div`,{className:`pt-4 border-t border-white/5 flex items-center gap-6`,children:[(0,O.jsxs)(`div`,{className:`hive-stat`,children:[(0,O.jsx)(`span`,{className:`hive-stat__label`,children:`VOZ`}),(0,O.jsx)(`span`,{className:`hive-stat__value ${e.voice_enabled?`text-emerald-500`:`text-white/20`}`,children:e.voice_enabled?`ON`:`OFF`})]}),(0,O.jsxs)(`div`,{className:`hive-stat`,children:[(0,O.jsx)(`span`,{className:`hive-stat__label`,children:`SÍNTESIS`}),(0,O.jsx)(`span`,{className:`hive-stat__value ${e.tts_enabled?`text-emerald-500`:`text-white/20`}`,children:e.tts_enabled?`ON`:`OFF`})]})]})]}),i&&(0,O.jsx)(`div`,{className:`hive-glow-blob hive-glow-blob--emerald -bottom-10 -right-10 h-24 w-24 opacity-20`})]}),(0,O.jsx)(`div`,{className:`hive-strip--bottom ${i?`bg-emerald-500`:r?`bg-blue-500/30`:`bg-white/10`}`})]})}var k=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),A=t((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),j=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),M=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),N=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),P=t((e=>{var t=A().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),F=t((e=>{var t=A().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),I=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),L=t((e=>{var t=j(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),le=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),ue=t((e=>{var t=le();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),de=t(((e,t)=>{var n=ue();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),R=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),z=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
2
+ ]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^`+t+`$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),B=t((e=>{var t=R(),n=z();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),V=t((e=>{var t=A(),n=L(),r=j(),i=B(),a=R(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),fe=t((e=>{var t=A(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),H=t(((e,t)=>{var n=B();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),pe=t(((e,t)=>{var n=B(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),U=t(((e,t)=>{var n=B();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),W=t(((e,t)=>{var n=B(),r=A();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
3
+ Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),G=t(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),K=t((e=>{var t=B(),n=H(),r=pe(),i=U(),a=W(),o=z(),s=A(),c=G();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
4
+ Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),q=t((e=>{var t=A(),n=j(),r=M(),i=N(),a=P(),o=F(),s=I(),c=L(),l=de(),u=V(),d=fe(),f=B(),p=K();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function ee(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function y(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return b(a,e,n)}function b(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,ee=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=ee.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let y=new Uint8Array(i),b=0,x,S;for(x=0;x<v;x++)for(S=0;S<o;S++)x<g[S].length&&(y[b++]=g[S][x]);for(x=0;x<p;x++)for(S=0;S<o;S++)y[b++]=_[S][x];return y}function x(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
5
+ The chosen QR Code version cannot contain this amount of data.
6
+ Minimum version required to store current data is: `+c+`.
7
+ `);let l=y(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),ee(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),x(e,a,i,o)}})),J=t((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||={};let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),Y=t((e=>{var t=J();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),X=t((e=>{var t=J();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
8
+ `;return typeof a==`function`&&a(null,p),p}})),me=e(t((e=>{var t=k(),n=q(),r=Y(),i=X();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))(),1),he=[{id:`whisper-large-v3-turbo`,name:`Whisper Large V3 Turbo (Groq)`,provider:`groq`},{id:`whisper-large-v3`,name:`Whisper Large V3 (Groq)`,provider:`groq`},{id:`distil-whisper-large-v3-en`,name:`Distil Whisper V3 EN (Groq)`,provider:`groq`},{id:`whisper-1`,name:`Whisper 1 (OpenAI)`,provider:`openai`}],ge=[{group:`ElevenLabs`,provider:`elevenlabs`,models:[{id:`eleven_flash_v2_5`,name:`Flash v2.5`},{id:`eleven_turbo_v2_5`,name:`Turbo v2.5`},{id:`eleven_multilingual_v2`,name:`Multilingual v2`},{id:`eleven_v3`,name:`V3`}]},{group:`OpenAI`,provider:`openai`,models:[{id:`tts-1`,name:`TTS-1`},{id:`tts-1-hd`,name:`TTS-1 HD`},{id:`gpt-4o-mini-tts`,name:`GPT-4o Mini TTS`}]},{group:`Google Gemini`,provider:`gemini`,models:[{id:`gemini-2.5-flash-preview-tts`,name:`Gemini 2.5 Flash TTS`},{id:`gemini-2.5-pro-preview-tts`,name:`Gemini 2.5 Pro TTS`}]},{group:`Qwen`,provider:`qwen`,models:[{id:`qwen3-tts-instruct-flash`,name:`Qwen3 TTS Instruct Flash`},{id:`qwen3-tts-flash`,name:`Qwen3 TTS Flash`},{id:`qwen-tts`,name:`Qwen TTS`}]},{group:`Piper (Local)`,provider:`piper`,models:[{id:`piper`,name:`Piper TTS (es_MX Cortana)`}]}];function _e(e){return e.startsWith(`eleven`)?`elevenlabs`:e.startsWith(`tts-`)||e.startsWith(`gpt-`)?`openai`:e.startsWith(`gemini`)?`gemini`:e.startsWith(`qwen`)?`qwen`:e===`piper`?`piper`:null}var ve=[{id:`gemini`,name:`Google Gemini`,provider:`gemini`},{id:`openai`,name:`OpenAI`,provider:`openai`},{id:`anthropic`,name:`Anthropic Claude`,provider:`anthropic`}];function ye({data:e}){let t=(0,D.useRef)(null);return(0,D.useEffect)(()=>{!e||!t.current||me.toCanvas(t.current,e,{width:220,margin:2,color:{dark:`#000000`,light:`#ffffff`}}).catch(console.error)},[e]),(0,O.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,O.jsx)(`div`,{className:`rounded-xl overflow-hidden border-4 border-white shadow-lg`,children:(0,O.jsx)(`canvas`,{ref:t})}),(0,O.jsx)(`p`,{className:`text-xs text-white/40 text-center`,children:`Abre WhatsApp → Ajustes → Dispositivos vinculados → Vincular dispositivo`})]})}function be({channel:e,isOpen:t,onClose:n,onSave:r}){let _=b(),{createChannel:y,reconnectChannel:te,fetchChannels:w}=re(),{configuredVoiceProviders:T,fetchConfiguredVoiceProviders:ce}=ie(),[k,A]=(0,D.useState)(e?`settings`:`type`),[j,M]=(0,D.useState)(`telegram`),[N,P]=(0,D.useState)(``),[F,I]=(0,D.useState)(``),[L,le]=(0,D.useState)(``),[ue,de]=(0,D.useState)(!1),[R,z]=(0,D.useState)(!1),[B,V]=(0,D.useState)(null),[fe,H]=(0,D.useState)(null),[pe,U]=(0,D.useState)(!1),[W,G]=(0,D.useState)(null),[K,q]=(0,D.useState)(!1),J=(0,D.useRef)(null),[Y,X]=(0,D.useState)({}),[me,be]=(0,D.useState)(!1),[xe,Se]=(0,D.useState)([]),[Ce,we]=(0,D.useState)(!1),[Te,Ee]=(0,D.useState)(!1),[De,Oe]=(0,D.useState)(``),[ke,Ae]=(0,D.useState)(!1),je=e&&e.status!==`connected`,Z=e&&e.isConfigured===!1;(0,D.useEffect)(()=>{t?e?(A(je?`reconnect`:`settings`),M(e.type),P(``),I(``),le(``),V(e.id),H(null),U(!1),G(null),X(e),Ee(!1),Oe(``),Ae(!1)):(A(`type`),M(`telegram`),P(``),I(``),le(``),V(null),H(null),U(!1),G(null)):Q()},[t,e]),(0,D.useEffect)(()=>{ce()},[ce]),(0,D.useEffect)(()=>{let e=Y.tts_provider?_e(Y.tts_provider):null;if(!e){Se([]);return}we(!0),ne(`/api/voice/${e}/voices`,{showError:!1}).then(e=>Se(e.voices||[])).catch(()=>Se([])).finally(()=>we(!1))},[Y.tts_provider]);let Q=(0,D.useCallback)(()=>{J.current&&=(clearInterval(J.current),null)},[]),Me=(0,D.useCallback)((e,t)=>{Q(),J.current=setInterval(async()=>{try{let n=await ne(`/api/channels/${e}/${t}/status`,{showError:!1});n.status===`qr`&&n.qrCode?(H(n.qrCode),U(!1),A(`qr`)):n.status===`connected`?(Q(),await w(),A(`success`)):n.status===`error`?(Q(),G(`Error de conexión. Intenta de nuevo.`),A(`credentials`)):(n.status===`disconnected`||n.status===`not_found`)&&U(!0)}catch{}},2e3)},[Q,w]),Ne=async()=>{if(e){q(!0),G(null);try{let t={};j===`telegram`&&N.trim()&&(t.botToken=N),j===`discord`&&(N.trim()&&(t.botToken=N),F.trim()&&(t.applicationId=F)),await te(e.id,Object.keys(t).length>0?t:void 0),A(`connecting`),Me(j,e.id)}catch(e){G(e.message||`Error al reconectar`)}finally{q(!1)}}},Pe=async()=>{q(!0),G(null);try{let e={};j===`telegram`&&(e.botToken=N),j===`discord`&&(e.botToken=N,e.applicationId=F),j===`slack`&&(e.botToken=N,e.signingSecret=L);let{id:t}=await y(j,e);V(t),j===`whatsapp`?(A(`connecting`),Me(`whatsapp`,t)):(A(`connecting`),Me(j,t))}catch(e){G(e.message||`Error al conectar`)}finally{q(!1)}},Fe=async()=>{if(e?.id){be(!0);try{if(De.trim().length>10&&(e.type===`telegram`||e.type===`discord`)){let t={botToken:De.trim()};await te(e.id,t)}await r(e.id,Y),n()}catch(e){console.error(`Save failed`,e)}finally{be(!1)}}},$=()=>{Q(),n()},Ie=j===`whatsapp`||j===`webchat`||j===`telegram`&&N.trim().length>10||j===`discord`&&N.trim().length>10&&F.trim().length>0||j===`slack`&&N.trim().length>10&&L.trim().length>10,Le=()=>k===`reconnect`?(0,O.jsxs)(`div`,{className:`space-y-4 py-2`,children:[W&&(0,O.jsxs)(oe,{variant:`destructive`,className:`bg-red-500/10 border-red-500/30`,children:[(0,O.jsx)(f,{className:`h-4 w-4`}),(0,O.jsx)(ae,{children:W})]}),(0,O.jsxs)(`div`,{className:`p-4 rounded-xl ${Z?`bg-blue-500/10 border border-blue-500/20`:`bg-amber-500/10 border border-amber-500/20`}`,children:[(0,O.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-widest mb-1 ${Z?`text-blue-300`:`text-amber-300`}`,children:Z?`Canal no configurado`:`Canal desconectado`}),(0,O.jsx)(`p`,{className:`text-xs ${Z?`text-blue-200/70`:`text-amber-200/70`}`,children:Z?j===`whatsapp`?`Haz clic en Conectar para generar el código QR.`:j===`webchat`?`Haz clic en Conectar para activar el canal web.`:`Ingresa las credenciales para activar este canal.`:j===`whatsapp`?`Haz clic en Reconectar para generar un nuevo código QR.`:j===`webchat`?`Haz clic en Reconectar para activar el canal.`:`Puedes reconectar con las credenciales existentes o ingresar un nuevo token.`})]}),(j===`telegram`||j===`discord`)&&(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsx)(`p`,{className:`text-[10px] text-white/30 uppercase tracking-widest`,children:Z?`Credenciales`:`Actualizar credenciales (opcional)`}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(E,{className:`text-xs text-white/50`,children:`Bot Token`}),(0,O.jsxs)(`div`,{className:`relative`,children:[(0,O.jsx)(S,{type:R?`text`:`password`,value:N,onChange:e=>P(e.target.value),placeholder:Z?j===`telegram`?`123456789:AAF...`:`MTA5NDY...`:`Dejar vacío para usar el token actual`,className:`bg-white/5 border-white/10 pr-10 font-mono text-sm`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>z(e=>!e),className:`absolute right-2 top-1/2 -translate-y-1/2 text-white/40 hover:text-white/70`,children:R?(0,O.jsx)(m,{className:`h-4 w-4`}):(0,O.jsx)(h,{className:`h-4 w-4`})})]})]}),j===`discord`&&(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(E,{className:`text-xs text-white/50`,children:`Application ID`}),(0,O.jsx)(S,{value:F,onChange:e=>I(e.target.value),placeholder:Z?`123456789012345678`:`Dejar vacío para usar el actual`,className:`bg-white/5 border-white/10 font-mono text-sm`})]})]})]}):k===`type`?(0,O.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,O.jsx)(`p`,{className:`text-sm text-white/50`,children:`Selecciona el tipo de canal a conectar:`}),(0,O.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:[{id:`telegram`,label:`Telegram`,icon:`✈️`},{id:`whatsapp`,label:`WhatsApp`,icon:`💬`},{id:`discord`,label:`Discord`,icon:`🎮`},{id:`slack`,label:`Slack`,icon:`💼`},{id:`webchat`,label:`WebChat`,icon:`🌐`}].map(e=>(0,O.jsxs)(`button`,{onClick:()=>M(e.id),className:`p-4 rounded-xl border text-left transition-all duration-200 ${j===e.id?`border-blue-500 bg-blue-500/10 text-white`:`border-white/10 bg-white/5 text-white/50 hover:border-white/20 hover:text-white/70`}`,children:[(0,O.jsx)(`div`,{className:`text-2xl mb-1`,children:e.icon}),(0,O.jsx)(`div`,{className:`text-sm font-semibold`,children:e.label})]},e.id))})]}):k===`credentials`?(0,O.jsxs)(`div`,{className:`space-y-4 py-2`,children:[W&&(0,O.jsxs)(oe,{variant:`destructive`,className:`bg-red-500/10 border-red-500/30`,children:[(0,O.jsx)(f,{className:`h-4 w-4`}),(0,O.jsx)(ae,{children:W})]}),j===`whatsapp`&&(0,O.jsx)(`div`,{className:`p-4 rounded-xl bg-emerald-500/10 border border-emerald-500/20 text-sm text-emerald-300`,children:`WhatsApp no requiere token. Haz clic en "Conectar" y escanea el código QR con tu teléfono.`}),j===`webchat`&&(0,O.jsx)(`div`,{className:`p-4 rounded-xl bg-blue-500/10 border border-blue-500/20 text-sm text-blue-300`,children:`WebChat no requiere configuración. Haz clic en "Conectar" para activarlo.`}),(j===`telegram`||j===`discord`||j===`slack`)&&(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(E,{className:`text-xs text-white/50 uppercase tracking-widest`,children:`Bot Token`}),(0,O.jsxs)(`div`,{className:`relative`,children:[(0,O.jsx)(S,{type:R?`text`:`password`,value:N,onChange:e=>P(e.target.value),placeholder:j===`telegram`?`123456789:AAF...`:j===`slack`?`xoxb-...`:`MTA5NDY...`,className:`bg-white/5 border-white/10 pr-10 font-mono text-sm`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>z(e=>!e),className:`absolute right-2 top-1/2 -translate-y-1/2 text-white/40 hover:text-white/70`,children:R?(0,O.jsx)(m,{className:`h-4 w-4`}):(0,O.jsx)(h,{className:`h-4 w-4`})})]})]}),j===`discord`&&(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(E,{className:`text-xs text-white/50 uppercase tracking-widest`,children:`Application ID`}),(0,O.jsx)(S,{value:F,onChange:e=>I(e.target.value),placeholder:`123456789012345678`,className:`bg-white/5 border-white/10 font-mono text-sm`})]}),j===`slack`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(E,{className:`text-xs text-white/50 uppercase tracking-widest`,children:`Signing Secret`}),(0,O.jsxs)(`div`,{className:`relative`,children:[(0,O.jsx)(S,{type:ue?`text`:`password`,value:L,onChange:e=>le(e.target.value),placeholder:`a1b2c3d4e5f6...`,className:`bg-white/5 border-white/10 pr-10 font-mono text-sm`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>de(e=>!e),className:`absolute right-2 top-1/2 -translate-y-1/2 text-white/40 hover:text-white/70`,children:ue?(0,O.jsx)(m,{className:`h-4 w-4`}):(0,O.jsx)(h,{className:`h-4 w-4`})})]})]}),(0,O.jsxs)(`div`,{className:`p-3 rounded-lg bg-amber-500/10 border border-amber-500/20 text-xs text-amber-200/80`,children:[`Slack requiere una URL pública para webhooks. Usa ngrok, cloudflared o Tailscale y configura la Request URL en tu Slack App: `,(0,O.jsx)(`span`,{className:`font-mono`,children:`https://tu-url/slack/events`})]})]})]})]}):k===`connecting`?(0,O.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-8`,children:[(0,O.jsx)(`div`,{className:`relative`,children:(0,O.jsx)(`div`,{className:`h-16 w-16 rounded-full border-2 border-white/10 flex items-center justify-center`,children:(0,O.jsx)(g,{className:`h-8 w-8 animate-spin text-blue-400`})})}),(0,O.jsx)(`p`,{className:`text-sm text-white/60 text-center`,children:j===`whatsapp`?`Iniciando WhatsApp... Generando código QR`:`Conectando canal...`}),(0,O.jsx)(`p`,{className:`text-xs text-white/30`,children:`Esto puede tardar unos segundos`})]}):k===`qr`?(0,O.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-4`,children:[(0,O.jsxs)(`div`,{className:`relative`,children:[fe?(0,O.jsx)(ye,{data:fe}):(0,O.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-6`,children:[(0,O.jsx)(se,{className:`h-16 w-16 text-white/20`}),(0,O.jsx)(`p`,{className:`text-xs text-white/40`,children:`Generando QR...`})]}),pe&&(0,O.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center rounded-xl bg-zinc-950/80 backdrop-blur-sm gap-2`,children:[(0,O.jsx)(g,{className:`h-8 w-8 animate-spin text-amber-400`}),(0,O.jsx)(`p`,{className:`text-xs text-amber-300 font-medium`,children:`QR expirado, renovando...`})]})]}),(0,O.jsx)(`div`,{className:`flex items-center gap-2 text-xs text-white/30`,children:pe?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-amber-400 animate-pulse`}),`Renovando código QR...`]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse`}),`Esperando escaneo...`]})}),(0,O.jsx)(`p`,{className:`text-[11px] text-white/30 text-center`,children:`Abre WhatsApp → Ajustes → Dispositivos vinculados → Vincular dispositivo`})]}):k===`success`?(0,O.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-8`,children:[(0,O.jsx)(`div`,{className:`h-16 w-16 rounded-full bg-emerald-500/10 border border-emerald-500/30 flex items-center justify-center`,children:(0,O.jsx)(p,{className:`h-8 w-8 text-emerald-400`})}),(0,O.jsxs)(`div`,{className:`text-center`,children:[(0,O.jsx)(`p`,{className:`text-sm font-semibold text-white`,children:`Canal conectado`}),(0,O.jsxs)(`p`,{className:`text-xs text-white/40 mt-1`,children:[j.charAt(0).toUpperCase()+j.slice(1),` está activo y listo para recibir mensajes.`]})]})]}):null,Re=()=>(0,O.jsxs)(`div`,{className:`grid gap-4 py-4`,children:[e?.type===`whatsapp`&&(0,O.jsxs)(`div`,{className:`space-y-2 pb-2 border-b border-white/10`,children:[(0,O.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,O.jsx)(E,{className:`text-xs text-white/50 uppercase tracking-widest`,children:`Número Vinculado`})}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-white/5 border border-white/10`,children:[(0,O.jsx)(`span`,{className:`font-mono text-sm text-white/70`,children:e.accountId?`+${e.accountId}`:`No conectado`}),(0,O.jsx)(`span`,{className:`text-[10px] text-white/40 ml-auto`,children:e.status===`connected`?`✓`:`sin conexión`})]})]}),(e?.type===`telegram`||e?.type===`discord`)&&(0,O.jsxs)(`div`,{className:`space-y-2 pb-2 border-b border-white/10`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(E,{className:`text-xs text-white/50 uppercase tracking-widest`,children:`Bot Token`}),!Te&&(0,O.jsx)(`button`,{type:`button`,onClick:()=>Ee(!0),className:`text-[11px] text-blue-400 hover:text-blue-300 transition-colors`,children:`Cambiar token`})]}),Te?(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsxs)(`div`,{className:`relative`,children:[(0,O.jsx)(S,{type:ke?`text`:`password`,value:De,onChange:e=>Oe(e.target.value),placeholder:e?.type===`telegram`?`123456789:AAF...`:`MTA5NDY...`,className:`bg-white/5 border-white/10 pr-10 font-mono text-sm`,autoFocus:!0}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>Ae(e=>!e),className:`absolute right-2 top-1/2 -translate-y-1/2 text-white/40 hover:text-white/70`,children:ke?(0,O.jsx)(m,{className:`h-4 w-4`}):(0,O.jsx)(h,{className:`h-4 w-4`})})]}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:()=>{Ee(!1),Oe(``),Ae(!1)},className:`text-[11px] text-white/40 hover:text-white/60 transition-colors`,children:`Cancelar`}),De.trim().length>0&&(0,O.jsx)(`span`,{className:`text-[11px] text-amber-400/70`,children:`Se aplicará al guardar`})]})]}):(0,O.jsx)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-white/5 border border-white/10`,children:(0,O.jsx)(`span`,{className:`font-mono text-sm text-white/30 tracking-widest select-none`,children:`••••••••••••••••••••••••`})})]}),(0,O.jsxs)(`div`,{className:`grid grid-cols-4 items-center gap-4`,children:[(0,O.jsx)(E,{className:`text-right text-xs`,children:`Voz (STT)`}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2 col-span-3`,children:[(0,O.jsx)(d,{checked:Y.voice_enabled,onCheckedChange:e=>X(t=>({...t,voice_enabled:e}))}),(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Procesar notas de voz`})]})]}),(0,O.jsxs)(`div`,{className:`grid grid-cols-4 items-center gap-4`,children:[(0,O.jsx)(E,{className:`text-right text-xs`,children:`TTS`}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2 col-span-3`,children:[(0,O.jsx)(d,{checked:Y.tts_enabled,onCheckedChange:e=>X(t=>({...t,tts_enabled:e}))}),(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Responder por voz`})]})]}),Y.voice_enabled&&(0,O.jsxs)(`div`,{className:`grid grid-cols-4 items-center gap-4`,children:[(0,O.jsx)(E,{className:`text-right text-xs`,children:`Modelo STT`}),(0,O.jsxs)(s,{value:Y.stt_provider||``,onValueChange:e=>X(t=>({...t,stt_provider:e})),children:[(0,O.jsx)(u,{className:`col-span-3`,children:(0,O.jsx)(a,{placeholder:`Selecciona modelo STT`})}),(0,O.jsx)(l,{children:he.filter(e=>T[e.provider]).map(e=>(0,O.jsx)(i,{value:e.id,children:e.name},e.id))})]})]}),Y.tts_enabled&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`grid grid-cols-4 items-center gap-4`,children:[(0,O.jsx)(E,{className:`text-right text-xs`,children:`Modelo TTS`}),(0,O.jsxs)(s,{value:Y.tts_provider||``,onValueChange:e=>X(t=>({...t,tts_provider:e,tts_voice_id:``})),children:[(0,O.jsx)(u,{className:`col-span-3`,children:(0,O.jsx)(a,{placeholder:`Selecciona modelo TTS`})}),(0,O.jsx)(l,{children:ge.filter(e=>T[e.provider]).map(e=>(0,O.jsxs)(o,{children:[(0,O.jsx)(c,{children:e.group}),e.models.map(e=>(0,O.jsx)(i,{value:e.id,children:e.name},e.id))]},e.group))})]})]}),Y.tts_provider&&(0,O.jsxs)(`div`,{className:`grid grid-cols-4 items-center gap-4`,children:[(0,O.jsx)(E,{className:`text-right text-xs`,children:`Voz`}),(0,O.jsxs)(s,{value:Y.tts_voice_id||``,onValueChange:e=>X(t=>({...t,tts_voice_id:e})),disabled:Ce||xe.length===0,children:[(0,O.jsx)(u,{className:`col-span-3`,children:(0,O.jsx)(a,{placeholder:Ce?`Cargando...`:`Selecciona una voz`})}),(0,O.jsx)(l,{children:xe.map(e=>(0,O.jsx)(i,{value:e.id,children:e.name},e.id))})]})]}),!T.elevenlabs&&!T.openai&&!T.gemini&&!T.qwen&&!T.piper&&(0,O.jsxs)(oe,{variant:`destructive`,className:`bg-yellow-500/10 border-yellow-500/30 text-yellow-200`,children:[(0,O.jsx)(f,{className:`h-4 w-4`}),(0,O.jsxs)(ae,{className:`text-yellow-200/80`,children:[`Configura un provider TTS.`,` `,(0,O.jsx)(`button`,{className:`underline`,onClick:()=>{n(),_(`/settings/voz`)},children:`Ir a Configuración de Voz`})]})]})]}),(0,O.jsxs)(`div`,{className:`grid grid-cols-4 items-center gap-4`,children:[(0,O.jsx)(E,{className:`text-right text-xs`,children:`Entrega`}),(0,O.jsxs)(s,{value:Y.step_delivery_mode,onValueChange:e=>X(t=>({...t,step_delivery_mode:e})),children:[(0,O.jsx)(u,{className:`col-span-3`,children:(0,O.jsx)(a,{placeholder:`Modo de entrega`})}),(0,O.jsxs)(l,{children:[(0,O.jsx)(i,{value:`new_messages`,children:`Solo Mensajes Nuevos`}),(0,O.jsx)(i,{value:`all`,children:`Todo (Sincronización)`})]})]})]}),(0,O.jsxs)(`div`,{className:`pt-4 mt-2 border-t border-white/5 space-y-4`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,O.jsx)(E,{className:`text-xs font-bold uppercase tracking-wider text-blue-400`,children:`Visión / Multimodal`}),(0,O.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Procesamiento de imágenes y documentos`})]}),(0,O.jsx)(d,{checked:Y.vision_enabled,onCheckedChange:e=>X(t=>({...t,vision_enabled:e}))})]}),Y.vision_enabled&&(0,O.jsxs)(`div`,{className:`grid grid-cols-4 items-center gap-4 animate-in fade-in slide-in-from-top-1 duration-200`,children:[(0,O.jsx)(E,{className:`text-right text-xs`,children:`OCR Fallback`}),(0,O.jsxs)(s,{value:Y.ocr_provider||``,onValueChange:e=>X(t=>({...t,ocr_provider:e})),children:[(0,O.jsx)(u,{className:`col-span-3`,children:(0,O.jsx)(a,{placeholder:`Selecciona provider de OCR`})}),(0,O.jsx)(l,{children:ve.map(e=>(0,O.jsx)(i,{value:e.id,children:e.name},e.id))})]}),(0,O.jsx)(`div`,{className:`col-start-2 col-span-3 text-[10px] text-white/30 italic`,children:`Se usa cuando el modelo del agente no soporta visión nativa.`})]})]})]}),ze=j===`whatsapp`||j===`webchat`||!Z||j===`telegram`&&N.trim().length>10||j===`discord`&&N.trim().length>10&&F.trim().length>0;return t?(0,O.jsx)(`div`,{className:`fixed inset-0 z-[9999] bg-black/80 flex items-center justify-center`,onClick:$,children:(0,O.jsxs)(`div`,{className:`relative w-full max-w-[480px] mx-4 hive-card border-white/10 overflow-hidden`,onClick:e=>e.stopPropagation(),children:[(0,O.jsx)(`button`,{onClick:$,className:`absolute right-4 top-4 z-10 text-white/40 hover:text-white transition-colors`,children:(0,O.jsx)(x,{className:`h-4 w-4`})}),(0,O.jsxs)(`div`,{className:`p-6 border-b border-white/5 bg-white/5 relative overflow-hidden`,children:[(0,O.jsx)(`div`,{className:`hive-glow-blob hive-glow-blob--blue -top-10 -right-10 h-32 w-32 opacity-20`}),(0,O.jsxs)(`h2`,{className:`text-xl font-black text-white uppercase tracking-tighter relative z-10 flex items-center gap-2`,children:[(0,O.jsx)(ee,{className:`h-4 w-4 text-blue-400`}),{type:`Nuevo Canal`,credentials:`Conectar ${j.charAt(0).toUpperCase()+j.slice(1)}`,reconnect:Z?`Configurar ${j.charAt(0).toUpperCase()+j.slice(1)}`:`Reconectar ${j.charAt(0).toUpperCase()+j.slice(1)}`,connecting:`Conectando...`,qr:`Escanea el código QR`,success:`¡Canal conectado!`,settings:`Configurar ${e?.type??`canal`}`}[k]??`Nuevo Canal`]}),(0,O.jsx)(`p`,{className:`text-xs text-white/40 font-medium mt-1 relative z-10`,children:k===`settings`?`Ajusta el comportamiento y las opciones de voz del canal.`:k===`qr`?`Abre WhatsApp en tu teléfono y escanea el código para vincular el dispositivo.`:k===`reconnect`?Z?`Ingresa las credenciales para activar este canal.`:`Reconecta el canal con las credenciales existentes o actualízalas.`:`Conecta un nuevo canal de comunicación a Hive.`})]}),(0,O.jsx)(`div`,{className:`p-6`,children:e&&k===`settings`?Re():Le()}),(0,O.jsx)(`div`,{className:`p-6 pt-4 flex gap-2`,children:e&&k===`settings`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(C,{variant:`outline`,onClick:$,disabled:me,children:`Cancelar`}),(0,O.jsx)(C,{onClick:Fe,disabled:me,children:me?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(g,{className:`h-4 w-4 animate-spin mr-2`}),`Guardando...`]}):`Guardar Cambios`})]}):k===`reconnect`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(C,{variant:`outline`,onClick:$,children:`Cancelar`}),(0,O.jsx)(C,{onClick:Ne,disabled:K||!ze,children:K?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(g,{className:`h-4 w-4 animate-spin mr-2`}),`Conectando...`]}):Z?`Conectar`:`Reconectar`})]}):k===`type`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(C,{variant:`outline`,onClick:$,children:`Cancelar`}),(0,O.jsx)(C,{onClick:()=>A(`credentials`),children:`Siguiente →`})]}):k===`credentials`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(C,{variant:`outline`,onClick:()=>A(`type`),children:`← Atrás`}),(0,O.jsx)(C,{onClick:Pe,disabled:K||!Ie,children:K?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(g,{className:`h-4 w-4 animate-spin mr-2`}),`Conectando...`]}):`Conectar`})]}):k===`connecting`?(0,O.jsx)(C,{variant:`outline`,onClick:$,children:`Cancelar`}):k===`qr`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(C,{variant:`outline`,size:`sm`,onClick:()=>{B&&Me(j,B)},children:[(0,O.jsx)(v,{className:`h-3.5 w-3.5 mr-2`}),`Actualizar QR`]}),(0,O.jsx)(C,{variant:`outline`,onClick:$,children:`Cancelar`})]}):k===`success`?(0,O.jsx)(C,{onClick:$,children:`Cerrar`}):null})]})}):null}function xe(){let{channels:e,activeChannels:t,fetchChannels:n,isLoading:r,toggleChannel:i,updateChannel:a}=re(),[o,s]=(0,D.useState)(`all`),[c,l]=(0,D.useState)(null),[u,d]=(0,D.useState)(!1);(0,D.useEffect)(()=>{n()},[]);let f=(0,D.useMemo)(()=>o===`all`?e:o===`active`?e.filter(e=>e.active):o===`inactive`?e.filter(e=>!e.active):e,[e,o]),p=e=>{l(e),d(!0)},m=()=>{l(null),d(!0)};return(0,O.jsxs)(`div`,{className:`hive-page-container animate-fade-in mt-10`,children:[(0,O.jsx)(`div`,{className:`hive-page-header`,children:(0,O.jsxs)(`div`,{className:`flex flex-col md:flex-row md:items-center justify-between gap-6`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,O.jsx)(`div`,{className:`h-10 w-10 rounded-xl bg-blue-500/10 border border-blue-500/20 flex items-center justify-center text-blue-400`,children:(0,O.jsx)(w,{className:`h-6 w-6`})}),(0,O.jsx)(`h1`,{className:`text-3xl font-black text-white uppercase tracking-tighter`,children:`Canales`})]}),(0,O.jsx)(`p`,{className:`hive-subtitle`,children:`Gestiona tus puntos de entrada y salida de comunicación en la red Hive.`})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.jsxs)(`button`,{onClick:()=>n(),disabled:r,className:`hive-btn hive-btn--ghost px-6 text-[10px]`,children:[(0,O.jsx)(v,{className:`h-3.5 w-3.5 mr-2 ${r?`animate-spin`:``}`}),`SINCRONIZAR`]}),(0,O.jsxs)(`button`,{onClick:m,className:`hive-btn hive-btn--primary px-8 text-[10px]`,children:[(0,O.jsx)(_,{className:`h-3.5 w-3.5 mr-2`}),`NUEVO CANAL`]})]})]})}),(0,O.jsxs)(`div`,{className:`hive-card border-blue-500/10 !bg-blue-500/[0.02] mb-8 overflow-hidden relative`,children:[(0,O.jsxs)(`div`,{className:`hive-card-body py-4 px-6 flex items-center justify-between relative z-10`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,O.jsx)(`div`,{className:`h-8 w-8 rounded-lg bg-blue-500/10 flex items-center justify-center text-blue-400`,children:(0,O.jsx)(y,{className:`h-4 w-4`})}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-[10px] font-black tracking-widest text-blue-500/50 uppercase`,children:`Estado Operativo`}),(0,O.jsxs)(`p`,{className:`text-xs text-white/60`,children:[`Actualmente tienes `,(0,O.jsx)(`span`,{className:`text-blue-400 font-black`,children:t.length}),` canales procesando datos.`]})]})]}),(0,O.jsx)(`div`,{className:`text-[10px] text-white/20 font-black tracking-widest uppercase`,children:`HIVE NODE SECURE`})]}),(0,O.jsx)(`div`,{className:`hive-glow-blob hive-glow-blob--blue -top-10 -right-10 h-32 w-32 opacity-10`})]}),(0,O.jsx)(`div`,{className:`flex items-center gap-1.5 p-1 bg-white/5 rounded-2xl w-fit border border-white/5 mb-8`,children:[{id:`all`,label:`TODOS (${e.length})`},{id:`active`,label:`ACTIVOS (${e.filter(e=>e.active).length})`},{id:`inactive`,label:`INACTIVOS (${e.filter(e=>!e.active).length})`}].map(e=>(0,O.jsx)(`button`,{onClick:()=>s(e.id),className:`px-8 py-2.5 rounded-xl text-[10px] font-black tracking-widest uppercase transition-all duration-300 ${o===e.id?`bg-blue-500 text-white shadow-blue-glow`:`text-white/20 hover:text-white/40 hover:bg-white/5`}`,children:e.label},e.id))}),(0,O.jsx)(`div`,{className:`animate-fade-in`,children:f.length>0?(0,O.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6`,children:f.map(e=>(0,O.jsx)(ce,{channel:e,onEdit:p,onToggle:i},e.id))}):(0,O.jsx)(`div`,{className:`hive-card border-dashed border-white/10 bg-white/[0.02]`,children:(0,O.jsxs)(`div`,{className:`hive-card-body flex flex-col items-center justify-center py-20 px-4`,children:[(0,O.jsx)(`div`,{className:`h-20 w-20 rounded-2xl bg-white/5 flex items-center justify-center mb-6`,children:(0,O.jsx)(w,{className:`h-10 w-10 text-white/10`})}),(0,O.jsxs)(`div`,{className:`text-center`,children:[(0,O.jsx)(`p`,{className:`hive-title-section text-center mb-2`,children:`No se detectaron canales`}),(0,O.jsx)(`p`,{className:`text-xs text-white/40 mb-8 max-w-[300px] mx-auto leading-relaxed`,children:`Configura tu primer punto de enlace para empezar a recibir datos en tiempo real.`}),(0,O.jsx)(`button`,{onClick:m,className:`hive-btn hive-btn--primary px-10 text-[10px]`,children:`ESTABLECER CONEXIÓNHORA`})]})]})})}),(0,O.jsx)(be,{channel:c,isOpen:u,onClose:()=>d(!1),onSave:async(e,t)=>{await a(e,t)}})]})}export{xe as ChannelsPage};
@@ -0,0 +1,6 @@
1
+ import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as t,a as n,f as r,l as i,m as a,o,p as s,r as c,s as l,t as u,u as d}from"./vendor-charts-Bu2lyBKP.js";import{i as f,n as p,o as m,t as h}from"./vendor-query-DsWPbQdG.js";import{t as g}from"./activity-BB8JBT7a.js";import{t as _}from"./circle-check-BhwUUu4Z.js";import{t as v}from"./download-DRO1cmbw.js";import{t as y}from"./external-link-BULKsDvk.js";import{t as b}from"./gauge-DYmZYnET.js";import{t as x}from"./info-CFGdNsZs.js";import{t as S}from"./loader-circle-BaadtldT.js";import{t as C}from"./triangle-alert-vUtWDfZd.js";import{t as ee}from"./zap-BD57u2UH.js";import{$ as te,J as w,P as ne,X as re,Z as ie,b as ae,et as T,f as E,m as D,t as O,tt as k}from"./index-B4lS14UW.js";import{t as A}from"./badge-BY-VUaxL.js";import{a as j,n as M,o as N,r as P,t as F}from"./card-CE_kGxdL.js";import{t as oe}from"./progress-CFpWXmru.js";import{a as I,c as L,i as R,n as z,o as B,r as V,s as H,t as U}from"./alert-dialog-B12geoBt.js";var W=k(`ArrowUpRight`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),G=k(`CircleArrowUp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),K=k(`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`}]]),se=k(`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`}]]),ce=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`}]]),le=k(`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`}]]),ue=k(`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`}]]),q=e(t(),1);function de(){let{agents:e,isLoading:t,error:n,fetchAgents:r,createAgent:i,updateAgent:a,deleteAgent:o}=O(),[s,c]=(0,q.useState)(`all`);return(0,q.useEffect)(()=>{r()},[r]),{agents:(0,q.useMemo)(()=>Array.isArray(e)?s===`all`?e:e.filter(e=>e.status===s):[],[e,s]),allAgents:e||[],filter:s,setFilter:c,createAgent:i,updateAgent:a,deleteAgent:o,isLoading:t,error:n,refreshAgents:r}}var J=m();function fe(e){return e<50?`#22c55e`:e<80?`#eab308`:`#ef4444`}function pe(){let[e,t]=(0,q.useState)(()=>{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}))}),[r,i]=(0,q.useState)([]),{data:a}=p({queryKey:[`system-stats`],queryFn:()=>E(`/api/system-stats`),refetchInterval:5e3}),c=(0,q.useRef)(a);(0,q.useEffect)(()=>{c.current=a},[a]),(0,q.useEffect)(()=>{let e=setInterval(()=>{let e=c.current;if(!e)return;let n=new Date().toLocaleTimeString(`es`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`});t(t=>[...t,{time:n,msgs:e.recentMessages,rss:e.memory.rss}].slice(-20))},5e3);return()=>clearInterval(e)},[]);let d=a?.memory.rss??0,f=a?.memory.heapUsed??0,m=a?.memory.external??0,h=a?.recentMessages??0;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-4 mb-4`,children:[(0,J.jsxs)(F,{className:`overflow-hidden border-primary/10`,children:[(0,J.jsx)(j,{className:`pb-2 bg-gradient-to-r from-primary/5 to-transparent`,children:(0,J.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,J.jsxs)(N,{className:`text-base flex items-center gap-2`,children:[(0,J.jsx)(b,{className:`h-4 w-4 text-primary`}),`Monitor del Proceso Hive`]})})}),(0,J.jsxs)(M,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-4 pt-4`,children:[(0,J.jsx)(Y,{icon:re,label:`Actividad reciente`,value:`${h}`,subValue:`mensajes últimos 5 min`,color:h>0?`#22c55e`:`hsl(var(--muted-foreground))`,progress:Math.min(100,h*10)}),(0,J.jsx)(Y,{icon:se,label:`Memoria Hive (RSS)`,value:`${d} MB`,subValue:`Heap JS: ${f} MB usados`,color:fe(Math.min(100,Math.round(d/1024*100))),progress:Math.min(100,Math.round(d/1024*100))}),(0,J.jsx)(Y,{icon:le,label:`Heap JS`,value:`${f} MB`,subValue:`External: ${m} MB`,color:`#3b82f6`,progress:Math.min(100,Math.round(f/512*100))}),(0,J.jsx)(Y,{icon:w,label:`Sesiones WS activas`,value:`${a?.connections??0}`,subValue:`conexiones WebSocket`,color:`#a855f7`,progress:Math.min(100,(a?.connections??0)*10)})]})]}),(0,J.jsxs)(F,{className:`border-primary/10`,children:[(0,J.jsx)(j,{className:`pb-2`,children:(0,J.jsxs)(N,{className:`text-sm flex items-center gap-2`,children:[(0,J.jsx)(g,{className:`h-4 w-4 text-primary`}),`Historial — `,(0,J.jsx)(`span`,{className:`text-green-400`,children:`Mensajes`}),` · `,(0,J.jsx)(`span`,{className:`text-purple-400`,children:`RSS MB`})]})}),(0,J.jsx)(M,{className:`h-[160px]`,children:(0,J.jsx)(s,{width:`100%`,height:`100%`,children:(0,J.jsxs)(u,{data:e,children:[(0,J.jsxs)(`defs`,{children:[(0,J.jsxs)(`linearGradient`,{id:`gMsgs`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,J.jsx)(`stop`,{offset:`5%`,stopColor:`#22c55e`,stopOpacity:.3}),(0,J.jsx)(`stop`,{offset:`95%`,stopColor:`#22c55e`,stopOpacity:0})]}),(0,J.jsxs)(`linearGradient`,{id:`gHeap`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,J.jsx)(`stop`,{offset:`5%`,stopColor:`#8b5cf6`,stopOpacity:.3}),(0,J.jsx)(`stop`,{offset:`95%`,stopColor:`#8b5cf6`,stopOpacity:0})]})]}),(0,J.jsx)(o,{dataKey:`time`,axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:9},interval:`preserveStartEnd`}),(0,J.jsx)(n,{axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:9}}),(0,J.jsx)(l,{type:`monotone`,dataKey:`msgs`,stroke:`#22c55e`,strokeWidth:2,fillOpacity:1,fill:`url(#gMsgs)`,name:`Mensajes`}),(0,J.jsx)(l,{type:`monotone`,dataKey:`rss`,stroke:`#8b5cf6`,strokeWidth:2,fillOpacity:1,fill:`url(#gHeap)`,name:`RSS MB`})]})})})]})]})}function Y({icon:e,label:t,value:n,subValue:r,color:i,progress:a}){return(0,J.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3 space-y-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{style:{color:i},children:(0,J.jsx)(e,{className:`h-4 w-4`})}),(0,J.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:t})]}),(0,J.jsx)(`span`,{className:`text-lg font-bold font-mono`,style:{color:i},children:n})]}),(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsx)(`div`,{className:`h-1.5 w-full rounded-full bg-muted overflow-hidden`,children:(0,J.jsx)(`div`,{className:`h-full rounded-full transition-all duration-500`,style:{width:`${Math.min(a,100)}%`,backgroundColor:i}})}),(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r})]})]})}var X={anthropic:`#d97706`,openai:`#10b981`,google:`#3b82f6`,gemini:`#3b82f6`,deepseek:`#8b5cf6`,kimi:`#ec4899`,ollama:`#14b8a6`,openrouter:`#f59e0b`,mistral:`#6366f1`};function Z(e){return e>=1e6?(e/1e6).toFixed(2)+`M`:e>=1e3?(e/1e3).toFixed(1)+`K`:e.toString()}function Q(e){return e>=1?`$`+e.toFixed(2):e>=.01?`$`+e.toFixed(3):e>0?`$`+e.toFixed(5):`$0.00`}function $(e){return e>=10?e.toFixed(1)+`%`:e>=1?e.toFixed(2)+`%`:e>0?e.toFixed(3)+`%`:`0%`}function me(){let[e,t]=(0,q.useState)(24),{data:i,isLoading:l}=p({queryKey:[`usage-stats`,e],queryFn:async()=>await E(`/api/usage-stats?hours=${e}`),refetchInterval:6e4});if(l&&!i)return(0,J.jsxs)(F,{className:`border-primary/10`,children:[(0,J.jsx)(j,{children:(0,J.jsxs)(N,{className:`flex items-center gap-2`,children:[(0,J.jsx)(K,{className:`h-5 w-5 text-primary`}),`Uso y Costos de API`]})}),(0,J.jsx)(M,{children:(0,J.jsx)(`div`,{className:`h-40 flex items-center justify-center text-muted-foreground animate-pulse`,children:`Cargando estadísticas de uso...`})})]});let u=i&&(i.totalTokens>0||i.totalCostUsd>0),f=i?Object.entries(i.byProvider).map(([e,t])=>({name:e.charAt(0).toUpperCase()+e.slice(1),value:t.tokens,cost:t.costUsd,color:X[e.toLowerCase()]||`#6b7280`})):[],m=i?Object.entries(i.byModel).slice(0,8).map(([e,t])=>({name:e.length>20?e.slice(0,18)+`...`:e,tokens:t.tokens,cost:t.costUsd,fullName:e})):[];return(0,J.jsxs)(F,{className:`border-primary/10`,children:[(0,J.jsx)(j,{className:`pb-2`,children:(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(N,{className:`text-base flex items-center gap-2`,children:[(0,J.jsx)(K,{className:`h-5 w-5 text-primary`}),`Uso y Costos de API`]}),(0,J.jsx)(P,{children:`Tokens consumidos y costos por provider/modelo`})]}),(0,J.jsx)(`div`,{className:`flex gap-1`,children:[6,24,168].map(n=>(0,J.jsx)(`button`,{onClick:()=>t(n),className:`px-2 py-1 text-xs rounded-md transition-colors ${e===n?`bg-primary text-primary-foreground`:`bg-muted hover:bg-muted/80`}`,children:n===6?`6h`:n===24?`24h`:`7d`},n))})]})}),(0,J.jsxs)(M,{className:`space-y-4`,children:[(0,J.jsxs)(`div`,{className:`rounded-lg border p-3 ${i?.toonSavedTokens?`border-emerald-500/30 bg-emerald-500/5`:`bg-card/50`}`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(ee,{className:`h-3 w-3 ${i?.toonSavedTokens?`text-emerald-400`:``}`}),(0,J.jsx)(`span`,{className:`font-medium`,children:`TOON Optimización de Tokens`})]}),i?.toonSavingsPercent&&i.toonSavingsPercent>0?(0,J.jsxs)(`span`,{className:`text-xs font-bold text-emerald-400`,children:[$(i.toonSavingsPercent),` reducción`]}):null]}),(0,J.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 md:grid-cols-4 gap-3`,children:[(0,J.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Tokens Ahorrados`}),(0,J.jsx)(`div`,{className:`text-lg font-bold ${i?.toonSavedTokens?`text-emerald-400`:`text-muted-foreground`}`,children:i?Z(i.toonSavedTokens):`—`})]}),(0,J.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Costo Ahorrado`}),(0,J.jsx)(`div`,{className:`text-lg font-bold text-emerald-400`,children:i?Q(i.toonSavedCost):`—`})]}),(0,J.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Bytes Ahorrados`}),(0,J.jsx)(`div`,{className:`text-lg font-bold text-emerald-400`,children:i&&i.toonSavedBytes>0?Z(i.toonSavedBytes):`—`})]}),(0,J.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Reducción Bytes`}),(0,J.jsx)(`div`,{className:`text-lg font-bold text-emerald-400`,children:i?.toonSavedBytesPercent&&i.toonSavedBytesPercent>0?$(i.toonSavedBytesPercent):`—`})]})]}),i&&(i.toonJsonTokens>0||i.toonToonTokens>0)&&(0,J.jsx)(`div`,{className:`mt-3 pt-3 border-t border-emerald-500/20`,children:(0,J.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`JSON:`}),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:i.toonJsonTokens>0?Z(i.toonJsonTokens):`—`}),` `,(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`tokens`})]}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`text-emerald-400`,children:`TOON:`}),` `,(0,J.jsx)(`span`,{className:`font-medium text-emerald-400`,children:i.toonToonTokens>0?Z(i.toonToonTokens):`—`}),` `,(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`tokens`})]})]}),i?.toonSavingsPercent&&i.toonSavingsPercent>0?(0,J.jsxs)(`span`,{className:`text-xs font-bold text-emerald-400`,children:[$(i.toonSavingsPercent),` menos tokens`]}):null]})}),i&&!i.toonSavedTokens&&(0,J.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground italic`,children:`Sin optimizaciones TOON registradas aún`})]}),u?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,J.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,J.jsx)(K,{className:`h-3 w-3`}),`Costo Total`]}),(0,J.jsx)(`div`,{className:`text-2xl font-bold text-green-500`,children:Q(i.totalCostUsd)})]}),(0,J.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,J.jsx)(ce,{className:`h-3 w-3`}),`Total Tokens`]}),(0,J.jsx)(`div`,{className:`text-2xl font-bold`,children:Z(i.totalTokens)})]}),(0,J.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,J.jsx)(ue,{className:`h-3 w-3`}),`Input / Output`]}),(0,J.jsxs)(`div`,{className:`text-lg font-semibold`,children:[(0,J.jsx)(`span`,{className:`text-blue-500`,children:Z(i.totalInputTokens)}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:` / `}),(0,J.jsx)(`span`,{className:`text-purple-500`,children:Z(i.totalOutputTokens)})]})]}),(0,J.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,J.jsx)(w,{className:`h-3 w-3`}),`Providers`]}),(0,J.jsx)(`div`,{className:`text-2xl font-bold`,children:Object.keys(i.byProvider).length})]})]}),(0,J.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`h4`,{className:`text-sm font-medium mb-2 flex items-center gap-2`,children:[(0,J.jsx)(w,{className:`h-4 w-4 text-muted-foreground`}),`Por Provider`]}),(0,J.jsx)(`div`,{className:`h-[180px]`,children:(0,J.jsx)(s,{width:`100%`,height:`100%`,children:(0,J.jsxs)(c,{data:f,layout:`vertical`,children:[(0,J.jsx)(o,{type:`number`,hide:!0}),(0,J.jsx)(n,{type:`category`,dataKey:`name`,axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:11},width:70}),(0,J.jsx)(a,{contentStyle:{backgroundColor:`hsl(var(--card))`,border:`1px solid hsl(var(--border))`,borderRadius:`8px`},formatter:(e,t)=>[t===`cost`?Q(e):Z(e),t===`cost`?`Costo`:`Tokens`]}),(0,J.jsx)(d,{dataKey:`value`,radius:[0,4,4,0],barSize:16,children:f.map(e=>(0,J.jsx)(r,{fill:e.color},e.name))})]})})})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`h4`,{className:`text-sm font-medium mb-2 flex items-center gap-2`,children:[(0,J.jsx)(T,{className:`h-4 w-4 text-muted-foreground`}),`Por Modelo (Top 8)`]}),(0,J.jsx)(`div`,{className:`h-[180px]`,children:(0,J.jsx)(s,{width:`100%`,height:`100%`,children:(0,J.jsxs)(c,{data:m,children:[(0,J.jsx)(o,{dataKey:`name`,axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:10},angle:-45,textAnchor:`end`,height:60}),(0,J.jsx)(n,{axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:10}}),(0,J.jsx)(a,{contentStyle:{backgroundColor:`hsl(var(--card))`,border:`1px solid hsl(var(--border))`,borderRadius:`8px`},formatter:e=>Q(e),labelFormatter:e=>m.find(t=>t.name===e)?.fullName||e}),(0,J.jsx)(d,{dataKey:`cost`,radius:[4,4,0,0],children:m.map(e=>(0,J.jsx)(r,{fill:X[e.fullName.split(`-`)[0]?.toLowerCase()]||`#6b7280`},e.fullName))})]})})})]})]}),f.length>0&&(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h4`,{className:`text-sm font-medium mb-2`,children:`Detalle por Provider`}),(0,J.jsx)(`div`,{className:`rounded-lg border overflow-hidden`,children:(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{className:`bg-muted/50`,children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{className:`text-left p-2 font-medium`,children:`Provider`}),(0,J.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Input`}),(0,J.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Output`}),(0,J.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Total`}),(0,J.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Costo`})]})}),(0,J.jsx)(`tbody`,{children:Object.entries(i.byProvider).map(([e,t])=>(0,J.jsxs)(`tr`,{className:`border-t`,children:[(0,J.jsx)(`td`,{className:`p-2 font-medium`,children:e}),(0,J.jsx)(`td`,{className:`p-2 text-right text-blue-500`,children:Z(t.inputTokens)}),(0,J.jsx)(`td`,{className:`p-2 text-right text-purple-500`,children:Z(t.outputTokens)}),(0,J.jsx)(`td`,{className:`p-2 text-right`,children:Z(t.tokens)}),(0,J.jsx)(`td`,{className:`p-2 text-right font-medium text-green-500`,children:Q(t.costUsd)})]},e))})]})})]})]}):(0,J.jsx)(`div`,{className:`h-32 flex items-center justify-center text-muted-foreground`,children:(0,J.jsxs)(`div`,{className:`text-center`,children:[(0,J.jsx)(g,{className:`h-8 w-8 mx-auto mb-2 opacity-50`}),(0,J.jsx)(`p`,{children:`No hay datos de uso aún`}),(0,J.jsx)(`p`,{className:`text-xs`,children:`Los tokens se registrarán automáticamente`})]})})]})]})}function he(){let[e,t]=(0,q.useState)(!1),[n,r]=(0,q.useState)(0),[i,a]=(0,q.useState)([]),o=f(),{data:s,isLoading:c}=p({queryKey:[`version-check`],queryFn:()=>E(`/api/version`),refetchInterval:3e5,retry:2}),l=h({mutationFn:()=>E(`/api/update`,{method:`POST`,showLoader:`Actualizando Hive...`}),onSuccess:e=>{r(100),e.success?(a(e.instructions||[]),D.fire({title:`¡Actualización Completada!`,text:e.message||`Hive ha sido actualizado exitosamente.`,icon:`success`,confirmButtonText:`Continuar`})):(e.instructions&&a(e.instructions),D.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(()=>{o.invalidateQueries({queryKey:[`version-check`]})},2e3)},onError:e=>{r(0),console.error(`[UpdateChecker] Error:`,e)}}),u=()=>{t(!0)},d=()=>{t(!1),r(10),l.mutate();let e=setInterval(()=>{r(t=>t>=90?(clearInterval(e),t):t+10)},500)},m=e=>{switch(e){case`docker`:return`Docker`;case`binary`:return`Binario`;case`npm`:return`npm`;case`bun`:return`Bun`;default:return`Desconocida`}},g=()=>{if(!s)return null;switch(s.status){case`up-to-date`:return(0,J.jsxs)(A,{variant:`outline`,className:`flex items-center gap-1 bg-green-500/10 text-green-400 border-green-500/20`,children:[(0,J.jsx)(_,{className:`h-3 w-3`}),`Actualizado`]});case`update-available`:return(0,J.jsxs)(A,{className:`flex items-center gap-1 bg-blue-500 text-white border-blue-400 hover:bg-blue-600`,children:[(0,J.jsx)(G,{className:`h-3 w-3`}),`v`,s.latest,` disponible`]});case`checking`:return(0,J.jsxs)(A,{variant:`outline`,className:`flex items-center gap-1`,children:[(0,J.jsx)(S,{className:`h-3 w-3 animate-spin`}),`Verificando...`]});case`error`:return(0,J.jsxs)(A,{variant:`destructive`,className:`flex items-center gap-1`,children:[(0,J.jsx)(C,{className:`h-3 w-3`}),`Error`]})}},b=s?.status===`update-available`;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[(0,J.jsx)(`span`,{className:`hive-label mb-1`,children:`Versión`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[g(),s&&(0,J.jsxs)(`span`,{className:`text-xs text-white/40 font-mono`,children:[`v`,s.current,` · `,m(s.installationType)]})]})]}),b&&(0,J.jsx)(ne,{size:`sm`,onClick:u,disabled:l.isPending,className:`bg-blue-600 hover:bg-blue-700 text-white shadow-lg shadow-blue-500/20`,children:l.isPending?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(S,{className:`h-4 w-4 mr-2 animate-spin`}),`Actualizando...`]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(v,{className:`h-4 w-4 mr-2`}),`Actualizar a v`,s.latest]})}),(0,J.jsx)(U,{open:e,onOpenChange:t,children:(0,J.jsxs)(R,{children:[(0,J.jsxs)(H,{children:[(0,J.jsxs)(L,{className:`flex items-center gap-2`,children:[(0,J.jsx)(v,{className:`h-5 w-5 text-blue-500`}),`Actualizar Hive`]}),(0,J.jsxs)(I,{className:`space-y-3`,children:[(0,J.jsxs)(`p`,{children:[`Se ha detectado una nueva versión disponible (`,(0,J.jsxs)(`strong`,{children:[`v`,s?.latest]}),`). Tu versión actual es `,(0,J.jsxs)(`strong`,{children:[`v`,s?.current]}),`.`]}),(0,J.jsx)(`div`,{className:`bg-muted p-3 rounded-lg space-y-2`,children:(0,J.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,J.jsx)(x,{className:`h-4 w-4 text-blue-500 mt-0.5`}),(0,J.jsxs)(`div`,{className:`text-sm`,children:[(0,J.jsxs)(`p`,{className:`font-semibold mb-1`,children:[`Tipo de instalación: `,m(s?.installationType)]}),s?.installationType===`docker`&&(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`Para Docker, deberás ejecutar manualmente los comandos en tu terminal.`}),s?.installationType===`binary`&&(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`Para el binario, serás redirigido a GitHub Releases para descargar la nueva versión.`}),(s?.installationType===`npm`||s?.installationType===`bun`)&&(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`La actualización se realizará automáticamente. Deberás reiniciar el gateway después.`})]})]})}),l.isPending&&(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,J.jsx)(`span`,{children:`Progreso de actualización...`}),(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[n,`%`]})]}),(0,J.jsx)(oe,{value:n,className:`h-2`})]})]})]}),(0,J.jsxs)(B,{children:[(0,J.jsx)(V,{disabled:l.isPending,children:`Cancelar`}),(0,J.jsx)(z,{onClick:d,disabled:l.isPending,className:`bg-blue-600 hover:bg-blue-700`,children:l.isPending?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(S,{className:`h-4 w-4 mr-2 animate-spin`}),`Actualizando...`]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(v,{className:`h-4 w-4 mr-2`}),`Confirmar actualización`]})})]})]})}),i.length>0&&(0,J.jsx)(U,{open:!0,onOpenChange:()=>a([]),children:(0,J.jsxs)(R,{children:[(0,J.jsxs)(H,{children:[(0,J.jsx)(L,{children:`Instrucciones de Actualización`}),(0,J.jsxs)(I,{className:`space-y-3`,children:[(0,J.jsx)(`p`,{children:`Sigue estos pasos para completar la actualización:`}),(0,J.jsx)(`ol`,{className:`list-decimal list-inside space-y-2 bg-muted p-4 rounded-lg`,children:i.map((e,t)=>(0,J.jsx)(`li`,{className:`text-sm`,children:e},t))}),(0,J.jsxs)(`div`,{className:`flex items-start gap-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(y,{className:`h-4 w-4 mt-0.5`}),(0,J.jsx)(`p`,{children:`Después de completar los pasos, recarga esta página para ver la nueva versión.`})]})]})]}),(0,J.jsx)(B,{children:(0,J.jsx)(z,{children:`Entendido`})})]})})]})}function ge({icon:e,...t}){return(0,J.jsx)(e,{...t})}function _e(){let{status:e}=ae(),{allAgents:t}=de(),{data:f}=p({queryKey:[`system-stats`],queryFn:()=>E(`/api/system-stats`),refetchInterval:5e3}),{data:m=[]}=p({queryKey:[`activity-stats`],queryFn:()=>E(`/api/activity-stats?hours=12`),refetchInterval:6e4}),h=(0,q.useMemo)(()=>t||[],[t]),_=[{label:`Agentes Activos`,value:h.length,icon:T,color:`text-blue-500`,trend:`${h.filter(e=>e.status===`active`||e.status===`thinking`).length} en uso`},{label:`Sesiones Canvas`,value:f?.connections??0,icon:ie,color:`text-orange-500`,trend:`Live`},{label:`Procesos Bridge`,value:h.filter(e=>e.status===`thinking`).length,icon:te,color:`text-purple-500`,trend:`Estable`},{label:`Mensajes / 1h`,value:m.at(-1)?.count??0,icon:g,color:`text-green-500`,trend:`Última hora`}],v=(0,q.useMemo)(()=>{let e=h.filter(e=>e.status===`idle`||e.status===`hibernated`).length,t=h.filter(e=>e.status===`active`).length,n=h.filter(e=>e.status===`thinking`).length,r=h.filter(e=>e.status===`error`).length;return[{name:`Idle`,value:e||0,color:`hsl(var(--muted))`},{name:`Active`,value:t||0,color:`hsl(var(--primary))`},{name:`Thinking`,value:n||0,color:`hsl(var(--accent))`},...r>0?[{name:`Error`,value:r,color:`#ef4444`}]:[]].filter(e=>e.value>0||e.name===`Idle`)},[h]),y=m.reduce((e,t)=>e+t.count,0);return f?.memory?.percentage&&Math.max(0,Math.round(100-f.memory.percentage*.3-(f.cpu||0)*.2)),(0,J.jsxs)(`div`,{className:`hive-page-container`,children:[(0,J.jsxs)(`div`,{className:`hive-page-header`,children:[(0,J.jsxs)(`div`,{className:`relative z-10`,children:[(0,J.jsxs)(`div`,{className:`hive-page-header__eyebrow`,children:[(0,J.jsx)(`div`,{className:`hive-page-header__dot`}),(0,J.jsx)(`span`,{className:`hive-page-header__label`,children:`SISTEMA OPERATIVO HIVE`})]}),(0,J.jsxs)(`h2`,{className:`hive-title-page`,children:[`Centro de `,(0,J.jsx)(`span`,{className:`hive-title-page__accent`,children:`Control`})]}),(0,J.jsx)(`p`,{className:`hive-subtitle`,children:`Monitoreo en tiempo real del enjambre y estado de los nodos cognitivos.`})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-6 relative z-10`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col items-end`,children:[(0,J.jsx)(`span`,{className:`hive-label mb-1`,children:`Estado Hive`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`div`,{className:e===`connected`?`hive-status-dot--active`:`hive-status-dot--disabled`}),(0,J.jsx)(`span`,{className:e===`connected`?`hive-status-label--active`:`hive-status-label--disabled`,children:e===`connected`?`EN LÍNEA`:`DESCONECTADO`})]})]}),(0,J.jsx)(`div`,{className:`h-10 w-px bg-white/10 hidden sm:block`}),(0,J.jsx)(he,{})]})]}),(0,J.jsx)(`div`,{className:`grid gap-6 sm:grid-cols-2 lg:grid-cols-4 mb-8`,children:_.map(e=>(0,J.jsxs)(`div`,{className:`hive-card hive-card--active group`,children:[(0,J.jsxs)(`div`,{className:`hive-card-body`,children:[(0,J.jsxs)(`div`,{className:`flex flex-row items-center justify-between mb-4`,children:[(0,J.jsx)(`span`,{className:`hive-title-section`,children:e.label}),(0,J.jsx)(`div`,{className:`p-2 rounded-lg bg-white/5 border border-white/5`,children:(0,J.jsx)(ge,{icon:e.icon,className:`h-4 w-4 ${e.color}`})})]}),(0,J.jsxs)(`div`,{className:`flex items-end justify-between`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-3xl font-black text-white group-hover:text-blue-400 transition-colors`,children:e.value}),(0,J.jsxs)(`p`,{className:`text-[10px] font-bold text-white/30 uppercase tracking-widest mt-1 flex items-center gap-1`,children:[(0,J.jsx)(W,{className:`h-2.5 w-2.5 text-green-500`}),e.trend]})]}),(0,J.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,J.jsx)(W,{className:`h-4 w-4 text-blue-400`})})]})]}),(0,J.jsx)(`div`,{className:`hive-strip--bottom`})]},e.label))}),(0,J.jsx)(pe,{}),(0,J.jsx)(me,{}),(0,J.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-3 mb-8`,children:[(0,J.jsx)(`div`,{className:`lg:col-span-2 hive-card`,children:(0,J.jsxs)(`div`,{className:`hive-card-body !pb-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between mb-6`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`hive-title-section`,children:`Actividad del Enjambre`}),(0,J.jsxs)(`p`,{className:`text-[10px] text-white/40 uppercase tracking-widest font-bold`,children:[`Últimas 12 horas · `,y,` mensajes`]})]}),(0,J.jsx)(g,{className:`h-5 w-5 text-blue-500 animate-pulse shadow-blue-glow`})]}),(0,J.jsx)(`div`,{className:`h-[280px] w-full`,children:m.length>0?(0,J.jsx)(s,{width:`100%`,height:`100%`,children:(0,J.jsxs)(u,{data:m,children:[(0,J.jsx)(`defs`,{children:(0,J.jsxs)(`linearGradient`,{id:`colorCount`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,J.jsx)(`stop`,{offset:`5%`,stopColor:`#3b82f6`,stopOpacity:.2}),(0,J.jsx)(`stop`,{offset:`95%`,stopColor:`#3b82f6`,stopOpacity:0})]})}),(0,J.jsx)(i,{strokeDasharray:`3 3`,vertical:!1,stroke:`rgba(255,255,255,0.05)`}),(0,J.jsx)(o,{dataKey:`time`,axisLine:!1,tickLine:!1,tick:{fill:`rgba(255,255,255,0.3)`,fontSize:10,fontWeight:`bold`}}),(0,J.jsx)(n,{axisLine:!1,tickLine:!1,tick:{fill:`rgba(255,255,255,0.3)`,fontSize:10,fontWeight:`bold`},allowDecimals:!1}),(0,J.jsx)(a,{contentStyle:{backgroundColor:`#09090b`,borderRadius:`12px`,border:`1px solid rgba(255,255,255,0.1)`,color:`#fff`},itemStyle:{color:`#3b82f6`},formatter:e=>[e,`Mensajes`]}),(0,J.jsx)(l,{type:`monotone`,dataKey:`count`,stroke:`#3b82f6`,strokeWidth:4,fillOpacity:1,fill:`url(#colorCount)`})]})}):(0,J.jsx)(`div`,{className:`h-full flex items-center justify-center text-white/30 text-sm`,children:`Cargando actividad...`})})]})}),(0,J.jsx)(`div`,{className:`hive-card`,children:(0,J.jsxs)(`div`,{className:`hive-card-body`,children:[(0,J.jsx)(`h3`,{className:`hive-title-section mb-6`,children:`Distribución de Agentes`}),(0,J.jsx)(`div`,{className:`h-[210px]`,children:v.length>0?(0,J.jsx)(s,{width:`100%`,height:`100%`,children:(0,J.jsxs)(c,{data:v,layout:`vertical`,children:[(0,J.jsx)(o,{type:`number`,hide:!0,allowDecimals:!1}),(0,J.jsx)(n,{dataKey:`name`,type:`category`,axisLine:!1,tickLine:!1,tick:{fill:`rgba(255,255,255,0.5)`,fontSize:10,fontWeight:`bold`},width:70}),(0,J.jsx)(a,{cursor:{fill:`rgba(255,255,255,0.02)`}}),(0,J.jsx)(d,{dataKey:`value`,radius:[0,8,8,0],barSize:16,children:v.map(e=>(0,J.jsx)(r,{fill:e.color},e.name))})]})}):(0,J.jsx)(`div`,{className:`h-full flex items-center justify-center text-white/30 text-sm`,children:`Sin agentes configurados`})}),(0,J.jsxs)(`div`,{className:`mt-4 pt-4 border-t border-white/5 grid grid-cols-2 gap-4`,children:[(0,J.jsxs)(`div`,{className:`hive-stat`,children:[(0,J.jsx)(`span`,{className:`hive-stat__label`,children:`Salud Monitor`}),(0,J.jsx)(`span`,{className:`hive-stat__value hive-stat__value--active`,children:`Óptima`})]}),(0,J.jsxs)(`div`,{className:`hive-stat`,children:[(0,J.jsx)(`span`,{className:`hive-stat__label`,children:`Uptime`}),(0,J.jsx)(`span`,{className:`hive-stat__value hive-stat__value--active`,children:f?.uptime??`—`})]})]})]})})]})]})}export{_e as DashboardPage};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as t}from"./vendor-charts-Bu2lyBKP.js";import{o as n}from"./vendor-query-DsWPbQdG.js";import{n as r,t as i}from"./eye-SOUMoM2-.js";import{t as a}from"./loader-circle-BaadtldT.js";import{c as o}from"./vendor-router-4QM6Fwg6.js";import{N as s,P as c}from"./index-B4lS14UW.js";import{t as l}from"./label-CplWBwSz.js";var u=e(t(),1),d=n();function f(){let e=o(),[t,n]=(0,u.useState)(``),[f,p]=(0,u.useState)(``),[m,h]=(0,u.useState)(!1),[g,_]=(0,u.useState)(!1),[v,y]=(0,u.useState)(``);(0,u.useEffect)(()=>{fetch(`/api/auth/status`).then(e=>e.json()).then(({hasCredentials:t})=>{t||e(`/`,{replace:!0})}).catch(()=>{})},[]);async function b(n){n.preventDefault(),y(``),_(!0);try{let n=await fetch(`/api/auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:t,password:f})}),r=await n.json();if(!n.ok){y(r.error||`Credenciales inválidas`);return}localStorage.setItem(`hive-auth-token`,r.authToken),e(`/`,{replace:!0})}catch{y(`No se pudo conectar al servidor`)}finally{_(!1)}}return(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,d.jsxs)(`div`,{className:`w-full max-w-sm space-y-6 p-8`,children:[(0,d.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,d.jsx)(`div`,{className:`text-4xl`,children:`🐝`}),(0,d.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:`Hive`}),(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Inicia sesión para continuar`})]}),(0,d.jsxs)(`form`,{onSubmit:b,className:`space-y-4`,children:[(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsx)(l,{htmlFor:`email`,children:`Email`}),(0,d.jsx)(s,{id:`email`,type:`email`,autoComplete:`email`,placeholder:`tu@email.com`,value:t,onChange:e=>n(e.target.value),required:!0,disabled:g})]}),(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsx)(l,{htmlFor:`password`,children:`Contraseña`}),(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(s,{id:`password`,type:m?`text`:`password`,autoComplete:`current-password`,placeholder:`••••••••`,value:f,onChange:e=>p(e.target.value),required:!0,disabled:g,className:`pr-10`}),(0,d.jsx)(`button`,{type:`button`,className:`absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>h(e=>!e),tabIndex:-1,children:m?(0,d.jsx)(r,{className:`h-4 w-4`}):(0,d.jsx)(i,{className:`h-4 w-4`})})]})]}),v&&(0,d.jsx)(`p`,{className:`text-sm text-destructive`,children:v}),(0,d.jsxs)(c,{type:`submit`,className:`w-full`,disabled:g,children:[g&&(0,d.jsx)(a,{className:`mr-2 h-4 w-4 animate-spin`}),`Iniciar Sesión`]})]}),(0,d.jsx)(`div`,{className:`text-center`,children:(0,d.jsx)(`button`,{type:`button`,onClick:()=>e(`/recover`),className:`text-sm text-muted-foreground hover:text-foreground underline underline-offset-4`,children:`¿Olvidaste tu contraseña?`})})]})})}export{f as default};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as t}from"./vendor-charts-Bu2lyBKP.js";import{o as n}from"./vendor-query-DsWPbQdG.js";import{t as r}from"./activity-BB8JBT7a.js";import{t as i}from"./pause-BsToEchU.js";import{t as a}from"./play-Rmf5Px63.js";import{t as o}from"./refresh-cw-Yf5FGfA5.js";import{t as s}from"./search-CnhAnemg.js";import{t as c}from"./trash-2-CUqHaFaC.js";import{B as l,N as u,P as d,b as f}from"./index-B4lS14UW.js";import{t as p}from"./badge-BY-VUaxL.js";import{n as m,t as h}from"./card-CE_kGxdL.js";import{t as g}from"./scroll-area-B3bGhGnD.js";var _=e(t(),1),v=n();function y(){let[e,t]=(0,_.useState)([]),[n,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(``),[S,C]=(0,_.useState)([`info`,`warn`,`error`]),[w,T]=(0,_.useState)(!1),[E,D]=(0,_.useState)(!0),O=(0,_.useRef)(null),{url:k,status:A,subscribe:j,send:M}=f();(0,_.useEffect)(()=>{if(A!==`connected`)return;M({type:`logs_subscribe`});let e=j(`log`,e=>{w||e.logEntry&&t(t=>[...t,e.logEntry].slice(-2e3))});return()=>{M({type:`logs_unsubscribe`}),e()}},[A,j,M,w]),(0,_.useEffect)(()=>{if(E&&O.current){let e=O.current.querySelector(`[data-radix-scroll-area-viewport]`);e&&(e.scrollTop=e.scrollHeight)}},[e,E]);let N=e=>{C(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},P=(0,_.useMemo)(()=>e.filter(e=>{let t=S.includes(e.level),n=e.message.toLowerCase().includes(b.toLowerCase())||e.meta&&JSON.stringify(e.meta).toLowerCase().includes(b.toLowerCase());return t&&n}),[e,S,b]),F=e=>{switch(e){case`error`:return`bg-red-500/10 text-red-500 border-red-500/20`;case`warn`:return`bg-yellow-500/10 text-yellow-500 border-yellow-500/20`;case`debug`:return`bg-slate-500/10 text-slate-500 border-slate-500/20`;default:return`bg-blue-500/10 text-blue-500 border-blue-500/20`}};return(0,v.jsxs)(`div`,{className:`flex flex-col h-[calc(100vh-8rem)] space-y-4 mt-10`,children:[(0,v.jsxs)(`div`,{className:`flex flex-col md:flex-row md:items-center justify-between gap-4`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`h2`,{className:`text-2xl font-bold tracking-tight`,children:`Logs del Sistema`}),(0,v.jsx)(`p`,{className:`text-muted-foreground`,children:`Monitoreo en tiempo real de la actividad del enjambre.`})]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsxs)(d,{variant:`outline`,size:`sm`,onClick:()=>T(!w),className:w?`text-yellow-500 border-yellow-500/50 hover:bg-yellow-500/10`:``,children:[w?(0,v.jsx)(a,{className:`h-4 w-4 mr-2`}):(0,v.jsx)(i,{className:`h-4 w-4 mr-2`}),w?`Renaudar`:`Pausar`]}),(0,v.jsxs)(d,{variant:`outline`,size:`sm`,onClick:()=>t([]),children:[(0,v.jsx)(c,{className:`h-4 w-4 mr-2`}),`Limpiar`]}),(0,v.jsxs)(d,{variant:`outline`,size:`sm`,onClick:()=>{},disabled:!0,className:`opacity-50`,children:[(0,v.jsx)(o,{className:`h-4 w-4 mr-2`}),`Sincronizado via WS`]})]})]}),(0,v.jsx)(h,{className:`bg-muted/30`,children:(0,v.jsxs)(m,{className:`p-3 flex flex-wrap items-center gap-4`,children:[(0,v.jsxs)(`div`,{className:`relative flex-1 min-w-[200px]`,children:[(0,v.jsx)(s,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground`}),(0,v.jsx)(u,{placeholder:`Buscar en logs...`,className:`pl-9 h-9 bg-background`,value:b,onChange:e=>x(e.target.value)})]}),(0,v.jsx)(`div`,{className:`flex items-center gap-1.5 p-1 bg-background rounded-md border text-xs`,children:[`debug`,`info`,`warn`,`error`].map(e=>(0,v.jsx)(`button`,{onClick:()=>N(e),className:l(`px-2 py-1 rounded capitalize transition-colors`,S.includes(e)?F(e).split(` `)[1]+` `+F(e).split(` `)[0]:`text-muted-foreground hover:bg-muted`),children:e},e))}),(0,v.jsxs)(`label`,{className:`flex items-center gap-2 text-xs cursor-pointer select-none`,children:[(0,v.jsx)(`input`,{type:`checkbox`,className:`sr-only`,checked:E,onChange:()=>D(!E)}),(0,v.jsx)(`div`,{className:l(`w-8 h-4 rounded-full relative transition-colors`,E?`bg-primary`:`bg-muted border shadow-inner`),children:(0,v.jsx)(`div`,{className:l(`absolute top-0.5 w-3 h-3 rounded-full bg-white transition-all shadow-sm`,E?`left-[17px]`:`left-0.5`)})}),`Auto-scroll`]}),(0,v.jsxs)(`div`,{className:`ml-auto flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(0,v.jsx)(`div`,{className:l(`w-2 h-2 rounded-full`,A===`connected`?`bg-green-500 animate-pulse`:`bg-red-500`)}),A===`connected`?`STREAMING`:`OFFLINE`,(0,v.jsx)(`span`,{className:`mx-1 opacity-30`,children:`|`}),P.length,` de `,e.length,` entradas`]})]})}),(0,v.jsx)(h,{className:`flex-1 overflow-hidden border-2`,children:(0,v.jsx)(m,{className:`p-0 h-full bg-black/95`,children:(0,v.jsx)(g,{className:`h-full w-full`,ref:O,children:(0,v.jsxs)(`div`,{className:`p-4 font-mono text-[11px] leading-relaxed`,children:[P.length===0?(0,v.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20 text-muted-foreground opacity-50`,children:[(0,v.jsx)(r,{className:`h-10 w-10 mb-4 stroke-[1]`}),(0,v.jsx)(`p`,{children:n?`Analizando registros...`:`No se encontraron logs con los filtros activos.`})]}):(0,v.jsx)(`div`,{className:`space-y-0.5`,children:P.map(e=>(0,v.jsxs)(`div`,{className:`group flex items-start gap-3 py-0.5 hover:bg-white/5 rounded px-1 transition-colors`,children:[(0,v.jsx)(`span`,{className:`text-slate-600 shrink-0 select-none hidden md:inline`,children:e.timestamp.includes(`T`)?e.timestamp.split(`T`)[1].split(`.`)[0]:e.timestamp}),(0,v.jsx)(p,{variant:`outline`,className:l(`px-1 py-0 h-4 text-[9px] uppercase font-bold shrink-0 border`,F(e.level)),children:e.level}),(0,v.jsxs)(`div`,{className:`flex-1 break-all text-slate-300`,children:[(0,v.jsxs)(`span`,{className:`text-slate-500 mr-2`,children:[`[`,e.source,`]`]}),e.message,e.meta&&(0,v.jsx)(`span`,{className:`text-slate-500 ml-2 italic opacity-60`,children:JSON.stringify(e.meta)})]})]},`${e.timestamp}-${e.source}-${e.message.slice(0,30)}`))}),(0,v.jsx)(`div`,{className:`h-4`}),` `]})})})})]})}export{y as LogsPage};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as t}from"./vendor-charts-Bu2lyBKP.js";import{o as n}from"./vendor-query-DsWPbQdG.js";import{t as r}from"./chevron-down-DLfCQOQA.js";import{t as i}from"./chevron-up-GfewdYph.js";import{t as a}from"./file-text-CxAwK_Ze.js";import{t as o}from"./history-vA8Y7XQq.js";import{n as s,t as c}from"./square-PyIpnS-W.js";import{C as l,N as u,P as d,Q as f,S as p,tt as m,w as h}from"./index-B4lS14UW.js";import{t as g}from"./badge-BY-VUaxL.js";var ee=m(`MicOff`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M18.89 13.23A7.12 7.12 0 0 0 19 12v-2`,key:`80xlxr`}],[`path`,{d:`M5 10v2a7 7 0 0 0 12 5`,key:`p2k8kg`}],[`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`,key:`1gzdoj`}],[`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`,key:`r2i35w`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}]]),_=m(`MonitorSpeaker`,[[`path`,{d:`M5.5 20H8`,key:`1k40s5`}],[`path`,{d:`M17 9h.01`,key:`1j24nn`}],[`rect`,{width:`10`,height:`16`,x:`12`,y:`4`,rx:`2`,key:`ixliua`}],[`path`,{d:`M8 6H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h4`,key:`1mp6e1`}],[`circle`,{cx:`17`,cy:`15`,r:`1`,key:`tqvash`}]]),v=m(`Radio`,[[`path`,{d:`M4.9 19.1C1 15.2 1 8.8 4.9 4.9`,key:`1vaf9d`}],[`path`,{d:`M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5`,key:`u1ii0m`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5`,key:`1j5fej`}],[`path`,{d:`M19.1 4.9C23 8.8 23 15.1 19.1 19`,key:`10b0cb`}]]),y=e(t(),1),b=h((e,t)=>({sessions:[],activeSessionId:null,segments:[],isRecording:!1,isConnecting:!1,error:null,wsConnection:null,startSession:async(n,r=`whisper-large-v3-turbo`)=>{e({error:null,isConnecting:!0});try{let i=await(await fetch(`${p()}/api/meetings`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:n,stt_model:r})})).json();return!i.ok||!i.session?(e({error:i.error??`Error al crear sesión`,isConnecting:!1}),null):(e({activeSessionId:i.session.id,segments:[],sessions:[i.session,...t().sessions],isConnecting:!1}),i.session.id)}catch(t){return e({error:t.message,isConnecting:!1}),null}},stopSession:async()=>{let{activeSessionId:n,wsConnection:r}=t();if(n){if(r&&r.readyState===WebSocket.OPEN)r.send(JSON.stringify({type:`meeting_stop`}));else try{await fetch(`${p()}/api/meetings/${n}/stop`,{method:`POST`})}catch{}r?.close(),e({isRecording:!1,wsConnection:null})}},fetchSessions:async()=>{try{let t=await(await fetch(`${p()}/api/meetings`)).json();t.ok&&t.sessions&&e({sessions:t.sessions})}catch{}},fetchSession:async t=>{try{let n=await(await fetch(`${p()}/api/meetings/${t}`)).json();n.ok&&n.session&&e({activeSessionId:t,segments:n.segments??[]})}catch{}},addSegmentLocal:t=>e(e=>({segments:[...e.segments,t]})),setWsConnection:t=>e({wsConnection:t}),setRecording:t=>e({isRecording:t}),setConnecting:t=>e({isConnecting:t}),setError:t=>e({error:t}),clearActiveSession:()=>e({activeSessionId:null,segments:[],isRecording:!1,wsConnection:null})}));function x(e){return`${l()}/meeting-stream?meetingSessionId=${encodeURIComponent(e)}`}var S=n();function C(e){let t=Math.floor(Date.now()/1e3-e);return`${Math.floor(t/60).toString().padStart(2,`0`)}:${(t%60).toString().padStart(2,`0`)}`}async function te(){if(!navigator.mediaDevices?.getDisplayMedia)return!1;try{let e=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!0,systemAudio:`include`}),t=e.getAudioTracks().length>0;return e.getTracks().forEach(e=>e.stop()),t}catch{return!1}}function ne({segment:e}){return(0,S.jsxs)(`div`,{className:`flex gap-3 py-2 px-3 rounded-lg hover:bg-white/[0.03] transition-colors`,children:[e.speaker&&(0,S.jsxs)(`span`,{className:`shrink-0 text-xs font-semibold text-amber-400 mt-0.5 leading-5`,children:[`[`,e.speaker,`]`]}),(0,S.jsx)(`span`,{className:`text-sm text-zinc-300 leading-relaxed`,children:e.text})]})}function re(){return(0,S.jsxs)(`span`,{className:`relative flex h-3 w-3`,children:[(0,S.jsx)(`span`,{className:`animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75`}),(0,S.jsx)(`span`,{className:`relative inline-flex rounded-full h-3 w-3 bg-red-500`})]})}function ie(){let{sessions:e,activeSessionId:t,segments:n,isRecording:l,isConnecting:m,error:h,wsConnection:ie,startSession:w,stopSession:T,fetchSessions:E,addSegmentLocal:D,setWsConnection:O,setRecording:k,setError:A,clearActiveSession:j}=b(),[M,N]=(0,y.useState)(``),[P,F]=(0,y.useState)(`00:00`),[I,ae]=(0,y.useState)(!0),[L,R]=(0,y.useState)(!1),[z,B]=(0,y.useState)(!1),[V,H]=(0,y.useState)(`microphone`),[U,W]=(0,y.useState)(null),G=(0,y.useRef)(null),K=(0,y.useRef)([]),q=(0,y.useRef)(null),J=(0,y.useRef)(null),Y=(0,y.useRef)(null),oe=(0,y.useRef)(null),X=(0,y.useRef)(null),Z=(0,y.useRef)(!1),Q=e.find(e=>e.id===t);(0,y.useEffect)(()=>{if(!l||!Q)return;let e=setInterval(()=>F(C(Q.started_at)),1e3);return()=>clearInterval(e)},[l,Q]),(0,y.useEffect)(()=>{X.current?.scrollIntoView({behavior:`smooth`})},[n]),(0,y.useEffect)(()=>{E()},[]),(0,y.useEffect)(()=>{te().then(e=>{W(e)})},[]);let $=(0,y.useCallback)(async()=>{if(!M.trim()){A(`Ingresa el título de la reunión`);return}if(A(null),B(!1),!navigator.mediaDevices?.getUserMedia){A(`Tu navegador no puede acceder al micrófono. Asegúrate de usar HTTPS o localhost.`);return}let e=`audio/webm`,t,n=`microphone`;try{let e=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});q.current=e;let r;if(U)try{r=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!0,systemAudio:`include`}),J.current=r,n=r.getAudioTracks().length>0?`system`:`microphone`}catch{n=`microphone`}if(n===`system`&&r){let n=new AudioContext;Y.current=n;let i=n.createMediaStreamDestination();oe.current=i,n.createMediaStreamSource(e).connect(i),n.createMediaStreamSource(r).connect(i),t=new MediaStream([...i.stream.getAudioTracks()]),H(`dual`)}else t=e,H(`microphone`)}catch(e){let t=e.name;A(t===`NotAllowedError`||t===`PermissionDeniedError`?`Permiso de micrófono denegado. Ve a la configuración del navegador (🔒 en la barra de URL) y permite el micrófono.`:t===`NotFoundError`?`No se encontró ningún micrófono en este dispositivo.`:`No se pudo acceder al micrófono: ${e.message}`);return}q.current=t;let r=await w(M.trim());if(!r){t.getTracks().forEach(e=>e.stop()),J.current?.getTracks().forEach(e=>e.stop());return}let i=new WebSocket(x(r));O(i);let a=()=>{if(!Z.current||i.readyState!==WebSocket.OPEN)return;K.current=[];let n=new MediaRecorder(t,{mimeType:e});G.current=n,n.ondataavailable=e=>{e.data.size>0&&K.current.push(e.data)},n.onstop=()=>{if(K.current.length===0){Z.current&&i.readyState===WebSocket.OPEN&&a();return}let t=new Blob(K.current,{type:e}),n=new FileReader;n.readAsDataURL(t),n.onloadend=()=>{let t=n.result.split(`,`)[1];i.readyState===WebSocket.OPEN&&i.send(JSON.stringify({type:`audio_chunk`,audio:t,mime_type:e})),Z.current&&i.readyState===WebSocket.OPEN&&a()}},n.start(),setTimeout(()=>{n.state===`recording`&&n.stop()},5e3)};i.onopen=()=>{Z.current=!0,k(!0),a()},i.onmessage=e=>{try{let t=JSON.parse(e.data);t.type===`transcript_segment`&&D({seq:t.seq,speaker:t.speaker||null,text:t.text}),t.type===`meeting_stopped`&&(Z.current=!1,k(!1)),t.type===`error`&&A(t.error)}catch{}},i.onerror=()=>A(`Error en la conexión WebSocket`),i.onclose=()=>{Z.current=!1,k(!1),q.current?.getTracks().forEach(e=>e.stop()),J.current?.getTracks().forEach(e=>e.stop()),Y.current?.close()}},[M,w,O,k,A,D,U]),se=(0,y.useCallback)(async()=>{Z.current=!1,G.current?.stop(),q.current?.getTracks().forEach(e=>e.stop()),J.current?.getTracks().forEach(e=>e.stop()),Y.current?.close(),await T(),F(`00:00`)},[T]),ce=(0,y.useCallback)(async()=>{if(t){R(!0),A(null);try{(await fetch(`${p()}/api/chat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({message:`Genera el reporte de la reunión ${t}`})})).ok?B(!0):A(`Error al enviar el mensaje al agente`)}catch(e){A(e.message)}finally{R(!1)}}},[t,A]),le=!l&&t,ue=!l&&!Q?.status.startsWith(`stop`)&&!t;return(0,S.jsxs)(`div`,{className:`flex h-full flex-col bg-[#111319] text-white`,children:[(0,S.jsx)(`div`,{className:`shrink-0 px-5 py-4 border-b border-white/[0.06] bg-[#191b22]/80 backdrop-blur-sm`,children:(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,S.jsx)(`div`,{className:`flex items-center justify-center w-9 h-9 rounded-xl bg-amber-500/10 border border-amber-500/20`,children:(0,S.jsx)(v,{className:`h-4 w-4 text-amber-400`})}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h1`,{className:`text-sm font-semibold text-white leading-tight`,children:`Transcripción de Reuniones`}),(0,S.jsx)(`p`,{className:`text-[11px] text-zinc-500 leading-tight`,children:`Captura · Transcribe · Informa en tiempo real`})]})]}),l&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 rounded-full bg-red-500/10 border border-red-500/20`,children:[(0,S.jsx)(re,{}),(0,S.jsx)(`span`,{className:`text-xs font-semibold text-red-400 tabular-nums`,children:P})]})]})}),(0,S.jsxs)(`div`,{className:`flex flex-col lg:flex-row flex-1 overflow-hidden min-h-0`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0 overflow-hidden`,children:[(0,S.jsxs)(`div`,{className:`shrink-0 px-5 py-4 border-b border-white/[0.06] space-y-3`,children:[ue?(0,S.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,S.jsx)(u,{placeholder:`Nombre de la reunión...`,value:M,onChange:e=>N(e.target.value),onKeyDown:e=>e.key===`Enter`&&$(),className:`flex-1 bg-white/[0.04] border-white/[0.08] text-white placeholder:text-zinc-600 focus-visible:ring-amber-500/40 focus-visible:border-amber-500/40 rounded-xl h-10`,disabled:m}),(0,S.jsxs)(d,{onClick:$,disabled:m||!M.trim(),className:`shrink-0 bg-amber-500 hover:bg-amber-400 active:bg-amber-600 text-black font-semibold rounded-xl h-10 px-5 shadow-lg shadow-amber-900/30 transition-all`,children:[(0,S.jsx)(s,{className:`h-4 w-4 mr-1.5`}),m?`Iniciando...`:`Iniciar`]})]}):(0,S.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,S.jsx)(g,{variant:`outline`,className:l?`border-red-500/40 text-red-400 bg-red-500/10 rounded-full px-2.5`:`border-zinc-600/40 text-zinc-400 bg-white/[0.04] rounded-full px-2.5`,children:l?`● REC`:`Detenida`}),V!==`microphone`&&l&&(0,S.jsx)(g,{variant:`outline`,className:`border-blue-500/40 text-blue-400 bg-blue-500/10 rounded-full px-2.5`,children:V===`dual`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(_,{className:`h-3 w-3 mr-1`}),`Mic+Altavozz`]}):V===`system`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(_,{className:`h-3 w-3 mr-1`}),`Altavozz`]}):null}),(0,S.jsx)(`span`,{className:`text-sm font-medium text-zinc-200 truncate max-w-[180px]`,children:Q?.title}),l&&(0,S.jsxs)(`span`,{className:`hidden sm:flex items-center gap-1 text-xs text-zinc-500`,children:[(0,S.jsx)(f,{className:`h-3 w-3`}),P]})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[l&&(0,S.jsxs)(d,{variant:`outline`,size:`sm`,onClick:se,className:`border-red-500/30 text-red-400 hover:bg-red-500/10 hover:border-red-500/50 rounded-xl h-8`,children:[(0,S.jsx)(c,{className:`h-3 w-3 mr-1.5 fill-current`}),`Detener`]}),le&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(d,{size:`sm`,onClick:ce,disabled:L||z,className:`bg-amber-500 hover:bg-amber-400 text-black font-semibold rounded-xl h-8 px-3 shadow-md shadow-amber-900/30 disabled:opacity-60`,children:[(0,S.jsx)(a,{className:`h-3.5 w-3.5 mr-1.5`}),L?`Generando...`:z?`Enviado ✓`:`Generar Reporte`]}),(0,S.jsx)(d,{variant:`ghost`,size:`sm`,onClick:j,className:`text-zinc-500 hover:text-zinc-300 hover:bg-white/[0.05] rounded-xl h-8`,children:`Nueva reunión`})]})]})]}),h&&(0,S.jsxs)(`div`,{className:`flex items-start gap-2.5 px-3.5 py-2.5 rounded-xl bg-red-500/[0.08] border border-red-500/20 text-xs text-red-400`,children:[(0,S.jsx)(`span`,{className:`shrink-0 mt-px`,children:`⚠`}),(0,S.jsx)(`span`,{children:h})]}),z&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2.5 px-3.5 py-2.5 rounded-xl bg-emerald-500/[0.08] border border-emerald-500/20 text-xs text-emerald-400`,children:[(0,S.jsx)(`span`,{children:`✓`}),(0,S.jsx)(`span`,{children:`El agente está generando el reporte. Verifica el chat para el informe completo.`})]})]}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4 min-h-0`,children:n.length===0?(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-4 text-zinc-600`,children:[(0,S.jsx)(`div`,{className:`flex items-center justify-center w-16 h-16 rounded-2xl bg-white/[0.03] border border-white/[0.06]`,children:(0,S.jsx)(ee,{className:`h-7 w-7`})}),(0,S.jsx)(`p`,{className:`text-sm text-center max-w-[220px] leading-relaxed`,children:l?`Escuchando… las transcripciones aparecerán aquí`:`Inicia una sesión para ver la transcripción en tiempo real`})]}):(0,S.jsxs)(`div`,{className:`space-y-0.5`,children:[n.map(e=>(0,S.jsx)(ne,{segment:e},e.seq)),(0,S.jsx)(`div`,{ref:X})]})}),n.length>0&&(0,S.jsxs)(`div`,{className:`shrink-0 border-t border-white/[0.06] px-5 py-2 flex items-center justify-between`,children:[(0,S.jsxs)(`span`,{className:`text-[11px] text-zinc-600`,children:[n.length,` segmento`,n.length===1?``:`s`,` transcritos`]}),l&&(0,S.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] text-zinc-500`,children:[(0,S.jsx)(f,{className:`h-3 w-3`}),P]})]})]}),(0,S.jsxs)(`div`,{className:`shrink-0 flex flex-col lg:w-64 xl:w-72 border-t lg:border-t-0 lg:border-l border-white/[0.06] bg-[#191b22]/40 max-h-60 lg:max-h-none`,children:[(0,S.jsxs)(`button`,{onClick:()=>ae(!I),className:`flex items-center justify-between px-4 py-3 text-[11px] font-semibold text-zinc-500 uppercase tracking-wider hover:text-zinc-300 border-b border-white/[0.06] transition-colors`,children:[(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(o,{className:`h-3.5 w-3.5`}),`Historial (`,e.length,`)`]}),I?(0,S.jsx)(i,{className:`h-3 w-3`}):(0,S.jsx)(r,{className:`h-3 w-3`})]}),I&&(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:e.length===0?(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 gap-2 text-zinc-600`,children:[(0,S.jsx)(o,{className:`h-6 w-6 opacity-40`}),(0,S.jsx)(`p`,{className:`text-xs`,children:`Sin reuniones aún`})]}):(0,S.jsx)(`div`,{className:`py-1`,children:e.map(e=>(0,S.jsxs)(`button`,{onClick:()=>b.getState().fetchSession(e.id),className:`w-full text-left px-4 py-3 hover:bg-white/[0.04] transition-colors border-b border-white/[0.04] ${e.id===t?`bg-amber-500/[0.06]`:``}`,children:[(0,S.jsx)(`p`,{className:`text-xs font-medium text-zinc-200 truncate leading-snug`,children:e.title}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1`,children:[(0,S.jsx)(g,{variant:`outline`,className:`text-[10px] px-1.5 py-0 rounded-full border-0 ${e.status===`active`?`bg-emerald-500/15 text-emerald-400`:e.status===`report_ready`?`bg-blue-500/15 text-blue-400`:`bg-white/[0.05] text-zinc-500`}`,children:e.status===`active`?`activa`:e.status===`report_ready`?`con reporte`:`detenida`}),e.segment_count!==void 0&&e.segment_count>0&&(0,S.jsxs)(`span`,{className:`text-[10px] text-zinc-600`,children:[e.segment_count,` seg`]})]})]},e.id))})})]})]})]})}function w(){return(0,S.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,S.jsx)(ie,{})})}export{w as MeetingPage};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as t}from"./vendor-charts-Bu2lyBKP.js";import{o as n}from"./vendor-query-DsWPbQdG.js";import{s as r}from"./vendor-router-4QM6Fwg6.js";var i=e(t(),1),a=n(),o=()=>{let e=r();return(0,i.useEffect)(()=>{console.error(`404 Error: User attempted to access non-existent route:`,e.pathname)},[e.pathname]),(0,a.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-muted`,children:(0,a.jsxs)(`div`,{className:`text-center`,children:[(0,a.jsx)(`h1`,{className:`mb-4 text-4xl font-bold`,children:`404`}),(0,a.jsx)(`p`,{className:`mb-4 text-xl text-muted-foreground`,children:`Oops! Page not found`}),(0,a.jsx)(`a`,{href:`/`,className:`text-primary underline hover:text-primary/90`,children:`Return to Home`})]})})};export{o as default};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as t}from"./vendor-charts-Bu2lyBKP.js";import{o as n}from"./vendor-query-DsWPbQdG.js";import{t as r}from"./chevron-down-DLfCQOQA.js";import{t as i}from"./chevron-right-B60x0b2L.js";import{t as a}from"./circle-check-BhwUUu4Z.js";import{t as o}from"./circle-minus-BcF7EW2K.js";import{t as s}from"./circle-x-C55wB-DP.js";import{t as c}from"./circle-DLFOVgkH.js";import{t as l}from"./folder-open-BnXDc8BG.js";import{t as u}from"./loader-circle-BaadtldT.js";import{t as d}from"./refresh-cw-Yf5FGfA5.js";import{f,w as p}from"./index-B4lS14UW.js";import{t as m}from"./badge-BY-VUaxL.js";import{t as h}from"./progress-CFpWXmru.js";var g=e(t(),1),_=p((e,t)=>({projects:[],isLoading:!1,fetchProjects:async t=>{e({isLoading:!0});try{let n=await f(t?`/api/projects?status=${t}`:`/api/projects`,{showLoader:!1,showError:!0}),r=[];Array.isArray(n)?r=n:`projects`in n?r=n.projects:`project`in n?r=n.project?[n.project]:[]:n&&typeof n==`object`&&`id`in n&&(r=[n]),e({projects:r})}catch(t){console.error(`[ProjectsStore] Error en fetchProjects:`,t),e({projects:[]})}finally{e({isLoading:!1})}},fetchActiveProjects:async()=>{e({isLoading:!0});try{let t=await f(`/api/projects/active`,{showLoader:!1,showError:!0}),n=[];Array.isArray(t)?n=t:`projects`in t?n=t.projects:`project`in t?n=t.project?[t.project]:[]:t&&typeof t==`object`&&`id`in t&&(n=[t]),e({projects:n})}catch(t){console.error(`[ProjectsStore] Error en fetchActiveProjects:`,t),e({projects:[]})}finally{e({isLoading:!1})}},updateTaskLocal:(t,n)=>{e(e=>({projects:e.projects.map(e=>({...e,tasks:e.tasks.map(e=>e.id===t?{...e,...n}:e)}))}))},updateProjectLocal:(t,n)=>{e(e=>({projects:e.projects.map(e=>e.id===t?{...e,...n}:e)}))}})),v=n();function y({icon:e,...t}){return(0,v.jsx)(e,{...t})}var b={code:`Código`,research:`Investigación`,content:`Contenido`,data:`Datos`,general:`General`},x={code:`bg-blue-500/10 text-blue-400 border-blue-500/20`,research:`bg-purple-500/10 text-purple-400 border-purple-500/20`,content:`bg-green-500/10 text-green-400 border-green-500/20`,data:`bg-orange-500/10 text-orange-400 border-orange-500/20`,general:`bg-gray-500/10 text-gray-400 border-gray-500/20`},S={active:`bg-green-500/10 text-green-400 border-green-500/20`,pending:`bg-yellow-500/10 text-yellow-400 border-yellow-500/20`,paused:`bg-gray-500/10 text-gray-400 border-gray-500/20`,done:`bg-blue-500/10 text-blue-400 border-blue-500/20`,failed:`bg-red-500/10 text-red-400 border-red-500/20`},C={active:`Activo`,pending:`Pendiente`,paused:`Pausado`,done:`Completado`,failed:`Fallido`,in_progress:`En progreso`,completed:`Completada`,blocked:`Bloqueada`};function w({status:e}){switch(e){case`completed`:return(0,v.jsx)(y,{icon:a,className:`h-3.5 w-3.5 text-green-400`});case`in_progress`:return(0,v.jsx)(y,{icon:u,className:`h-3.5 w-3.5 text-yellow-400 animate-spin`});case`failed`:return(0,v.jsx)(y,{icon:s,className:`h-3.5 w-3.5 text-red-400`});case`blocked`:return(0,v.jsx)(y,{icon:o,className:`h-3.5 w-3.5 text-orange-400`});default:return(0,v.jsx)(y,{icon:c,className:`h-3.5 w-3.5 text-muted-foreground`})}}function T({task:e}){return(0,v.jsxs)(`div`,{className:`flex items-center gap-3 py-1.5 px-3 rounded-md hover:bg-white/5 transition-colors group`,children:[(0,v.jsx)(w,{status:e.status}),(0,v.jsx)(`span`,{className:`text-sm flex-1 text-white/40 group-hover:text-white/80 transition-colors`,children:e.name}),e.description&&(0,v.jsx)(`span`,{className:`text-xs text-white/20 hidden sm:block max-w-[200px] truncate`,children:e.description}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[e.status===`in_progress`&&(0,v.jsx)(`div`,{className:`w-16`,children:(0,v.jsx)(h,{value:e.progress,className:`h-1`})}),(0,v.jsxs)(`span`,{className:`text-[11px] text-white/30 w-8 text-right`,children:[e.progress,`%`]})]})]})}function E({project:e}){let[t,n]=(0,g.useState)(e.status===`active`||e.status===`pending`);return(0,v.jsxs)(`div`,{className:`hive-card group overflow-hidden mt-10`,children:[(0,v.jsxs)(`button`,{className:`w-full flex items-center gap-3 p-4 hover:bg-white/5 transition-colors text-left`,onClick:()=>n(!t),children:[(0,v.jsx)(y,{icon:t?r:i,className:`h-4 w-4 text-white/30 shrink-0`}),(0,v.jsx)(y,{icon:l,className:`h-4 w-4 text-blue-400 shrink-0`}),(0,v.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,v.jsx)(`span`,{className:`font-medium text-sm text-white`,children:e.name}),(0,v.jsx)(m,{variant:`outline`,className:`text-[10px] px-1.5 py-0 ${x[e.type]??x.general}`,children:b[e.type]??e.type}),(0,v.jsx)(m,{variant:`outline`,className:`text-[10px] px-1.5 py-0 ${S[e.status]??``}`,children:C[e.status]??e.status})]}),e.description&&(0,v.jsx)(`p`,{className:`hive-subtitle !mt-0.5 truncate`,children:e.description})]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,v.jsx)(`div`,{className:`w-20`,children:(0,v.jsx)(h,{value:e.progress,className:`h-1.5`})}),(0,v.jsxs)(`span`,{className:`text-xs text-white/30 w-8 text-right`,children:[e.progress,`%`]})]}),(e.tasks??[]).length>0&&(0,v.jsxs)(`span`,{className:`text-xs text-white/30`,children:[(e.tasks??[]).filter(e=>e.status===`completed`).length,`/`,(e.tasks??[]).length]})]})]}),t&&(e.tasks??[]).length>0&&(0,v.jsx)(`div`,{className:`border-t border-white/5 px-2 py-2`,children:(e.tasks??[]).map(e=>(0,v.jsx)(T,{task:e},e.id))}),t&&(e.tasks??[]).length===0&&(0,v.jsx)(`div`,{className:`border-t border-white/5 px-4 py-3 text-xs text-white/20`,children:`Sin tareas registradas`})]})}function D(){let{projects:e,isLoading:t,fetchProjects:n,fetchActiveProjects:r}=_(),[i,a]=(0,g.useState)(`active`),o=()=>{i===`active`?r():i===`done`?n(`done`):n()};return(0,g.useEffect)(()=>{o()},[i]),(0,v.jsx)(`div`,{className:`hive-page`,children:(0,v.jsxs)(`div`,{className:`hive-page-container`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,v.jsx)(`div`,{className:`hive-page-header__dot`}),(0,v.jsx)(`span`,{className:`hive-page-header__label`,children:`GESTIÓN`})]}),(0,v.jsxs)(`h1`,{className:`hive-title-page`,children:[`Proyectos`,(0,v.jsx)(`span`,{className:`hive-title-page__accent`,children:`.`})]}),(0,v.jsx)(`p`,{className:`hive-subtitle`,children:`Seguimiento de tareas y proyectos activos del agente`})]}),(0,v.jsxs)(`button`,{className:`hive-btn hive-btn--primary`,onClick:o,disabled:t,children:[(0,v.jsx)(y,{icon:d,className:`h-3.5 w-3.5 mr-1.5 ${t?`animate-spin`:``}`}),`Actualizar`]})]}),(0,v.jsx)(`div`,{className:`flex gap-1 mt-6 bg-white/[0.02] rounded-xl p-1 border border-white/5`,children:[{key:`active`,label:`Activos`},{key:`all`,label:`Todos`},{key:`done`,label:`Completados`}].map(e=>(0,v.jsx)(`button`,{onClick:()=>a(e.key),className:`px-6 py-2 rounded-xl text-[10px] font-black tracking-widest uppercase transition-all duration-300 ${i===e.key?`bg-blue-600 text-white shadow-btn-primary`:`text-white/20 hover:text-white/40 hover:bg-white/5`}`,children:e.label},e.key))}),(0,v.jsx)(`div`,{className:`mt-6 space-y-3`,children:t?(0,v.jsxs)(`div`,{className:`hive-empty-state`,children:[(0,v.jsx)(y,{icon:u,className:`h-5 w-5 animate-spin mr-2`}),`Cargando proyectos...`]}):e.length===0?(0,v.jsxs)(`div`,{className:`hive-empty-state`,children:[(0,v.jsx)(y,{icon:l,className:`h-10 w-10 opacity-30 mb-3`}),(0,v.jsxs)(`p`,{className:`text-sm text-white/30`,children:[`No hay proyectos `,i===`active`?`activos`:``]}),(0,v.jsx)(`p`,{className:`text-xs text-white/15 mt-1`,children:`El agente creará proyectos automáticamente cuando reciba tareas complejas`})]}):e.filter(Boolean).map(e=>(0,v.jsx)(E,{project:e},e.id))})]})})}export{D as ProjectsPage};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as t}from"./vendor-charts-Bu2lyBKP.js";import{o as n}from"./vendor-query-DsWPbQdG.js";import{a as r,c as i,l as a,n as o,r as s,s as c,t as l}from"./switch-CQf9jQKN.js";import{t as u}from"./chevron-down-DLfCQOQA.js";import{t as d}from"./chevron-right-B60x0b2L.js";import{t as f}from"./circle-check-BhwUUu4Z.js";import{t as p}from"./cpu-BxFtjoPn.js";import{t as m}from"./download-DRO1cmbw.js";import{n as h,t as g}from"./eye-SOUMoM2-.js";import{t as _}from"./globe-C7sirxEy.js";import{t as v}from"./key-DFIqRGXl.js";import{t as y}from"./loader-circle-BaadtldT.js";import{a as b,c as x,d as S,i as C,l as w,n as T,o as E,r as D,s as O,t as k,u as A}from"./table-CN6cGA9v.js";import{t as ee}from"./lock-DUwqtzEo.js";import{n as j,t as te}from"./square-PyIpnS-W.js";import{n as ne,r as re,t as M}from"./wifi-DK-RxSqc.js";import{t as ie}from"./play-Rmf5Px63.js";import{t as N}from"./plus-CqJyiQvM.js";import{t as P}from"./refresh-cw-Yf5FGfA5.js";import{t as F}from"./search-CnhAnemg.js";import{t as I}from"./settings-OcD7AWkq.js";import{t as L}from"./terminal-CNLY74vg.js";import{t as ae}from"./trash-2-CUqHaFaC.js";import{H as oe,J as se,N as R,P as z,X as ce,f as le,i as ue,m as B,o as de,r as V,s as H,tt as fe,u as pe}from"./index-B4lS14UW.js";import{t as U}from"./label-CplWBwSz.js";import{c as me,i as W,o as he,r as G,s as K,t as q}from"./dialog-CWlGzRqi.js";import{t as J}from"./badge-BY-VUaxL.js";import{a as Y,n as X,o as ge,r as _e,t as Z}from"./card-CE_kGxdL.js";import"./useProviders-77fYN2hY.js";import{t as ve}from"./scroll-area-B3bGhGnD.js";var ye=fe(`KeyRound`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),be=fe(`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`}]]),Q=e(t(),1),$=n();function xe({provider:e,onSave:t,onCancel:n}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(e?.baseUrl||e?.base_url||``),[l,u]=(0,Q.useState)(e?.config?.headers?JSON.stringify(e.config.headers,null,2):``),[d,p]=(0,Q.useState)(e?.num_ctx?String(e.num_ctx):``),m=s||e?.baseUrl||e?.base_url||``,_=e?.id===`ollama`||m.includes(`localhost`)||m.includes(`127.0.0.1`),v=!!e?.has_api_key,y=!!e?.has_headers;return(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(U,{className:`hive-label`,children:`API Key`}),v&&(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] font-bold text-emerald-400`,children:[(0,$.jsx)(f,{className:`h-3 w-3`}),`Configurada`]})]}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(R,{type:r?`text`:`password`,value:a,onChange:e=>o(e.target.value),placeholder:v?`•••••••••••••••• (dejar vacío para conservar)`:`sk-...`,className:`hive-input !h-8 text-xs pr-8`}),(0,$.jsx)(z,{variant:`ghost`,size:`icon`,className:`absolute right-0 top-0 h-8 w-8 text-white/40 hover:text-white`,onClick:()=>i(!r),children:r?(0,$.jsx)(h,{className:`h-3 w-3`}):(0,$.jsx)(g,{className:`h-3 w-3`})})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(U,{className:`hive-label`,children:`Base URL (opcional)`}),(0,$.jsx)(R,{value:s,onChange:e=>c(e.target.value),placeholder:`https://api.example.com`,className:`hive-input !h-8 text-xs`})]}),_&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(U,{className:`hive-label`,children:`Context Window (num_ctx)`}),(0,$.jsx)(`span`,{className:`text-[10px] text-white/30`,children:`tokens — por defecto 32 768`})]}),(0,$.jsx)(R,{type:`number`,value:d,onChange:e=>p(e.target.value),placeholder:`8192`,min:512,step:512,className:`hive-input !h-8 text-xs font-mono`}),(0,$.jsx)(`p`,{className:`text-[10px] text-amber-400/60`,children:`Aumenta si ves errores de contexto. Tu modelo soporta hasta 262 144 tokens.`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(U,{className:`hive-label`,children:`Custom Headers (JSON)`}),y&&(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] font-bold text-emerald-400`,children:[(0,$.jsx)(f,{className:`h-3 w-3`}),`Configurados`]})]}),(0,$.jsx)(`textarea`,{value:l,onChange:e=>u(e.target.value),placeholder:y?`{ ... } (dejar vacío para conservar)`:`{ "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`})]}),(0,$.jsxs)(`div`,{className:`flex gap-2 pt-2`,children:[(0,$.jsx)(`button`,{className:`hive-btn hive-btn--form-cancel flex-1`,onClick:n,children:`Cancelar`}),(0,$.jsx)(`button`,{className:`hive-btn hive-btn--form-submit flex-1`,onClick:()=>{let e;if(l.trim())try{e=JSON.parse(l.trim())}catch{B.fire(`Error`,`JSON de Headers inválido`,`error`);return}t&&t({apiKey:a,baseUrl:s||void 0,headers:e,numCtx:d.trim()?Number(d.trim()):null})},children:`Guardar`})]}),(0,$.jsx)(`p`,{className:`text-[10px] text-white/20 pt-2`,children:`La API key se guarda cifrada en la base de datos.`})]})}var Se=I,Ce=u,we=d,Te=p,Ee=N,De=ye,Oe=_,ke=P,Ae=re,je=ae,Me=a,Ne=oe;function Pe({provider:e,updateProvider:t,onManageModels:n}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(null),{models:S,toggleModel:C,createModel:w,syncModels:T,deleteModel:E,updateModel:D}=de(),{toggleProvider:O}=H(),k=(0,Q.useMemo)(()=>{let t=S.filter(t=>(t.providerId||t.provider_id)===e.id);return t.length>0?t:e.models||[]},[S,e.id,e.models]),A=k.filter(e=>e.enabled||e.active),ee=n=>{t(e.id,n),i(!1)},j=async t=>{try{await O(e.id,t)}catch(e){console.error(`Failed to toggle provider:`,e)}},te=async(e,t)=>{try{await C(e.id,t)}catch(e){console.error(`Failed to toggle model:`,e)}},ne=async()=>{p(!0);try{await T(e.id),o(!0)}catch(e){console.error(`Failed to sync models:`,e)}finally{p(!1)}},re=e=>{h(e.id),_(e.name),y(e.id)},M=()=>{h(null),_(``),y(``)},ie=async e=>{let t=g.trim()||e.name,n=v.trim()||e.id;if(t===e.name&&n===e.id){M();return}try{await D(e.id,{name:t,id:n}),M()}catch(e){console.error(`Failed to update model:`,e)}},N=async e=>{x(e.id);try{await E(e.id)}catch(e){console.error(`Failed to delete model:`,e)}finally{x(null)}},P=async()=>{let t=s.trim();if(t){d(!0);try{await w(e.id,t),c(``)}catch(e){console.error(`Failed to add model:`,e)}finally{d(!1)}}},F=!!e.active,I=e.base_url||e.baseUrl,L=e.id===`ollama`||I?.includes(`localhost`)||I?.includes(`127.0.0.1`);return(0,$.jsxs)(`div`,{className:`hive-card group overflow-hidden flex flex-col gap-0 transition-all duration-500 ${F?`hive-card--active`:`opacity-70 grayscale-[0.5] hover:grayscale-0 hover:opacity-100`}`,children:[(0,$.jsx)(`div`,{className:`hive-card-body pb-3`,children:(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,$.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 ${F?`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,$.jsx)(Te,{className:`h-5 w-5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 mb-0.5`,children:[(0,$.jsx)(`h3`,{className:`font-black text-white tracking-tight text-base sm:text-lg uppercase leading-none truncate`,children:e.name}),F&&(0,$.jsx)(`div`,{className:`hive-status-dot--active h-1.5 w-1.5 shrink-0`})]}),(0,$.jsx)(`p`,{className:`text-[11px] text-white/35 font-medium leading-none truncate`,children:e.id})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,$.jsx)(`span`,{className:`hidden sm:block text-[10px] font-black tracking-widest ${F?`text-blue-400`:`text-white/30`}`,children:F?`ON`:`OFF`}),(0,$.jsx)(l,{checked:F,onCheckedChange:j,className:`data-[state=checked]:bg-blue-500`})]})]})}),(0,$.jsxs)(`div`,{className:`px-5 pb-3 space-y-2 border-b border-white/5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(De,{className:`h-3.5 w-3.5 shrink-0 ${e.has_api_key?`text-emerald-400`:L?`text-amber-400`:`text-white/20`}`}),(0,$.jsx)(`span`,{className:`text-[11px] font-mono truncate`,children:e.masked_api_key?(0,$.jsx)(`span`,{className:`text-white/50`,children:e.masked_api_key}):e.has_api_key?(0,$.jsx)(`span`,{className:`text-white/50`,children:`••••••••••••••••`}):L?(0,$.jsx)(`span`,{className:`text-amber-400/70`,children:`Local — sin API key`}):(0,$.jsx)(`span`,{className:`text-white/25`,children:`Sin API key`})})]}),I&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(Oe,{className:`h-3.5 w-3.5 shrink-0 text-white/20`}),(0,$.jsx)(`span`,{className:`text-[11px] text-white/40 truncate font-mono`,children:I})]}),L&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(Te,{className:`h-3.5 w-3.5 shrink-0 text-white/20`}),(0,$.jsxs)(`span`,{className:`text-[11px] text-white/40 font-mono`,children:[`ctx: `,(0,$.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,$.jsxs)(`div`,{className:`px-5 py-3 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,$.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:()=>o(!a),children:[a?(0,$.jsx)(Ce,{className:`h-3 w-3`}):(0,$.jsx)(we,{className:`h-3 w-3`}),`MODELOS`,(0,$.jsxs)(`span`,{className:`hive-tag scale-90 origin-left`,children:[A.length,`/`,k.length]})]}),L&&(0,$.jsxs)($.Fragment,{children:[(0,$.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,$.jsx)(`button`,{type:`button`,onClick:ne,disabled:f,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,$.jsx)(ke,{className:`h-3 w-3 ${f?`animate-spin`:``}`})})]})]}),!a&&k.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:[k.slice(0,3).map(e=>(0,$.jsx)(`span`,{className:`hive-tag text-[10px] ${e.enabled||e.active?``:`opacity-40`}`,children:e.name.split(`/`).pop()||e.name},e.id)),k.length>3&&(0,$.jsxs)(`span`,{className:`hive-tag text-[10px] text-white/30`,children:[`+`,k.length-3]})]}),a&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`div`,{className:`hive-scroll max-h-44 overflow-y-auto flex flex-col gap-0.5 pr-1`,children:[k.length===0&&(0,$.jsx)(`p`,{className:`text-[11px] text-white/25 py-2 text-center`,children:`Sin modelos configurados`}),k.map(e=>{let t=e.enabled||!!e.active,n=m===e.id;return(0,$.jsx)(`div`,{className:`rounded-lg transition-colors ${t&&!n||n?`bg-white/5`:`bg-transparent opacity-40`}`,children:n?(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 px-2.5 py-1.5`,children:[(0,$.jsx)(`input`,{type:`text`,value:g,onChange:e=>_(e.target.value),placeholder:`Display name`,className:`w-full bg-white/5 border border-white/10 rounded-md px-2 h-7 text-[11px] text-white/70 placeholder-white/20 focus:outline-none focus:border-blue-500/50 transition-all`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`API model ID`,className:`flex-1 min-w-0 bg-white/5 border border-white/10 rounded-md px-2 h-7 text-[11px] text-white/70 placeholder-white/20 focus:outline-none focus:border-blue-500/50 transition-all font-mono`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>ie(e),className:`shrink-0 h-7 w-7 flex items-center justify-center rounded-md bg-emerald-500/10 border border-emerald-500/20 text-emerald-400 hover:bg-emerald-500/20 transition-colors`,children:(0,$.jsx)(Me,{className:`h-3 w-3`})}),(0,$.jsx)(`button`,{type:`button`,onClick:M,className:`shrink-0 h-7 w-7 flex items-center justify-center rounded-md bg-white/5 border border-white/10 text-white/40 hover:text-white hover:bg-white/10 transition-colors`,children:(0,$.jsx)(Ne,{className:`h-3 w-3`})})]})]}):(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-2.5 py-1.5`,children:[(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-white truncate flex-1 mr-2`,children:e.name}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>re(e),title:`Editar modelo`,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,$.jsx)(Ae,{className:`h-3 w-3`})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>N(e),disabled:b===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,$.jsx)(je,{className:`h-3 w-3`})}),(0,$.jsx)(l,{checked:t,onCheckedChange:t=>te(e,t),className:`scale-[0.7] origin-right data-[state=checked]:bg-blue-400 ml-0.5`})]})]})},e.id)})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 pt-1.5 border-t border-white/5`,children:[(0,$.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>e.key===`Enter`&&P(),placeholder:`nombre-del-modelo`,className:`flex-1 min-w-0 bg-white/5 border border-white/10 rounded-md px-2 h-7 text-[11px] text-white/70 placeholder-white/20 focus:outline-none focus:border-blue-500/50 transition-all font-mono`}),(0,$.jsxs)(`button`,{type:`button`,onClick:P,disabled:u||!s.trim(),className:`shrink-0 h-7 px-2.5 flex items-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 disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[(0,$.jsx)(Ee,{className:`h-3 w-3`}),(0,$.jsx)(`span`,{className:`hidden xs:inline`,children:`ADD`})]})]})]})]}),(0,$.jsxs)(`div`,{className:`px-4 py-3 border-t border-white/5 flex items-center justify-between gap-2 overflow-hidden`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 overflow-hidden`,children:[(0,$.jsxs)(`div`,{className:`hive-stat shrink-0`,children:[(0,$.jsx)(`span`,{className:`hive-stat__label`,children:`Uptime`}),(0,$.jsx)(`span`,{className:`hive-stat__value`,children:`99.9%`})]}),(0,$.jsxs)(`div`,{className:`hive-stat shrink-0`,children:[(0,$.jsx)(`span`,{className:`hive-stat__label`,children:`Estado`}),(0,$.jsx)(`span`,{className:`hive-stat__value ${F?`text-emerald-400`:`text-white/30`}`,children:F?`Activo`:`Inactivo`})]})]}),(0,$.jsxs)(q,{open:r,onOpenChange:i,children:[(0,$.jsx)(me,{asChild:!0,children:(0,$.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,$.jsx)(Se,{className:`h-3 w-3`}),(0,$.jsx)(`span`,{children:`CONFIG`})]})}),(0,$.jsxs)(G,{className:`rounded-xl border border-white/10 p-0 overflow-hidden w-[calc(100vw-2rem)] max-w-md bg-[#09090b]`,children:[(0,$.jsxs)(`div`,{className:`p-5 border-b border-white/5 bg-white/5 relative overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`absolute -top-10 -right-10 h-32 w-32 bg-blue-600/10 rounded-full blur-[80px] pointer-events-none`}),(0,$.jsx)(K,{className:`text-lg font-black text-white uppercase tracking-tighter`,children:e.name}),(0,$.jsx)(W,{className:`text-xs text-white/40 font-medium mt-0.5`,children:`Autenticación y punto de enlace.`})]}),(0,$.jsx)(`div`,{className:`p-5`,children:(0,$.jsx)(xe,{provider:e,onSave:ee,onCancel:()=>i(!1)})})]})]})]}),(0,$.jsx)(`div`,{className:`hive-strip--bottom ${F?``:`opacity-20`}`})]})}function Fe(){let{providers:e,updateProvider:t}=H(),n=e.filter(e=>e.active).length;return(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`hive-title-section`,children:`Providers de IA`}),(0,$.jsxs)(`span`,{className:`hive-tag hive-tag--provider`,children:[n,` activos / `,e.length,` total`]})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4 sm:gap-5`,children:[e.map(e=>(0,$.jsx)(Pe,{provider:e,updateProvider:t},e.id)),e.length===0&&(0,$.jsx)(`div`,{className:`hive-empty-state col-span-full`,children:`No hay providers disponibles.`})]})]})}function Ie({onSave:e,onCancel:t}){let[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(``),[m,_]=(0,Q.useState)(``),v=o.toLowerCase()===`ollama`||u.includes(`localhost`)||u.includes(`127.0.0.1`);return(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(U,{className:`hive-label`,children:`Nombre del Provider`}),(0,$.jsx)(R,{value:i,onChange:e=>a(e.target.value),placeholder:`Mi Provider Personalizado`,className:`hive-input !h-8 text-xs`}),(0,$.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Se usará como identificador interno`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(U,{className:`hive-label`,children:`Tipo de Provider`}),(0,$.jsx)(R,{value:o,onChange:e=>s(e.target.value),placeholder:`openai, anthropic, ollama...`,className:`hive-input !h-8 text-xs`}),(0,$.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Ej: openai, anthropic, ollama, custom...`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,$.jsx)(U,{className:`hive-label`,children:`API Key`})}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(R,{type:n?`text`:`password`,value:c,onChange:e=>l(e.target.value),placeholder:v?`Opcional para providers locales`:`sk-...`,className:`hive-input !h-8 text-xs pr-8`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>r(!n),className:`absolute right-0 top-0 h-8 w-8 flex items-center justify-center text-white/40 hover:text-white`,children:n?(0,$.jsx)(h,{className:`h-3 w-3`}):(0,$.jsx)(g,{className:`h-3 w-3`})})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(U,{className:`hive-label`,children:`Base URL (opcional)`}),(0,$.jsx)(R,{value:u,onChange:e=>d(e.target.value),placeholder:`https://api.example.com o http://localhost:11434`,className:`hive-input !h-8 text-xs`})]}),v&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(U,{className:`hive-label`,children:`Context Window (num_ctx)`}),(0,$.jsx)(`span`,{className:`text-[10px] text-white/30`,children:`tokens — por defecto 32 768`})]}),(0,$.jsx)(R,{type:`number`,value:m,onChange:e=>_(e.target.value),placeholder:`32768`,min:512,step:512,className:`hive-input !h-8 text-xs font-mono`}),(0,$.jsx)(`p`,{className:`text-[10px] text-amber-400/60`,children:`Aumenta si ves errores de contexto.`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,$.jsx)(U,{className:`hive-label`,children:`Custom Headers (JSON)`})}),(0,$.jsx)(`textarea`,{value:f,onChange:e=>p(e.target.value),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`})]}),(0,$.jsxs)(`div`,{className:`flex gap-2 pt-2`,children:[(0,$.jsx)(`button`,{className:`hive-btn hive-btn--form-cancel flex-1`,onClick:t,children:`Cancelar`}),(0,$.jsx)(`button`,{className:`hive-btn hive-btn--form-submit flex-1`,onClick:()=>{if(!i.trim()){B.fire(`Error`,`El nombre del provider es requerido`,`error`);return}if(!o){B.fire(`Error`,`Selecciona un tipo de provider`,`error`);return}if(!c.trim()&&!v){B.fire(`Error`,`La API Key es requerida para este provider`,`error`);return}let t;if(f.trim())try{t=JSON.parse(f.trim())}catch{B.fire(`Error`,`JSON de Headers inválido`,`error`);return}e({id:i.trim().toLowerCase().replace(/\s+/g,`-`),name:i.trim(),type:o,apiKey:c.trim()||``,baseUrl:u.trim()||void 0,headers:t,numCtx:m.trim()?Number(m.trim()):null})},children:`Crear Provider`})]}),(0,$.jsx)(`p`,{className:`text-[10px] text-white/20 pt-2`,children:`La API key se guarda cifrada en la base de datos.`})]})}var Le={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 Re({capabilities:e}){let t=[];if(typeof e==`string`)try{t=JSON.parse(e)}catch{t=[]}else Array.isArray(e)&&(t=e);return t.length===0?null:(0,$.jsx)($.Fragment,{children:t.map(e=>(0,$.jsx)(J,{variant:`outline`,className:`text-[10px] py-0 h-4`,children:Le[e]??e},e))})}function ze({model:e}){let{toggleModel:t}=de();return(0,$.jsx)(Z,{className:e.active?``:`opacity-70 bg-muted/30`,children:(0,$.jsxs)(X,{className:`flex items-center gap-4 p-3`,children:[(0,$.jsxs)(`div`,{className:`flex-1 space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm font-semibold`,children:e.name}),(0,$.jsx)(J,{variant:`secondary`,className:`text-[10px]`,children:e.providerId||e.provider_id})]}),e.contextWindow&&(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[(e.contextWindow/1e3).toFixed(0),`K tokens contexto`]}),(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 pt-1`,children:(0,$.jsx)(Re,{capabilities:e.capabilities})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col items-end gap-2`,children:[(0,$.jsx)(l,{checked:!!e.active,onCheckedChange:n=>t(e.id,n)}),(0,$.jsx)(J,{variant:e.active?`default`:`secondary`,className:`text-[10px]`,children:e.active?`Activo`:`Inactivo`})]})]})})}function Be(e){if(!e)return[];if(typeof e==`string`)try{return JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:[]}function Ve(){let{availableModels:e,activeProviders:t}=H(),n=V(e=>e.fetchAll),[a,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(`all`);(0,Q.useEffect)(()=>{n(!0)},[n]);let f=(0,Q.useMemo)(()=>e.filter(e=>{let t=Be(e.capabilities),n=t.includes(`vision`)||t.includes(`image_generation`)||t.includes(`ocr`),r=e.name.toLowerCase().includes(a.toLowerCase())||e.id.toLowerCase().includes(a.toLowerCase()),i=u===`all`||e.providerId===u||e.provider_id===u;return n&&r&&i}),[e,a,u]);return(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Modelos de Imagen / Vision`})}),(0,$.jsx)(J,{variant:`secondary`,children:f.length})]}),(0,$.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.`}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(`div`,{className:`relative flex-1`,children:[(0,$.jsx)(F,{className:`absolute left-2 top-2 h-4 w-4 text-muted-foreground`}),(0,$.jsx)(R,{placeholder:`Buscar modelo...`,className:`h-8 pl-8 text-sm`,value:a,onChange:e=>l(e.target.value)})]}),(0,$.jsxs)(o,{value:u,onValueChange:d,children:[(0,$.jsx)(c,{className:`h-8 w-40 text-sm`,children:(0,$.jsx)(i,{placeholder:`Provider`})}),(0,$.jsxs)(s,{children:[(0,$.jsx)(r,{value:`all`,children:`Todos`}),t.map(e=>(0,$.jsx)(r,{value:e.id,children:e.name},e.id))]})]})]}),(0,$.jsx)(ve,{className:`h-[calc(100vh-26rem)]`,children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[f.map(e=>(0,$.jsx)(ze,{model:e},e.id)),f.length===0&&(0,$.jsxs)(`div`,{className:`hive-empty-state`,children:[(0,$.jsx)(g,{className:`h-8 w-8 mx-auto mb-2 text-muted-foreground`}),(0,$.jsx)(`p`,{children:`No hay modelos con capacidad de vision.`}),(0,$.jsx)(`p`,{className:`text-xs mt-1`,children:`Habilita modelos con capability "vision" en la tab Providers.`})]})]})})]})}function He({open:e,onOpenChange:t}){let{availableTTSModels:n,fetchAvailableTTSModels:r,downloadTTSModel:i,isDownloadingModel:o,downloadLogs:s,fetchDownloadLogs:c}=ue(),[l,u]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{e&&d()},[e]);let d=async()=>{u(!0),await r(),u(!1)},f=async e=>{await i(e)},p=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`}};return(0,$.jsx)(q,{open:e,onOpenChange:t,children:(0,$.jsxs)(G,{className:`max-w-3xl max-h-[80vh] overflow-hidden flex flex-col`,children:[(0,$.jsxs)(he,{children:[(0,$.jsx)(K,{className:`flex items-center gap-2`,children:`📦 Gestionar Modelos TTS`}),(0,$.jsx)(W,{children:`Descarga modelos de voz adicionales para Piper TTS. Cada modelo incluye el archivo de voz (.onnx) y su configuración (.json).`})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-auto mt-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,$.jsxs)(J,{variant:`outline`,children:[n.filter(e=>e.installed).length,` / `,n.length,` instalados`]})}),(0,$.jsxs)(z,{size:`sm`,variant:`ghost`,onClick:d,disabled:l||o,className:`gap-2`,children:[(0,$.jsx)(P,{className:`h-4 w-4 ${l?`animate-spin`:``}`}),`Actualizar`]})]}),l&&!n.length?(0,$.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,$.jsx)(y,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):n.length===0?(0,$.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`No hay modelos disponibles`}):(0,$.jsxs)(k,{children:[(0,$.jsx)(b,{children:(0,$.jsxs)(E,{children:[(0,$.jsx)(C,{children:`Modelo`}),(0,$.jsx)(C,{children:`Idioma`}),(0,$.jsx)(C,{children:`Calidad`}),(0,$.jsx)(C,{children:`Tamaño`}),(0,$.jsx)(C,{children:`Estado`}),(0,$.jsx)(C,{className:`text-right`,children:`Acciones`})]})}),(0,$.jsx)(T,{children:n.map(e=>(0,$.jsxs)(E,{children:[(0,$.jsx)(D,{className:`font-medium`,children:e.name}),(0,$.jsx)(D,{children:e.language}),(0,$.jsx)(D,{children:(0,$.jsx)(J,{className:p(e.quality),children:e.quality})}),(0,$.jsx)(D,{className:`text-muted-foreground`,children:e.size}),(0,$.jsx)(D,{children:e.installed?(0,$.jsxs)(J,{className:`bg-green-500/20 text-green-400 border-green-500/30 gap-1`,children:[(0,$.jsx)(a,{className:`h-3 w-3`}),`Instalado`]}):o&&s.some(t=>t.includes(e.name))?(0,$.jsxs)(J,{className:`bg-blue-500/20 text-blue-400 border-blue-500/30 gap-1`,children:[(0,$.jsx)(y,{className:`h-3 w-3 animate-spin`}),`Descargando`]}):(0,$.jsx)(J,{variant:`secondary`,className:`bg-zinc-700/50 text-zinc-400`,children:`No instalado`})}),(0,$.jsx)(D,{className:`text-right`,children:e.installed?(0,$.jsxs)(z,{size:`sm`,variant:`ghost`,disabled:!0,className:`gap-2 opacity-50`,children:[(0,$.jsx)(a,{className:`h-4 w-4`}),`Instalado`]}):(0,$.jsxs)(z,{size:`sm`,onClick:()=>f(e.id),disabled:o,className:`gap-2`,children:[(0,$.jsx)(m,{className:`h-4 w-4`}),`Descargar`]})})]},e.id))})]}),s.length>0&&(0,$.jsxs)(`div`,{className:`mt-4`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium mb-2`,children:`Progreso de descarga:`}),(0,$.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:s.map((e,t)=>(0,$.jsx)(`div`,{className:e.startsWith(`[error]`)?`text-red-400`:e.startsWith(`✓`)?`text-green-400`:``,children:e},t))})]})]})]})})}function Ue(){let{localTTS:e,fetchLocalTTSStatus:t,installLocalTTS:n,startLocalTTS:r,stopLocalTTS:i}=ue(),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)([]),[d,f]=(0,Q.useState)(``),[p,h]=(0,Q.useState)(!1),g=(0,Q.useRef)(null),_=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{t()},[t]),(0,Q.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,Q.useEffect)(()=>{_.current&&(_.current.scrollTop=_.current.scrollHeight)},[l]);let v=async()=>{try{let e=await le(`/api/tts-local/logs`);u(e.logs),f(e.ttsRoot)}catch{}},y=async()=>{o(!0),c(!0);try{await n(),await v()}finally{o(!1)}},b=async()=>{o(!0);try{await r()}finally{o(!1)}},x=async()=>{o(!0);try{await i()}finally{o(!1)}},S=async()=>{c(e=>!e),s||await v()},{installed:C,running:w,piperExists:T,voiceExists:E,port:D}=e,O=e.installing;return(0,$.jsxs)(Z,{className:`relative overflow-hidden col-span-full ${w?`border-blue-500/30 bg-blue-500/[0.02]`:``}`,children:[(0,$.jsx)(Y,{children:(0,$.jsxs)(`div`,{className:`flex items-start justify-between flex-wrap gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`text-3xl`,children:`🎙️`}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(ge,{className:`text-lg flex items-center gap-2`,children:[`Piper TTS`,(0,$.jsx)(J,{variant:`outline`,className:`text-[10px] px-1.5 py-0 font-normal border-zinc-600 text-zinc-400`,children:`Local · Offline`})]}),(0,$.jsx)(_e,{className:`text-xs`,children:`TTS sin internet — binario nativo, sin Python, sin Docker. Fallback cuando no hay providers online.`})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[O?(0,$.jsxs)(J,{className:`bg-yellow-500/20 text-yellow-400 border-yellow-500/30 gap-1`,children:[(0,$.jsx)(P,{className:`h-3 w-3 animate-spin`}),`Instalando…`]}):C?(0,$.jsx)(J,{className:`bg-green-500/20 text-green-400 border-green-500/30`,children:`Instalado`}):(0,$.jsx)(J,{variant:`secondary`,className:`bg-zinc-700/50 text-zinc-400`,children:`No instalado`}),C&&(w?(0,$.jsxs)(J,{className:`bg-blue-500/20 text-blue-400 border-blue-500/30 gap-1`,children:[(0,$.jsx)(M,{className:`h-3 w-3`}),`Servidor :`,D]}):(0,$.jsxs)(J,{variant:`secondary`,className:`bg-zinc-700/50 text-zinc-400 gap-1`,children:[(0,$.jsx)(ne,{className:`h-3 w-3`}),`Detenido`]}))]})]})}),(0,$.jsxs)(X,{className:`space-y-4`,children:[!C&&!O&&(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 ${T?`text-green-400`:``}`,children:[(0,$.jsx)(`span`,{children:T?`✓`:`○`}),` Binario Piper (~8 MB)`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 ${E?`text-green-400`:``}`,children:[(0,$.jsx)(`span`,{children:E?`✓`:`○`}),` Voz española (~60 MB)`]})]}),C&&(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Voz: `,(0,$.jsx)(`code`,{className:`text-zinc-300`,children:e.voices?.[0]||`N/A`}),` · Puerto:`,` `,(0,$.jsx)(`code`,{className:`text-zinc-300`,children:D}),` · Configurable con`,` `,(0,$.jsx)(`code`,{className:`text-zinc-300`,children:`TTS_PORT`}),` / `,(0,$.jsx)(`code`,{className:`text-zinc-300`,children:`TTS_VOICE`})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[!C&&!O&&(0,$.jsxs)(z,{size:`sm`,onClick:y,disabled:a,className:`gap-2`,children:[(0,$.jsx)(m,{className:`h-3.5 w-3.5`}),`Instalar Piper (~68 MB)`]}),O&&(0,$.jsxs)(z,{size:`sm`,disabled:!0,className:`gap-2 opacity-70`,children:[(0,$.jsx)(P,{className:`h-3.5 w-3.5 animate-spin`}),`Descargando…`]}),C&&!w&&(0,$.jsxs)(z,{size:`sm`,onClick:b,disabled:a,className:`gap-2 bg-blue-600 hover:bg-blue-500 text-white`,children:[(0,$.jsx)(ie,{className:`h-3.5 w-3.5`}),`Iniciar servidor`]}),w&&(0,$.jsxs)(z,{size:`sm`,variant:`outline`,onClick:x,disabled:a,className:`gap-2 border-red-500/40 text-red-400 hover:bg-red-500/10`,children:[(0,$.jsx)(te,{className:`h-3.5 w-3.5`}),`Detener servidor`]}),C&&(0,$.jsxs)(z,{size:`sm`,variant:`outline`,onClick:()=>h(!0),disabled:a,className:`gap-2`,children:[(0,$.jsx)(be,{className:`h-3.5 w-3.5`}),`Gestionar modelos`,e.voices&&e.voices.length>0&&(0,$.jsx)(J,{variant:`secondary`,className:`ml-1 text-[10px] px-1`,children:e.voices.length})]}),(0,$.jsx)(z,{size:`sm`,variant:`ghost`,onClick:()=>t(),title:`Actualizar estado`,className:`text-zinc-400`,children:(0,$.jsx)(P,{className:`h-3.5 w-3.5`})}),(0,$.jsxs)(z,{size:`sm`,variant:`ghost`,onClick:S,className:`gap-1.5 text-zinc-400 text-xs`,children:[(0,$.jsx)(L,{className:`h-3.5 w-3.5`}),s?`Ocultar log`:`Ver log`]})]}),O&&(0,$.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,$.jsxs)(`div`,{className:`space-y-1`,children:[d&&(0,$.jsxs)(`p`,{className:`text-[10px] text-zinc-500 font-mono`,children:[`ruta: `,d]}),(0,$.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,$.jsx)(`span`,{className:`text-zinc-600`,children:`Sin registros aún. Inicia la instalación para ver el progreso.`}):l.map((e,t)=>(0,$.jsx)(`div`,{className:e.startsWith(`[stderr]`)||e.startsWith(`[error]`)?`text-red-400`:``,children:e},t))})]}),(0,$.jsx)(He,{open:p,onOpenChange:h})]})]})}var We={groq:{name:`Groq`,description:`STT (Speech-to-Text) - Transcripcion de audio ultra-rapida`,logo:`🔴`,consoleUrl:`https://console.groq.com/keys`},elevenlabs:{name:`ElevenLabs`,description:`TTS (Text-to-Speech) - Voces neuronales de alta calidad`,logo:`🎙️`,consoleUrl:`https://elevenlabs.io/app/settings/api-keys`},openai:{name:`OpenAI`,description:`STT/TTS - Whisper y TTS-1`,logo:`🟢`,consoleUrl:`https://platform.openai.com/api-keys`},gemini:{name:`Google Gemini`,description:`TTS - Voces de Gemini`,logo:`🔵`,consoleUrl:`https://aistudio.google.com/app/apikey`},qwen:{name:`Qwen (Alibaba)`,description:`TTS - Voces de Qwen`,logo:`🟣`,consoleUrl:`https://dashscope.console.aliyun.com/apiKey`},piper:{name:`Piper TTS (Local)`,description:`TTS offline — sin internet, sin API key.`,logo:`🖥️`,consoleUrl:`/settings/voz`,noApiKey:!0}};function Ge(e){if(!e)return[];if(typeof e==`string`)try{return JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:[]}function Ke(){let{availableModels:e,activeProviders:t}=H(),{voiceProviders:n,configuredVoiceProviders:l,fetchVoiceProviders:u,fetchConfiguredVoiceProviders:d,saveVoiceProviderKey:f}=pe(),p=V(e=>e.fetchAll),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(!1),[x,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(``),[E,D]=(0,Q.useState)(`all`);(0,Q.useEffect)(()=>{u(),d(),p(!0)},[u,d,p]);let O=async e=>{if(g.trim()){b(!0);try{await f(e,g.trim()),await d(),h(null),_(``)}catch(e){console.error(`Failed to save API key:`,e)}finally{b(!1)}}},k=n.length>0?n:Object.keys(We),A=(0,Q.useMemo)(()=>e.filter(e=>{let t=e.model_type===`stt`||e.model_type===`tts`,n=Ge(e.capabilities),r=n.includes(`transcription`)||n.includes(`tts`)||n.includes(`speech`),i=e.name.toLowerCase().includes(w.toLowerCase())||e.id.toLowerCase().includes(w.toLowerCase()),a=E===`all`||e.providerId===E||e.provider_id===E;return(t||r)&&i&&a}),[e,w,E]);return(0,$.jsxs)(`div`,{className:`space-y-6`,children:[(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Modelos de Voz (STT / TTS)`}),(0,$.jsx)(J,{variant:`secondary`,children:A.length})]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(`div`,{className:`relative flex-1`,children:[(0,$.jsx)(F,{className:`absolute left-2 top-2 h-4 w-4 text-muted-foreground`}),(0,$.jsx)(R,{placeholder:`Buscar modelo...`,className:`h-8 pl-8 text-sm`,value:w,onChange:e=>T(e.target.value)})]}),(0,$.jsxs)(o,{value:E,onValueChange:D,children:[(0,$.jsx)(c,{className:`h-8 w-40 text-sm`,children:(0,$.jsx)(i,{placeholder:`Provider`})}),(0,$.jsxs)(s,{children:[(0,$.jsx)(r,{value:`all`,children:`Todos`}),t.map(e=>(0,$.jsx)(r,{value:e.id,children:e.name},e.id))]})]})]}),(0,$.jsx)(ve,{className:`h-60`,children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[A.map(e=>(0,$.jsx)(ze,{model:e},e.id)),A.length===0&&(0,$.jsxs)(`div`,{className:`hive-empty-state`,children:[(0,$.jsx)(j,{className:`h-8 w-8 mx-auto mb-2 text-muted-foreground`}),(0,$.jsx)(`p`,{children:`No hay modelos de voz disponibles.`})]})]})})]}),(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:`API Keys de Voz`}),(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,$.jsx)(Ue,{}),k.map(e=>{let t=We[e]||{name:e,description:``,logo:`🔌`,consoleUrl:`#`},n=l[e]===!0,r=m===e;return(0,$.jsxs)(Z,{className:`relative overflow-hidden ${n?`border-green-500/30 bg-green-500/[0.02]`:``}`,children:[(0,$.jsx)(Y,{children:(0,$.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`text-3xl`,children:t.logo}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(ge,{className:`text-lg`,children:t.name}),(0,$.jsx)(_e,{className:`text-xs`,children:t.description})]})]}),t.noApiKey?(0,$.jsx)(J,{variant:`outline`,className:`bg-zinc-700/40 text-zinc-300 border-zinc-600`,children:`Sin API key`}):n?(0,$.jsxs)(J,{variant:`default`,className:`bg-green-500/20 text-green-400 border-green-500/30`,children:[(0,$.jsx)(a,{className:`h-3 w-3 mr-1`}),`Configurado`]}):(0,$.jsx)(J,{variant:`secondary`,className:`bg-yellow-500/20 text-yellow-400 border-yellow-500/30`,children:`Sin configurar`})]})}),(0,$.jsx)(X,{className:`space-y-4`,children:t.noApiKey?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.description}):r?(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(U,{htmlFor:`api-key-${e}`,children:`API Key`}),(0,$.jsxs)(`div`,{className:`flex gap-2 mt-1`,children:[(0,$.jsx)(R,{id:`api-key-${e}`,type:x?`text`:`password`,placeholder:`sk-...`,value:g,onChange:e=>_(e.target.value),className:`flex-1 font-mono text-sm`,autoFocus:!0}),(0,$.jsx)(z,{variant:`outline`,size:`icon`,onClick:()=>C(!x),title:x?`Ocultar`:`Mostrar`,children:x?(0,$.jsx)(ee,{className:`h-4 w-4`}):(0,$.jsx)(S,{className:`h-4 w-4`})})]})]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(z,{size:`sm`,onClick:()=>O(e),disabled:y||!g.trim(),className:`flex-1`,children:y?`Guardando...`:`Guardar`}),(0,$.jsx)(z,{size:`sm`,variant:`outline`,onClick:()=>{h(null),_(``)},children:`Cancelar`})]})]}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[n?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(v,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{children:`API key guardada de forma segura (encriptada)`})]}):(0,$.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Necesitas una API key de `,t.name,` para usar esta funcionalidad.`]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[n?(0,$.jsxs)(z,{size:`sm`,variant:`outline`,onClick:()=>{h(e),_(``)},className:`flex-1`,children:[(0,$.jsx)(v,{className:`h-3 w-3 mr-2`}),`Actualizar API Key`]}):(0,$.jsxs)(z,{size:`sm`,onClick:()=>{h(e),_(``)},className:`flex-1`,children:[(0,$.jsx)(v,{className:`h-3 w-3 mr-2`}),`Configurar API Key`]}),(0,$.jsx)(z,{size:`sm`,variant:`outline`,onClick:()=>window.open(t.consoleUrl,`_blank`),children:`Obtener Key`})]})]})})]},e)})]})]}),(0,$.jsxs)(Z,{children:[(0,$.jsxs)(Y,{children:[(0,$.jsx)(ge,{className:`text-lg`,children:`Como funciona?`}),(0,$.jsx)(_e,{children:`Configura las API keys de los providers de voz para habilitar STT y TTS en tus canales.`})]}),(0,$.jsxs)(X,{className:`space-y-4 text-sm text-muted-foreground`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{className:`text-foreground`,children:`STT (Speech-to-Text):`}),` Convierte el audio entrante en texto. Groq Whisper es recomendado por su velocidad.`]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{className:`text-foreground`,children:`TTS (Text-to-Speech):`}),` Convierte las respuestas de texto en audio. ElevenLabs ofrece las voces mas naturales.`]}),(0,$.jsx)(`div`,{className:`pt-2 border-t`,children:(0,$.jsx)(`p`,{className:`text-xs`,children:`Las API keys se guardan encriptadas en la base de datos local de Hive.`})})]})]})]})}function qe(e){if(!e)return[];if(typeof e==`string`)try{return JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:[]}function Je(){let{availableModels:e,activeProviders:t}=H(),n=V(e=>e.fetchAll),[a,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(`all`);(0,Q.useEffect)(()=>{n(!0)},[]);let f=(0,Q.useMemo)(()=>e.filter(e=>{let t=qe(e.capabilities),n=(t.includes(`chat`)||!t.includes(`vision`))&&e.model_type!==`stt`&&e.model_type!==`tts`,r=e.name.toLowerCase().includes(a.toLowerCase())||e.id.toLowerCase().includes(a.toLowerCase()),i=u===`all`||e.providerId===u||e.provider_id===u;return n&&r&&i}),[e,a,u]);return(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Modelos de Texto`}),(0,$.jsx)(J,{variant:`secondary`,children:f.length})]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(`div`,{className:`relative flex-1`,children:[(0,$.jsx)(F,{className:`absolute left-2 top-2 h-4 w-4 text-muted-foreground`}),(0,$.jsx)(R,{placeholder:`Buscar modelo...`,className:`h-8 pl-8 text-sm`,value:a,onChange:e=>l(e.target.value)})]}),(0,$.jsxs)(o,{value:u,onValueChange:d,children:[(0,$.jsx)(c,{className:`h-8 w-40 text-sm`,children:(0,$.jsx)(i,{placeholder:`Provider`})}),(0,$.jsxs)(s,{children:[(0,$.jsx)(r,{value:`all`,children:`Todos`}),t.map(e=>(0,$.jsx)(r,{value:e.id,children:e.name},e.id))]})]})]}),(0,$.jsx)(ve,{className:`h-[calc(100vh-22rem)]`,children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[f.map(e=>(0,$.jsx)(ze,{model:e},e.id)),f.length===0&&(0,$.jsx)(`div`,{className:`hive-empty-state`,children:`No hay modelos de texto disponibles.`})]})})]})}var Ye=N,Xe=ce,Ze=g,Qe=j,$e=se;function et(){let{providers:e,createProvider:t}=H(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(`text`);return(0,$.jsxs)(`div`,{className:`space-y-4 mt-6 sm:mt-10`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,$.jsx)(`div`,{className:`hive-page-header__dot`}),(0,$.jsx)(`span`,{className:`hive-page-header__label`,children:`INFRAESTRUCTURA`})]}),(0,$.jsxs)(`h2`,{className:`hive-title-page`,children:[`Providers de IA`,(0,$.jsx)(`span`,{className:`hive-title-page__accent`,children:`.`})]})]}),(0,$.jsxs)(q,{open:n,onOpenChange:e=>{r(e)},children:[(0,$.jsx)(me,{asChild:!0,children:(0,$.jsxs)(`button`,{className:`hive-btn hive-btn--primary`,children:[(0,$.jsx)(Ye,{className:`mr-1 h-4 w-4`}),`Añadir Provider`]})}),(0,$.jsxs)(G,{className:`max-w-md`,children:[(0,$.jsxs)(he,{className:`p-6 border-b border-white/5 bg-white/5 relative overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`hive-glow-blob hive-glow-blob--blue -top-10 -right-10 h-32 w-32 opacity-20`}),(0,$.jsx)(K,{className:`text-xl font-black text-white uppercase tracking-tighter`,children:`Añadir Provider`}),(0,$.jsx)(W,{className:`text-xs text-white/40 font-medium mt-1`,children:`Crea un nuevo provider de IA para tu infraestructura.`})]}),(0,$.jsx)(`div`,{className:`p-6`,children:(0,$.jsx)(Ie,{onSave:async e=>{try{await t({id:e.id,name:e.name,base_url:e.baseUrl,api_key:e.apiKey,headers:e.headers,num_ctx:e.numCtx}),r(!1)}catch(e){console.error(`Error creating provider:`,e)}},onCancel:()=>r(!1)})})]})]})]}),(0,$.jsxs)(O,{value:i,onValueChange:a,className:`w-full`,children:[(0,$.jsxs)(w,{className:`w-full grid grid-cols-4 h-10`,children:[(0,$.jsxs)(A,{value:`text`,className:`gap-1.5 text-xs`,children:[(0,$.jsx)(Xe,{className:`h-3.5 w-3.5`}),`Texto`]}),(0,$.jsxs)(A,{value:`vision`,className:`gap-1.5 text-xs`,children:[(0,$.jsx)(Ze,{className:`h-3.5 w-3.5`}),`Imagen`]}),(0,$.jsxs)(A,{value:`voice`,className:`gap-1.5 text-xs`,children:[(0,$.jsx)(Qe,{className:`h-3.5 w-3.5`}),`Voz`]}),(0,$.jsxs)(A,{value:`providers`,className:`gap-1.5 text-xs`,children:[(0,$.jsx)($e,{className:`h-3.5 w-3.5`}),`Providers`]})]}),(0,$.jsx)(x,{value:`text`,className:`mt-4`,children:(0,$.jsx)(Je,{})}),(0,$.jsx)(x,{value:`vision`,className:`mt-4`,children:(0,$.jsx)(Ve,{})}),(0,$.jsx)(x,{value:`voice`,className:`mt-4`,children:(0,$.jsx)(Ke,{})}),(0,$.jsx)(x,{value:`providers`,className:`mt-4`,children:(0,$.jsx)(Fe,{})})]})]})}export{et as ProvidersPage};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as t}from"./vendor-charts-Bu2lyBKP.js";import{o as n}from"./vendor-query-DsWPbQdG.js";import{t as r}from"./arrow-left-WQsWOWW_.js";import{n as i,t as a}from"./eye-SOUMoM2-.js";import{t as o}from"./loader-circle-BaadtldT.js";import{c as s}from"./vendor-router-4QM6Fwg6.js";import{N as c,P as l}from"./index-B4lS14UW.js";import{t as u}from"./label-CplWBwSz.js";var d=e(t(),1),f=n();function p(){let e=s(),[t,n]=(0,d.useState)(``),[p,m]=(0,d.useState)(``),[h,g]=(0,d.useState)(``),[_,v]=(0,d.useState)(!1),[y,b]=(0,d.useState)(!1),[x,S]=(0,d.useState)(``);async function C(n){if(n.preventDefault(),S(``),p!==h){S(`Las contraseñas no coinciden`);return}if(p.length<8){S(`La contraseña debe tener al menos 8 caracteres`);return}b(!0);try{let n=await fetch(`/api/auth/recover`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({recoveryKey:t,newPassword:p})}),r=await n.json();if(!n.ok){S(r.error||`Recovery key inválido`);return}localStorage.setItem(`hive-auth-token`,r.authToken),e(`/`,{replace:!0})}catch{S(`No se pudo conectar al servidor`)}finally{b(!1)}}return(0,f.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,f.jsxs)(`div`,{className:`w-full max-w-sm space-y-6 p-8`,children:[(0,f.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,f.jsx)(`div`,{className:`text-4xl`,children:`🐝`}),(0,f.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:`Recuperar acceso`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Usa tu recovery key para restablecer la contraseña`})]}),(0,f.jsxs)(`form`,{onSubmit:C,className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(u,{htmlFor:`recoveryKey`,children:`Recovery Key`}),(0,f.jsx)(c,{id:`recoveryKey`,type:`text`,placeholder:`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`,value:t,onChange:e=>n(e.target.value),required:!0,disabled:y,className:`font-mono text-sm`}),(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Encuéntralo en `,(0,f.jsx)(`code`,{className:`bg-muted px-1 rounded`,children:`~/.hive/.auth_token`})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(u,{htmlFor:`newPassword`,children:`Nueva contraseña`}),(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(c,{id:`newPassword`,type:_?`text`:`password`,placeholder:`••••••••`,value:p,onChange:e=>m(e.target.value),required:!0,disabled:y,className:`pr-10`}),(0,f.jsx)(`button`,{type:`button`,className:`absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>v(e=>!e),tabIndex:-1,children:_?(0,f.jsx)(i,{className:`h-4 w-4`}):(0,f.jsx)(a,{className:`h-4 w-4`})})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(u,{htmlFor:`confirmPassword`,children:`Confirmar contraseña`}),(0,f.jsx)(c,{id:`confirmPassword`,type:_?`text`:`password`,placeholder:`••••••••`,value:h,onChange:e=>g(e.target.value),required:!0,disabled:y})]}),x&&(0,f.jsx)(`p`,{className:`text-sm text-destructive`,children:x}),(0,f.jsxs)(l,{type:`submit`,className:`w-full`,disabled:y,children:[y&&(0,f.jsx)(o,{className:`mr-2 h-4 w-4 animate-spin`}),`Recuperar acceso`]})]}),(0,f.jsx)(`div`,{className:`text-center`,children:(0,f.jsxs)(`button`,{type:`button`,onClick:()=>e(`/login`),className:`text-sm text-muted-foreground hover:text-foreground inline-flex items-center gap-1`,children:[(0,f.jsx)(r,{className:`h-3 w-3`}),`Volver al login`]})})]})})}export{p as default};