@johpaz/hive-agents 0.0.45 → 1.0.0

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 (298) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +119 -852
  3. package/dist/hive.js +59290 -58797
  4. package/dist/tool-worker.js +220 -925
  5. package/dist/ui/assets/A2UIPage-D4nUFe5q.js +8 -0
  6. package/dist/ui/assets/AgentCreateForm-g1mQnIoJ.js +1 -0
  7. package/dist/ui/assets/AgentDetailPage-C3XkU4Ll.js +1 -0
  8. package/dist/ui/assets/AgentNewPage-CEkLeA79.js +1 -0
  9. package/dist/ui/assets/AgentsPage-CNA778Eo.js +10 -0
  10. package/dist/ui/assets/ApiClientPage-t5DpKhmA.js +3 -0
  11. package/dist/ui/assets/ChannelsPage-yY6t0YTU.js +8 -0
  12. package/dist/ui/assets/DashboardPage-BSeNSYg5.js +6 -0
  13. package/dist/ui/assets/{LoginPage-BTxJdFVG.js → LoginPage-eT5zDRDa.js} +1 -1
  14. package/dist/ui/assets/{LogsPage-DVV2eHbh.js → LogsPage-Gczzzsdh.js} +1 -1
  15. package/dist/ui/assets/MeetingPage-Bu4aMMNR.js +1 -0
  16. package/dist/ui/assets/ModelSelector-nNOrW3te.js +1 -0
  17. package/dist/ui/assets/{NotFound-BIUDlIXU.js → NotFound-Bpr12V51.js} +1 -1
  18. package/dist/ui/assets/Office3DPage-B_iXEbyv.js +4614 -0
  19. package/dist/ui/assets/Office3DPage-C3SIzd2H.css +1 -0
  20. package/dist/ui/assets/ProvidersPage-BupHs5yO.js +1 -0
  21. package/dist/ui/assets/{RecoverPage-7YDQysBL.js → RecoverPage-DMqSasKk.js} +1 -1
  22. package/dist/ui/assets/SettingsPage-B6FTSkOn.js +9 -0
  23. package/dist/ui/assets/SetupPage-DhcRbGgg.js +1 -0
  24. package/dist/ui/assets/WebChatPage-CWXjW4Hn.js +29 -0
  25. package/dist/ui/assets/{activity-c3pNngT_.js → activity-CQuPevhB.js} +1 -1
  26. package/dist/ui/assets/agentCapabilities-CDC6y91E.js +1 -0
  27. package/dist/ui/assets/alert-CQlRq6sv.js +1 -0
  28. package/dist/ui/assets/arrow-left-0EBE7nsF.js +1 -0
  29. package/dist/ui/assets/arrow-right-5QIaph-z.js +1 -0
  30. package/dist/ui/assets/arrow-up-right-DQQCY007.js +1 -0
  31. package/dist/ui/assets/badge-DKGZbVZJ.js +1 -0
  32. package/dist/ui/assets/{calendar-B-KZ9RQO.js → calendar-Be23hQGc.js} +1 -1
  33. package/dist/ui/assets/{card-CNf6BS2e.js → card-D3Nw3kh3.js} +1 -1
  34. package/dist/ui/assets/check-Dp6tzwax.js +1 -0
  35. package/dist/ui/assets/chevron-down-33N886NY.js +1 -0
  36. package/dist/ui/assets/chevron-left-C6itJXh3.js +1 -0
  37. package/dist/ui/assets/chevron-right-CFodBS-b.js +1 -0
  38. package/dist/ui/assets/chevron-up-BvSmyBEs.js +1 -0
  39. package/dist/ui/assets/{circle-alert-KuAm2FWh.js → circle-alert-BDVHxmAz.js} +1 -1
  40. package/dist/ui/assets/circle-check-BJWNbLuF.js +1 -0
  41. package/dist/ui/assets/{circle-x-DjLkFDO8.js → circle-x-Cb2Yer4s.js} +1 -1
  42. package/dist/ui/assets/{copy-Bu5d7C-0.js → copy-33tZrzc9.js} +1 -1
  43. package/dist/ui/assets/{dialog-Jk4bieO4.js → dialog-KOZKWbib.js} +1 -1
  44. package/dist/ui/assets/dist-CD_qfA30.js +1 -0
  45. package/dist/ui/assets/{download-Cjbk4Rek.js → download-CiQqqXyz.js} +1 -1
  46. package/dist/ui/assets/earth-DCvN7ynm.js +1 -0
  47. package/dist/ui/assets/ellipsis-vertical-BybFZDk2.js +1 -0
  48. package/dist/ui/assets/{external-link-6sTlRDUR.js → external-link-0iNNBvZm.js} +1 -1
  49. package/dist/ui/assets/{eye-Df8o0tkC.js → eye-C8sKSSkg.js} +1 -1
  50. package/dist/ui/assets/{file-text-lnxnjBp0.js → file-text-DO8jqiJK.js} +1 -1
  51. package/dist/ui/assets/{gateway-url-DwzPmoc8.js → gateway-url-BlnabM5e.js} +1 -1
  52. package/dist/ui/assets/gauge-BRGwuN8G.js +1 -0
  53. package/dist/ui/assets/{history-CAF_R34_.js → history-BtTD1kDo.js} +1 -1
  54. package/dist/ui/assets/index-Bejlp-R1.js +116 -0
  55. package/dist/ui/assets/index-XoTT41Hr.css +2 -0
  56. package/dist/ui/assets/{info-WjromB4Y.js → info-mpk1tsNC.js} +1 -1
  57. package/dist/ui/assets/key-CoQ0qtXt.js +1 -0
  58. package/dist/ui/assets/label-k0jYxoWW.js +1 -0
  59. package/dist/ui/assets/loader-circle-BhqRN2nO.js +1 -0
  60. package/dist/ui/assets/lock-open-Cd2aqwOd.js +1 -0
  61. package/dist/ui/assets/mail-BG0RYSkL.js +1 -0
  62. package/dist/ui/assets/{pause-VqeUmp2Z.js → pause-Cme88_9s.js} +1 -1
  63. package/dist/ui/assets/pencil-f1nJ1xhs.js +1 -0
  64. package/dist/ui/assets/play-CfYDHD6h.js +1 -0
  65. package/dist/ui/assets/plus-C5BxJeOX.js +1 -0
  66. package/dist/ui/assets/progress-DrI2UDu-.js +1 -0
  67. package/dist/ui/assets/radio-B5SpKJ-J.js +1 -0
  68. package/dist/ui/assets/{refresh-cw-CCzDCAuz.js → refresh-cw-CroGQY62.js} +1 -1
  69. package/dist/ui/assets/scroll-area-CfHn94Vb.js +1 -0
  70. package/dist/ui/assets/search-rfBcmohK.js +1 -0
  71. package/dist/ui/assets/select-BhbW0stK.js +1 -0
  72. package/dist/ui/assets/{send-BPk9XbIq.js → send-D6whYpw-.js} +1 -1
  73. package/dist/ui/assets/{settings-BGfrZ_zM.js → settings-BX6q3MGB.js} +1 -1
  74. package/dist/ui/assets/{shield-CxhcUT39.js → shield-BnGyu1xf.js} +1 -1
  75. package/dist/ui/assets/slider-CmE_z1Ii.js +1 -0
  76. package/dist/ui/assets/{sparkles-BhwlS1pc.js → sparkles-BcaOs_Jk.js} +1 -1
  77. package/dist/ui/assets/{square-DMNWw4Hi.js → square-ju5H8nrT.js} +1 -1
  78. package/dist/ui/assets/switch-DXcELPsM.js +1 -0
  79. package/dist/ui/assets/tabs-CxiybXcw.js +1 -0
  80. package/dist/ui/assets/terminal-Bjfu-TkS.js +1 -0
  81. package/dist/ui/assets/{textarea-B6Z1Zc6W.js → textarea-rp6vsOZl.js} +1 -1
  82. package/dist/ui/assets/{trash-2-xD2o4SgX.js → trash-2-DjQXac_0.js} +1 -1
  83. package/dist/ui/assets/{triangle-alert-pVIJGjga.js → triangle-alert-B04mgMcg.js} +1 -1
  84. package/dist/ui/assets/{useHiveAgentsModelLoad-BnC4jLE-.js → useHiveAgentsModelLoad-DT5-4CCj.js} +1 -1
  85. package/dist/ui/assets/useOfficeModel-Cy7cAyEn.js +1 -0
  86. package/dist/ui/assets/useProviders-DSX7eVsz.js +1 -0
  87. package/dist/ui/assets/utils-Dyb7SC2_.js +1 -0
  88. package/dist/ui/assets/vendor-charts-K3xcRl0X.js +60 -0
  89. package/dist/ui/assets/{vendor-query-DsWPbQdG.js → vendor-query-Dj8xYhQD.js} +1 -1
  90. package/dist/ui/assets/vendor-radix-D0s_k6Gp.js +63 -0
  91. package/dist/ui/assets/vendor-react-CPJEWbIG.js +1 -0
  92. package/dist/ui/assets/{vendor-router-gqiZ7xhx.js → vendor-router-zpB-76nT.js} +1 -1
  93. package/dist/ui/assets/volume-x-qnVxkRSM.js +1 -0
  94. package/dist/ui/assets/wifi-BA1m2dGO.js +1 -0
  95. package/dist/ui/assets/{zap-B4RaNNO5.js → zap-DT7cM7YS.js} +1 -1
  96. package/dist/ui/index.html +10 -9
  97. package/package.json +8 -9
  98. package/packages/cli/src/adapters/config.ts +1 -80
  99. package/packages/cli/src/adapters/factory.ts +0 -45
  100. package/packages/cli/src/adapters/index.ts +0 -8
  101. package/packages/cli/src/commands/doctor.ts +45 -1
  102. package/packages/cli/src/commands/gateway.ts +2 -9
  103. package/packages/cli/src/index.ts +9 -11
  104. package/packages/core/src/agent/acceptance-verifier.ts +300 -0
  105. package/packages/core/src/agent/agent-catalog.ts +384 -0
  106. package/packages/core/src/agent/agent-loop.ts +185 -28
  107. package/packages/core/src/agent/capability-search.ts +5 -5
  108. package/packages/core/src/agent/catalog-selector.ts +104 -0
  109. package/packages/core/src/agent/compaction.ts +36 -41
  110. package/packages/core/src/agent/context-compiler.ts +182 -62
  111. package/packages/core/src/agent/conversation-store.ts +56 -3
  112. package/packages/core/src/agent/curator.ts +129 -34
  113. package/packages/core/src/agent/delegation-runtime.ts +248 -0
  114. package/packages/core/src/agent/index.ts +17 -0
  115. package/packages/core/src/agent/llm-providers/hiveagents.ts +1 -1
  116. package/packages/core/src/agent/llm-providers/interface.ts +3 -3
  117. package/packages/core/src/agent/llm-providers/openai-compat-base.ts +1 -1
  118. package/packages/core/src/agent/minimal-loadout.ts +46 -0
  119. package/packages/core/src/agent/playbook-selector.ts +1 -1
  120. package/packages/core/src/agent/prompt-builder.ts +4 -0
  121. package/packages/core/src/agent/proof-packet.ts +15 -1
  122. package/packages/core/src/agent/providers/index.ts +8 -3
  123. package/packages/core/src/agent/routing-intent.ts +22 -0
  124. package/packages/core/src/agent/run-store.ts +24 -3
  125. package/packages/core/src/agent/service.ts +2 -2
  126. package/packages/core/src/agent/skill-selector.ts +12 -31
  127. package/packages/core/src/agent/tool-selector.ts +36 -35
  128. package/packages/core/src/agent/tracer.ts +5 -1
  129. package/packages/core/src/artifacts/store.ts +162 -0
  130. package/packages/core/src/canvas/canvas-manager.ts +5 -234
  131. package/packages/core/src/canvas/emitter.ts +165 -69
  132. package/packages/core/src/canvas/index.ts +0 -2
  133. package/packages/core/src/channels/base.ts +3 -1
  134. package/packages/core/src/channels/webchat.ts +4 -8
  135. package/packages/core/src/config/loader.ts +0 -22
  136. package/packages/core/src/events/agent-bus.ts +0 -31
  137. package/packages/core/src/events/narration.ts +82 -0
  138. package/packages/core/src/gateway/channel-notify.ts +34 -5
  139. package/packages/core/src/gateway/delegation-groups.ts +245 -0
  140. package/packages/core/src/gateway/delegation-notify.ts +103 -0
  141. package/packages/core/src/gateway/durable-queue.ts +33 -2
  142. package/packages/core/src/gateway/helpers/index.ts +2 -2
  143. package/packages/core/src/gateway/helpers/narration.ts +12 -7
  144. package/packages/core/src/gateway/helpers/redact.ts +1 -1
  145. package/packages/core/src/gateway/initializer.ts +15 -13
  146. package/packages/core/src/gateway/job-executors.ts +232 -101
  147. package/packages/core/src/gateway/lane-queue.ts +1 -1
  148. package/packages/core/src/gateway/notification-inbox.ts +57 -0
  149. package/packages/core/src/gateway/resolver.ts +1 -23
  150. package/packages/core/src/gateway/routes/agents.ts +91 -1
  151. package/packages/core/src/gateway/routes/auth.ts +21 -42
  152. package/packages/core/src/gateway/routes/chat.ts +6 -6
  153. package/packages/core/src/gateway/routes/cron-api.ts +0 -4
  154. package/packages/core/src/gateway/routes/mcp.ts +0 -63
  155. package/packages/core/src/gateway/routes/meeting.ts +245 -0
  156. package/packages/core/src/gateway/routes/providers.ts +1 -0
  157. package/packages/core/src/gateway/routes/setup.ts +29 -24
  158. package/packages/core/src/gateway/routes/skills.ts +2 -2
  159. package/packages/core/src/gateway/routes/system.ts +23 -5
  160. package/packages/core/src/gateway/routes/users.ts +24 -1
  161. package/packages/core/src/gateway/server.ts +153 -117
  162. package/packages/core/src/gateway/session.ts +6 -4
  163. package/packages/core/src/gateway/slash-commands.ts +7 -6
  164. package/packages/core/src/gateway/webchat-turn.ts +34 -8
  165. package/packages/core/src/index.ts +3 -0
  166. package/packages/core/src/mcp/hot-reload.ts +14 -7
  167. package/packages/core/src/mcp/singleton.ts +0 -3
  168. package/packages/core/src/mcp/tool-sync.ts +2 -2
  169. package/packages/core/src/resilience/retry.ts +1 -1
  170. package/packages/core/src/scheduler/CronScheduler.ts +3 -1
  171. package/packages/core/src/scheduler/integration.ts +1 -1
  172. package/packages/core/src/storage/bootstrap.ts +25 -5
  173. package/packages/core/src/storage/collections.ts +201 -27
  174. package/packages/core/src/storage/onboarding.ts +147 -32
  175. package/packages/core/src/storage/reconcile.ts +2 -5
  176. package/packages/core/src/storage/seed.ts +202 -38
  177. package/packages/core/src/storage/usage.ts +0 -9
  178. package/packages/core/src/storage/user-email.ts +11 -0
  179. package/packages/core/src/tool-runtime/index.ts +69 -23
  180. package/packages/core/src/tool-runtime/worker-tools.ts +4 -2
  181. package/packages/core/src/{canvas/a2ui-tools.ts → tools/a2ui/index.ts} +17 -8
  182. package/packages/core/src/tools/agents/get-available-models.ts +11 -3
  183. package/packages/core/src/tools/agents/index.ts +404 -86
  184. package/packages/core/src/tools/core/index.ts +28 -10
  185. package/packages/core/src/tools/cron/index.ts +1 -6
  186. package/packages/core/src/tools/index.ts +17 -45
  187. package/packages/core/src/tools/types.ts +1 -1
  188. package/packages/core/src/tools/web/artifact-inspect.ts +23 -0
  189. package/packages/core/src/tools/web/browser-screenshot.ts +26 -5
  190. package/packages/core/src/tools/web/index.ts +3 -0
  191. package/packages/core/src/utils/logger.ts +58 -30
  192. package/packages/core/src/utils/toon.ts +0 -20
  193. package/packages/mcp/src/manager.ts +8 -7
  194. package/packages/mcp/src/transports/sse.ts +0 -4
  195. package/packages/mcp/src/transports/websocket.ts +0 -6
  196. package/packages/skills/src/bundled/{canvas → a2ui}/a2ui_dashboard/SKILL.md +4 -4
  197. package/packages/skills/src/bundled/{canvas → a2ui}/a2ui_form/SKILL.md +4 -4
  198. package/packages/skills/src/bundled/{canvas → a2ui}/a2ui_interactive/SKILL.md +5 -5
  199. package/packages/skills/src/bundled/agents/acceptance_verification/SKILL.md +26 -0
  200. package/packages/skills/src/bundled/agents/agent_spawner/SKILL.md +24 -18
  201. package/packages/skills/src/bundled/agents/task_orchestrator/SKILL.md +47 -148
  202. package/packages/skills/src/bundled/cli/cli_pipeline/SKILL.md +9 -10
  203. package/packages/skills/src/bundled/cli/cli_safe_exec/SKILL.md +1 -1
  204. package/packages/skills/src/bundled/cli/software_engineering/SKILL.md +23 -0
  205. package/packages/skills/src/bundled/cron_manager/SKILL.md +2 -2
  206. package/packages/skills/src/bundled/cron_reminder/SKILL.md +7 -7
  207. package/packages/skills/src/bundled/filesystem/file_read_and_summarize/SKILL.md +11 -10
  208. package/packages/skills/src/bundled/filesystem/file_writer/SKILL.md +29 -35
  209. package/packages/skills/src/bundled/filesystem/workspace_file_operator/SKILL.md +22 -0
  210. package/packages/skills/src/bundled/search_knowledge/capability_discovery/SKILL.md +5 -4
  211. package/packages/skills/src/bundled-data.generated.ts +155 -720
  212. package/dist/ui/assets/AgentCreateForm-DzaIT-dA.js +0 -1
  213. package/dist/ui/assets/AgentDetailPage-DgqcJceY.js +0 -1
  214. package/dist/ui/assets/AgentNewPage-CNSpoOSA.js +0 -1
  215. package/dist/ui/assets/AgentsPage-BMUJzTD6.js +0 -10
  216. package/dist/ui/assets/ApiClientPage-Cum_a_3j.js +0 -3
  217. package/dist/ui/assets/CanvasPage-o6oCP6uq.js +0 -33
  218. package/dist/ui/assets/ChannelsPage-WrB0zwLq.js +0 -8
  219. package/dist/ui/assets/DashboardPage-BCd6kNw0.js +0 -6
  220. package/dist/ui/assets/MeetingPage-BULIAWzq.js +0 -1
  221. package/dist/ui/assets/ModelSelector-BMYOChYb.js +0 -1
  222. package/dist/ui/assets/ProvidersPage-BVN5UZrI.js +0 -1
  223. package/dist/ui/assets/SettingsPage-CYmpFfDn.js +0 -9
  224. package/dist/ui/assets/SetupPage-Dnmb1Lbv.js +0 -1
  225. package/dist/ui/assets/WebChatPage-DmmdFhIC.js +0 -16
  226. package/dist/ui/assets/accordion-CnLzKNHK.js +0 -1
  227. package/dist/ui/assets/alert-B9J6KHmt.js +0 -1
  228. package/dist/ui/assets/alert-dialog-KcYQWcJ6.js +0 -1
  229. package/dist/ui/assets/arrow-left-CBcbX5EZ.js +0 -1
  230. package/dist/ui/assets/badge-88dRb4M8.js +0 -1
  231. package/dist/ui/assets/bell-8BqRYmzf.js +0 -1
  232. package/dist/ui/assets/chevron-down-DIosfU_U.js +0 -1
  233. package/dist/ui/assets/chevron-left-D4U-5A27.js +0 -1
  234. package/dist/ui/assets/chevron-right-CR4Skrf3.js +0 -1
  235. package/dist/ui/assets/chevron-up-CI-W21Fy.js +0 -1
  236. package/dist/ui/assets/circle-check-6Ard1-2z.js +0 -1
  237. package/dist/ui/assets/dropdown-menu-DDiaHg5y.js +0 -1
  238. package/dist/ui/assets/es-4I-joeZz.js +0 -1
  239. package/dist/ui/assets/folder-open-DJBLDFjv.js +0 -1
  240. package/dist/ui/assets/format-DsLPBxvt.js +0 -1
  241. package/dist/ui/assets/gauge-B8Tj43rC.js +0 -1
  242. package/dist/ui/assets/hexagon-6L79pgVK.js +0 -1
  243. package/dist/ui/assets/index-BmwTAwOF.css +0 -2
  244. package/dist/ui/assets/index-Cyw7L0Li.js +0 -116
  245. package/dist/ui/assets/key-DyKOoQh5.js +0 -1
  246. package/dist/ui/assets/label-B_15zZlR.js +0 -1
  247. package/dist/ui/assets/loader-circle-BmBOgYze.js +0 -1
  248. package/dist/ui/assets/lock-BS6OLXPv.js +0 -1
  249. package/dist/ui/assets/play-zJpWuhrr.js +0 -1
  250. package/dist/ui/assets/plus-BZQX26Dr.js +0 -1
  251. package/dist/ui/assets/progress-D5c-Eilm.js +0 -1
  252. package/dist/ui/assets/scroll-area-CihOx0cb.js +0 -1
  253. package/dist/ui/assets/search-DzDptO9s.js +0 -1
  254. package/dist/ui/assets/select-BQCOjM2j.js +0 -1
  255. package/dist/ui/assets/slider-bcUiUfx0.js +0 -14
  256. package/dist/ui/assets/switch-BR30E4ej.js +0 -1
  257. package/dist/ui/assets/table-B3aGEaVp.js +0 -1
  258. package/dist/ui/assets/tabs-LQidMKRS.js +0 -1
  259. package/dist/ui/assets/terminal--7G943As.js +0 -1
  260. package/dist/ui/assets/useProviders-C1xVKLxB.js +0 -1
  261. package/dist/ui/assets/utils-3pnRFmFe.js +0 -1
  262. package/dist/ui/assets/vendor-charts-Bu2lyBKP.js +0 -65
  263. package/dist/ui/assets/vendor-radix-D6rA7xKY.js +0 -63
  264. package/dist/ui/assets/vendor-react-BU5iQU4f.js +0 -1
  265. package/dist/ui/assets/volume-2-BekVQl6P.js +0 -1
  266. package/packages/core/src/agent/context-guard.ts +0 -91
  267. package/packages/core/src/agent/hooks.ts +0 -166
  268. package/packages/core/src/agent/providers.ts +0 -1
  269. package/packages/core/src/auth/auth.ts +0 -111
  270. package/packages/core/src/auth/index.ts +0 -1
  271. package/packages/core/src/canvas/canvas-tools.ts +0 -448
  272. package/packages/core/src/gateway/router.ts +0 -126
  273. package/packages/core/src/scheduler/dag/AgentExecutor.ts +0 -53
  274. package/packages/core/src/scheduler/dag/DAGScheduler.ts +0 -250
  275. package/packages/core/src/scheduler/dag/EventBridge.ts +0 -122
  276. package/packages/core/src/scheduler/dag/TaskGraph.ts +0 -192
  277. package/packages/core/src/scheduler/dag/TaskNode.ts +0 -97
  278. package/packages/core/src/scheduler/dag/TaskResult.ts +0 -22
  279. package/packages/core/src/scheduler/dag/errors.ts +0 -37
  280. package/packages/core/src/scheduler/dag/index.ts +0 -26
  281. package/packages/core/src/scheduler/dag/presets/ResearchPreset.ts +0 -97
  282. package/packages/core/src/scheduler/dag/strategies/ParallelStrategy.ts +0 -21
  283. package/packages/core/src/scheduler/dag/strategies/PriorityStrategy.ts +0 -46
  284. package/packages/core/src/scheduler/index.ts +0 -22
  285. package/packages/core/src/scheduler/task-driver.ts +0 -216
  286. package/packages/core/src/tools/canvas/index.ts +0 -420
  287. package/packages/core/src/tools/meeting/index.ts +0 -336
  288. package/packages/core/src/tools/projects/index.ts +0 -348
  289. package/packages/core/src/tools/voice/index.ts +0 -104
  290. package/packages/core/src/utils/index.ts +0 -5
  291. package/packages/skills/src/bundled/agents/code_delegator/SKILL.md +0 -156
  292. package/packages/skills/src/bundled/canvas/canvas_dashboard/SKILL.md +0 -146
  293. package/packages/skills/src/bundled/canvas/canvas_interact/SKILL.md +0 -148
  294. package/packages/skills/src/bundled/canvas/canvas_report/SKILL.md +0 -146
  295. package/packages/skills/src/bundled/meeting/meeting_transcription/SKILL.md +0 -213
  296. package/packages/skills/src/bundled/voice/voice_assistant/SKILL.md +0 -174
  297. package/packages/skills/src/bundled/voice/voice_input/SKILL.md +0 -146
  298. package/packages/skills/src/bundled/voice/voice_output/SKILL.md +0 -151
@@ -0,0 +1,8 @@
1
+ import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{o as n}from"./vendor-query-Dj8xYhQD.js";import{t as r}from"./arrow-left-0EBE7nsF.js";import{t as i}from"./arrow-right-5QIaph-z.js";import{t as a}from"./calendar-Be23hQGc.js";import{t as o}from"./check-Dp6tzwax.js";import{t as s}from"./circle-alert-BDVHxmAz.js";import{t as c}from"./download-CiQqqXyz.js";import{t as l}from"./ellipsis-vertical-BybFZDk2.js";import{n as u,t as d}from"./eye-C8sKSSkg.js";import{t as f}from"./info-mpk1tsNC.js";import{t as p}from"./lock-open-Cd2aqwOd.js";import{n as m,t as ee}from"./pencil-f1nJ1xhs.js";import{t as te}from"./mail-BG0RYSkL.js";import{t as ne}from"./plus-C5BxJeOX.js";import{t as re}from"./refresh-cw-CroGQY62.js";import{t as h}from"./search-rfBcmohK.js";import{t as g}from"./send-D6whYpw-.js";import{t as _}from"./settings-BX6q3MGB.js";import{t as ie}from"./trash-2-DjQXac_0.js";import{t as ae}from"./triangle-alert-B04mgMcg.js";import{n as oe,t as se}from"./wifi-BA1m2dGO.js";import{l as ce}from"./vendor-router-zpB-76nT.js";import{B as v,C as y,F as b,G as le,K as x,M as S,S as C,T as w,_ as T,b as E,d as D,v as O,w as k,x as A,y as j}from"./index-Bejlp-R1.js";import{t as M}from"./badge-DKGZbVZJ.js";import{t as N}from"./scroll-area-CfHn94Vb.js";import{t as P}from"./slider-CmE_z1Ii.js";import{i as F,n as I,r as L,t as R}from"./tabs-CxiybXcw.js";import{c as z,i as B,r as V,s as H,t as U}from"./dialog-KOZKWbib.js";var W=x(`Camera`,[[`path`,{d:`M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z`,key:`1tc9qg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),G=x(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ue=x(`CreditCard`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`,key:`ynyp8z`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`,key:`1b3vmo`}]]),de=x(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),fe=x(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),K=x(`Heart`,[[`path`,{d:`M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z`,key:`c3ymky`}]]),pe=x(`House`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]),me=x(`Image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),he=x(`MapPin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),ge=x(`Phone`,[[`path`,{d:`M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z`,key:`foiqr5`}]]),_e=x(`Printer`,[[`path`,{d:`M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2`,key:`143wyd`}],[`path`,{d:`M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6`,key:`1itne7`}],[`rect`,{x:`6`,y:`14`,width:`12`,height:`8`,rx:`1`,key:`1ue0tg`}]]),ve=x(`Share2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),ye=x(`ShoppingCart`,[[`circle`,{cx:`8`,cy:`21`,r:`1`,key:`jimo8o`}],[`circle`,{cx:`19`,cy:`21`,r:`1`,key:`13723u`}],[`path`,{d:`M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12`,key:`9zh506`}]]),be=x(`Star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),xe=x(`Upload`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`17 8 12 3 7 8`,key:`t8dd8p`}],[`line`,{x1:`12`,x2:`12`,y1:`3`,y2:`15`,key:`widbto`}]]),q=e(t(),1),J=n(),Y={h1:`text-2xl font-black text-white`,h2:`text-xl font-bold text-white`,h3:`text-base font-bold text-white`,h4:`text-sm font-semibold text-white/90`,h5:`text-xs font-semibold text-white/80`,body:`text-sm text-white/70 leading-relaxed`,caption:`text-xs text-white/40`,label:`text-xs font-semibold text-white/50 uppercase tracking-wider`,code:`font-mono text-xs text-green-300 bg-black/40 rounded-lg p-3 leading-relaxed whitespace-pre-wrap break-all`};function Se({def:e,ctx:t}){let n=y(e.text,t.dataModel,t.scopeData),r=e.variant??e.usageHint??`body`,i=Y[r]??Y.body;if(r===`code`)return(0,J.jsx)(`pre`,{className:i,children:n});let a=n.split(/(\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`|\n)/g);return(0,J.jsx)(`p`,{className:i,style:e.weight?{flex:e.weight}:void 0,children:a.map((e,t)=>e.startsWith(`**`)&&e.endsWith(`**`)?(0,J.jsx)(`strong`,{className:`font-bold`,children:e.slice(2,-2)},t):e.startsWith(`*`)&&e.endsWith(`*`)?(0,J.jsx)(`em`,{className:`italic`,children:e.slice(1,-1)},t):e.startsWith("`")&&e.endsWith("`")?(0,J.jsx)(`code`,{className:`font-mono text-green-300 bg-black/30 px-1 rounded text-[0.9em]`,children:e.slice(1,-1)},t):e===`
2
+ `?(0,J.jsx)(`br`,{},t):e)})}function Ce(e,t,n,r){let i=[];for(let a of e)X(a,t,n,r)||i.push({message:a.message??`Validation failed: ${a.call}`});return{valid:i.length===0,errors:i}}function X(e,t,n,r){if(e.condition)return O(e.condition,t,n,r)===!0;let i=O({call:e.call,args:e.args??{}},t,n,r);return i===!0||i===`true`}function we(e,t,n,r){if(!e||e.length===0)return!1;for(let i of e)if(!X(i,t,n,r))return!0;return!1}function Te({def:e,ctx:t}){let n=e.action,r=e.variant??`primary`,i=e.disabled===!0||we(e.checks,t.dataModel,t.scopeData),a=r===`primary`?`bg-blue-600 hover:bg-blue-500 text-white font-bold`:r===`borderless`?`text-white/70 hover:text-white hover:bg-white/5`:`bg-white/5 hover:bg-white/10 text-white/70 border border-white/10`;return(0,J.jsx)(`button`,{onClick:()=>{if(i)return;let r=n?.event??n,a=r?.name;if(!a)return;let o={},s=r.context??{};for(let[e,n]of Object.entries(s))E(n)?o[e]=w(n.path,t.dataModel,t.scopeData):j(n)?o[e]=O(n,t.dataModel,t.scopeData):o[e]=n;t.onAction(a,o,e.id)},disabled:i,className:`w-full py-2.5 rounded-xl text-sm transition-all disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center gap-2 ${a}`,style:e.weight?{flex:e.weight}:void 0,children:e.child?(0,J.jsx)(Q,{...t,id:e.child}):y(e.text,t.dataModel,t.scopeData)||`Button`})}var Ee={start:`flex-start`,end:`flex-end`,center:`center`,spaceBetween:`space-between`,spaceAround:`space-around`,spaceEvenly:`space-evenly`};function De({def:e,ctx:t}){return(0,J.jsx)(`div`,{className:`flex flex-row gap-2`,style:{justifyContent:Ee[String(e.justify??e.distribution??`start`)]??`flex-start`,alignItems:(()=>{let t=e.align??e.alignment;return t===`center`?`center`:t===`end`?`flex-end`:t===`stretch`?`stretch`:`flex-start`})(),...e.weight?{flex:e.weight}:{}},children:$(e.children,t)})}var Oe={start:`flex-start`,end:`flex-end`,center:`center`,spaceBetween:`space-between`,spaceAround:`space-around`,spaceEvenly:`space-evenly`};function ke({def:e,ctx:t}){return(0,J.jsx)(`div`,{className:`flex flex-col gap-3`,style:{justifyContent:Oe[String(e.justify??e.distribution??`start`)]??`flex-start`,alignItems:(()=>{let t=e.align??e.alignment;return t===`center`?`center`:t===`end`?`flex-end`:t===`stretch`?`stretch`:`flex-start`})(),...e.weight?{flex:e.weight}:{}},children:$(e.children,t)})}function Ae({def:e,ctx:t}){return(0,J.jsx)(`div`,{className:`rounded-xl border p-4`,style:{background:`rgba(255,255,255,0.03)`,borderColor:`rgba(255,255,255,0.08)`,...e.weight?{flex:e.weight}:{}},children:e.child&&(0,J.jsx)(Q,{...t,id:e.child})})}function je({def:e,ctx:t}){let n=e.direction===`horizontal`?`flex-row`:`flex-col`;return e.children?(0,J.jsx)(`div`,{className:`flex ${n} gap-2 overflow-x-auto pb-1`,style:e.weight?{flex:e.weight}:void 0,children:$(e.children,t)}):e.child?(0,J.jsx)(Q,{...t,id:e.child}):null}function Me({def:e}){return(0,J.jsx)(`div`,{className:e.axis===`vertical`?`w-px bg-white/[0.06] self-stretch`:`h-px bg-white/[0.06] w-full`,style:e.weight?{flex:e.weight}:void 0})}var Ne={contain:`contain`,cover:`cover`,fill:`fill`,none:`none`,"scale-down":`scale-down`},Pe={icon:`w-8 h-8`,avatar:`w-12 h-12 rounded-full`,smallFeature:`w-24 h-24`,mediumFeature:`w-48 h-48`,largeFeature:`w-64 h-64`,header:`w-full h-48`};function Fe({def:e,ctx:t}){let n=y(e.url,t.dataModel,t.scopeData);if(!n)return null;let r=Ne[e.fit??`contain`]??`contain`,i=Pe[e.usageHint??``]??``,a=typeof e.alt==`string`?e.alt:``;return(0,J.jsx)(`div`,{className:`rounded-xl overflow-hidden border border-white/[0.08] ${i}`,style:e.weight?{flex:e.weight}:void 0,children:(0,J.jsx)(`img`,{src:n,alt:a,className:`w-full max-h-64 block`,style:{objectFit:r}})})}var Ie={settings:_,home:pe,search:h,mail:te,call:ge,camera:W,calendarToday:a,star:be,check:o,close:S,delete:ie,download:c,upload:xe,edit:ee,refresh:re,send:g,share:ve,shoppingCart:ye,warning:ae,info:f,error:s,favorite:K,favoriteOff:K,folder:fe,help:G,lock:m,lockOpen:p,visibility:d,visibilityOff:u,add:ne,arrowBack:r,arrowForward:i,accountCircle:b,notifications:le,moreVert:l,moreHoriz:de,locationOn:he,payment:ue,photo:me,print:_e,person:b};function Z({def:e,ctx:t}){return(0,J.jsx)(Ie[y(e.name,t.dataModel,t.scopeData)]??G,{className:`text-white/70`,style:e.weight?{flex:e.weight}:void 0})}function Le({def:e,ctx:t}){let[n,r]=(0,q.useState)(y((typeof e.value==`object`&&e.value,e.value),t.dataModel,t.scopeData)),i=y(e.label,t.dataModel,t.scopeData),a=y(e.placeholder,t.dataModel,t.scopeData),o=e.variant??e.textFieldType??`shortText`,s=o===`code`||o===`multiline_code`,c=o===`longText`||s||o===`multiline`,l=e.checks?Ce(e.checks,t.dataModel,t.scopeData):e.validationRegexp&&n?new RegExp(e.validationRegexp).test(n)?{valid:!0,errors:[]}:{valid:!1,errors:[{message:`Formato inválido`}]}:{valid:!0,errors:[]},u=n=>{if(r(n.target.value),typeof e.value==`object`&&e.value!==null&&`path`in e.value){let r=e.value.path;t.setDataModel(e=>{let t=structuredClone(e),i=r.replace(/^\//,``).split(`/`),a=t;for(let e=0;e<i.length-1;e++)a[i[e]]??(a[i[e]]={}),a=a[i[e]];return a[i[i.length-1]]=n.target.value,t})}},d=n=>{let r=e.action,i=(r?.event??r)?.name;i&&t.onAction(i,{value:n},e.id)},f=e=>{d(e.target.value)},p=e=>{e.key===`Enter`&&!c&&d(e.target.value)},m=`w-full rounded-xl border px-3 py-2.5 text-sm resize-none outline-none transition-all
3
+ bg-white/[0.04] border-white/[0.08] focus:border-blue-500/50 focus:bg-white/[0.06]
4
+ disabled:opacity-50 placeholder:text-white/20
5
+ ${s?`font-mono text-green-300 leading-relaxed`:`text-white/80 leading-relaxed`}
6
+ ${l.valid?``:`border-red-500/50`}`;return(0,J.jsxs)(`div`,{className:`space-y-1.5`,style:e.weight?{flex:e.weight}:void 0,children:[i&&(0,J.jsx)(`label`,{className:`text-xs font-semibold text-white/45 uppercase tracking-wider`,children:i}),c?(0,J.jsx)(`textarea`,{value:n,onChange:u,onBlur:f,onKeyDown:p,placeholder:a,rows:s?5:3,className:m}):(0,J.jsx)(`input`,{type:o===`obscured`?`password`:o===`number`?`number`:`text`,value:n,onChange:u,onBlur:f,onKeyDown:p,placeholder:a,className:m}),!l.valid&&l.errors.length>0&&(0,J.jsx)(`p`,{className:`text-xs text-red-400`,children:l.errors[0].message})]})}function Re({def:e,ctx:t}){let n=y(e.label,t.dataModel,t.scopeData),[r,i]=(0,q.useState)(A(e.value,t.dataModel,t.scopeData));return(0,J.jsxs)(`label`,{className:`flex items-center gap-2.5 cursor-pointer`,style:e.weight?{flex:e.weight}:void 0,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:r,onChange:n=>{if(i(n.target.checked),typeof e.value==`object`&&e.value!==null&&`path`in e.value){let r=e.value.path;t.setDataModel(e=>{let t=structuredClone(e),i=r.replace(/^\//,``).split(`/`),a=t;for(let e=0;e<i.length-1;e++)a[i[e]]??(a[i[e]]={}),a=a[i[e]];return a[i[i.length-1]]=n.target.checked,t})}},className:`w-4 h-4 rounded border-white/20 bg-white/5 text-blue-500 focus:ring-blue-500/30`}),(0,J.jsx)(`span`,{className:`text-sm text-white/70`,children:n})]})}function ze({def:e,ctx:t}){let n=e.variant===`mutuallyExclusive`?`single`:`multi`,r=e.maxAllowedSelections??(n===`single`?1:5),[i,a]=(0,q.useState)(k(e.selections??e.value,t.dataModel,t.scopeData)),o=e.options??[],s=i=>{a(a=>{let o;o=n===`single`?[i]:a.includes(i)?a.filter(e=>e!==i):a.length>=r?a:[...a,i];let s=e.selections??e.value;if(typeof s==`object`&&s&&`path`in s){let e=s.path;t.setDataModel(t=>{let n=structuredClone(t),r=e.replace(/^\//,``).split(`/`),i=n;for(let e=0;e<r.length-1;e++)i[r[e]]??(i[r[e]]={}),i=i[r[e]];return i[r[r.length-1]]=o,n})}let c=e.action,l=(c?.event??c)?.name;return l&&t.onAction(l,{selections:o,selected:o[0]??null},e.id),o})};return(0,J.jsx)(`div`,{className:`space-y-2`,style:e.weight?{flex:e.weight}:void 0,children:o.map((e,n)=>{let r=y(e.label,t.dataModel,t.scopeData),a=e.value??r,o=i.includes(a),c=String.fromCharCode(65+n);return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>s(a),className:`w-full text-left px-3 py-2.5 rounded-xl border text-sm transition-all flex items-center gap-2.5
7
+ ${o?`bg-blue-500/15 border-blue-500/50 text-blue-100`:`bg-white/[0.03] border-white/[0.08] text-white/65 hover:border-white/20 hover:bg-white/[0.06]`}`,children:[(0,J.jsx)(`span`,{className:`text-xs font-bold w-6 h-6 rounded-lg flex items-center justify-center flex-shrink-0 transition-colors
8
+ ${o?`bg-blue-500/40 text-blue-200`:`bg-white/5 text-white/40`}`,children:o?`✓`:c}),(0,J.jsx)(`span`,{className:`leading-snug`,children:r})]},n)})})}function Be({def:e,ctx:t}){let n=typeof e.min==`number`?e.min:e.minValue??0,r=typeof e.max==`number`?e.max:e.maxValue??100,i=typeof e.step==`number`?e.step:1,a=e.label,[o,s]=(0,q.useState)(C(e.value,t.dataModel,t.scopeData)),c=n=>{if(typeof e.value==`object`&&e.value!==null&&`path`in e.value){let r=e.value.path;t.setDataModel(e=>{let t=structuredClone(e),i=r.replace(/^\//,``).split(`/`),a=t;for(let e=0;e<i.length-1;e++)a[i[e]]??(a[i[e]]={}),a=a[i[e]];return a[i[i.length-1]]=n,t})}};return(0,J.jsxs)(`div`,{className:`space-y-2`,style:e.weight?{flex:e.weight}:void 0,children:[a&&(0,J.jsx)(`span`,{className:`text-xs font-semibold text-white/45 uppercase tracking-wider`,children:a}),(0,J.jsxs)(`div`,{className:`flex justify-between text-xs text-white/40`,children:[(0,J.jsx)(`span`,{children:n}),(0,J.jsx)(`span`,{className:`text-white/70 font-mono`,children:o}),(0,J.jsx)(`span`,{children:r})]}),(0,J.jsx)(P,{value:[o],min:n,max:r,step:i,onValueChange:e=>{s(e[0]),c(e[0])},onValueCommit:n=>{let r=n[0],i=e.action,a=(i?.event??i)?.name;a&&t.onAction(a,{value:r},e.id)},className:`w-full`})]})}function Ve({def:e,ctx:t}){let[n,r]=(0,q.useState)(``),i=n=>{if(r(n.target.value),typeof e.value==`object`&&e.value!==null&&`path`in e.value){let r=e.value.path;t.setDataModel(e=>{let t=structuredClone(e),i=r.replace(/^\//,``).split(`/`),a=t;for(let e=0;e<i.length-1;e++)a[i[e]]??(a[i[e]]={}),a=a[i[e]];return a[i[i.length-1]]=n.target.value,t})}},a=e.enableTime&&e.enableDate?`datetime-local`:e.enableDate?`date`:`time`;return(0,J.jsxs)(`div`,{className:`space-y-1.5`,style:e.weight?{flex:e.weight}:void 0,children:[e.label&&(0,J.jsx)(`label`,{className:`text-xs font-semibold text-white/45 uppercase tracking-wider`,children:typeof e.label==`string`?e.label:String(e.label)}),(0,J.jsx)(`input`,{type:a,value:n,onChange:i,className:`w-full rounded-xl border px-3 py-2.5 text-sm bg-white/[0.04] border-white/[0.08] focus:border-blue-500/50 focus:bg-white/[0.06] outline-none text-white/80`})]})}function He({def:e,ctx:t}){let n=Array.isArray(e.tabs)?e.tabs:e.tabItems??[];return(0,J.jsxs)(R,{defaultValue:n[0]?.title?y(n[0].title,t.dataModel,t.scopeData):``,style:e.weight?{flex:e.weight}:void 0,children:[(0,J.jsx)(L,{className:`w-full`,children:n.map((e,n)=>(0,J.jsx)(F,{value:y(e.title,t.dataModel,t.scopeData),children:y(e.title,t.dataModel,t.scopeData)},n))}),n.map((e,n)=>(0,J.jsx)(I,{value:y(e.title,t.dataModel,t.scopeData),children:(0,J.jsx)(Q,{...t,id:e.child})},n))]})}function Ue({def:e,ctx:t}){let[n,r]=(0,q.useState)(!1);return(0,J.jsxs)(U,{open:n,onOpenChange:r,children:[(e.trigger??e.entryPointChild)&&(0,J.jsx)(z,{asChild:!0,children:(0,J.jsx)(`div`,{className:`cursor-pointer`,children:(0,J.jsx)(Q,{...t,id:e.trigger??e.entryPointChild})})}),(0,J.jsxs)(V,{children:[(0,J.jsx)(H,{className:`sr-only`,children:`Interactive modal`}),(0,J.jsx)(B,{className:`sr-only`,children:`Interactive modal content generated by the agent.`}),(e.content??e.contentChild)&&(0,J.jsx)(Q,{...t,id:e.content??e.contentChild})]})]})}function We({def:e,ctx:t}){let n=y(e.url,t.dataModel,t.scopeData);return n?(0,J.jsx)(`div`,{className:`rounded-xl overflow-hidden border border-white/[0.08]`,style:e.weight?{flex:e.weight}:void 0,children:(0,J.jsx)(`video`,{src:n,controls:!0,className:`w-full max-h-96`,children:`Tu navegador no soporta video.`})}):null}function Ge({def:e,ctx:t}){let n=y(e.url,t.dataModel,t.scopeData),r=y(e.description,t.dataModel,t.scopeData);return n?(0,J.jsxs)(`div`,{className:`rounded-xl border border-white/[0.08] p-4 bg-white/[0.02]`,style:e.weight?{flex:e.weight}:void 0,children:[r&&(0,J.jsx)(`p`,{className:`text-xs text-white/40 mb-2`,children:r}),(0,J.jsx)(`audio`,{src:n,controls:!0,className:`w-full`,style:{height:40},children:`Tu navegador no soporta audio.`})]}):null}function Ke({surface:e,onAction:t,isLoading:n}){let{components:r,dataModel:i,rootId:a,theme:o}=e,[s,c]=(0,q.useState)(()=>structuredClone(i));(0,q.useEffect)(()=>{c(structuredClone(i))},[i]);let l=(0,q.useMemo)(()=>{let e=new Map;for(let t of r)e.set(t.id,t);return e},[r]),u=o?.primaryColor||`#3B82F6`,d=(0,q.useCallback)((n,r,i)=>{t&&t({name:n,surfaceId:e.surfaceId,sourceComponentId:i,timestamp:new Date().toISOString(),context:r})},[t,e.surfaceId]);return n?(0,J.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,J.jsx)(`span`,{className:`text-white/30 text-sm animate-pulse`,children:`Cargando superficie...`})}):!a||!l.has(a)?(0,J.jsx)(`div`,{className:`flex items-center justify-center py-8 text-white/20 text-sm`,children:`Sin contenido disponible`}):(0,J.jsx)(`div`,{className:`a2ui-surface`,style:{"--a2ui-primary":u},children:(0,J.jsx)(Q,{id:a,compMap:l,dataModel:s,setDataModel:c,scopeData:void 0,onAction:d})})}function Q(e){let t=e.compMap.get(e.id);if(!t)return null;let n=t.component?.replace(/[^\x00-\x7F]/g,``).trim();switch(n){case`Text`:return(0,J.jsx)(Se,{def:t,ctx:e});case`Button`:return(0,J.jsx)(Te,{def:t,ctx:e});case`Row`:return(0,J.jsx)(De,{def:t,ctx:e});case`Column`:return(0,J.jsx)(ke,{def:t,ctx:e});case`Card`:return(0,J.jsx)(Ae,{def:t,ctx:e});case`List`:return(0,J.jsx)(je,{def:t,ctx:e});case`Divider`:return(0,J.jsx)(Me,{def:t,ctx:e});case`Image`:return(0,J.jsx)(Fe,{def:t,ctx:e});case`Icon`:return(0,J.jsx)(Z,{def:t,ctx:e});case`TextField`:return(0,J.jsx)(Le,{def:t,ctx:e});case`CheckBox`:return(0,J.jsx)(Re,{def:t,ctx:e});case`ChoicePicker`:return(0,J.jsx)(ze,{def:t,ctx:e});case`Slider`:return(0,J.jsx)(Be,{def:t,ctx:e});case`DateTimeInput`:return(0,J.jsx)(Ve,{def:t,ctx:e});case`Tabs`:return(0,J.jsx)(He,{def:t,ctx:e});case`Modal`:return(0,J.jsx)(Ue,{def:t,ctx:e});case`Video`:return(0,J.jsx)(We,{def:t,ctx:e});case`AudioPlayer`:return(0,J.jsx)(Ge,{def:t,ctx:e});default:return(0,J.jsxs)(`div`,{className:`rounded-md border border-dashed border-white/10 px-3 py-2 text-xs text-white/30`,children:[`Unknown component: `,n]})}}function $(e,t){if(!e)return[];if(typeof e==`string`)return[(0,J.jsx)(Q,{...t,id:e},e)];if(Array.isArray(e))return e.map(e=>(0,J.jsx)(Q,{...t,id:e},e));if(`explicitList`in e||`array`in e)return(`explicitList`in e?e.explicitList:e.array).map(e=>(0,J.jsx)(Q,{...t,id:e},e));if(`path`in e&&`componentId`in e){let n=e,r=w(n.path,t.dataModel,t.scopeData);return Array.isArray(r)?r.map((e,r)=>{let i=typeof e==`object`&&e?e:{value:e,index:r};return(0,J.jsx)(Q,{...t,id:n.componentId,scopeData:i},`${n.componentId}_${r}`)}):[]}if(`template`in e){let n=e.template,r=w(n.dataBinding,t.dataModel,t.scopeData);return Array.isArray(r)?r.map((e,r)=>{let i=typeof e==`object`&&e?e:{value:e,index:r};return(0,J.jsx)(Q,{...t,id:n.componentId,scopeData:i},`${n.componentId}_${r}`)}):[]}return[]}function qe(){let e=T(e=>e.a2uiSurfaces),t=T(e=>e.sendA2UIAction),n=(0,q.useCallback)(e=>{t(e)},[t]),r=Array.from(e.values());return(0,J.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,style:{backgroundImage:`radial-gradient(circle, rgba(59,130,246,0.03) 1px, transparent 1px)`,backgroundSize:`40px 40px`},children:[r.length===0?(0,J.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-white/20`,children:[(0,J.jsx)(v,{className:`h-10 w-10 opacity-30`}),(0,J.jsx)(`p`,{className:`text-sm`,children:`Sin paneles interactivos activos`}),(0,J.jsx)(`p`,{className:`text-xs text-white/15`,children:`Los resultados y formularios creados por los agentes aparecerán aquí.`})]}):(0,J.jsx)(N,{className:`flex-1 p-6`,children:r.length>0&&(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:r.map(e=>(0,J.jsxs)(`div`,{className:`rounded-xl border border-blue-500/20 bg-[rgba(255,255,255,0.02)] backdrop-blur-sm p-4`,style:e.theme?.primaryColor?{borderColor:`${e.theme.primaryColor}33`}:void 0,children:[e.theme?.agentDisplayName&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 pb-3 border-b border-white/5`,children:[e.theme.iconUrl&&(0,J.jsx)(`img`,{src:e.theme.iconUrl,alt:``,className:`w-5 h-5 rounded-full`}),(0,J.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider`,style:{color:e.theme.primaryColor??`#93c5fd`},children:e.theme.agentDisplayName})]}),(0,J.jsx)(Ke,{surface:e,onAction:n})]},e.surfaceId))})}),(0,J.jsx)(`div`,{className:`border-t border-white/5 bg-white/[0.02] px-6 py-2.5`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(v,{className:`h-3 w-3 text-blue-400/50`}),(0,J.jsx)(`span`,{className:`hive-mono`,children:r.length>0?`${r.length} superficie${r.length>1?`s`:``} A2UI activa${r.length>1?`s`:``}`:`Panel interactivo · sin superficies`})]})})]})}function Je(){let{sessionId:e}=ce(),{currentUser:t}=D(),n=T(e=>e.isConnected),r=T(e=>e.markA2UISeen),i=e&&e!==`default`?e:t?.id;return(0,q.useEffect)(()=>{r()},[r]),i?(0,J.jsx)(`div`,{className:`flex h-[calc(100vh-4rem)] flex-col bg-background/50 backdrop-blur-sm`,children:(0,J.jsx)(`div`,{className:`flex-1 overflow-hidden p-4 lg:p-8`,children:(0,J.jsx)(`div`,{className:`mx-auto h-full max-w-7xl`,children:(0,J.jsxs)(`div`,{className:`hive-card flex h-full flex-col shadow-2xl`,children:[(0,J.jsxs)(`div`,{className:`flex flex-row items-center justify-between space-y-0 border-b border-white/5 bg-white/5 px-6 py-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`hive-icon-wrap hive-icon-wrap--primary`,children:(0,J.jsx)(v,{className:`h-5 w-5`})}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`hive-title-page !text-lg`,children:`Panel interactivo`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-white/40 mt-0.5`,children:[(0,J.jsx)(b,{className:`h-3 w-3`}),(0,J.jsx)(`span`,{className:`font-mono`,children:i})]})]})]}),(0,J.jsx)(M,{variant:`outline`,className:`flex items-center gap-1.5 px-3 py-1 transition-all duration-500 border ${n?`bg-emerald-500/15 text-emerald-500 border-emerald-500/20 hover:bg-emerald-500/20`:`bg-red-500/15 text-red-500 border-red-500/20 hover:bg-red-500/20`}`,children:n?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(se,{className:`h-3.5 w-3.5 animate-pulse`}),(0,J.jsx)(`span`,{className:`font-semibold uppercase tracking-wider text-[10px]`,children:`Live`})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(oe,{className:`h-3.5 w-3.5`}),(0,J.jsx)(`span`,{className:`font-semibold uppercase tracking-wider text-[10px]`,children:`Offline`})]})})]}),(0,J.jsx)(qe,{})]})})})}):(0,J.jsx)(`div`,{className:`flex h-[calc(100vh-4rem)] items-center justify-center`,children:(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,J.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Cargando sesión...`})]})})}export{Je as A2UIPage};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{o as n}from"./vendor-query-Dj8xYhQD.js";import{t as r}from"./check-Dp6tzwax.js";import{t as i}from"./circle-alert-BDVHxmAz.js";import{t as a}from"./useProviders-DSX7eVsz.js";import{t as o}from"./external-link-0iNNBvZm.js";import{n as s,r as c,t as l}from"./ModelSelector-nNOrW3te.js";import{t as u}from"./loader-circle-BhqRN2nO.js";import{t as d}from"./shield-BnGyu1xf.js";import{t as f}from"./sparkles-BcaOs_Jk.js";import{t as p}from"./utils-Dyb7SC2_.js";import{M as m,O as h,f as g,k as _,m as v,s as y,t as b}from"./index-Bejlp-R1.js";import{a as x,c as S,i as C,n as w,o as T,r as E,s as ee,t as D}from"./dialog-KOZKWbib.js";import{t as O}from"./label-k0jYxoWW.js";import{t as k}from"./textarea-rp6vsOZl.js";import{i as A,n as j,o as M,s as N,t as P}from"./select-BhbW0stK.js";import{t as F}from"./switch-DXcELPsM.js";import{a as I,i as L,n as R,r as z,t as B}from"./card-D3Nw3kh3.js";var V=e(t(),1),H=n(),U=[{value:`friendly`,label:`Amigable`},{value:`professional`,label:`Profesional`},{value:`casual`,label:`Casual`},{value:`formal`,label:`Formal`},{value:`creative`,label:`Creativo`}];function W({initialData:e,onSuccess:t,onCancel:n}){let{createAgent:W,updateAgent:G,isLoading:K,error:q}=b(),{activeProviders:te}=y(),[J,Y]=(0,V.useState)({isValidating:!1,exists:!1,accessible:!1}),[X,Z]=(0,V.useState)({name:``,description:``,tone:`professional`,provider_id:``,model_id:``,role:`coordinator`,enabled:!0,systemPrompt:``,workspace:e?.workspace||``});(0,V.useEffect)(()=>{e&&Z({...e,provider_id:e.provider_id||e.providerId||``,model_id:e.model_id||e.modelId||``})},[e]);let Q=async e=>{if(!e||e.trim()===``){Y({isValidating:!1,exists:!1,accessible:!1});return}Y({isValidating:!0,exists:!1,accessible:!1});try{let t=await g(`/api/workspace/validate`,{method:`POST`,body:{path:e}});Y({isValidating:!1,exists:t.exists,accessible:t.accessible,error:t.error,message:t.message})}catch(e){Y({isValidating:!1,exists:!1,accessible:!1,error:e.message})}},ne=async()=>{if(X.workspace)try{await g(`/api/workspace/create`,{method:`POST`,body:{path:X.workspace},showLoader:`Creando directorio...`,showSuccess:`Directorio creado exitosamente`}),await Q(X.workspace)}catch(e){v.fire(`Error`,e.message,`error`)}},re=async()=>{if(X.workspace)try{await g(`/api/workspace/open?path=${encodeURIComponent(X.workspace)}`,{method:`GET`})}catch(e){v.fire(`Error`,e.message,`error`)}},ie=async n=>{if(n.preventDefault(),!X.provider_id||!X.model_id){v.fire(`Incompleto`,`Por favor selecciona un proveedor y modelo`,`warning`);return}try{e?.id?await G(e.id,X):await W(X),t&&t()}catch(e){console.error(e)}},$=!!e?.id;return(0,H.jsxs)(B,{className:`hive-card--form group`,children:[(0,H.jsx)(`div`,{className:`hive-glow-blob--card absolute -top-24 -right-24 h-48 w-48 bg-blue-600/10 group-hover:bg-blue-600/20`,style:{borderRadius:`50%`,filter:`blur(80px)`}}),(0,H.jsx)(L,{className:`relative`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`hive-icon-wrap hive-icon-wrap--primary`,children:$?(0,H.jsx)(s,{className:`h-5 w-5`}):(0,H.jsx)(f,{className:`h-5 w-5`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(I,{className:`text-xl font-bold text-white/90`,children:$?`Configurar Nodo`:`Desplegar Nuevo Nodo`}),(0,H.jsx)(z,{className:`text-white/40`,children:$?`Ajusta los parámetros de tu agente inteligente.`:`Crea una nueva entidad inteligente para tu colmena.`})]})]}),n&&(0,H.jsx)(_,{variant:`ghost`,size:`icon`,onClick:n,className:`text-white/40 hover:text-white hover:bg-white/5`,children:(0,H.jsx)(m,{className:`h-5 w-5`})})]})}),(0,H.jsx)(R,{className:`relative space-y-6 pt-2`,children:(0,H.jsxs)(`form`,{onSubmit:ie,className:`space-y-8`,children:[(0,H.jsxs)(`div`,{className:`grid gap-6`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(O,{htmlFor:`name`,className:`hive-label--field`,children:`Nombre del Agente`}),(0,H.jsx)(h,{id:`name`,placeholder:`Ej: Analista de Mercado`,className:`hive-input`,value:X.name,onChange:e=>Z({...X,name:e.target.value}),disabled:K,required:!0})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(O,{htmlFor:`description`,className:`hive-label--field`,children:`Descripción / Rol`}),(0,H.jsx)(k,{id:`description`,placeholder:`Describe qué hace este agente y cuáles son sus objetivos...`,className:`hive-textarea`,value:X.description,onChange:e=>Z({...X,description:e.target.value}),disabled:K})]})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(O,{htmlFor:`systemPrompt`,className:`hive-label--field`,children:`System Prompt`}),(0,H.jsxs)(D,{children:[(0,H.jsx)(S,{asChild:!0,children:(0,H.jsx)(_,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 px-3 text-xs bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 border-blue-500/30 transition-colors`,children:`Modifica acá el System Prompt`})}),(0,H.jsxs)(E,{className:`sm:max-w-3xl bg-[#0a0a0c] border-white/10 text-white shadow-2xl [&>button]:text-white/50 hover:[&>button]:text-white`,children:[(0,H.jsxs)(T,{children:[(0,H.jsx)(ee,{className:`text-xl`,children:`Editar System Prompt`}),(0,H.jsx)(C,{className:`text-sm text-white/50`,children:`El prompt base de comportamiento del agente. Se recomienda formato Markdown.`})]}),(0,H.jsx)(`div`,{className:`py-2`,children:(0,H.jsx)(k,{value:X.systemPrompt||``,onChange:e=>Z({...X,systemPrompt:e.target.value}),className:`min-h-[400px] font-mono text-sm bg-black/40 border-white/10 text-white/90 focus-visible:ring-blue-500/50 resize-y`,placeholder:`Escribe el system prompt detallado aquí...`,disabled:K})}),(0,H.jsx)(x,{children:(0,H.jsx)(w,{asChild:!0,children:(0,H.jsx)(_,{type:`button`,className:`bg-blue-600 hover:bg-blue-500 text-white shadow-[0_0_15px_rgba(37,99,235,0.3)]`,children:`Guardar Cambios`})})})]})]})]}),X.systemPrompt?(0,H.jsxs)(`p`,{className:`text-xs text-white/40 line-clamp-1 italic border border-white/5 bg-white/[0.02] p-2 rounded-md`,children:[`"`,X.systemPrompt,`"`]}):(0,H.jsx)(`p`,{className:`text-xs text-white/30 italic`,children:`Sin system prompt configurado...`})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,H.jsx)(c,{className:`h-4 w-4 text-emerald-400`}),(0,H.jsx)(`h3`,{className:`hive-title-section`,children:`Workspace Directory`})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(O,{htmlFor:`workspace`,className:`hive-label--field`,children:`Directorio de Trabajo del Agente`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(h,{id:`workspace`,placeholder:`Ej: /home/user/proyectos, D:\\Work, /Volumes/USB`,className:`hive-input flex-1 font-mono text-sm`,value:X.workspace,onChange:e=>{Z({...X,workspace:e.target.value}),Q(e.target.value)},disabled:K}),X.workspace&&J.exists&&J.accessible&&(0,H.jsx)(_,{type:`button`,variant:`outline`,size:`icon`,onClick:re,className:`shrink-0 border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10`,title:`Abrir en el explorador`,children:(0,H.jsx)(o,{className:`h-4 w-4`})})]}),(0,H.jsx)(`p`,{className:`text-xs text-white/40 leading-relaxed`,children:`Directorio donde el agente creará archivos, carpetas y ejecutará comandos. Puede ser cualquier ubicación en tu sistema (disco duro, USB, red, etc.).`}),X.workspace&&X.workspace.trim()!==``&&(0,H.jsxs)(`div`,{className:p(`flex items-center gap-2 text-xs p-2.5 rounded-lg border backdrop-blur-md transition-all`,J.isValidating&&`bg-blue-500/10 border-blue-500/20 text-blue-400`,!J.isValidating&&J.exists&&J.accessible&&`bg-emerald-500/10 border-emerald-500/20 text-emerald-400`,!J.isValidating&&J.exists&&!J.accessible&&`bg-amber-500/10 border-amber-500/20 text-amber-400`,!J.isValidating&&!J.exists&&`bg-purple-500/10 border-purple-500/20 text-purple-400`),children:[J.isValidating&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u,{className:`h-3.5 w-3.5 animate-spin`}),(0,H.jsx)(`span`,{children:`Validando directorio...`})]}),!J.isValidating&&J.exists&&J.accessible&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(r,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:J.message||`Directorio válido y accesible`})]}),!J.isValidating&&J.exists&&!J.accessible&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(i,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:J.message||`El directorio existe pero no tiene permisos de lectura/escritura`})]}),!J.isValidating&&!J.exists&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(c,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:J.message||`El directorio no existe`}),!J.error&&(0,H.jsx)(_,{type:`button`,variant:`outline`,size:`sm`,onClick:ne,className:`ml-auto h-6 px-2 text-xs bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 border-purple-500/30`,children:`Crear directorio`})]})]})]})]}),(0,H.jsx)(`div`,{className:`hive-card-divider`}),(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,H.jsx)(a,{className:`h-4 w-4 text-blue-400`}),(0,H.jsx)(`h3`,{className:`hive-title-section`,children:`Motor de Inteligencia`})]}),(0,H.jsx)(l,{selectedProviderId:X.provider_id||void 0,selectedModelId:X.model_id||void 0,onProviderChange:e=>Z({...X,provider_id:e,model_id:``}),onModelChange:e=>Z({...X,model_id:e}),disabled:K,typeFilter:`llm`})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(O,{htmlFor:`tone`,className:`hive-label--field`,children:`Tono de Voz`}),(0,H.jsxs)(P,{value:X.tone,onValueChange:e=>Z({...X,tone:e}),disabled:K,children:[(0,H.jsx)(M,{className:`hive-select-trigger`,children:(0,H.jsx)(N,{placeholder:`Selecciona un tono`})}),(0,H.jsx)(j,{className:`hive-select-content`,children:U.map(e=>(0,H.jsx)(A,{value:e.value,className:`hive-select-item`,children:e.label},e.value))})]})]}),(0,H.jsxs)(`div`,{className:`hive-toggle-panel`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(d,{className:`h-3.5 w-3.5 text-purple-400`}),(0,H.jsx)(O,{htmlFor:`role`,className:`text-xs font-medium text-white/70`,children:`Rol`})]}),(0,H.jsxs)(P,{value:X.role,onValueChange:e=>Z({...X,role:e}),disabled:K,children:[(0,H.jsx)(M,{className:`w-[120px] bg-white/5 border-white/10 text-white`,children:(0,H.jsx)(N,{})}),(0,H.jsxs)(j,{className:`bg-zinc-900 border-white/10`,children:[(0,H.jsx)(A,{value:`coordinator`,children:`Coordinador`}),(0,H.jsx)(A,{value:`worker`,children:`Worker`})]})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`h-2 w-2 rounded-full ${X.enabled?`bg-blue-400`:`bg-zinc-600`}`}),(0,H.jsx)(O,{htmlFor:`enabled`,className:`text-xs font-medium text-white/70`,children:`Habilitado`})]}),(0,H.jsx)(F,{id:`enabled`,checked:X.enabled,onCheckedChange:e=>Z({...X,enabled:e}),disabled:K})]})]})]}),q&&(0,H.jsx)(`div`,{className:`hive-form-error`,children:q}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 pt-4`,children:[n&&(0,H.jsx)(_,{type:`button`,variant:`outline`,onClick:n,disabled:K,className:`hive-btn--form-cancel`,children:`Cancelar`}),(0,H.jsx)(_,{type:`submit`,disabled:K,className:`hive-btn--form-submit`,children:K?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u,{className:`mr-2 h-4 w-4 animate-spin`}),`Procesando...`]}):(0,H.jsx)(H.Fragment,{children:$?`Actualizar Agente`:`Desplegar Agente`})})]})]})})]})}export{W as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{o as n}from"./vendor-query-Dj8xYhQD.js";import{t as r}from"./activity-CQuPevhB.js";import{t as i}from"./calendar-Be23hQGc.js";import{t as a}from"./check-Dp6tzwax.js";import{t as o}from"./chevron-left-C6itJXh3.js";import{t as s}from"./circle-alert-BDVHxmAz.js";import{t as c}from"./circle-check-BJWNbLuF.js";import{n as l,t as u}from"./earth-DCvN7ynm.js";import{t as d}from"./useProviders-DSX7eVsz.js";import{t as f}from"./external-link-0iNNBvZm.js";import{n as p,r as m,t as h}from"./ModelSelector-nNOrW3te.js";import{t as g}from"./loader-circle-BhqRN2nO.js";import{a as _,i as v,o as y,r as b,s as x}from"./agentCapabilities-CDC6y91E.js";import{t as ee}from"./shield-BnGyu1xf.js";import{t as S}from"./sparkles-BcaOs_Jk.js";import{t as C}from"./terminal-Bjfu-TkS.js";import{t as te}from"./zap-DT7cM7YS.js";import{t as ne}from"./utils-Dyb7SC2_.js";import{c as re,l as ie}from"./vendor-router-zpB-76nT.js";import{F as ae,H as oe,K as w,N as T,O as E,W as se,c as ce,f as D,h as O,k,l as le,o as A,p as j,s as M,t as N}from"./index-Bejlp-R1.js";import{t as ue}from"./badge-DKGZbVZJ.js";import{a as de,c as P,i as F,n as I,o as L,r as R,s as z,t as B}from"./dialog-KOZKWbib.js";import{t as V}from"./label-k0jYxoWW.js";import{t as H}from"./textarea-rp6vsOZl.js";import{i as U,n as fe,o as pe,s as me,t as he}from"./select-BhbW0stK.js";import{t as ge}from"./switch-DXcELPsM.js";var W=w(`BookOpenCheck`,[[`path`,{d:`M12 21V7`,key:`gj6g52`}],[`path`,{d:`m16 12 2 2 4-4`,key:`mdajum`}],[`path`,{d:`M22 6V4a1 1 0 0 0-1-1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4H3a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h6a3 3 0 0 1 3 3 3 3 0 0 1 3-3h6a1 1 0 0 0 1-1v-1.3`,key:`8arnkb`}]]),_e=w(`CalendarClock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),G=w(`FileStack`,[[`path`,{d:`M21 7h-3a2 2 0 0 1-2-2V2`,key:`9rb54x`}],[`path`,{d:`M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z`,key:`1059l0`}],[`path`,{d:`M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15`,key:`16874u`}],[`path`,{d:`M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11`,key:`k2ox98`}]]),ve=w(`Fingerprint`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),ye=w(`LayoutGrid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),be=w(`PackageOpen`,[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]),K=e(t(),1),q=n();function J({icon:e,...t}){return(0,q.jsx)(e,{...t})}function xe({agentId:e}){let{agents:t,updateAgent:n,fetchAgents:i}=N(),{fetchProviders:o}=M(),{fetchModels:c}=A();(0,K.useEffect)(()=>{i(),o(),c()},[i,o,c]);let l=t.find(t=>t.id===e),[u,d]=(0,K.useState)({name:``,description:``,provider_id:``,model_id:``,tone:``,role:`coordinator`,enabled:!0,headers:``,systemPrompt:``,workspace:``}),[_,v]=(0,K.useState)({isValidating:!1,exists:!1,accessible:!1});(0,K.useEffect)(()=>{l&&(d({name:l.name||``,description:l.description||``,provider_id:l.provider_id||l.providerId||``,model_id:l.model_id||l.modelId||``,tone:l.tone||``,role:l.role||`coordinator`,enabled:!!l.enabled,headers:``,systemPrompt:l.systemPrompt||``,workspace:l.workspace||``}),l.workspace&&y(l.workspace))},[l]);let y=async e=>{if(!e||e.trim()===``){v({isValidating:!1,exists:!1,accessible:!1});return}v({isValidating:!0,exists:!1,accessible:!1});try{let t=await D(`/api/workspace/validate`,{method:`POST`,body:{path:e}});v({isValidating:!1,exists:t.exists,accessible:t.accessible,error:t.error,message:t.message})}catch(e){v({isValidating:!1,exists:!1,accessible:!1,error:e.message})}};return l?(0,q.jsx)(`div`,{className:`space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500`,children:(0,q.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-8`,children:[(0,q.jsxs)(`div`,{className:`lg:col-span-1 space-y-6`,children:[(0,q.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`p-2 rounded-xl bg-blue-500/10 border border-blue-500/20`,children:(0,q.jsx)(J,{icon:ae,className:`h-4 w-4 text-blue-400`})}),(0,q.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Identidad Base`})]}),(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(V,{htmlFor:`name`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Nombre Público`}),(0,q.jsx)(E,{id:`name`,value:u.name,onChange:e=>d(t=>({...t,name:e.target.value})),className:`bg-white/5 border-white/10 focus:border-blue-500/50 rounded-xl h-11`,placeholder:`Nombre del nodo`})]}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(V,{htmlFor:`tone`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Tono Cognitivo`}),(0,q.jsx)(E,{id:`tone`,value:u.tone,onChange:e=>d(t=>({...t,tone:e.target.value})),className:`bg-white/5 border-white/10 focus:border-blue-500/50 rounded-xl h-11`,placeholder:`Ej: Analítico, Conciso...`})]})]})]}),(0,q.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`p-2 rounded-xl bg-purple-500/10 border border-purple-500/20`,children:(0,q.jsx)(J,{icon:ee,className:`h-4 w-4 text-purple-400`})}),(0,q.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Permisos de Red`})]}),(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-2xl bg-white/5 hover:bg-white/10 transition-colors`,children:[(0,q.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,q.jsx)(V,{className:`text-sm font-semibold`,children:`Rol`}),(0,q.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Coordinador o Worker`})]}),(0,q.jsxs)(he,{value:u.role,onValueChange:e=>d(t=>({...t,role:e})),children:[(0,q.jsx)(pe,{className:`w-[120px] bg-white/5 border-white/10 text-white`,children:(0,q.jsx)(me,{})}),(0,q.jsxs)(fe,{className:`bg-zinc-900 border-white/10`,children:[(0,q.jsx)(U,{value:`coordinator`,children:`Coordinador`}),(0,q.jsx)(U,{value:`worker`,children:`Worker`})]})]})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-2xl bg-white/5 hover:bg-white/10 transition-colors`,children:[(0,q.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,q.jsx)(V,{className:`text-sm font-semibold`,children:`Nodo Activo`}),(0,q.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Disponible para la colmena`})]}),(0,q.jsx)(ge,{checked:u.enabled,onCheckedChange:e=>d(t=>({...t,enabled:e}))})]})]})]}),(0,q.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`p-2 rounded-xl bg-emerald-500/10 border border-emerald-500/20`,children:(0,q.jsx)(J,{icon:m,className:`h-4 w-4 text-emerald-400`})}),(0,q.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Workspace Directory`})]}),(0,q.jsx)(`div`,{className:`space-y-4`,children:(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(V,{htmlFor:`workspace`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Directorio de Trabajo`}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(E,{id:`workspace`,value:u.workspace,onChange:e=>{d(t=>({...t,workspace:e.target.value})),y(e.target.value)},className:`bg-white/5 border-white/10 focus:border-emerald-500/50 rounded-xl h-11 font-mono text-sm flex-1`,placeholder:`Ej: /home/user/proyectos, D:\\Work`}),u.workspace&&_.exists&&_.accessible&&(0,q.jsx)(k,{type:`button`,variant:`outline`,size:`icon`,onClick:async()=>{if(u.workspace)try{await D(`/api/workspace/open?path=${encodeURIComponent(u.workspace)}`,{method:`GET`})}catch(e){j.fire({icon:`error`,title:e.message})}},className:`shrink-0 border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10 h-11 w-11`,title:`Abrir en el explorador`,children:(0,q.jsx)(f,{className:`h-4 w-4`})})]}),(0,q.jsx)(`p`,{className:`text-xs text-white/40 leading-relaxed`,children:`Directorio donde el agente operará. Puede ser cualquier ubicación (disco, USB, red).`}),u.workspace&&u.workspace.trim()!==``&&(0,q.jsxs)(`div`,{className:ne(`flex items-center gap-2 text-xs p-2.5 rounded-lg border backdrop-blur-md transition-all`,_.isValidating&&`bg-blue-500/10 border-blue-500/20 text-blue-400`,!_.isValidating&&_.exists&&_.accessible&&`bg-emerald-500/10 border-emerald-500/20 text-emerald-400`,!_.isValidating&&_.exists&&!_.accessible&&`bg-amber-500/10 border-amber-500/20 text-amber-400`,!_.isValidating&&!_.exists&&`bg-purple-500/10 border-purple-500/20 text-purple-400`),children:[_.isValidating&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(g,{className:`h-3.5 w-3.5 animate-spin`}),(0,q.jsx)(`span`,{children:`Validando directorio...`})]}),!_.isValidating&&_.exists&&_.accessible&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(a,{className:`h-3.5 w-3.5`}),(0,q.jsx)(`span`,{children:_.message||`Directorio válido y accesible`})]}),!_.isValidating&&_.exists&&!_.accessible&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(s,{className:`h-3.5 w-3.5`}),(0,q.jsx)(`span`,{children:_.message||`Sin permisos de lectura/escritura`})]}),!_.isValidating&&!_.exists&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(m,{className:`h-3.5 w-3.5`}),(0,q.jsx)(`span`,{children:_.message||`El directorio no existe`}),!_.error&&(0,q.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,onClick:async()=>{if(u.workspace)try{await D(`/api/workspace/create`,{method:`POST`,body:{path:u.workspace},showLoader:`Creando directorio...`,showSuccess:`Directorio creado exitosamente`}),await y(u.workspace)}catch(e){j.fire({icon:`error`,title:e.message})}},className:`ml-auto h-6 px-2 text-xs bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 border-purple-500/30`,children:`Crear`})]})]})]})})]})]}),(0,q.jsx)(`div`,{className:`lg:col-span-2 space-y-6`,children:(0,q.jsxs)(`div`,{className:`p-8 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-8`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`p-2 rounded-xl bg-amber-500/10 border border-amber-500/20`,children:(0,q.jsx)(J,{icon:S,className:`h-4 w-4 text-amber-400`})}),(0,q.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Configuración Cognitiva`})]}),(0,q.jsxs)(k,{onClick:async()=>{O.show(`Sincronizando configuración del agente...`);try{await n(e,{...u,role:u.role,enabled:+!!u.enabled,workspace:u.workspace||null}),j.fire({icon:`success`,title:`Cambios sincronizados correctamente`})}catch(e){j.fire({icon:`error`,title:e instanceof Error?e.message:`Error al sincronizar cambios`})}finally{O.hide()}},className:`bg-blue-600 hover:bg-blue-500 text-white font-bold rounded-xl px-6 shadow-[0_4px_15px_rgba(37,99,235,0.3)] transition-all active:scale-95 gap-2`,children:[(0,q.jsx)(J,{icon:p,className:`h-4 w-4`}),`Sincronizar Cambios`]})]}),(0,q.jsxs)(`div`,{className:`space-y-6`,children:[(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(V,{htmlFor:`description`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Directiva de Misión (Descripción)`}),(0,q.jsx)(H,{id:`description`,value:u.description,onChange:e=>d(t=>({...t,description:e.target.value})),className:`bg-white/5 border-white/10 focus:border-blue-500/50 rounded-2xl min-h-[80px] resize-none`,placeholder:`Define el propósito general de este nodo...`})]}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between pl-1`,children:[(0,q.jsx)(V,{className:`text-xs text-white/40 uppercase tracking-widest`,children:`System Prompt (Markdown)`}),(0,q.jsxs)(B,{children:[(0,q.jsx)(P,{asChild:!0,children:(0,q.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 px-3 text-xs bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 border-blue-500/30 transition-colors`,children:`Modifica acá el System Prompt`})}),(0,q.jsxs)(R,{className:`sm:max-w-3xl bg-[#0a0a0c] border-white/10 text-white shadow-2xl [&>button]:text-white/50 hover:[&>button]:text-white`,children:[(0,q.jsxs)(L,{children:[(0,q.jsx)(z,{className:`text-xl`,children:`Editar System Prompt`}),(0,q.jsx)(F,{className:`text-sm text-white/50`,children:`El comportamiento principal del agente. Se recomienda usar Markdown.`})]}),(0,q.jsx)(`div`,{className:`py-2`,children:(0,q.jsx)(H,{value:u.systemPrompt,onChange:e=>d(t=>({...t,systemPrompt:e.target.value})),className:`min-h-[400px] font-mono text-sm bg-black/40 border-white/10 text-white/90 focus-visible:ring-blue-500/50 resize-y`,placeholder:`Escribe el system prompt detallado aquí...`})}),(0,q.jsx)(de,{children:(0,q.jsx)(I,{asChild:!0,children:(0,q.jsx)(k,{type:`button`,className:`bg-blue-600 hover:bg-blue-500 text-white shadow-[0_0_15px_rgba(37,99,235,0.3)]`,children:`Listo`})})})]})]})]}),u.systemPrompt?(0,q.jsx)(`div`,{className:`bg-white/[0.02] border border-white/5 rounded-2xl p-4 max-h-[120px] overflow-y-auto custom-scrollbar`,children:(0,q.jsx)(`p`,{className:`text-xs text-white/60 font-mono whitespace-pre-wrap italic`,children:u.systemPrompt})}):(0,q.jsx)(`div`,{className:`bg-white/[0.02] border border-white/5 rounded-2xl p-4`,children:(0,q.jsx)(`p`,{className:`text-xs text-white/30 italic`,children:`Sin system prompt configurado...`})})]}),(0,q.jsx)(h,{selectedProviderId:u.provider_id||void 0,selectedModelId:u.model_id||void 0,onProviderChange:e=>d(t=>({...t,provider_id:e,model_id:``})),onModelChange:e=>d(t=>({...t,model_id:e})),typeFilter:`llm`})]}),(0,q.jsxs)(`div`,{className:`mt-8 p-4 rounded-2xl bg-white/[0.03] border border-white/5 flex items-start gap-4 italic`,children:[(0,q.jsx)(J,{icon:oe,className:`h-5 w-5 text-white/20 mt-0.5`}),(0,q.jsx)(`p`,{className:`text-[11px] text-white/30 leading-relaxed`,children:`Las credenciales de acceso y llaves de cifrado para los headers personalizados se gestionan en una capa segura y no son visibles en texto plano para mantener la integridad de la red.`})]})]})})]})}):(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center p-12 text-center space-y-4 rounded-3xl border border-dashed border-white/10 bg-white/5`,children:[(0,q.jsx)(J,{icon:r,className:`h-12 w-12 text-white/10 animate-pulse`}),(0,q.jsx)(`p`,{className:`text-white/40 font-medium`,children:`Buscando nodo en la colmena...`})]})}function Se({agent:e}){let{providers:t}=M(),{models:n}=A(),a=e.role===`coordinator`,o=e.provider_id||e.providerId,s=e.model_id||e.modelId,c=e.created_at||e.createdAt,l=c?_(typeof c==`string`?new Date(c):new Date(c*1e3),`PPP`,{locale:v}):`Fecha desconocida`,u=t.find(e=>e.id===o)?.name||o,f=n.find(e=>e.id===s)?.name||s;return(0,q.jsxs)(`div`,{className:`hive-card--internal group ${e.enabled?`hive-card--internal-active`:`hive-card--internal-disabled`}`,children:[e.enabled&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`absolute -top-24 -right-24 h-64 w-64 bg-blue-600/10 rounded-full blur-[100px] pointer-events-none group-hover:bg-blue-600/20 transition-all duration-700`}),(0,q.jsx)(`div`,{className:`absolute -bottom-24 -left-24 h-64 w-64 bg-purple-600/10 rounded-full blur-[100px] pointer-events-none group-hover:bg-purple-600/20 transition-all duration-700`})]}),(0,q.jsxs)(`div`,{className:`relative flex flex-col md:flex-row gap-8 items-start justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex-1 space-y-6`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`hive-icon-wrap--internal ${e.enabled?`hive-icon-wrap--internal-active`:`hive-icon-wrap--internal-disabled`}`,children:(0,q.jsx)(ve,{className:`h-6 w-6 ${e.enabled?`text-blue-400`:`text-white/20`}`})}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,q.jsx)(`span`,{className:`hive-page-header__label ${!e.enabled&&`text-white/20`}`,children:`Identidad de Nodo`}),a&&(0,q.jsx)(ue,{className:`hive-tag--coordinator ${!e.enabled&&`bg-white/5 text-white/20 border-white/10`}`,children:`Coordinador`})]}),(0,q.jsx)(`h1`,{className:`text-4xl font-black tracking-tighter ${e.enabled?`text-white`:`text-white/40`}`,children:e.name})]})]}),(0,q.jsxs)(`p`,{className:`text-lg leading-relaxed max-w-2xl font-light italic ${e.enabled?`text-white/60`:`text-white/20`}`,children:[`"`,e.description||`Este agente no tiene una descripción definida aún.`,`"`]})]}),(0,q.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4`,children:[(0,q.jsx)(Y,{icon:d,label:`Infraestructura`,value:u,subValue:f,color:e.enabled?`text-blue-400`:`text-white/20`,enabled:e.enabled}),(0,q.jsx)(Y,{icon:te,label:`Personalidad`,value:e.tone||`Neutral`,color:e.enabled?`text-purple-400`:`text-white/20`,enabled:e.enabled}),(0,q.jsx)(Y,{icon:i,label:`Desplegado el`,value:l,color:e.enabled?`text-emerald-400`:`text-white/20`,enabled:e.enabled})]})]}),(0,q.jsxs)(`div`,{className:`flex flex-col items-center md:items-end gap-6 min-w-[200px]`,children:[(0,q.jsxs)(`div`,{className:`text-center md:text-right space-y-2`,children:[(0,q.jsx)(`span`,{className:`hive-label block`,children:`Estado Operativo`}),(0,q.jsx)(y,{status:e.enabled?e.status:`hibernated`,className:`px-6 py-2 text-sm border-2`})]}),(0,q.jsxs)(`div`,{className:`hive-network-panel md:w-auto`,children:[(0,q.jsxs)(`div`,{className:`flex-1`,children:[(0,q.jsx)(`p`,{className:`hive-label mb-1`,children:`Carga de Red`}),(0,q.jsx)(`div`,{className:`hive-network-track`,children:e.enabled&&(0,q.jsx)(`div`,{className:`hive-network-fill`})})]}),(0,q.jsx)(r,{className:`h-5 w-5 ${e.enabled?`text-blue-400 animate-pulse`:`text-white/10`}`})]})]})]}),(0,q.jsx)(`div`,{className:`hive-strip--bottom ${!e.enabled&&`opacity-20`}`}),(0,q.jsxs)(`div`,{className:`absolute top-4 right-8 hive-mono hidden md:block`,children:[`NODE_UID: `,e.id]})]})}function Y({icon:e,label:t,value:n,subValue:r,color:i,enabled:a}){return(0,q.jsxs)(`div`,{className:`hive-info-card ${a?`hive-info-card--active`:`hive-info-card--disabled`}`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,q.jsx)(e,{className:`h-3.5 w-3.5 ${i}`}),(0,q.jsx)(`span`,{className:`hive-info-card__label`,children:t})]}),(0,q.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,q.jsx)(`p`,{className:`hive-info-card__value ${a?`text-white/80 group-hover/item:text-white`:`text-white/20`}`,children:n}),r&&(0,q.jsx)(`p`,{className:`hive-info-card__sub ${a?`text-white/40`:`text-white/10`}`,children:r})]})]})}var Ce={filesystem:`Archivos`,web:`Web`,cron:`Automatización`,cli:`Terminal`,agents:`Agentes`,canvas:`Canvas`,office:`Office`,mcp:`MCP`,core:`Sistema`};function X(e){return e.startsWith(`fs_`)?`filesystem`:e.startsWith(`browser_`)||e.startsWith(`web_`)||e===`search_knowledge`?`web`:e.startsWith(`cron`)?`cron`:e.startsWith(`office_`)?`office`:e.startsWith(`mcp`)||e.includes(`_mcp`)?`mcp`:e.startsWith(`canvas_`)||e.startsWith(`a2ui_`)?`canvas`:e.startsWith(`cli_`)?`cli`:e.includes(`agent`)||e.includes(`task_`)||e.includes(`acceptance`)?`agents`:`core`}function Z(e){return e.split(`_`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function we({agent:e}){let{tools:t,isLoading:n,fetchTools:r}=le(),{skills:i,isLoading:a,fetchSkills:o}=ce();(0,K.useEffect)(()=>{t.length===0&&r(),i.length===0&&o()},[o,r,i.length,t.length]);let s=(0,K.useMemo)(()=>b(e.toolsJson),[e.toolsJson]),l=(0,K.useMemo)(()=>b(e.skillsJson),[e.skillsJson]),u=(0,K.useMemo)(()=>e.role===`coordinator`?e.minimalTools??[]:[],[e.minimalTools,e.role]),d=(0,K.useMemo)(()=>e.role===`coordinator`?e.minimalSkills??[]:[],[e.minimalSkills,e.role]),f=(0,K.useMemo)(()=>{let e=new Map;return u.forEach(t=>e.set(t,{id:t,source:`base`})),s.forEach(t=>{let n=e.get(t.id);e.set(t.id,{...t,source:n?.source??`assigned`})}),Array.from(e.values()).map(e=>{let n=t.find(t=>t.id===e.id);return{id:e.id,name:n?.name||e.suppliedName||Z(e.id),description:n?.description||`Capacidad disponible en el loadout operativo de este agente.`,category:n?.category||X(e.id),available:n?n.enabled&&n.active!==!1:!0,source:e.source}})},[u,s,t]),p=(0,K.useMemo)(()=>{let e=new Map;return d.forEach(t=>e.set(t.id,{id:t.id,suppliedName:t.name,source:`base`})),l.forEach(t=>{let n=e.get(t.id);e.set(t.id,{...t,source:n?.source??`assigned`})}),Array.from(e.values()).map(e=>{let t=i.find(t=>t.id===e.id),n=d.find(t=>t.id===e.id);return{id:e.id,name:t?.name||n?.name||e.suppliedName||Z(e.id),description:t?.description||n?.description||`Conocimiento operativo incluido en el contexto de este agente.`,category:t?.category||n?.category||`core`,source:e.source}})},[d,l,i]),m=new Set(f.map(e=>e.category)).size,h=e.mcpServers??(e.mcpServerIds??[]).map(e=>({id:e,name:e,status:`unknown`,enabled:!0,toolsCount:0})),_=n&&t.length===0||a&&i.length===0;return(0,q.jsxs)(`section`,{className:`mb-8 overflow-hidden rounded-2xl border border-white/[0.08] bg-[#0b0e14]/75`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-4 border-b border-white/[0.07] px-5 py-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg border border-emerald-500/20 bg-emerald-500/10`,children:(0,q.jsx)(T,{className:`h-4 w-4 text-emerald-400`})}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h2`,{className:`text-sm font-black uppercase tracking-[0.12em] text-white/85`,children:`Loadout operativo`}),(0,q.jsx)(`p`,{className:`mt-0.5 text-[11px] text-white/35`,children:e.role===`coordinator`?`Capacidades mínimas del coordinador y asignaciones adicionales`:`Tools y skills asignadas para ejecutar tareas`})]})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,q.jsx)($,{value:f.length,label:`tools`,color:`text-emerald-400`}),(0,q.jsx)(`div`,{className:`h-7 w-px bg-white/[0.08]`}),(0,q.jsx)($,{value:p.length,label:`skills`,color:`text-amber-400`}),h.length>0&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`h-7 w-px bg-white/[0.08]`}),(0,q.jsx)($,{value:h.length,label:`MCP`,color:`text-violet-400`})]}),(0,q.jsx)(`div`,{className:`hidden h-7 w-px bg-white/[0.08] sm:block`}),(0,q.jsx)(`div`,{className:`hidden sm:block`,children:(0,q.jsx)($,{value:m,label:`categorías`,color:`text-blue-400`})})]})]}),_&&f.length===0&&p.length===0&&h.length===0?(0,q.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-14 text-xs text-white/35`,children:[(0,q.jsx)(g,{className:`h-4 w-4 animate-spin text-emerald-400`}),`Sincronizando loadout…`]}):f.length===0&&p.length===0&&h.length===0?(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center px-5 py-14 text-center`,children:[(0,q.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-xl border border-dashed border-white/10 bg-white/[0.025]`,children:(0,q.jsx)(be,{className:`h-5 w-5 text-white/20`})}),(0,q.jsx)(`p`,{className:`mt-3 text-sm font-semibold text-white/60`,children:`Este agente no tiene capacidades asignadas`}),(0,q.jsx)(`p`,{className:`mt-1 text-xs text-white/30`,children:`Su loadout operativo está vacío.`})]}):(0,q.jsxs)(q.Fragment,{children:[f.length>0&&(0,q.jsxs)(`div`,{className:`p-4`,children:[(0,q.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,q.jsx)(T,{className:`h-3.5 w-3.5 text-emerald-400`}),(0,q.jsx)(`h3`,{className:`text-[10px] font-black uppercase tracking-[0.16em] text-white/50`,children:`Tools disponibles`})]}),(0,q.jsx)(`div`,{className:`grid gap-2.5 sm:grid-cols-2 xl:grid-cols-3`,children:f.map(e=>(0,q.jsxs)(`article`,{className:`group rounded-xl border border-white/[0.07] bg-black/20 p-3.5 transition-colors hover:border-emerald-500/20 hover:bg-emerald-500/[0.025]`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-white/[0.07] bg-white/[0.035]`,children:(0,q.jsx)(Te(e.category),{className:`h-3.5 w-3.5 text-emerald-400/80`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,q.jsx)(`h4`,{className:`truncate text-xs font-bold text-white/80`,title:e.name,children:e.name}),(0,q.jsx)(`span`,{title:e.available?`Disponible`:`No disponible`,children:(0,q.jsx)(c,{className:`h-3.5 w-3.5 shrink-0 ${e.available?`text-emerald-400`:`text-white/15`}`})})]}),(0,q.jsx)(`p`,{className:`mt-1 line-clamp-2 min-h-8 text-[10px] leading-4 text-white/30`,children:e.description})]})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-white/[0.05] pt-2`,children:[(0,q.jsx)(`span`,{className:`text-[8px] font-bold uppercase tracking-[0.14em] text-emerald-400/65`,children:Ce[e.category]||e.category}),(0,q.jsx)(Q,{source:e.source})]})]},e.id))})]}),h.length>0&&(0,q.jsxs)(`div`,{className:`border-t border-white/[0.07] p-4`,children:[(0,q.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,q.jsx)(x,{className:`h-3.5 w-3.5 text-violet-400`}),(0,q.jsx)(`h3`,{className:`text-[10px] font-black uppercase tracking-[0.16em] text-white/50`,children:`Integraciones MCP asignadas`})]}),(0,q.jsx)(`div`,{className:`grid gap-2.5 sm:grid-cols-2 xl:grid-cols-3`,children:h.map(e=>(0,q.jsxs)(`article`,{className:`rounded-xl border border-violet-500/15 bg-violet-500/[0.035] p-3.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-violet-500/20 bg-violet-500/[0.08]`,children:(0,q.jsx)(x,{className:`h-3.5 w-3.5 text-violet-300`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,q.jsx)(`h4`,{className:`truncate text-xs font-bold text-white/80`,title:e.name,children:e.name}),(0,q.jsx)(`span`,{className:`mt-1 h-2 w-2 shrink-0 rounded-full ${e.enabled?`bg-emerald-400`:`bg-white/20`}`})]}),(0,q.jsxs)(`p`,{className:`mt-1 text-[10px] leading-4 text-white/30`,children:[`Servidor completo · `,e.toolsCount,` tools sincronizadas`]})]})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-white/[0.05] pt-2`,children:[(0,q.jsx)(`span`,{className:`text-[8px] font-bold uppercase tracking-[0.14em] text-violet-300/70`,children:e.status}),(0,q.jsx)(`span`,{className:`rounded bg-violet-500/10 px-1.5 py-0.5 text-[7px] font-black uppercase tracking-wider text-violet-200/70`,children:`Persistente`})]})]},e.id))})]}),p.length>0&&(0,q.jsxs)(`div`,{className:`border-t border-white/[0.07] p-4`,children:[(0,q.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,q.jsx)(W,{className:`h-3.5 w-3.5 text-amber-400`}),(0,q.jsx)(`h3`,{className:`text-[10px] font-black uppercase tracking-[0.16em] text-white/50`,children:`Skills en contexto`})]}),(0,q.jsx)(`div`,{className:`grid gap-2.5 sm:grid-cols-2 xl:grid-cols-3`,children:p.map(e=>(0,q.jsxs)(`article`,{className:`rounded-xl border border-amber-500/10 bg-amber-500/[0.025] p-3.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-amber-500/15 bg-amber-500/[0.07]`,children:(0,q.jsx)(W,{className:`h-3.5 w-3.5 text-amber-400`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`h4`,{className:`truncate text-xs font-bold text-white/80`,title:e.name,children:e.name}),(0,q.jsx)(`p`,{className:`mt-1 line-clamp-2 min-h-8 text-[10px] leading-4 text-white/30`,children:e.description})]})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-white/[0.05] pt-2`,children:[(0,q.jsx)(`span`,{className:`text-[8px] font-bold uppercase tracking-[0.14em] text-amber-400/65`,children:e.category}),(0,q.jsx)(Q,{source:e.source})]})]},e.id))})]})]})]})}function Q({source:e}){return(0,q.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[7px] font-black uppercase tracking-wider ${e===`base`?`bg-blue-500/10 text-blue-300/70`:`bg-white/5 text-white/25`}`,children:e===`base`?`Minimal · base`:`Asignada`})}function $({value:e,label:t,color:n}){return(0,q.jsxs)(`div`,{className:`text-right`,children:[(0,q.jsx)(`p`,{className:`text-base font-black tabular-nums ${n}`,children:e}),(0,q.jsx)(`p`,{className:`text-[8px] font-bold uppercase tracking-wider text-white/25`,children:t})]})}function Te(e){switch(e){case`filesystem`:return G;case`web`:return u;case`cron`:return _e;case`cli`:return C;case`agents`:return se;case`canvas`:return l;case`mcp`:return x;case`office`:return G;default:return T}}function Ee(){let{id:e}=ie(),t=re(),n=e??`unknown`,{agents:i,fetchAgents:a}=N();(0,K.useEffect)(()=>{a()},[a]);let s=i.find(e=>e.id===n);return(0,q.jsx)(`div`,{className:`min-h-screen bg-transparent pb-20`,children:(0,q.jsxs)(`div`,{className:`max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8 animate-fade-in`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between mb-8`,children:[(0,q.jsxs)(k,{variant:`ghost`,onClick:()=>t(`/agents`),className:`group flex items-center gap-2 text-white/40 hover:text-white hover:bg-white/5 px-4 py-2 rounded-xl transition-colors`,children:[(0,q.jsx)(o,{className:`h-4 w-4 transition-transform group-hover:-translate-x-1`}),(0,q.jsx)(`span`,{className:`text-sm font-bold uppercase tracking-widest`,children:`Volver a la Colmena`})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-4 text-white/20`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(ye,{className:`h-4 w-4`}),(0,q.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`Agentes`})]}),(0,q.jsx)(`div`,{className:`h-4 w-px bg-white/10`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(r,{className:`h-4 w-4`}),(0,q.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`Detalles Operativos`})]})]})]}),s?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Se,{agent:s}),(0,q.jsx)(we,{agent:s}),(0,q.jsx)(`div`,{className:`grid grid-cols-1 gap-8`,children:(0,q.jsx)(xe,{agentId:n})})]}):(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-[60vh] text-center space-y-6`,children:[(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(`div`,{className:`h-24 w-24 rounded-full border-4 border-t-blue-500 border-white/5 animate-spin`}),(0,q.jsx)(r,{className:`absolute inset-0 m-auto h-8 w-8 text-blue-400 animate-pulse`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{className:`text-xl font-bold text-white mb-2`,children:`Sincronizando con el Nodo`}),(0,q.jsx)(`p`,{className:`text-white/40 max-w-xs mx-auto`,children:`Estamos recuperando la configuración cuántica de este agente desde la base de datos central.`})]})]})]})})}export{Ee as AgentDetailPage};
@@ -0,0 +1 @@
1
+ import{o as e}from"./vendor-query-Dj8xYhQD.js";import{t}from"./AgentCreateForm-g1mQnIoJ.js";var n=e();function r(){return(0,n.jsx)(t,{})}export{r as AgentNewPage};
@@ -0,0 +1,10 @@
1
+ import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{C as n,D as r,E as i,O as a,S as o,T as s,b as c,k as l,v as u,w as d,x as f,y as p}from"./vendor-radix-D0s_k6Gp.js";import{o as m}from"./vendor-query-Dj8xYhQD.js";import{t as h}from"./activity-CQuPevhB.js";import{t as g}from"./arrow-up-right-DQQCY007.js";import{t as _}from"./calendar-Be23hQGc.js";import{t as v}from"./check-Dp6tzwax.js";import{t as y}from"./chevron-right-CFodBS-b.js";import{t as b}from"./useProviders-DSX7eVsz.js";import{t as x}from"./ellipsis-vertical-BybFZDk2.js";import{t as S}from"./file-text-DO8jqiJK.js";import{r as C}from"./ModelSelector-nNOrW3te.js";import{t as ee}from"./gauge-BRGwuN8G.js";import{n as te,t as w}from"./pencil-f1nJ1xhs.js";import{a as ne,i as re,n as T,o as ie,s as ae,t as E}from"./agentCapabilities-CDC6y91E.js";import{t as D}from"./plus-C5BxJeOX.js";import{t as oe}from"./refresh-cw-CroGQY62.js";import{t as O}from"./shield-BnGyu1xf.js";import{t as se}from"./sparkles-BcaOs_Jk.js";import{t as k}from"./trash-2-DjQXac_0.js";import{t as A}from"./zap-DT7cM7YS.js";import{t as j}from"./utils-Dyb7SC2_.js";import{c as M}from"./vendor-router-zpB-76nT.js";import{K as N,M as ce,N as P,W as le,k as ue,m as F,o as I,s as L,t as R}from"./index-Bejlp-R1.js";import{t as de}from"./AgentCreateForm-g1mQnIoJ.js";var z=N(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),fe=N(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),pe=N(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),B=N(`Pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),V=e(t(),1),H=m(),me=s,he=l,ge=V.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,H.jsxs)(a,{ref:i,className:j(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent`,t&&`pl-8`,e),...r,children:[n,(0,H.jsx)(y,{className:`ml-auto h-4 w-4`})]}));ge.displayName=a.displayName;var _e=V.forwardRef(({className:e,...t},n)=>(0,H.jsx)(r,{ref:n,className:j(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...t}));_e.displayName=r.displayName;var U=V.forwardRef(({className:e,sideOffset:t=4,...r},i)=>(0,H.jsx)(n,{children:(0,H.jsx)(p,{ref:i,sideOffset:t,className:j(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...r})}));U.displayName=p.displayName;var W=V.forwardRef(({className:e,inset:t,...n},r)=>(0,H.jsx)(c,{ref:r,className:j(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground`,t&&`pl-8`,e),...n}));W.displayName=c.displayName;var ve=V.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,H.jsxs)(u,{ref:i,className:j(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground`,e),checked:n,...r,children:[(0,H.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,H.jsx)(f,{children:(0,H.jsx)(v,{className:`h-4 w-4`})})}),t]}));ve.displayName=u.displayName;var ye=V.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsxs)(d,{ref:r,className:j(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground`,e),...n,children:[(0,H.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,H.jsx)(f,{children:(0,H.jsx)(fe,{className:`h-2 w-2 fill-current`})})}),t]}));ye.displayName=d.displayName;var be=V.forwardRef(({className:e,inset:t,...n},r)=>(0,H.jsx)(o,{ref:r,className:j(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));be.displayName=o.displayName;var xe=V.forwardRef(({className:e,...t},n)=>(0,H.jsx)(i,{ref:n,className:j(`-mx-1 my-1 h-px bg-muted`,e),...t}));xe.displayName=i.displayName;var Se=({className:e,...t})=>(0,H.jsx)(`span`,{className:j(`ml-auto text-xs tracking-widest opacity-60`,e),...t});Se.displayName=`DropdownMenuShortcut`;function Ce(e){if(!e)return null;try{return ne(new Date(e),`dd MMM yyyy`,{locale:re})}catch{return null}}function we({agent:e,onEdit:t}){let n=M(),{deleteAgent:r}=R(),{providers:i}=L(),{models:a}=I(),o=t=>{t.target.closest(`[role="menuitem"]`)||t.target.closest(`button`)||n(`/agents/${e.id}`)},s=async t=>{if(t.stopPropagation(),(await F.fire({title:`¿Eliminar Agente?`,text:`¿Estás seguro de que deseas eliminar al agente "${e.name}"? Esta acción eliminará permanentemente su configuración.`,icon:`warning`,showCancelButton:!0,confirmButtonText:`Sí, eliminar`,cancelButtonText:`Cancelar`,reverseButtons:!0,background:`#09090b`,color:`#fff`,customClass:{popup:`border border-white/10 rounded-xl`,confirmButton:`bg-red-500 hover:bg-red-600 text-white`,cancelButton:`bg-white/10 hover:bg-white/20 text-white`}})).isConfirmed)try{await r(e.id)}catch(e){console.error(e)}},c=e.role===`coordinator`,l=e.provider_id||e.providerId,u=e.model_id||e.modelId,d=i.find(e=>e.id===l)?.name||l,f=a.find(e=>e.id===u)?.name||u,p=e.enabled?e.status:`hibernated`,m=T(e).length,g=E(e).length,v=!!e.systemPrompt,y=e.maxIterations||10,w=Ce(e.created_at||e.createdAt);return(0,H.jsxs)(`div`,{role:`button`,tabIndex:0,className:`group relative overflow-hidden rounded-2xl border bg-black/40 backdrop-blur-xl transition-all duration-500 cursor-pointer flex flex-col h-full
2
+ ${e.enabled?c?`border-purple-500/20 hover:border-purple-500/50 hover:bg-white/[0.03] hover:shadow-[0_0_30px_rgba(168,85,247,0.15)]`:`border-white/10 hover:border-blue-500/50 hover:bg-white/[0.03] hover:shadow-[0_0_30px_rgba(59,130,246,0.15)]`:`border-white/5 opacity-70 grayscale hover:grayscale-0`}
3
+ `,onClick:o,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&n(`/agents/${e.id}`)},children:[e.enabled&&(0,H.jsx)(`div`,{className:`absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent ${c?`via-purple-500/60`:`via-blue-500/50`} to-transparent`}),e.enabled&&(0,H.jsx)(`div`,{className:`absolute inset-0 bg-gradient-to-br ${c?`from-purple-500/10 via-transparent to-blue-500/5`:`from-blue-500/10 via-transparent to-purple-500/10`} opacity-0 transition-opacity duration-500 group-hover:opacity-100 pointer-events-none`}),(0,H.jsxs)(`div`,{className:`p-5 flex flex-col flex-1 relative z-10`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3 mb-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`w-11 h-11 rounded-xl flex items-center justify-center shrink-0 border transition-colors
4
+ ${c?`bg-purple-500/10 border-purple-500/20 group-hover:border-purple-500/40`:`bg-blue-500/10 border-blue-500/20 group-hover:border-blue-500/40`}`,children:c?(0,H.jsx)(O,{className:`h-5 w-5 text-purple-400`}):(0,H.jsx)(b,{className:`h-5 w-5 text-blue-400`})}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h3`,{className:`text-base font-bold tracking-tight transition-colors truncate ${e.enabled?`text-white/95 group-hover:text-white`:`text-white/40`}`,children:e.name}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-0.5 flex-wrap`,children:[(0,H.jsx)(`span`,{className:`text-[9px] px-2 py-0.5 rounded-full font-bold uppercase border
5
+ ${c?`bg-purple-500/10 text-purple-400 border-purple-500/20`:`bg-blue-500/10 text-blue-400 border-blue-500/20`}`,children:c?`Coordinador`:`Worker`}),e.hasHeaders&&(0,H.jsx)(`span`,{title:`Credenciales Mapeadas`,className:`flex items-center justify-center p-0.5 rounded bg-emerald-500/10 border border-emerald-500/20`,children:(0,H.jsx)(te,{className:`h-2.5 w-2.5 text-emerald-400`})}),e.parentId&&(0,H.jsx)(`span`,{title:`Sub-agente`,className:`flex items-center justify-center p-0.5 rounded bg-amber-500/10 border border-amber-500/20`,children:(0,H.jsx)(pe,{className:`h-2.5 w-2.5 text-amber-400`})})]})]})]}),(0,H.jsxs)(`div`,{className:`flex flex-col items-end gap-2 shrink-0`,children:[(0,H.jsx)(ie,{status:p}),(0,H.jsxs)(me,{children:[(0,H.jsx)(he,{asChild:!0,children:(0,H.jsx)(ue,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-white/40 hover:text-white hover:bg-white/10 rounded-full transition-colors`,children:(0,H.jsx)(x,{className:`h-4 w-4`})})}),(0,H.jsxs)(U,{align:`end`,className:`w-48 bg-black/90 backdrop-blur-xl border-white/10 text-white p-1 rounded-xl shadow-2xl`,children:[(0,H.jsxs)(W,{onClick:()=>t?.(e),className:`gap-2 cursor-pointer focus:bg-white/10 focus:text-white rounded-lg px-3 py-2 text-sm transition-colors`,children:[(0,H.jsx)(B,{className:`h-4 w-4 text-blue-400`}),(0,H.jsx)(`span`,{children:`Editar Configuración`})]}),(0,H.jsxs)(W,{onClick:s,className:`gap-2 cursor-pointer focus:bg-red-500/20 focus:text-red-400 rounded-lg px-3 py-2 text-sm text-red-400 transition-colors`,children:[(0,H.jsx)(k,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:`Eliminar Agente`})]})]})]})]})]}),(0,H.jsx)(`p`,{className:`text-xs text-white/50 line-clamp-2 leading-relaxed font-light mb-1`,children:e.description||`Sin descripción`}),(0,H.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[l&&(0,H.jsxs)(`div`,{className:`px-2.5 py-1 rounded-md text-[10px] font-medium uppercase tracking-wider flex items-center gap-1.5 border backdrop-blur-md transition-colors
6
+ ${e.enabled?`bg-white/5 border-white/10 text-white/80 group-hover:bg-white/10 group-hover:border-white/20`:`bg-transparent border-white/5 text-white/30`}`,children:[(0,H.jsx)(b,{className:`h-3 w-3`}),d]}),u&&(0,H.jsx)(`div`,{className:`px-2.5 py-1 rounded-md text-[10px] font-medium tracking-wider border backdrop-blur-md transition-colors truncate max-w-[120px]
7
+ ${e.enabled?`bg-white/5 border-white/10 text-white/80 group-hover:bg-white/10 group-hover:border-white/20`:`bg-transparent border-white/5 text-white/30`}`,title:f,children:f}),e.tone&&(0,H.jsxs)(`div`,{className:`px-2.5 py-1 rounded-md text-[10px] font-medium uppercase tracking-wider flex items-center gap-1.5 border backdrop-blur-md transition-colors
8
+ ${e.enabled?`bg-white/5 border-white/10 text-white/80 group-hover:bg-white/10 group-hover:border-white/20`:`bg-transparent border-white/5 text-white/30`}`,children:[(0,H.jsx)(h,{className:`h-3 w-3`}),e.tone]}),e.workspace&&(0,H.jsxs)(`div`,{className:`px-2.5 py-1 rounded-md text-[10px] font-medium uppercase tracking-wider flex items-center gap-1.5 border backdrop-blur-md transition-colors
9
+ ${e.enabled?`bg-emerald-500/5 border-emerald-500/20 text-emerald-300 group-hover:bg-emerald-500/10 group-hover:border-emerald-500/30`:`bg-transparent border-white/5 text-white/30`}`,title:`Workspace: ${e.workspace}`,children:[(0,H.jsx)(C,{className:`h-3 w-3`}),(0,H.jsx)(`span`,{className:`truncate max-w-[100px]`,children:`Workspace`})]})]}),(0,H.jsxs)(`div`,{className:`mt-6 pt-5 border-t border-white/5 grid grid-cols-4 gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1 items-start bg-white/[0.02] rounded-lg p-2.5 border border-white/5 group-hover:border-white/10 transition-colors`,children:[(0,H.jsxs)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-white/40 flex items-center gap-1.5`,children:[(0,H.jsx)(P,{className:`h-3 w-3 text-emerald-400/70`}),`Tools`]}),(0,H.jsx)(`span`,{className:`text-sm font-semibold font-mono ${e.enabled?`text-white/90`:`text-white/30`}`,children:m})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1 items-start bg-white/[0.02] rounded-lg p-2.5 border border-white/5 group-hover:border-white/10 transition-colors`,children:[(0,H.jsxs)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-white/40 flex items-center gap-1.5`,children:[(0,H.jsx)(A,{className:`h-3 w-3 text-amber-400/70`}),`Skills`]}),(0,H.jsx)(`span`,{className:`text-sm font-semibold font-mono ${e.enabled?`text-white/90`:`text-white/30`}`,children:g})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1 items-start bg-white/[0.02] rounded-lg p-2.5 border border-white/5 group-hover:border-white/10 transition-colors`,children:[(0,H.jsxs)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-white/40 flex items-center gap-1.5`,children:[(0,H.jsx)(S,{className:`h-3 w-3 text-blue-400/70`}),`Prompt`]}),(0,H.jsx)(`span`,{className:`text-sm font-bold ${e.enabled?v?`text-emerald-400`:`text-white/30`:`text-white/20`}`,children:v?`✓`:`—`})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1 items-start bg-white/[0.02] rounded-lg p-2.5 border border-white/5 group-hover:border-white/10 transition-colors`,children:[(0,H.jsxs)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-white/40 flex items-center gap-1.5`,children:[(0,H.jsx)(ee,{className:`h-3 w-3 text-purple-400/70`}),`Iters`]}),(0,H.jsx)(`span`,{className:`text-sm font-semibold font-mono ${e.enabled?`text-white/90`:`text-white/30`}`,children:y})]})]}),e.systemPrompt&&(0,H.jsxs)(`div`,{className:`mt-3 bg-white/[0.02] rounded-lg p-3 border border-white/5 group-hover:border-white/10 transition-colors`,children:[(0,H.jsxs)(`span`,{className:`text-[10px] font-medium tracking-wider text-white/40 uppercase mb-1.5 flex items-center gap-1.5`,children:[(0,H.jsx)(S,{className:`h-3 w-3 text-blue-400/70`}),`System Prompt`]}),(0,H.jsxs)(`p`,{className:`text-xs text-white/60 font-mono line-clamp-2 leading-relaxed italic`,children:[`"`,e.systemPrompt,`"`]})]}),(0,H.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between bg-white/[0.02] rounded-lg p-2.5 border border-white/5 group-hover:border-white/10 transition-colors`,children:[(0,H.jsx)(`span`,{className:`text-[10px] font-medium tracking-wider text-white/40 uppercase`,children:`Tareas`}),(0,H.jsx)(`span`,{className:`text-sm font-semibold font-mono ${e.enabled?`text-white/90`:`text-white/30`}`,children:e.taskCount||0})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between bg-white/[0.02] rounded-lg p-2.5 border border-white/5 group-hover:border-white/10 transition-colors`,children:[(0,H.jsx)(`span`,{className:`text-[10px] font-medium tracking-wider text-white/40 uppercase`,children:`Éxito`}),(0,H.jsxs)(`span`,{className:`text-sm font-semibold font-mono ${e.enabled?`text-emerald-400/90`:`text-white/30`}`,children:[e.successRate||0,`%`]})]})]}),(0,H.jsxs)(`div`,{className:`mt-auto pt-5 flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`h-2 w-2 rounded-full ${e.enabled?`bg-blue-400 shadow-[0_0_8px_rgba(96,165,250,0.8)] animate-pulse`:`bg-white/20`}`}),(0,H.jsx)(`span`,{className:`text-[10px] font-bold tracking-widest uppercase ${e.enabled?`text-blue-400`:`text-white/30`}`,children:e.enabled?`ACTIVO`:`INACTIVO`})]}),w&&(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-white/30 font-medium tracking-wider pl-3 border-l border-white/10`,children:[(0,H.jsx)(_,{className:`h-3 w-3`}),w]})]}),(0,H.jsxs)(`div`,{className:`text-xs font-semibold tracking-wide flex items-center gap-1.5 transition-all
10
+ ${e.enabled?`text-white/70 group-hover:text-blue-400 translate-x-1 group-hover:translate-x-0`:`text-white/20`}`,children:[`INGRESAR`,(0,H.jsx)(`span`,{className:`transition-transform group-hover:translate-x-1 opacity-0 group-hover:opacity-100 hidden sm:inline-block`,children:`→`})]})]})]})]})}var G=Math.sqrt(3),K=82;function Te(e,t){return{x:K*1.5*e,y:K*(G/2*e+G*t)}}var q=[{q:1,r:0},{q:1,r:-1},{q:0,r:-1},{q:-1,r:0},{q:-1,r:1},{q:0,r:1}],J=[{q:2,r:0},{q:2,r:-1},{q:2,r:-2},{q:1,r:-2},{q:0,r:-2},{q:-1,r:-1},{q:-2,r:0},{q:-2,r:1},{q:-2,r:2},{q:-1,r:2},{q:0,r:2},{q:1,r:1}];function Y(e,t){return t<=0?[]:t>=e.length?e:Array.from({length:t},(n,r)=>e[Math.floor(r*e.length/t)])}var X=`polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)`,Z={active:{bg:`#22c55e22`,dot:`#22c55e`,glow:`0 0 12px #22c55e88`},idle:{bg:`#f59e0b22`,dot:`#f59e0b`,glow:`0 0 12px #f59e0b88`},thinking:{bg:`#6366f122`,dot:`#818cf8`,glow:`0 0 12px #6366f188`},error:{bg:`#ef444422`,dot:`#ef4444`,glow:`0 0 12px #ef444488`},hibernated:{bg:`#1f293700`,dot:`#4b5563`,glow:`none`}};function Ee(e){if(!e)return 0;try{let t=JSON.parse(e);return Array.isArray(t)?t.length:0}catch{return 0}}function De({agents:e,onEdit:t,selectedId:n,onSelect:r}){let i=M(),{deleteAgent:a}=R(),[o,s]=(0,V.useState)(null),{coordinator:c,workers:l}=(0,V.useMemo)(()=>{let t=e.find(e=>e.role===`coordinator`)??e[0];return{coordinator:t,workers:e.filter(e=>e.id!==t?.id)}},[e]),u=(0,V.useMemo)(()=>{let e=Math.min(l.length,q.length),t=Math.min(Math.max(l.length-q.length,0),J.length);return[...Y(q,e),...Y(J,t)].map(({q:e,r:t})=>Te(e,t))},[l.length]),d=l.slice(0,u.length),f=l.length>6?2:1,p=f===2?700:520,m=f===2?680:500,h=p/2,g=m/2,_=Math.round(164*G/2),v=Math.round(124*G/2),y=async(e,t)=>{if(t.stopPropagation(),(await F.fire({title:`¿Eliminar Agente?`,text:`¿Eliminar "${e.name}"?`,icon:`warning`,showCancelButton:!0,confirmButtonText:`Sí, eliminar`,cancelButtonText:`Cancelar`,background:`#09090b`,color:`#fff`})).isConfirmed)try{await a(e.id)}catch(e){console.error(`No se pudo eliminar el agente:`,e)}},x=c?Z[c.enabled?c.status:`hibernated`]??Z.hibernated:Z.hibernated;return(0,H.jsxs)(`div`,{className:`w-full overflow-x-auto overflow-y-visible py-3`,children:[(0,H.jsxs)(`div`,{className:`relative mx-auto select-none`,style:{width:p,height:m},children:[(0,H.jsx)(`div`,{className:`absolute pointer-events-none rounded-full blur-[80px] opacity-30`,style:{width:260,height:260,left:h-130,top:g-130,background:`radial-gradient(circle, rgba(245,158,11,0.6) 0%, transparent 70%)`}}),(0,H.jsxs)(`svg`,{className:`absolute inset-0 pointer-events-none`,width:p,height:m,xmlns:`http://www.w3.org/2000/svg`,children:[(0,H.jsxs)(`defs`,{children:[(0,H.jsx)(`pattern`,{id:`hc-hex`,x:`0`,y:`0`,width:`52`,height:`30`,patternUnits:`userSpaceOnUse`,children:(0,H.jsx)(`polygon`,{points:`26,1 51,15.5 51,29 26,29 1,15.5 1,1`,fill:`none`,stroke:`rgba(255,255,255,0.03)`,strokeWidth:`1`})}),(0,H.jsxs)(`radialGradient`,{id:`fade-mask`,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,H.jsx)(`stop`,{offset:`0%`,stopColor:`white`,stopOpacity:`0.08`}),(0,H.jsx)(`stop`,{offset:`100%`,stopColor:`white`,stopOpacity:`0`})]})]}),(0,H.jsx)(`rect`,{width:p,height:m,fill:`url(#hc-hex)`}),(0,H.jsx)(`rect`,{width:p,height:m,fill:`url(#fade-mask)`}),d.map((e,t)=>{let r=u[t],i=o===e.id||n===e.id;return(0,H.jsxs)(`g`,{children:[(0,H.jsx)(`line`,{x1:h,y1:g,x2:h+r.x,y2:g+r.y,stroke:i?`rgba(245,158,11,0.5)`:`rgba(245,158,11,0.12)`,strokeWidth:i?2:1,strokeDasharray:`5 5`,style:{transition:`stroke 0.3s ease, stroke-width 0.3s ease`}}),e.enabled&&(0,H.jsx)(`circle`,{r:`3`,fill:`rgba(245,158,11,0.7)`,children:(0,H.jsx)(`animateMotion`,{dur:`${2.5+t*.4}s`,repeatCount:`indefinite`,path:`M ${h} ${g} L ${h+r.x} ${g+r.y}`})})]},`line-${e.id}`)})]}),c&&(0,H.jsxs)(`div`,{className:`absolute z-20 cursor-pointer group outline-none`,style:{left:h-164/2,top:g-_/2,width:164,height:_},onMouseEnter:()=>s(c.id),onMouseLeave:()=>s(null),children:[(0,H.jsx)(`button`,{type:`button`,className:`absolute inset-0 z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-300/70`,style:{clipPath:X},onClick:()=>r?.(c.id),"aria-label":`Seleccionar ${c.name}`,"aria-pressed":n===c.id}),(0,H.jsx)(`div`,{className:`absolute inset-[-6px] blur-[10px] transition-opacity duration-500 ${n===c.id?`opacity-90`:`opacity-40 group-hover:opacity-80`}`,style:{clipPath:X,background:`rgba(245,158,11,0.5)`}}),(0,H.jsx)(`div`,{className:`absolute inset-0 transition-transform duration-300 ${n===c.id?`scale-105`:`group-hover:scale-105`}`,style:{clipPath:X,background:`rgba(245,158,11,0.55)`},children:(0,H.jsx)(`div`,{className:`absolute inset-[2px]`,style:{clipPath:X,background:`linear-gradient(145deg, #1c1100 0%, #0d0b00 60%, #120d00 100%)`},children:(0,H.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-1.5 px-3`,children:[(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(O,{className:`h-8 w-8 text-amber-400 drop-shadow-[0_0_8px_rgba(245,158,11,0.8)]`}),(0,H.jsx)(`div`,{className:`absolute -bottom-0.5 -right-0.5 h-2.5 w-2.5 rounded-full border-2 border-black`,style:{backgroundColor:x.dot,boxShadow:x.glow}})]}),(0,H.jsx)(`span`,{className:`text-[10px] font-black text-amber-300 tracking-[0.12em] text-center leading-tight uppercase line-clamp-2`,children:c.name}),(0,H.jsx)(`span`,{className:`text-[8px] text-amber-500/70 tracking-widest uppercase font-semibold`,children:`Coordinadora`})]})})}),(0,H.jsxs)(`div`,{className:`pointer-events-none absolute -bottom-8 left-1/2 z-30 flex -translate-x-1/2 gap-1 opacity-0 transition-opacity duration-200 group-hover:pointer-events-auto group-hover:opacity-100`,children:[(0,H.jsx)(`button`,{type:`button`,className:`p-1.5 rounded bg-black/80 border border-amber-500/30 text-amber-400 hover:bg-amber-500/20 transition-colors`,onClick:e=>{e.stopPropagation(),t?.(c)},title:`Editar`,children:(0,H.jsx)(B,{className:`h-3 w-3`})}),(0,H.jsx)(`button`,{type:`button`,className:`p-1.5 rounded bg-black/80 border border-white/10 text-white/50 hover:text-white hover:border-white/20 transition-colors`,onClick:e=>{e.stopPropagation(),i(`/agents/${c.id}`)},title:`Ver detalle`,children:(0,H.jsx)(`span`,{className:`text-[9px] px-0.5`,children:`→`})})]})]}),d.map((e,a)=>{let c=u[a],l=h+c.x-124/2,d=g+c.y-v/2,f=Z[e.enabled?e.status:`hibernated`]??Z.hibernated,p=Ee(e.toolsJson),m=Ee(e.skillsJson),_=o===e.id,x=n===e.id,S=e.enabled?x?`rgba(245,158,11,0.95)`:_?`rgba(96,165,250,0.9)`:`rgba(59,130,246,0.45)`:`rgba(255,255,255,0.08)`,C=e.enabled?`linear-gradient(145deg, #050d1c 0%, #020912 60%, #040a18 100%)`:`#0a0a0b`;return(0,H.jsxs)(`div`,{className:`absolute z-10 cursor-pointer group outline-none`,style:{left:l,top:d,width:124,height:v},onMouseEnter:()=>s(e.id),onMouseLeave:()=>s(null),children:[(0,H.jsx)(`button`,{type:`button`,className:`absolute inset-0 z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-300/70`,style:{clipPath:X},onClick:()=>r?.(e.id),"aria-label":`Seleccionar ${e.name}`,"aria-pressed":x}),e.enabled&&(0,H.jsx)(`div`,{className:`absolute inset-[-5px] transition-opacity duration-300 blur-[8px]`,style:{clipPath:X,background:x?`rgba(245,158,11,0.45)`:`rgba(59,130,246,0.35)`,opacity:x?.9:_?.8:.2}}),(0,H.jsx)(`div`,{className:`absolute inset-0 transition-transform duration-300`,style:{clipPath:X,background:S,transform:x?`scale(1.08)`:_?`scale(1.06)`:`scale(1)`},children:(0,H.jsx)(`div`,{className:`absolute inset-[1.5px]`,style:{clipPath:X,background:C},children:(0,H.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-1 px-2`,children:[(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(b,{className:`h-5 w-5 transition-colors duration-300`,style:{color:x?`#fbbf24`:e.enabled?`#60a5fa`:`#374151`}}),(0,H.jsx)(`div`,{className:`absolute -bottom-0.5 -right-0.5 h-2 w-2 rounded-full border border-[#020912]`,style:{backgroundColor:f.dot,boxShadow:f.glow}})]}),(0,H.jsx)(`span`,{className:`text-[8px] font-bold tracking-wide text-center leading-tight uppercase line-clamp-2 transition-colors duration-300`,style:{color:x?`#fde68a`:e.enabled?`#93c5fd`:`#374151`},children:e.name}),(p>0||m>0)&&(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-0.5`,children:[p>0&&(0,H.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[7px] text-emerald-400/70`,children:[(0,H.jsx)(P,{className:`h-2 w-2`}),p]}),m>0&&(0,H.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[7px] text-amber-400/70`,children:[(0,H.jsx)(A,{className:`h-2 w-2`}),m]})]})]})})}),(0,H.jsx)(`div`,{className:`absolute -bottom-7 left-1/2 -translate-x-1/2 z-30 transition-opacity duration-200`,style:{opacity:+!!_,pointerEvents:_?`auto`:`none`},children:(0,H.jsxs)(`div`,{className:`flex gap-1`,children:[(0,H.jsx)(`button`,{type:`button`,className:`p-1 rounded bg-black/80 border border-blue-500/30 text-blue-400 hover:bg-blue-500/20 transition-colors`,onClick:n=>{n.stopPropagation(),t?.(e)},title:`Editar`,children:(0,H.jsx)(B,{className:`h-2.5 w-2.5`})}),(0,H.jsx)(`button`,{type:`button`,className:`p-1 rounded bg-black/80 border border-white/10 text-white/50 hover:text-white transition-colors`,onClick:t=>{t.stopPropagation(),i(`/agents/${e.id}`)},title:`Ver`,children:(0,H.jsx)(`span`,{className:`text-[8px]`,children:`→`})}),(0,H.jsx)(`button`,{type:`button`,className:`p-1 rounded bg-black/80 border border-red-500/20 text-red-400/60 hover:text-red-400 transition-colors`,onClick:t=>y(e,t),title:`Eliminar`,children:(0,H.jsx)(k,{className:`h-2.5 w-2.5`})})]})})]},e.id)}),l.length>q.length+J.length&&(0,H.jsxs)(`div`,{className:`absolute bottom-6 right-6 text-[11px] text-white/50 bg-white/5 rounded-full px-3 py-1 border border-white/10 backdrop-blur-sm`,children:[`+`,l.length-q.length-J.length,` agentes en lista`]})]}),l.length>q.length+J.length&&(0,H.jsx)(`div`,{className:`mt-4 grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 max-w-[740px] mx-auto px-4`,children:l.slice(q.length+J.length).map(e=>(0,H.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2 px-3 py-2 rounded-lg border border-white/10 bg-white/[0.03] hover:bg-white/[0.06] transition-colors text-left group`,onClick:()=>i(`/agents/${e.id}`),children:[(0,H.jsx)(b,{className:`h-4 w-4 text-blue-400/60 shrink-0`}),(0,H.jsx)(`span`,{className:`text-xs text-white/60 group-hover:text-white/90 truncate transition-colors`,children:e.name})]},e.id))})]})}function Oe({agents:e,onEdit:t,selectedId:n,onSelect:r}){return e.length===0?(0,H.jsxs)(`div`,{className:`hive-empty-state`,children:[(0,H.jsx)(`div`,{className:`p-4 rounded-full bg-white/5 mb-4`,children:(0,H.jsx)(`div`,{className:`h-10 w-10 border-2 border-dashed border-white/20 rounded-full`})}),(0,H.jsx)(`p`,{className:`hive-label uppercase`,children:`No se detectaron nodos activos`}),(0,H.jsx)(`p`,{className:`text-xs text-white/20 mt-1`,children:`Comienza desplegando un nuevo agente en tu red.`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`hidden md:block`,children:(0,H.jsx)(De,{agents:e,onEdit:t,selectedId:n,onSelect:r})}),(0,H.jsx)(`div`,{className:`grid gap-6 sm:grid-cols-2 pb-20 md:hidden`,children:e.map(e=>(0,H.jsx)(we,{agent:e,onEdit:t},e.id))})]})}function ke(){let e=M(),{agents:t,isLoading:n,error:r,fetchAgents:i}=R(),{providers:a,fetchProviders:o}=L(),{models:s,fetchModels:c}=I(),[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(),[p,m]=(0,V.useState)();(0,V.useEffect)(()=>{i(),o(),c()},[i,o,c]);let h=(0,V.useMemo)(()=>t.find(e=>e.role===`coordinator`)??t[0],[t]),g=t.find(e=>e.id===p)??h,_=t.filter(e=>e.enabled).length,v=t.filter(e=>e.role===`worker`).length,y=e=>{f(e),u(!0)},b=()=>{f(void 0),u(!0)},x=()=>{u(!1),f(void 0)};return(0,H.jsxs)(`div`,{className:`hive-page min-h-full`,children:[(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-[1480px] px-2 py-4 sm:px-4 lg:px-6 lg:py-6`,children:[(0,H.jsxs)(`header`,{className:`relative overflow-hidden rounded-2xl border border-white/[0.08] bg-[#0b0e14]/80 px-5 py-5 shadow-xl shadow-black/10 sm:px-6`,children:[(0,H.jsx)(`div`,{className:`pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_85%_0%,rgba(59,130,246,0.10),transparent_28%),radial-gradient(circle_at_8%_100%,rgba(245,158,11,0.08),transparent_32%)]`}),(0,H.jsxs)(`div`,{className:`relative flex flex-col gap-5 lg:flex-row lg:items-end lg:justify-between`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`mb-2.5 flex items-center gap-2 text-[9px] font-bold uppercase tracking-[0.24em] text-blue-400`,children:[(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-blue-400 shadow-[0_0_8px_rgba(96,165,250,0.8)]`}),`Nexo central · configuración de agentes`]}),(0,H.jsxs)(`h1`,{className:`text-3xl font-black tracking-[-0.04em] text-white sm:text-4xl`,children:[`Tu colmena `,(0,H.jsx)(`span`,{className:`text-amber-400`,children:`inteligente`})]}),(0,H.jsx)(`p`,{className:`mt-2 max-w-2xl text-sm leading-6 text-white/45`,children:`Selecciona un nodo para revisar su configuración, ajustar su propósito o entrar a su espacio operativo.`})]}),(0,H.jsxs)(`div`,{className:`flex flex-col items-start gap-3 lg:items-end`,children:[(0,H.jsxs)(`div`,{className:`hidden items-center gap-4 xl:flex`,children:[(0,H.jsx)(Ae,{value:_,label:`activos`,color:`text-emerald-400`}),(0,H.jsx)(Ae,{value:v,label:`especialistas`,color:`text-blue-400`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>i(),disabled:n,className:`flex h-10 items-center gap-2 rounded-lg border border-white/10 bg-white/[0.035] px-3.5 text-xs font-semibold text-white/60 transition-colors hover:border-white/20 hover:bg-white/[0.07] hover:text-white disabled:opacity-50`,children:[(0,H.jsx)(oe,{className:`h-3.5 w-3.5 text-blue-400 ${n?`animate-spin`:``}`}),`Sincronizar`]}),(0,H.jsxs)(`button`,{type:`button`,onClick:b,className:`flex h-10 items-center gap-2 rounded-lg border border-amber-300/40 bg-amber-400 px-4 text-xs font-bold text-[#181108] shadow-[0_0_20px_rgba(245,158,11,0.16)] transition hover:bg-amber-300`,children:[(0,H.jsx)(D,{className:`h-3.5 w-3.5`}),`Desplegar nodo`]})]})]})]})]}),r?(0,H.jsxs)(`div`,{className:`mt-5 flex items-start gap-3 rounded-xl border border-red-500/20 bg-red-500/[0.07] p-4 text-red-300`,children:[(0,H.jsx)(ce,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-xs font-bold uppercase tracking-wider`,children:`Error de enlace`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-red-300/60`,children:r})]})]}):n&&t.length===0?(0,H.jsxs)(`div`,{className:`mt-5 grid gap-4 lg:grid-cols-[280px_1fr]`,children:[(0,H.jsx)(`div`,{className:`h-[560px] animate-pulse rounded-2xl border border-white/5 bg-white/[0.02]`}),(0,H.jsx)(`div`,{className:`h-[560px] animate-pulse rounded-2xl border border-white/5 bg-white/[0.02]`})]}):t.length===0?(0,H.jsxs)(`div`,{className:`mt-5 flex min-h-[500px] flex-col items-center justify-center rounded-2xl border border-dashed border-white/10 bg-black/20 px-6 text-center`,children:[(0,H.jsx)(`div`,{className:`flex h-16 w-16 items-center justify-center rounded-2xl border border-amber-500/20 bg-amber-500/10`,children:(0,H.jsx)(le,{className:`h-7 w-7 text-amber-400`})}),(0,H.jsx)(`h2`,{className:`mt-5 text-lg font-bold text-white`,children:`Colmena inactiva`}),(0,H.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-white/40`,children:`Despliega el primer agente para crear el núcleo de tu red.`}),(0,H.jsxs)(`button`,{type:`button`,onClick:b,className:`mt-6 flex h-10 items-center gap-2 rounded-lg bg-amber-400 px-4 text-xs font-bold text-[#181108]`,children:[(0,H.jsx)(D,{className:`h-4 w-4`}),`Desplegar primer nodo`]})]}):(0,H.jsxs)(`div`,{className:`mt-5 grid items-start gap-4 lg:grid-cols-[290px_minmax(0,1fr)]`,children:[(0,H.jsx)(je,{agent:g,providerName:a.find(e=>e.id===(g?.provider_id||g?.providerId))?.name,modelName:s.find(e=>e.id===(g?.model_id||g?.modelId))?.name,totalAgents:t.length,activeCount:_,onEdit:y,onOpen:t=>e(`/agents/${t.id}`)}),(0,H.jsxs)(`section`,{className:`min-w-0 overflow-hidden rounded-2xl border border-white/[0.08] bg-[#080b11]/75 shadow-2xl shadow-black/15`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-white/[0.07] px-4 py-3.5 sm:flex-row sm:items-center sm:justify-between sm:px-5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg border border-blue-500/20 bg-blue-500/10`,children:(0,H.jsx)(ae,{className:`h-4 w-4 text-blue-400`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-xs font-bold uppercase tracking-[0.14em] text-white/80`,children:`Mapa de la colmena`}),(0,H.jsx)(`p`,{className:`mt-0.5 text-[10px] text-white/30`,children:`Haz clic en un hexágono para inspeccionarlo`})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px] font-semibold uppercase tracking-wider text-white/30`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-amber-400`}),`Coordinación`]}),(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-blue-400`}),`Especialistas`]})]})]}),(0,H.jsxs)(`div`,{className:`relative min-h-[560px] overflow-hidden`,children:[(0,H.jsx)(`div`,{className:`pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_50%_50%,rgba(245,158,11,0.045),transparent_38%)]`}),(0,H.jsx)(Oe,{agents:t,onEdit:y,selectedId:g?.id,onSelect:m})]})]})]})]}),l&&(0,H.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-3 sm:p-6`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":`Cerrar configuración`,className:`absolute inset-0 cursor-default bg-black/75 backdrop-blur-sm`,onClick:x}),(0,H.jsx)(`div`,{className:`relative max-h-[92vh] w-full max-w-4xl overflow-y-auto rounded-2xl border border-white/10 bg-[#09090b] shadow-2xl`,children:(0,H.jsx)(de,{initialData:d,onSuccess:x,onCancel:x})})]})]})}function Ae({value:e,label:t,color:n}){return(0,H.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-lg font-black tabular-nums ${n}`,children:e}),(0,H.jsx)(`span`,{className:`text-[9px] font-bold uppercase tracking-wider text-white/25`,children:t})]})}function je({agent:e,providerName:t,modelName:n,totalAgents:r,activeCount:i,onEdit:a,onOpen:o}){if(!e)return null;let s=e.role===`coordinator`,c=e.provider_id||e.providerId,l=e.model_id||e.modelId,u=T(e).length,d=E(e).length;return(0,H.jsxs)(`aside`,{className:`overflow-hidden rounded-2xl border border-white/[0.08] bg-[#0b0e14]/90 lg:sticky lg:top-4`,children:[(0,H.jsx)(`div`,{className:`h-1 w-full ${s?`bg-amber-400`:`bg-blue-500`}`}),(0,H.jsxs)(`div`,{className:`p-5`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsx)(`div`,{className:`flex h-11 w-11 items-center justify-center rounded-xl border ${s?`border-amber-500/20 bg-amber-500/10 text-amber-400`:`border-blue-500/20 bg-blue-500/10 text-blue-400`}`,children:s?(0,H.jsx)(O,{className:`h-5 w-5`}):(0,H.jsx)(z,{className:`h-5 w-5`})}),(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-full border px-2 py-1 text-[9px] font-bold uppercase tracking-wider ${e.status===`archived`?`border-amber-500/20 bg-amber-500/10 text-amber-400`:e.enabled?`border-emerald-500/20 bg-emerald-500/10 text-emerald-400`:`border-white/10 bg-white/5 text-white/35`}`,children:[(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${e.status===`archived`?`bg-amber-400`:e.enabled?`bg-emerald-400`:`bg-white/30`}`}),e.status===`archived`?`Archivado`:e.enabled?`Activo`:`Inactivo`]})]}),(0,H.jsx)(`p`,{className:`mt-4 text-[9px] font-bold uppercase tracking-[0.2em] ${s?`text-amber-400`:`text-blue-400`}`,children:s?`Nodo coordinador`:`Nodo especialista`}),(0,H.jsx)(`h2`,{className:`mt-1.5 text-xl font-black leading-tight tracking-tight text-white`,children:e.name}),(0,H.jsx)(`p`,{className:`mt-2 line-clamp-3 min-h-[54px] text-xs leading-[18px] text-white/40`,children:e.description||`Este agente todavía no tiene una descripción de propósito.`}),(0,H.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,H.jsx)(Q,{icon:z,label:`Motor`,value:t||c||`Sin proveedor`}),(0,H.jsx)(Q,{icon:se,label:`Modelo`,value:n||l||`Sin modelo`}),(0,H.jsx)(Q,{icon:C,label:`Workspace`,value:e.workspace||`Sin asignar`,mono:!!e.workspace})]}),(0,H.jsxs)(`div`,{className:`mt-4 grid grid-cols-3 gap-1.5`,children:[(0,H.jsx)($,{icon:P,value:u,label:`Tools`,color:`text-emerald-400`}),(0,H.jsx)($,{icon:A,value:d,label:`Skills`,color:`text-amber-400`}),(0,H.jsx)($,{icon:h,value:e.maxIterations||10,label:`Iters`,color:`text-violet-400`})]}),(0,H.jsxs)(`div`,{className:`mt-5 grid gap-2`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>a(e),className:`flex h-10 items-center justify-center gap-2 rounded-lg text-xs font-bold transition-colors ${s?`bg-amber-400 text-[#181108] hover:bg-amber-300`:`bg-blue-600 text-white hover:bg-blue-500`}`,children:[(0,H.jsx)(w,{className:`h-3.5 w-3.5`}),`Configurar nodo`]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>o(e),className:`flex h-10 items-center justify-center gap-2 rounded-lg border border-white/10 bg-white/[0.03] text-xs font-semibold text-white/60 transition-colors hover:bg-white/[0.07] hover:text-white`,children:[`Abrir perfil`,(0,H.jsx)(g,{className:`h-3.5 w-3.5`})]})]})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-px border-t border-white/[0.07] bg-white/[0.07]`,children:[(0,H.jsxs)(`div`,{className:`bg-[#0b0e14] px-4 py-3`,children:[(0,H.jsx)(`p`,{className:`text-lg font-black tabular-nums text-white`,children:r}),(0,H.jsx)(`p`,{className:`text-[8px] font-bold uppercase tracking-wider text-white/25`,children:`Nodos totales`})]}),(0,H.jsxs)(`div`,{className:`bg-[#0b0e14] px-4 py-3`,children:[(0,H.jsx)(`p`,{className:`text-lg font-black tabular-nums text-emerald-400`,children:i}),(0,H.jsx)(`p`,{className:`text-[8px] font-bold uppercase tracking-wider text-white/25`,children:`En operación`})]})]})]})}function Q({icon:e,label:t,value:n,mono:r=!1}){return(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-lg border border-white/[0.06] bg-white/[0.025] px-3 py-2.5`,children:[(0,H.jsx)(e,{className:`h-3.5 w-3.5 shrink-0 text-white/30`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`text-[8px] font-bold uppercase tracking-wider text-white/25`,children:t}),(0,H.jsx)(`p`,{className:`mt-0.5 truncate text-[11px] text-white/65 ${r?`font-mono`:`font-medium`}`,title:n,children:n})]})]})}function $({icon:e,value:t,label:n,color:r}){return(0,H.jsxs)(`div`,{className:`rounded-lg border border-white/[0.06] bg-black/20 px-2 py-2.5 text-center`,children:[(0,H.jsx)(e,{className:`mx-auto h-3.5 w-3.5 ${r}`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm font-black tabular-nums text-white/80`,children:t}),(0,H.jsx)(`p`,{className:`text-[7px] font-bold uppercase tracking-wider text-white/25`,children:n})]})}export{ke as AgentsPage};
@@ -0,0 +1,3 @@
1
+ import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{o as n}from"./vendor-query-Dj8xYhQD.js";import{t as r}from"./chevron-down-33N886NY.js";import{t as i}from"./chevron-right-CFodBS-b.js";import{t as a}from"./circle-check-BJWNbLuF.js";import{t as o}from"./circle-x-Cb2Yer4s.js";import{t as s}from"./copy-33tZrzc9.js";import{t as c}from"./history-BtTD1kDo.js";import{t as l}from"./plus-C5BxJeOX.js";import{t as u}from"./send-D6whYpw-.js";import{t as d}from"./trash-2-DjQXac_0.js";import{t as f}from"./utils-Dyb7SC2_.js";import{H as ee,O as p,U as m,f as h,k as g}from"./index-Bejlp-R1.js";import{t as te}from"./badge-DKGZbVZJ.js";import{t as _}from"./scroll-area-CfHn94Vb.js";import{i as v,n as y,r as b,t as x}from"./tabs-CxiybXcw.js";import{t as S}from"./textarea-rp6vsOZl.js";import{i as C,n as ne,o as re,s as w,t as T}from"./select-BhbW0stK.js";import{a as E,i as D,n as O,t as k}from"./card-D3Nw3kh3.js";var A=e(t(),1),j=n(),ie=[`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`];function M(){return Math.random().toString(36).substring(2,9)}function N(){return{id:M(),key:``,value:``,enabled:!0}}function P(){let[e,t]=(0,A.useState)(`GET`),[n,P]=(0,A.useState)(``),[F,I]=(0,A.useState)([N()]),[L,R]=(0,A.useState)([N()]),[z,B]=(0,A.useState)(``),[V,H]=(0,A.useState)(null),[U,W]=(0,A.useState)(!1),[G,K]=(0,A.useState)(0),[q,J]=(0,A.useState)([]),[Y,ae]=(0,A.useState)(!1),[oe,se]=(0,A.useState)(`body`);(0,A.useEffect)(()=>{try{let e=localStorage.getItem(`hive-api-client-history`);e&&J(JSON.parse(e))}catch{}},[]);let ce=(0,A.useCallback)(e=>{localStorage.setItem(`hive-api-client-history`,JSON.stringify(e.slice(0,50)))},[]),X=(e,t,n,r,i)=>{t(e.map(e=>e.id===n?{...e,[r]:i}:e))},Z=(e,t)=>{t([...e,N()])},le=(e,t,n)=>{e.length===1?t([N()]):t(e.filter(e=>e.id!==n))},ue=()=>{let e={};for(let t of F)t.enabled&&t.key.trim()&&(e[t.key.trim()]=t.value);return e},de=()=>{let e={};for(let t of L)t.enabled&&t.key.trim()&&(e[t.key.trim()]=t.value);return e},Q=async()=>{if(!n.trim())return;W(!0),H(null);let t=performance.now();try{let r={method:e,url:n.trim(),headers:ue(),query_params:de()};z.trim()&&e!==`GET`&&e!==`HEAD`&&(r.body=z.trim());let i=await h(`/api/http-request`,{method:`POST`,body:r,showError:!1});K(Math.round(performance.now()-t)),H(i);let a=[{id:M(),method:e,url:n.trim(),timestamp:Date.now(),status:i.status,ok:i.ok},...q];J(a),ce(a)}catch(e){K(Math.round(performance.now()-t)),H({ok:!1,error:e.message||`Request failed`})}finally{W(!1)}},fe=e=>{t(e.method),P(e.url),H(null)},pe=e=>{navigator.clipboard.writeText(e)},me=e=>{if(e==null)return``;if(typeof e==`string`)try{let t=JSON.parse(e);return JSON.stringify(t,null,2)}catch{return e}return JSON.stringify(e,null,2)},he=e=>e?e>=200&&e<300?`bg-green-500`:e>=300&&e<400?`bg-yellow-500`:e>=400&&e<500?`bg-orange-500`:`bg-red-500`:`bg-gray-500`,$=(e,t,n,r)=>(0,j.jsxs)(`div`,{className:`space-y-2`,children:[e.map(i=>(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`input`,{type:`checkbox`,checked:i.enabled,onChange:n=>X(e,t,i.id,`enabled`,n.target.checked),className:`h-4 w-4 rounded border-white/20 bg-background`}),(0,j.jsx)(p,{placeholder:n,value:i.key,onChange:n=>X(e,t,i.id,`key`,n.target.value),className:`h-8 text-xs bg-background/50`}),(0,j.jsx)(p,{placeholder:r,value:i.value,onChange:n=>X(e,t,i.id,`value`,n.target.value),className:`h-8 text-xs bg-background/50`}),(0,j.jsx)(g,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground hover:text-red-400`,onClick:()=>le(e,t,i.id),children:(0,j.jsx)(d,{className:`h-3.5 w-3.5`})})]},i.id)),(0,j.jsxs)(g,{variant:`ghost`,size:`sm`,className:`text-xs text-muted-foreground hover:text-primary`,onClick:()=>Z(e,t),children:[(0,j.jsx)(l,{className:`h-3.5 w-3.5 mr-1`}),`Agregar`]})]});return(0,j.jsxs)(`div`,{className:`hive-page-container animate-fade-in mt-10`,children:[(0,j.jsx)(`div`,{className:`hive-page-header mb-6`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,j.jsx)(`div`,{className:`h-10 w-10 rounded-xl bg-purple-500/10 border border-purple-500/20 flex items-center justify-center text-purple-400`,children:(0,j.jsx)(ee,{className:`h-6 w-6`})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h1`,{className:`text-3xl font-black text-white uppercase tracking-tighter`,children:`API Client`}),(0,j.jsx)(`p`,{className:`hive-subtitle`,children:`Cliente HTTP para probar endpoints REST directamente desde Hive.`})]})]})}),(0,j.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-6`,children:[(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsx)(k,{className:`border-white/10 bg-card/50`,children:(0,j.jsx)(O,{className:`p-4`,children:(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[(0,j.jsxs)(T,{value:e,onValueChange:t,children:[(0,j.jsx)(re,{className:`w-[110px] h-10 text-xs font-bold tracking-wider`,children:(0,j.jsx)(w,{})}),(0,j.jsx)(ne,{children:ie.map(e=>(0,j.jsx)(C,{value:e,className:`text-xs font-bold`,children:e},e))})]}),(0,j.jsx)(p,{placeholder:`https://api.example.com/endpoint`,value:n,onChange:e=>P(e.target.value),onKeyDown:e=>e.key===`Enter`&&Q(),className:`h-10 text-sm bg-background/50 font-mono`}),(0,j.jsxs)(g,{onClick:Q,disabled:U||!n.trim(),className:`h-10 px-6 bg-purple-600 hover:bg-purple-500 text-white font-bold text-xs tracking-wider`,children:[U?(0,j.jsx)(m,{className:`h-4 w-4 animate-spin mr-2`}):(0,j.jsx)(u,{className:`h-4 w-4 mr-2`}),`ENVIAR`]})]})})}),(0,j.jsx)(k,{className:`border-white/10 bg-card/50`,children:(0,j.jsx)(O,{className:`p-4`,children:(0,j.jsxs)(x,{defaultValue:`headers`,className:`w-full`,children:[(0,j.jsxs)(b,{className:`bg-background/50 h-8`,children:[(0,j.jsxs)(v,{value:`headers`,className:`text-xs h-7`,children:[`Headers (`,F.filter(e=>e.enabled&&e.key.trim()).length,`)`]}),(0,j.jsxs)(v,{value:`query`,className:`text-xs h-7`,children:[`Query Params (`,L.filter(e=>e.enabled&&e.key.trim()).length,`)`]}),(0,j.jsx)(v,{value:`body`,className:`text-xs h-7`,children:`Body`})]}),(0,j.jsx)(y,{value:`headers`,className:`mt-3`,children:$(F,I,`Header`,`Value`)}),(0,j.jsx)(y,{value:`query`,className:`mt-3`,children:$(L,R,`Key`,`Value`)}),(0,j.jsxs)(y,{value:`body`,className:`mt-3`,children:[(0,j.jsx)(S,{placeholder:`{
2
+ "key": "value"
3
+ }`,value:z,onChange:e=>B(e.target.value),className:`min-h-[140px] font-mono text-xs bg-background/50`}),(0,j.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-2`,children:`Se enviará como string crudo. Para JSON, asegurate de que sea válido.`})]})]})})}),V&&(0,j.jsxs)(k,{className:f(`border-white/10`,V.ok?`bg-green-500/[0.02]`:`bg-red-500/[0.02]`),children:[(0,j.jsx)(D,{className:`pb-3`,children:(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(E,{className:`text-sm font-bold tracking-wider`,children:`RESPUESTA`}),V.status!==void 0&&(0,j.jsxs)(te,{variant:`outline`,className:f(`text-xs font-bold border-none`,he(V.status),`text-white`),children:[V.status,` `,V.statusText||``]}),V.ok?(0,j.jsx)(a,{className:`h-4 w-4 text-green-500`}):(0,j.jsx)(o,{className:`h-4 w-4 text-red-500`}),(0,j.jsxs)(`span`,{className:`text-[10px] text-muted-foreground font-mono`,children:[G,`ms`]})]}),(0,j.jsxs)(g,{variant:`ghost`,size:`sm`,className:`h-7 text-xs`,onClick:()=>pe(JSON.stringify(V,null,2)),children:[(0,j.jsx)(s,{className:`h-3 w-3 mr-1`}),`Copiar`]})]})}),(0,j.jsx)(O,{className:`pt-0`,children:(0,j.jsxs)(x,{value:oe,onValueChange:se,children:[(0,j.jsxs)(b,{className:`bg-background/50 h-8`,children:[(0,j.jsx)(v,{value:`body`,className:`text-xs h-7`,children:`Body`}),(0,j.jsx)(v,{value:`headers`,className:`text-xs h-7`,children:`Headers`}),(0,j.jsx)(v,{value:`raw`,className:`text-xs h-7`,children:`Raw`})]}),(0,j.jsx)(y,{value:`body`,className:`mt-3`,children:(0,j.jsx)(_,{className:`h-[300px] w-full rounded-md border bg-black/40 p-3`,children:(0,j.jsx)(`pre`,{className:`font-mono text-xs text-green-400 whitespace-pre-wrap`,children:me(V.body??V)})})}),(0,j.jsx)(y,{value:`headers`,className:`mt-3`,children:(0,j.jsx)(_,{className:`h-[300px] w-full rounded-md border bg-black/40 p-3`,children:V.headers?(0,j.jsx)(`div`,{className:`space-y-1`,children:Object.entries(V.headers).map(([e,t])=>(0,j.jsxs)(`div`,{className:`flex gap-2 text-xs font-mono`,children:[(0,j.jsxs)(`span`,{className:`text-purple-400 shrink-0`,children:[e,`:`]}),(0,j.jsx)(`span`,{className:`text-white/70`,children:String(t)})]},e))}):(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No headers disponibles`})})}),(0,j.jsx)(y,{value:`raw`,className:`mt-3`,children:(0,j.jsx)(_,{className:`h-[300px] w-full rounded-md border bg-black/40 p-3`,children:(0,j.jsx)(`pre`,{className:`font-mono text-xs text-white/60 whitespace-pre-wrap`,children:JSON.stringify(V,null,2)})})})]})})]})]}),(0,j.jsx)(`div`,{children:(0,j.jsxs)(k,{className:`border-white/10 bg-card/50`,children:[(0,j.jsx)(D,{className:`pb-3`,children:(0,j.jsxs)(`button`,{onClick:()=>ae(!Y),className:`flex items-center justify-between w-full`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(c,{className:`h-4 w-4 text-muted-foreground`}),(0,j.jsx)(E,{className:`text-xs font-bold tracking-wider`,children:`HISTORIAL`})]}),Y?(0,j.jsx)(r,{className:`h-4 w-4 text-muted-foreground`}):(0,j.jsx)(i,{className:`h-4 w-4 text-muted-foreground`})]})}),Y&&(0,j.jsxs)(O,{className:`pt-0`,children:[q.length===0?(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground text-center py-4`,children:`No hay requests en el historial`}):(0,j.jsx)(_,{className:`h-[calc(100vh-300px)]`,children:(0,j.jsx)(`div`,{className:`space-y-1`,children:q.map(e=>(0,j.jsxs)(`button`,{onClick:()=>fe(e),className:`w-full text-left p-2 rounded-lg hover:bg-white/5 transition-colors group`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:f(`text-[10px] font-bold px-1.5 py-0.5 rounded`,e.ok?`bg-green-500/20 text-green-400`:`bg-red-500/20 text-red-400`),children:e.method}),e.status&&(0,j.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.status})]}),(0,j.jsx)(`p`,{className:`text-[10px] text-white/50 truncate mt-1 font-mono`,children:e.url}),(0,j.jsx)(`p`,{className:`text-[9px] text-white/30 mt-0.5`,children:new Date(e.timestamp).toLocaleTimeString()})]},e.id))})}),q.length>0&&(0,j.jsxs)(g,{variant:`ghost`,size:`sm`,className:`w-full mt-2 text-[10px] text-muted-foreground hover:text-red-400`,onClick:()=>{J([]),localStorage.removeItem(`hive-api-client-history`)},children:[(0,j.jsx)(d,{className:`h-3 w-3 mr-1`}),`Limpiar historial`]})]})]})})]})]})}export{P as ApiClientPage};
@@ -0,0 +1,8 @@
1
+ import{r as e,t}from"./rolldown-runtime-S-ySWqyJ.js";import{f as n}from"./vendor-charts-K3xcRl0X.js";import{o as r}from"./vendor-query-Dj8xYhQD.js";import{t as i}from"./circle-alert-BDVHxmAz.js";import{t as a}from"./circle-check-BJWNbLuF.js";import{n as o,t as s}from"./eye-C8sKSSkg.js";import{t as c}from"./loader-circle-BhqRN2nO.js";import{t as l}from"./plus-C5BxJeOX.js";import{t as u}from"./refresh-cw-CroGQY62.js";import{t as d}from"./settings-BX6q3MGB.js";import{t as f}from"./zap-DT7cM7YS.js";import{c as p}from"./vendor-router-zpB-76nT.js";import{B as m,K as h,M as g,O as _,f as v,k as y,n as b,o as ee,s as x,u as S,z as te}from"./index-Bejlp-R1.js";import{t as C}from"./label-k0jYxoWW.js";import{a as ne,i as w,n as T,o as E,r as re,s as D,t as O}from"./select-BhbW0stK.js";import{t as k}from"./switch-DXcELPsM.js";import{n as ie,t as ae}from"./alert-CQlRq6sv.js";var oe=h(`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`}]]),A=e(n(),1),j=r();function M({channel:e,onEdit:t,onToggle:n}){e.status;let r=e.isConfigured===!1,i=e.status===`connected`||e.status===`connecting`;return(0,j.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,j.jsxs)(`div`,{className:`hive-card-body relative overflow-hidden`,children:[(0,j.jsxs)(`div`,{className:`flex items-start justify-between mb-8`,children:[(0,j.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,j.jsx)(te,{className:`h-6 w-6`})}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i&&(0,j.jsx)(`span`,{className:`text-[9px] font-black tracking-widest text-emerald-500 shadow-emerald-glow`,children:e.status===`connecting`?`CONECTANDO`:`CONECTADO`}),r?(0,j.jsx)(`span`,{className:`text-[9px] font-black tracking-widest text-blue-400/60 uppercase`,children:`DISPONIBLE`}):(0,j.jsx)(k,{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,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`div`,{children:[(0,j.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,j.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,j.jsxs)(`div`,{className:`pt-4 border-t border-white/5 flex items-center gap-6`,children:[(0,j.jsxs)(`div`,{className:`hive-stat`,children:[(0,j.jsx)(`span`,{className:`hive-stat__label`,children:`VOZ`}),(0,j.jsx)(`span`,{className:`hive-stat__value ${e.voice_enabled?`text-emerald-500`:`text-white/20`}`,children:e.voice_enabled?`ON`:`OFF`})]}),(0,j.jsxs)(`div`,{className:`hive-stat`,children:[(0,j.jsx)(`span`,{className:`hive-stat__label`,children:`SÍNTESIS`}),(0,j.jsx)(`span`,{className:`hive-stat__value ${e.tts_enabled?`text-emerald-500`:`text-white/20`}`,children:e.tts_enabled?`ON`:`OFF`})]})]})]}),i&&(0,j.jsx)(`div`,{className:`hive-glow-blob hive-glow-blob--emerald -bottom-10 -right-10 h-24 w-24 opacity-20`})]}),(0,j.jsx)(`div`,{className:`hive-strip--bottom ${i?`bg-emerald-500`:r?`bg-blue-500/30`:`bg-white/10`}`})]})}var se=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),N=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)}})),P=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}}})),ce=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})),le=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})),ue=t((e=>{var t=N().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}})),de=t((e=>{var t=N().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),F=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}})),I=t((e=>{var t=P(),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}}})),L=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]]}})),fe=t((e=>{var t=L();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}})),R=t(((e,t)=>{var n=fe();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})),z=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),B=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)}})),V=t((e=>{var t=z(),n=B();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}}})),pe=t((e=>{var t=N(),n=I(),r=P(),i=V(),a=z(),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}})),me=t((e=>{var t=N(),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}})),he=t(((e,t)=>{var n=V();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})),ge=t(((e,t)=>{var n=V(),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})),H=t(((e,t)=>{var n=V();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})),_e=t(((e,t)=>{var n=V(),r=N();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})),ve=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)})),ye=t((e=>{var t=V(),n=he(),r=ge(),i=H(),a=_e(),o=B(),s=N(),c=ve();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()))}})),be=t((e=>{var t=N(),n=P(),r=ce(),i=le(),a=ue(),o=de(),s=F(),c=I(),l=R(),u=pe(),d=me(),f=V(),p=ye();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 y(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 b(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 ee(a,e,n)}function ee(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,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),ee=0,x,S;for(x=0;x<v;x++)for(S=0;S<o;S++)x<g[S].length&&(b[ee++]=g[S][x]);for(x=0;x<p;x++)for(S=0;S<o;S++)b[ee++]=_[S][x];return b}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=b(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),y(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)}})),U=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}}})),xe=t((e=>{var t=U();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)}})),W=t((e=>{var t=U();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}})),G=e(t((e=>{var t=se(),n=be(),r=xe(),i=W();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),Se=[{id:`gemini`,name:`Google Gemini`,provider:`gemini`},{id:`openai`,name:`OpenAI`,provider:`openai`},{id:`anthropic`,name:`Anthropic Claude`,provider:`anthropic`}];function Ce({data:e}){let t=(0,A.useRef)(null);return(0,A.useEffect)(()=>{!e||!t.current||G.toCanvas(t.current,e,{width:220,margin:2,color:{dark:`#000000`,light:`#ffffff`}}).catch(console.error)},[e]),(0,j.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,j.jsx)(`div`,{className:`rounded-xl overflow-hidden border-4 border-white shadow-lg`,children:(0,j.jsx)(`canvas`,{ref:t})}),(0,j.jsx)(`p`,{className:`text-xs text-white/40 text-center`,children:`Abre WhatsApp → Ajustes → Dispositivos vinculados → Vincular dispositivo`})]})}function K({channel:e,isOpen:t,onClose:n,onSave:r}){let f=p(),{createChannel:m,reconnectChannel:h,fetchChannels:te}=b(),{configuredVoiceProviders:M,fetchConfiguredVoiceProviders:se}=S(),{models:N}=ee(),{providers:P}=x(),ce=e=>e.provider_id||e.providerId||``,le=(0,A.useMemo)(()=>N.filter(e=>e.model_type===`stt`&&M[ce(e)]),[N,M]),ue=(0,A.useMemo)(()=>{let e=new Map;for(let t of N){if(t.model_type!==`tts`)continue;let n=ce(t);M[n]&&(e.has(n)||e.set(n,[]),e.get(n).push(t))}return Array.from(e.entries()).map(([e,t])=>({provider:e,group:P.find(t=>t.id===e)?.name||e,models:t}))},[N,P,M]),de=(0,A.useCallback)(e=>{let t=N.find(t=>t.id===e);return t?ce(t):P.some(t=>t.id===e)?e:null},[N,P]),[F,I]=(0,A.useState)(e?`settings`:`type`),[L,fe]=(0,A.useState)(`telegram`),[R,z]=(0,A.useState)(``),[B,V]=(0,A.useState)(``),[pe,me]=(0,A.useState)(``),[he,ge]=(0,A.useState)(!1),[H,_e]=(0,A.useState)(!1),[ve,ye]=(0,A.useState)(null),[be,U]=(0,A.useState)(null),[xe,W]=(0,A.useState)(!1),[G,K]=(0,A.useState)(null),[q,we]=(0,A.useState)(!1),Te=(0,A.useRef)(null),[J,Y]=(0,A.useState)({}),[Ee,De]=(0,A.useState)(!1),[Oe,ke]=(0,A.useState)([]),[Ae,je]=(0,A.useState)(!1),[Me,Ne]=(0,A.useState)(!1),[Pe,Fe]=(0,A.useState)(``),[Ie,Le]=(0,A.useState)(!1),[Re,ze]=(0,A.useState)(!0),[Be,Ve]=(0,A.useState)(!1),[He,Ue]=(0,A.useState)(`open`),[X,We]=(0,A.useState)([]),[Ge,Ke]=(0,A.useState)(``),[qe,Je]=(0,A.useState)(5),[Ye,Xe]=(0,A.useState)(1e3),[Ze,Qe]=(0,A.useState)(!1),$e=e&&e.status!==`connected`,Z=e&&e.isConfigured===!1;(0,A.useEffect)(()=>{t?e?(I($e?`reconnect`:`settings`),fe(e.type),z(``),V(``),me(``),ye(e.id),U(null),W(!1),K(null),Y(e),Ne(!1),Fe(``),Le(!1)):(I(`type`),fe(`telegram`),z(``),V(``),me(``),ye(null),U(null),W(!1),K(null)):Q()},[t,e]),(0,A.useEffect)(()=>{se()},[se]),(0,A.useEffect)(()=>{if(!t||!e||e.type!==`whatsapp`){Qe(!1);return}let n=!1;return v(`/api/channels/whatsapp/${e.id}/details`,{showError:!1}).then(e=>{n||(ze(e.selfMessagesOnly??!0),Ve(e.acceptGroups??!1),Ue(e.dmPolicy??`open`),We(e.allowFrom??[]),Je(e.reconnectMaxAttempts??5),Xe(e.reconnectBaseDelayMs??1e3),Qe(!0))}).catch(()=>Qe(!1)),()=>{n=!0}},[t,e]),(0,A.useEffect)(()=>{let e=J.tts_provider?de(J.tts_provider):null;if(!e){ke([]);return}je(!0),v(`/api/voice/${e}/voices`,{showError:!1}).then(e=>ke(e.voices||[])).catch(()=>ke([])).finally(()=>je(!1))},[J.tts_provider,de]);let Q=(0,A.useCallback)(()=>{Te.current&&=(clearInterval(Te.current),null)},[]),et=(0,A.useCallback)((e,t)=>{Q(),Te.current=setInterval(async()=>{try{let n=await v(`/api/channels/${e}/${t}/status`,{showError:!1});n.status===`qr`&&n.qrCode?(U(n.qrCode),W(!1),I(`qr`)):n.status===`connected`?(Q(),await te(),I(`success`)):n.status===`error`?(Q(),K(`Error de conexión. Intenta de nuevo.`),I(`credentials`)):(n.status===`disconnected`||n.status===`not_found`)&&W(!0)}catch{}},2e3)},[Q,te]),tt=async()=>{if(e){we(!0),K(null);try{let t={};L===`telegram`&&R.trim()&&(t.botToken=R),L===`discord`&&(R.trim()&&(t.botToken=R),B.trim()&&(t.applicationId=B)),await h(e.id,Object.keys(t).length>0?t:void 0),I(`connecting`),et(L,e.id)}catch(e){K(e.message||`Error al reconectar`)}finally{we(!1)}}},nt=async()=>{we(!0),K(null);try{let e={};L===`telegram`&&(e.botToken=R),L===`discord`&&(e.botToken=R,e.applicationId=B),L===`slack`&&(e.botToken=R,e.signingSecret=pe);let{id:t}=await m(L,e);ye(t),L===`whatsapp`?(I(`connecting`),et(`whatsapp`,t)):(I(`connecting`),et(L,t))}catch(e){K(e.message||`Error al conectar`)}finally{we(!1)}},rt=async()=>{if(e?.id){De(!0);try{if(Pe.trim().length>10&&(e.type===`telegram`||e.type===`discord`)){let t={botToken:Pe.trim()};await h(e.id,t)}await r(e.id,J),e.type===`whatsapp`&&await v(`/api/channels/whatsapp/${e.id}/config`,{method:`PUT`,body:{selfMessagesOnly:Re,acceptGroups:Be,dmPolicy:He,allowFrom:X,reconnectMaxAttempts:qe,reconnectBaseDelayMs:Ye}}),n()}catch(e){console.error(`Save failed`,e)}finally{De(!1)}}},$=()=>{Q(),n()},it=L===`whatsapp`||L===`webchat`||L===`telegram`&&R.trim().length>10||L===`discord`&&R.trim().length>10&&B.trim().length>0||L===`slack`&&R.trim().length>10&&pe.trim().length>10,at=()=>F===`reconnect`?(0,j.jsxs)(`div`,{className:`space-y-4 py-2`,children:[G&&(0,j.jsxs)(ae,{variant:`destructive`,className:`bg-red-500/10 border-red-500/30`,children:[(0,j.jsx)(i,{className:`h-4 w-4`}),(0,j.jsx)(ie,{children:G})]}),(0,j.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,j.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,j.jsx)(`p`,{className:`text-xs ${Z?`text-blue-200/70`:`text-amber-200/70`}`,children:Z?L===`whatsapp`?`Haz clic en Conectar para generar el código QR.`:L===`webchat`?`Haz clic en Conectar para activar el canal web.`:`Ingresa las credenciales para activar este canal.`:L===`whatsapp`?`Haz clic en Reconectar para generar un nuevo código QR.`:L===`webchat`?`Haz clic en Reconectar para activar el canal.`:`Puedes reconectar con las credenciales existentes o ingresar un nuevo token.`})]}),(L===`telegram`||L===`discord`)&&(0,j.jsxs)(`div`,{className:`space-y-3`,children:[(0,j.jsx)(`p`,{className:`text-[10px] text-white/30 uppercase tracking-widest`,children:Z?`Credenciales`:`Actualizar credenciales (opcional)`}),(0,j.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,j.jsx)(C,{className:`text-xs text-white/50`,children:`Bot Token`}),(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(_,{type:H?`text`:`password`,value:R,onChange:e=>z(e.target.value),placeholder:Z?L===`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,j.jsx)(`button`,{type:`button`,onClick:()=>_e(e=>!e),className:`absolute right-2 top-1/2 -translate-y-1/2 text-white/40 hover:text-white/70`,children:H?(0,j.jsx)(o,{className:`h-4 w-4`}):(0,j.jsx)(s,{className:`h-4 w-4`})})]})]}),L===`discord`&&(0,j.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,j.jsx)(C,{className:`text-xs text-white/50`,children:`Application ID`}),(0,j.jsx)(_,{value:B,onChange:e=>V(e.target.value),placeholder:Z?`123456789012345678`:`Dejar vacío para usar el actual`,className:`bg-white/5 border-white/10 font-mono text-sm`})]})]})]}):F===`type`?(0,j.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,j.jsx)(`p`,{className:`text-sm text-white/50`,children:`Selecciona el tipo de canal a conectar:`}),(0,j.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,j.jsxs)(`button`,{onClick:()=>fe(e.id),className:`p-4 rounded-xl border text-left transition-all duration-200 ${L===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,j.jsx)(`div`,{className:`text-2xl mb-1`,children:e.icon}),(0,j.jsx)(`div`,{className:`text-sm font-semibold`,children:e.label})]},e.id))})]}):F===`credentials`?(0,j.jsxs)(`div`,{className:`space-y-4 py-2`,children:[G&&(0,j.jsxs)(ae,{variant:`destructive`,className:`bg-red-500/10 border-red-500/30`,children:[(0,j.jsx)(i,{className:`h-4 w-4`}),(0,j.jsx)(ie,{children:G})]}),L===`whatsapp`&&(0,j.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.`}),L===`webchat`&&(0,j.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.`}),(L===`telegram`||L===`discord`||L===`slack`)&&(0,j.jsxs)(`div`,{className:`space-y-3`,children:[(0,j.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,j.jsx)(C,{className:`text-xs text-white/50 uppercase tracking-widest`,children:`Bot Token`}),(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(_,{type:H?`text`:`password`,value:R,onChange:e=>z(e.target.value),placeholder:L===`telegram`?`123456789:AAF...`:L===`slack`?`xoxb-...`:`MTA5NDY...`,className:`bg-white/5 border-white/10 pr-10 font-mono text-sm`}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>_e(e=>!e),className:`absolute right-2 top-1/2 -translate-y-1/2 text-white/40 hover:text-white/70`,children:H?(0,j.jsx)(o,{className:`h-4 w-4`}):(0,j.jsx)(s,{className:`h-4 w-4`})})]})]}),L===`discord`&&(0,j.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,j.jsx)(C,{className:`text-xs text-white/50 uppercase tracking-widest`,children:`Application ID`}),(0,j.jsx)(_,{value:B,onChange:e=>V(e.target.value),placeholder:`123456789012345678`,className:`bg-white/5 border-white/10 font-mono text-sm`})]}),L===`slack`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,j.jsx)(C,{className:`text-xs text-white/50 uppercase tracking-widest`,children:`Signing Secret`}),(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(_,{type:he?`text`:`password`,value:pe,onChange:e=>me(e.target.value),placeholder:`a1b2c3d4e5f6...`,className:`bg-white/5 border-white/10 pr-10 font-mono text-sm`}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>ge(e=>!e),className:`absolute right-2 top-1/2 -translate-y-1/2 text-white/40 hover:text-white/70`,children:he?(0,j.jsx)(o,{className:`h-4 w-4`}):(0,j.jsx)(s,{className:`h-4 w-4`})})]})]}),(0,j.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,j.jsx)(`span`,{className:`font-mono`,children:`https://tu-url/slack/events`})]})]})]})]}):F===`connecting`?(0,j.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-8`,children:[(0,j.jsx)(`div`,{className:`relative`,children:(0,j.jsx)(`div`,{className:`h-16 w-16 rounded-full border-2 border-white/10 flex items-center justify-center`,children:(0,j.jsx)(c,{className:`h-8 w-8 animate-spin text-blue-400`})})}),(0,j.jsx)(`p`,{className:`text-sm text-white/60 text-center`,children:L===`whatsapp`?`Iniciando WhatsApp... Generando código QR`:`Conectando canal...`}),(0,j.jsx)(`p`,{className:`text-xs text-white/30`,children:`Esto puede tardar unos segundos`})]}):F===`qr`?(0,j.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-4`,children:[(0,j.jsxs)(`div`,{className:`relative`,children:[be?(0,j.jsx)(Ce,{data:be}):(0,j.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-6`,children:[(0,j.jsx)(oe,{className:`h-16 w-16 text-white/20`}),(0,j.jsx)(`p`,{className:`text-xs text-white/40`,children:`Generando QR...`})]}),xe&&(0,j.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,j.jsx)(c,{className:`h-8 w-8 animate-spin text-amber-400`}),(0,j.jsx)(`p`,{className:`text-xs text-amber-300 font-medium`,children:`QR expirado, renovando...`})]})]}),(0,j.jsx)(`div`,{className:`flex items-center gap-2 text-xs text-white/30`,children:xe?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-amber-400 animate-pulse`}),`Renovando código QR...`]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse`}),`Esperando escaneo...`]})}),(0,j.jsx)(`p`,{className:`text-[11px] text-white/30 text-center`,children:`Abre WhatsApp → Ajustes → Dispositivos vinculados → Vincular dispositivo`})]}):F===`success`?(0,j.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-8`,children:[(0,j.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,j.jsx)(a,{className:`h-8 w-8 text-emerald-400`})}),(0,j.jsxs)(`div`,{className:`text-center`,children:[(0,j.jsx)(`p`,{className:`text-sm font-semibold text-white`,children:`Canal conectado`}),(0,j.jsxs)(`p`,{className:`text-xs text-white/40 mt-1`,children:[L.charAt(0).toUpperCase()+L.slice(1),` está activo y listo para recibir mensajes.`]})]})]}):null,ot=()=>(0,j.jsxs)(`div`,{className:`grid gap-4 py-4`,children:[e?.type===`whatsapp`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`space-y-2 pb-2 border-b border-white/10`,children:[(0,j.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,j.jsx)(C,{className:`text-xs text-white/50 uppercase tracking-widest`,children:`Número Vinculado`})}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-white/5 border border-white/10`,children:[(0,j.jsx)(`span`,{className:`font-mono text-sm text-white/70`,children:e.accountId?`+${e.accountId}`:`No conectado`}),(0,j.jsx)(`span`,{className:`text-[10px] text-white/40 ml-auto`,children:e.status===`connected`?`✓`:`sin conexión`})]})]}),(0,j.jsxs)(`div`,{className:`space-y-3 pb-2 border-b border-white/10`,children:[(0,j.jsx)(`p`,{className:`text-xs font-bold uppercase tracking-widest text-green-400`,children:`Recepción de Mensajes`}),(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,j.jsx)(C,{className:`text-xs text-white/60`,children:`Solo mensajes propios`}),(0,j.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Solo se procesan los mensajes enviados por la propia cuenta`})]}),(0,j.jsx)(k,{checked:Re,onCheckedChange:ze})]}),(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,j.jsx)(C,{className:`text-xs text-white/60`,children:`Aceptar mensajes de grupo`}),(0,j.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Procesar mensajes provenientes de conversaciones grupales`})]}),(0,j.jsx)(k,{checked:Be,onCheckedChange:Ve})]}),!Re&&(0,j.jsxs)(`div`,{className:`space-y-2 animate-in fade-in slide-in-from-top-1 duration-200`,children:[(0,j.jsx)(C,{className:`text-xs text-white/60 uppercase tracking-widest`,children:`Política de DM (WhatsApp)`}),(0,j.jsxs)(O,{value:He,onValueChange:e=>Ue(e),children:[(0,j.jsx)(E,{className:`bg-white/5 border-white/10`,children:(0,j.jsx)(D,{})}),(0,j.jsxs)(T,{children:[(0,j.jsx)(w,{value:`open`,children:(0,j.jsxs)(`div`,{className:`flex flex-col`,children:[(0,j.jsx)(`span`,{children:`Abierto`}),(0,j.jsx)(`span`,{className:`text-[10px] text-white/30`,children:`Cualquiera puede iniciar chat`})]})}),(0,j.jsx)(w,{value:`allowlist`,children:(0,j.jsxs)(`div`,{className:`flex flex-col`,children:[(0,j.jsx)(`span`,{children:`Lista permitida`}),(0,j.jsx)(`span`,{className:`text-[10px] text-white/30`,children:`Solo números autorizados`})]})}),(0,j.jsx)(w,{value:`pairing`,children:(0,j.jsxs)(`div`,{className:`flex flex-col`,children:[(0,j.jsx)(`span`,{children:`Emparejamiento`}),(0,j.jsx)(`span`,{className:`text-[10px] text-white/30`,children:`Requiere vinculación manual`})]})})]})]}),(He===`allowlist`||He===`pairing`)&&(0,j.jsxs)(`div`,{className:`space-y-2 animate-in fade-in slide-in-from-top-1 duration-200`,children:[(0,j.jsx)(C,{className:`text-xs text-white/60 uppercase tracking-widest`,children:`Números permitidos`}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(_,{value:Ge,onChange:e=>Ke(e.target.value),placeholder:`Ej. +521234567890`,className:`bg-white/5 border-white/10 font-mono text-sm`,onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault();let t=Ge.trim();t&&!X.includes(t)&&(We(e=>[...e,t]),Ke(``))}}}),(0,j.jsx)(y,{type:`button`,variant:`ghost`,size:`sm`,disabled:!Ge.trim(),onClick:()=>{let e=Ge.trim();e&&!X.includes(e)&&(We(t=>[...t,e]),Ke(``))},className:`h-9 w-9 p-0 shrink-0 hover:bg-blue-500/10`,children:(0,j.jsx)(l,{className:`h-4 w-4`})})]}),X.length>0?(0,j.jsx)(`div`,{className:`space-y-1.5`,children:X.map(e=>(0,j.jsxs)(`div`,{className:`flex items-center justify-between h-9 px-3 rounded-lg bg-white/5 border border-white/10`,children:[(0,j.jsx)(`span`,{className:`text-sm font-mono font-medium`,children:e}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>We(t=>t.filter(t=>t!==e)),className:`text-white/30 hover:text-red-400 transition-colors`,children:(0,j.jsx)(g,{className:`h-3.5 w-3.5`})})]},e))}):(0,j.jsx)(`p`,{className:`text-[10px] text-white/30 italic`,children:`No hay números en la lista permitida`})]})]})]}),(0,j.jsxs)(`div`,{className:`space-y-3 pb-2 border-b border-white/10`,children:[(0,j.jsx)(`p`,{className:`text-xs font-bold uppercase tracking-widest text-amber-400`,children:`Reconexión`}),(0,j.jsxs)(`div`,{className:`grid grid-cols-4 items-center gap-4`,children:[(0,j.jsx)(C,{className:`text-right text-xs`,children:`Intentos máx.`}),(0,j.jsx)(_,{type:`number`,min:0,value:qe,onChange:e=>Je(parseInt(e.target.value,10)||0),className:`col-span-3 bg-white/5 border-white/10 text-sm`})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-4 items-center gap-4`,children:[(0,j.jsx)(C,{className:`text-right text-xs`,children:`Retardo base (ms)`}),(0,j.jsx)(_,{type:`number`,min:0,value:Ye,onChange:e=>Xe(parseInt(e.target.value,10)||0),className:`col-span-3 bg-white/5 border-white/10 text-sm`})]}),(0,j.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Backoff exponencial usando el retardo base configurado.`})]})]}),(e?.type===`telegram`||e?.type===`discord`)&&(0,j.jsxs)(`div`,{className:`space-y-2 pb-2 border-b border-white/10`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(C,{className:`text-xs text-white/50 uppercase tracking-widest`,children:`Bot Token`}),!Me&&(0,j.jsx)(`button`,{type:`button`,onClick:()=>Ne(!0),className:`text-[11px] text-blue-400 hover:text-blue-300 transition-colors`,children:`Cambiar token`})]}),Me?(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(_,{type:Ie?`text`:`password`,value:Pe,onChange:e=>Fe(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,j.jsx)(`button`,{type:`button`,onClick:()=>Le(e=>!e),className:`absolute right-2 top-1/2 -translate-y-1/2 text-white/40 hover:text-white/70`,children:Ie?(0,j.jsx)(o,{className:`h-4 w-4`}):(0,j.jsx)(s,{className:`h-4 w-4`})})]}),(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[(0,j.jsx)(`button`,{type:`button`,onClick:()=>{Ne(!1),Fe(``),Le(!1)},className:`text-[11px] text-white/40 hover:text-white/60 transition-colors`,children:`Cancelar`}),Pe.trim().length>0&&(0,j.jsx)(`span`,{className:`text-[11px] text-amber-400/70`,children:`Se aplicará al guardar`})]})]}):(0,j.jsx)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-white/5 border border-white/10`,children:(0,j.jsx)(`span`,{className:`font-mono text-sm text-white/30 tracking-widest select-none`,children:`••••••••••••••••••••••••`})})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-4 items-center gap-4`,children:[(0,j.jsx)(C,{className:`text-right text-xs`,children:`Voz (STT)`}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2 col-span-3`,children:[(0,j.jsx)(k,{checked:J.voice_enabled,onCheckedChange:e=>Y(t=>({...t,voice_enabled:e}))}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Procesar notas de voz`})]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-4 items-center gap-4`,children:[(0,j.jsx)(C,{className:`text-right text-xs`,children:`TTS`}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2 col-span-3`,children:[(0,j.jsx)(k,{checked:J.tts_enabled,onCheckedChange:e=>Y(t=>({...t,tts_enabled:e}))}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Responder por voz`})]})]}),J.voice_enabled&&(0,j.jsxs)(`div`,{className:`grid grid-cols-4 items-center gap-4`,children:[(0,j.jsx)(C,{className:`text-right text-xs`,children:`Modelo STT`}),(0,j.jsxs)(O,{value:J.stt_provider||``,onValueChange:e=>Y(t=>({...t,stt_provider:e})),children:[(0,j.jsx)(E,{className:`col-span-3`,children:(0,j.jsx)(D,{placeholder:`Selecciona modelo STT`})}),(0,j.jsx)(T,{children:le.map(e=>(0,j.jsx)(w,{value:e.id,children:e.name},e.id))})]})]}),J.tts_enabled&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-4 items-center gap-4`,children:[(0,j.jsx)(C,{className:`text-right text-xs`,children:`Modelo TTS`}),(0,j.jsxs)(O,{value:J.tts_provider||``,onValueChange:e=>Y(t=>({...t,tts_provider:e,tts_voice_id:``})),children:[(0,j.jsx)(E,{className:`col-span-3`,children:(0,j.jsx)(D,{placeholder:`Selecciona modelo TTS`})}),(0,j.jsx)(T,{children:ue.map(e=>(0,j.jsxs)(re,{children:[(0,j.jsx)(ne,{children:e.group}),e.models.map(e=>(0,j.jsx)(w,{value:e.id,children:e.name},e.id))]},e.provider))})]})]}),J.tts_provider&&(0,j.jsxs)(`div`,{className:`grid grid-cols-4 items-center gap-4`,children:[(0,j.jsx)(C,{className:`text-right text-xs`,children:`Voz`}),(0,j.jsxs)(O,{value:J.tts_voice_id||``,onValueChange:e=>Y(t=>({...t,tts_voice_id:e})),disabled:Ae||Oe.length===0,children:[(0,j.jsx)(E,{className:`col-span-3`,children:(0,j.jsx)(D,{placeholder:Ae?`Cargando...`:`Selecciona una voz`})}),(0,j.jsx)(T,{children:Oe.map(e=>(0,j.jsx)(w,{value:e.id,children:e.name},e.id))})]})]}),!M.elevenlabs&&!M.openai&&!M.gemini&&!M.qwen&&!M.piper&&(0,j.jsxs)(ae,{variant:`destructive`,className:`bg-yellow-500/10 border-yellow-500/30 text-yellow-200`,children:[(0,j.jsx)(i,{className:`h-4 w-4`}),(0,j.jsxs)(ie,{className:`text-yellow-200/80`,children:[`Configura un provider TTS.`,` `,(0,j.jsx)(`button`,{className:`underline`,onClick:()=>{n(),f(`/settings/voz`)},children:`Ir a Configuración de Voz`})]})]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-4 items-center gap-4`,children:[(0,j.jsx)(C,{className:`text-right text-xs`,children:`Entrega`}),(0,j.jsxs)(O,{value:J.step_delivery_mode,onValueChange:e=>Y(t=>({...t,step_delivery_mode:e})),children:[(0,j.jsx)(E,{className:`col-span-3`,children:(0,j.jsx)(D,{placeholder:`Modo de entrega`})}),(0,j.jsxs)(T,{children:[(0,j.jsx)(w,{value:`new_messages`,children:`Solo Mensajes Nuevos`}),(0,j.jsx)(w,{value:`all`,children:`Todo (Sincronización)`})]})]})]}),(0,j.jsxs)(`div`,{className:`pt-4 mt-2 border-t border-white/5 space-y-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,j.jsx)(C,{className:`text-xs font-bold uppercase tracking-wider text-blue-400`,children:`Visión / Multimodal`}),(0,j.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Procesamiento de imágenes y documentos`})]}),(0,j.jsx)(k,{checked:J.vision_enabled,onCheckedChange:e=>Y(t=>({...t,vision_enabled:e}))})]}),J.vision_enabled&&(0,j.jsxs)(`div`,{className:`grid grid-cols-4 items-center gap-4 animate-in fade-in slide-in-from-top-1 duration-200`,children:[(0,j.jsx)(C,{className:`text-right text-xs`,children:`OCR Fallback`}),(0,j.jsxs)(O,{value:J.ocr_provider||``,onValueChange:e=>Y(t=>({...t,ocr_provider:e})),children:[(0,j.jsx)(E,{className:`col-span-3`,children:(0,j.jsx)(D,{placeholder:`Selecciona provider de OCR`})}),(0,j.jsx)(T,{children:Se.map(e=>(0,j.jsx)(w,{value:e.id,children:e.name},e.id))})]}),(0,j.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.`})]})]})]}),st=L===`whatsapp`||L===`webchat`||!Z||L===`telegram`&&R.trim().length>10||L===`discord`&&R.trim().length>10&&B.trim().length>0;return t?(0,j.jsx)(`div`,{className:`fixed inset-0 z-[9999] bg-black/80 flex items-center justify-center`,onClick:$,children:(0,j.jsxs)(`div`,{className:`relative w-full max-w-[480px] mx-4 hive-card border-white/10 overflow-hidden`,onClick:e=>e.stopPropagation(),children:[(0,j.jsx)(`button`,{onClick:$,className:`absolute right-4 top-4 z-10 text-white/40 hover:text-white transition-colors`,children:(0,j.jsx)(g,{className:`h-4 w-4`})}),(0,j.jsxs)(`div`,{className:`p-6 border-b border-white/5 bg-white/5 relative overflow-hidden`,children:[(0,j.jsx)(`div`,{className:`hive-glow-blob hive-glow-blob--blue -top-10 -right-10 h-32 w-32 opacity-20`}),(0,j.jsxs)(`h2`,{className:`text-xl font-black text-white uppercase tracking-tighter relative z-10 flex items-center gap-2`,children:[(0,j.jsx)(d,{className:`h-4 w-4 text-blue-400`}),{type:`Nuevo Canal`,credentials:`Conectar ${L.charAt(0).toUpperCase()+L.slice(1)}`,reconnect:Z?`Configurar ${L.charAt(0).toUpperCase()+L.slice(1)}`:`Reconectar ${L.charAt(0).toUpperCase()+L.slice(1)}`,connecting:`Conectando...`,qr:`Escanea el código QR`,success:`¡Canal conectado!`,settings:`Configurar ${e?.type??`canal`}`}[F]??`Nuevo Canal`]}),(0,j.jsx)(`p`,{className:`text-xs text-white/40 font-medium mt-1 relative z-10`,children:F===`settings`?`Ajusta el comportamiento y las opciones de voz del canal.`:F===`qr`?`Abre WhatsApp en tu teléfono y escanea el código para vincular el dispositivo.`:F===`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,j.jsx)(`div`,{className:`p-6`,children:e&&F===`settings`?ot():at()}),(0,j.jsx)(`div`,{className:`p-6 pt-4 flex gap-2`,children:e&&F===`settings`?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(y,{variant:`outline`,onClick:$,disabled:Ee,children:`Cancelar`}),(0,j.jsx)(y,{onClick:rt,disabled:Ee,children:Ee?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c,{className:`h-4 w-4 animate-spin mr-2`}),`Guardando...`]}):`Guardar Cambios`})]}):F===`reconnect`?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(y,{variant:`outline`,onClick:$,children:`Cancelar`}),(0,j.jsx)(y,{onClick:tt,disabled:q||!st,children:q?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c,{className:`h-4 w-4 animate-spin mr-2`}),`Conectando...`]}):Z?`Conectar`:`Reconectar`})]}):F===`type`?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(y,{variant:`outline`,onClick:$,children:`Cancelar`}),(0,j.jsx)(y,{onClick:()=>I(`credentials`),children:`Siguiente →`})]}):F===`credentials`?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(y,{variant:`outline`,onClick:()=>I(`type`),children:`← Atrás`}),(0,j.jsx)(y,{onClick:nt,disabled:q||!it,children:q?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c,{className:`h-4 w-4 animate-spin mr-2`}),`Conectando...`]}):`Conectar`})]}):F===`connecting`?(0,j.jsx)(y,{variant:`outline`,onClick:$,children:`Cancelar`}):F===`qr`?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(y,{variant:`outline`,size:`sm`,onClick:()=>{ve&&et(L,ve)},children:[(0,j.jsx)(u,{className:`h-3.5 w-3.5 mr-2`}),`Actualizar QR`]}),(0,j.jsx)(y,{variant:`outline`,onClick:$,children:`Cancelar`})]}):F===`success`?(0,j.jsx)(y,{onClick:$,children:`Cerrar`}):null})]})}):null}function q(){let{channels:e,activeChannels:t,fetchChannels:n,isLoading:r,toggleChannel:i,updateChannel:a}=b(),[o,s]=(0,A.useState)(`all`),[c,d]=(0,A.useState)(null),[p,h]=(0,A.useState)(!1);(0,A.useEffect)(()=>{n()},[]);let g=(0,A.useMemo)(()=>o===`all`?e:o===`active`?e.filter(e=>e.active):o===`inactive`?e.filter(e=>!e.active):e,[e,o]),_=e=>{d(e),h(!0)},v=()=>{d(null),h(!0)};return(0,j.jsxs)(`div`,{className:`hive-page-container animate-fade-in mt-10`,children:[(0,j.jsx)(`div`,{className:`hive-page-header`,children:(0,j.jsxs)(`div`,{className:`flex flex-col md:flex-row md:items-center justify-between gap-6`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,j.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,j.jsx)(m,{className:`h-6 w-6`})}),(0,j.jsx)(`h1`,{className:`text-3xl font-black text-white uppercase tracking-tighter`,children:`Canales`})]}),(0,j.jsx)(`p`,{className:`hive-subtitle`,children:`Gestiona tus puntos de entrada y salida de comunicación en la red Hive.`})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsxs)(`button`,{onClick:()=>n(),disabled:r,className:`hive-btn hive-btn--ghost px-6 text-[10px]`,children:[(0,j.jsx)(u,{className:`h-3.5 w-3.5 mr-2 ${r?`animate-spin`:``}`}),`SINCRONIZAR`]}),(0,j.jsxs)(`button`,{onClick:v,className:`hive-btn hive-btn--primary px-8 text-[10px]`,children:[(0,j.jsx)(l,{className:`h-3.5 w-3.5 mr-2`}),`NUEVO CANAL`]})]})]})}),(0,j.jsxs)(`div`,{className:`hive-card border-blue-500/10 !bg-blue-500/[0.02] mb-8 overflow-hidden relative`,children:[(0,j.jsxs)(`div`,{className:`hive-card-body py-4 px-6 flex items-center justify-between relative z-10`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,j.jsx)(`div`,{className:`h-8 w-8 rounded-lg bg-blue-500/10 flex items-center justify-center text-blue-400`,children:(0,j.jsx)(f,{className:`h-4 w-4`})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`text-[10px] font-black tracking-widest text-blue-500/50 uppercase`,children:`Estado Operativo`}),(0,j.jsxs)(`p`,{className:`text-xs text-white/60`,children:[`Actualmente tienes `,(0,j.jsx)(`span`,{className:`text-blue-400 font-black`,children:t.length}),` canales procesando datos.`]})]})]}),(0,j.jsx)(`div`,{className:`text-[10px] text-white/20 font-black tracking-widest uppercase`,children:`HIVE NODE SECURE`})]}),(0,j.jsx)(`div`,{className:`hive-glow-blob hive-glow-blob--blue -top-10 -right-10 h-32 w-32 opacity-10`})]}),(0,j.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,j.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,j.jsx)(`div`,{className:`animate-fade-in`,children:g.length>0?(0,j.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6`,children:g.map(e=>(0,j.jsx)(M,{channel:e,onEdit:_,onToggle:i},e.id))}):(0,j.jsx)(`div`,{className:`hive-card border-dashed border-white/10 bg-white/[0.02]`,children:(0,j.jsxs)(`div`,{className:`hive-card-body flex flex-col items-center justify-center py-20 px-4`,children:[(0,j.jsx)(`div`,{className:`h-20 w-20 rounded-2xl bg-white/5 flex items-center justify-center mb-6`,children:(0,j.jsx)(m,{className:`h-10 w-10 text-white/10`})}),(0,j.jsxs)(`div`,{className:`text-center`,children:[(0,j.jsx)(`p`,{className:`hive-title-section text-center mb-2`,children:`No se detectaron canales`}),(0,j.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,j.jsx)(`button`,{onClick:v,className:`hive-btn hive-btn--primary px-10 text-[10px]`,children:`ESTABLECER CONEXIÓNHORA`})]})]})})}),(0,j.jsx)(K,{channel:c,isOpen:p,onClose:()=>h(!1),onSave:async(e,t)=>{await a(e,t)}})]})}export{q as ChannelsPage};
@@ -0,0 +1,6 @@
1
+ import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,c as n,f as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"./vendor-charts-K3xcRl0X.js";import{_ as f,d as p,f as m,g as h,h as g,m as _,p as v,u as y}from"./vendor-radix-D0s_k6Gp.js";import{i as b,n as x,o as ee,t as te}from"./vendor-query-Dj8xYhQD.js";import{t as S}from"./activity-CQuPevhB.js";import{t as C}from"./arrow-up-right-DQQCY007.js";import{t as ne}from"./circle-check-BJWNbLuF.js";import{t as w}from"./download-CiQqqXyz.js";import{t as re}from"./external-link-0iNNBvZm.js";import{t as ie}from"./gauge-BRGwuN8G.js";import{t as ae}from"./info-mpk1tsNC.js";import{t as T}from"./loader-circle-BhqRN2nO.js";import{t as oe}from"./triangle-alert-B04mgMcg.js";import{t as E}from"./zap-DT7cM7YS.js";import{t as D}from"./utils-Dyb7SC2_.js";import{A as se,B as ce,E as le,K as O,R as k,W as A,_ as ue,f as j,k as de,m as M,t as fe,z as pe}from"./index-Bejlp-R1.js";import{t as me}from"./useOfficeModel-Cy7cAyEn.js";import{t as N}from"./badge-DKGZbVZJ.js";import{a as P,i as F,n as I,r as he,t as L}from"./card-D3Nw3kh3.js";import{t as ge}from"./progress-DrI2UDu-.js";var _e=O(`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`}]]),R=O(`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`}]]),ve=O(`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`}]]),ye=O(`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`}]]),be=O(`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`}]]),xe=O(`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`}]]),z=e(r(),1);function Se(){let{agents:e,isLoading:t,error:n,fetchAgents:r,createAgent:i,updateAgent:a,deleteAgent:o}=fe(),[s,c]=(0,z.useState)(`all`);return(0,z.useEffect)(()=>{r()},[r]),{agents:(0,z.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 B=ee();function V(e){return e<50?`#22c55e`:e<80?`#eab308`:`#ef4444`}function Ce(){let[e,n]=(0,z.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,o]=(0,z.useState)([]),{data:s}=x({queryKey:[`system-stats`],queryFn:()=>j(`/api/system-stats`),refetchInterval:5e3}),l=(0,z.useRef)(s);(0,z.useEffect)(()=>{l.current=s},[s]),(0,z.useEffect)(()=>{let e=setInterval(()=>{let e=l.current;if(!e)return;let t=new Date().toLocaleTimeString(`es`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`});n(n=>[...n,{time:t,msgs:e.recentMessages,rss:e.memory.rss}].slice(-20))},5e3);return()=>clearInterval(e)},[]);let d=s?.memory.rss??0,f=s?.memory.heapUsed??0,p=s?.memory.external??0,m=s?.recentMessages??0;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4 mb-4`,children:[(0,B.jsxs)(L,{className:`overflow-hidden border-primary/10`,children:[(0,B.jsx)(F,{className:`pb-2 bg-gradient-to-r from-primary/5 to-transparent`,children:(0,B.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,B.jsxs)(P,{className:`text-base flex items-center gap-2`,children:[(0,B.jsx)(ie,{className:`h-4 w-4 text-primary`}),`Monitor del Proceso Hive`]})})}),(0,B.jsxs)(I,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-5 pt-4`,children:[(0,B.jsx)(H,{icon:E,label:`CPU del proceso`,value:`${s?.cpu??0}%`,subValue:`${s?.cores??1} núcleos disponibles`,color:V(s?.cpu??0),progress:Math.min(100,s?.cpu??0)}),(0,B.jsx)(H,{icon:pe,label:`Actividad reciente`,value:`${m}`,subValue:`mensajes últimos 5 min`,color:m>0?`#22c55e`:`hsl(var(--muted-foreground))`,progress:Math.min(100,m*10)}),(0,B.jsx)(H,{icon:ve,label:`Memoria Hive (RSS)`,value:`${d} MB`,subValue:`Heap JS: ${f} MB usados`,color:V(Math.min(100,Math.round(d/1024*100))),progress:Math.min(100,Math.round(d/1024*100))}),(0,B.jsx)(H,{icon:be,label:`Heap JS`,value:`${f} MB`,subValue:`External: ${p} MB`,color:`#3b82f6`,progress:Math.min(100,Math.round(f/512*100))}),(0,B.jsx)(H,{icon:k,label:`Sesiones WS activas`,value:`${s?.connections??0}`,subValue:`conexiones WebSocket`,color:`#a855f7`,progress:Math.min(100,(s?.connections??0)*10)})]})]}),(0,B.jsxs)(L,{className:`border-primary/10`,children:[(0,B.jsx)(F,{className:`pb-2`,children:(0,B.jsxs)(P,{className:`text-sm flex items-center gap-2`,children:[(0,B.jsx)(S,{className:`h-4 w-4 text-primary`}),`Historial — `,(0,B.jsx)(`span`,{className:`text-green-400`,children:`Mensajes`}),` · `,(0,B.jsx)(`span`,{className:`text-purple-400`,children:`RSS MB`})]})}),(0,B.jsx)(I,{className:`h-[160px]`,children:(0,B.jsx)(a,{width:`100%`,height:`100%`,children:(0,B.jsxs)(u,{data:e,children:[(0,B.jsxs)(`defs`,{children:[(0,B.jsxs)(`linearGradient`,{id:`gMsgs`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,B.jsx)(`stop`,{offset:`5%`,stopColor:`#22c55e`,stopOpacity:.3}),(0,B.jsx)(`stop`,{offset:`95%`,stopColor:`#22c55e`,stopOpacity:0})]}),(0,B.jsxs)(`linearGradient`,{id:`gHeap`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,B.jsx)(`stop`,{offset:`5%`,stopColor:`#8b5cf6`,stopOpacity:.3}),(0,B.jsx)(`stop`,{offset:`95%`,stopColor:`#8b5cf6`,stopOpacity:0})]})]}),(0,B.jsx)(i,{dataKey:`time`,axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:9},interval:`preserveStartEnd`}),(0,B.jsx)(c,{axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:9}}),(0,B.jsx)(t,{type:`monotone`,dataKey:`msgs`,stroke:`#22c55e`,strokeWidth:2,fillOpacity:1,fill:`url(#gMsgs)`,name:`Mensajes`}),(0,B.jsx)(t,{type:`monotone`,dataKey:`rss`,stroke:`#8b5cf6`,strokeWidth:2,fillOpacity:1,fill:`url(#gHeap)`,name:`RSS MB`})]})})})]})]})}function H({icon:e,label:t,value:n,subValue:r,color:i,progress:a}){return(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3 space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{style:{color:i},children:(0,B.jsx)(e,{className:`h-4 w-4`})}),(0,B.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:t})]}),(0,B.jsx)(`span`,{className:`text-lg font-bold font-mono`,style:{color:i},children:n})]}),(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsx)(`div`,{className:`h-1.5 w-full rounded-full bg-muted overflow-hidden`,children:(0,B.jsx)(`div`,{className:`h-full rounded-full transition-all duration-500`,style:{width:`${Math.min(a,100)}%`,backgroundColor:i}})}),(0,B.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r})]})]})}var U={anthropic:`#d97706`,openai:`#10b981`,google:`#3b82f6`,gemini:`#3b82f6`,deepseek:`#8b5cf6`,kimi:`#ec4899`,ollama:`#14b8a6`,openrouter:`#f59e0b`,mistral:`#6366f1`};function W(e){return e>=1e6?(e/1e6).toFixed(2)+`M`:e>=1e3?(e/1e3).toFixed(1)+`K`:e.toString()}function G(e){return e>=1?`$`+e.toFixed(2):e>=.01?`$`+e.toFixed(3):e>0?`$`+e.toFixed(5):`$0.00`}function K(e){return e>=10?e.toFixed(1)+`%`:e>=1?e.toFixed(2)+`%`:e>0?e.toFixed(3)+`%`:`0%`}function we(){let[e,t]=(0,z.useState)(24),{data:r,isLoading:s}=x({queryKey:[`usage-stats`,e],queryFn:async()=>await j(`/api/usage-stats?hours=${e}`),refetchInterval:6e4});if(s&&!r)return(0,B.jsxs)(L,{className:`border-primary/10`,children:[(0,B.jsx)(F,{children:(0,B.jsxs)(P,{className:`flex items-center gap-2`,children:[(0,B.jsx)(R,{className:`h-5 w-5 text-primary`}),`Uso y Costos de API`]})}),(0,B.jsx)(I,{children:(0,B.jsx)(`div`,{className:`h-40 flex items-center justify-center text-muted-foreground animate-pulse`,children:`Cargando estadísticas de uso...`})})]});let u=r&&(r.totalTokens>0||r.totalCostUsd>0),f=r?Object.entries(r.byProvider).map(([e,t])=>({name:e.charAt(0).toUpperCase()+e.slice(1),value:t.tokens,cost:t.costUsd,color:U[e.toLowerCase()]||`#6b7280`})):[],p=r?Object.entries(r.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,B.jsxs)(L,{className:`border-primary/10`,children:[(0,B.jsx)(F,{className:`pb-2`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(P,{className:`text-base flex items-center gap-2`,children:[(0,B.jsx)(R,{className:`h-5 w-5 text-primary`}),`Uso y Costos de API`]}),(0,B.jsx)(he,{children:`Tokens consumidos y costos por provider/modelo`})]}),(0,B.jsx)(`div`,{className:`flex gap-1`,children:[6,24,168].map(n=>(0,B.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,B.jsxs)(I,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`rounded-lg border p-3 ${r?.toonSavedTokens?`border-emerald-500/30 bg-emerald-500/5`:`bg-card/50`}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,B.jsx)(E,{className:`h-3 w-3 ${r?.toonSavedTokens?`text-emerald-400`:``}`}),(0,B.jsx)(`span`,{className:`font-medium`,children:`TOON Optimización de Tokens`})]}),r?.toonSavingsPercent&&r.toonSavingsPercent>0?(0,B.jsxs)(`span`,{className:`text-xs font-bold text-emerald-400`,children:[K(r.toonSavingsPercent),` reducción`]}):null]}),(0,B.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 md:grid-cols-4 gap-3`,children:[(0,B.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Tokens Ahorrados`}),(0,B.jsx)(`div`,{className:`text-lg font-bold ${r?.toonSavedTokens?`text-emerald-400`:`text-muted-foreground`}`,children:r?W(r.toonSavedTokens):`—`})]}),(0,B.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Costo Ahorrado`}),(0,B.jsx)(`div`,{className:`text-lg font-bold text-emerald-400`,children:r?G(r.toonSavedCost):`—`})]}),(0,B.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Bytes Ahorrados`}),(0,B.jsx)(`div`,{className:`text-lg font-bold text-emerald-400`,children:r&&r.toonSavedBytes>0?W(r.toonSavedBytes):`—`})]}),(0,B.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Reducción Bytes`}),(0,B.jsx)(`div`,{className:`text-lg font-bold text-emerald-400`,children:r?.toonSavedBytesPercent&&r.toonSavedBytesPercent>0?K(r.toonSavedBytesPercent):`—`})]})]}),r&&(r.toonJsonTokens>0||r.toonToonTokens>0)&&(0,B.jsx)(`div`,{className:`mt-3 pt-3 border-t border-emerald-500/20`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`JSON:`}),` `,(0,B.jsx)(`span`,{className:`font-medium`,children:r.toonJsonTokens>0?W(r.toonJsonTokens):`—`}),` `,(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`tokens`})]}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[(0,B.jsx)(`span`,{className:`text-emerald-400`,children:`TOON:`}),` `,(0,B.jsx)(`span`,{className:`font-medium text-emerald-400`,children:r.toonToonTokens>0?W(r.toonToonTokens):`—`}),` `,(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`tokens`})]})]}),r?.toonSavingsPercent&&r.toonSavingsPercent>0?(0,B.jsxs)(`span`,{className:`text-xs font-bold text-emerald-400`,children:[K(r.toonSavingsPercent),` menos tokens`]}):null]})}),r&&!r.toonSavedTokens&&(0,B.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground italic`,children:`Sin optimizaciones TOON registradas aún`})]}),u?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,B.jsx)(R,{className:`h-3 w-3`}),`Costo Total`]}),(0,B.jsx)(`div`,{className:`text-2xl font-bold text-green-500`,children:G(r.totalCostUsd)})]}),(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,B.jsx)(ye,{className:`h-3 w-3`}),`Total Tokens`]}),(0,B.jsx)(`div`,{className:`text-2xl font-bold`,children:W(r.totalTokens)})]}),(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,B.jsx)(xe,{className:`h-3 w-3`}),`Input / Output`]}),(0,B.jsxs)(`div`,{className:`text-lg font-semibold`,children:[(0,B.jsx)(`span`,{className:`text-blue-500`,children:W(r.totalInputTokens)}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:` / `}),(0,B.jsx)(`span`,{className:`text-purple-500`,children:W(r.totalOutputTokens)})]})]}),(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,B.jsx)(k,{className:`h-3 w-3`}),`Providers`]}),(0,B.jsx)(`div`,{className:`text-2xl font-bold`,children:Object.keys(r.byProvider).length})]})]}),(0,B.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h4`,{className:`text-sm font-medium mb-2 flex items-center gap-2`,children:[(0,B.jsx)(k,{className:`h-4 w-4 text-muted-foreground`}),`Por Provider`]}),(0,B.jsx)(`div`,{className:`h-[180px]`,children:(0,B.jsx)(a,{width:`100%`,height:`100%`,children:(0,B.jsxs)(o,{data:f,layout:`vertical`,children:[(0,B.jsx)(i,{type:`number`,hide:!0}),(0,B.jsx)(c,{type:`category`,dataKey:`name`,axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:11},width:70}),(0,B.jsx)(d,{contentStyle:{backgroundColor:`hsl(var(--card))`,border:`1px solid hsl(var(--border))`,borderRadius:`8px`},formatter:(e,t)=>[t===`cost`?G(e):W(e),t===`cost`?`Costo`:`Tokens`]}),(0,B.jsx)(l,{dataKey:`value`,radius:[0,4,4,0],barSize:16,children:f.map(e=>(0,B.jsx)(n,{fill:e.color},e.name))})]})})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h4`,{className:`text-sm font-medium mb-2 flex items-center gap-2`,children:[(0,B.jsx)(A,{className:`h-4 w-4 text-muted-foreground`}),`Por Modelo (Top 8)`]}),(0,B.jsx)(`div`,{className:`h-[180px]`,children:(0,B.jsx)(a,{width:`100%`,height:`100%`,children:(0,B.jsxs)(o,{data:p,children:[(0,B.jsx)(i,{dataKey:`name`,axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:10},angle:-45,textAnchor:`end`,height:60}),(0,B.jsx)(c,{axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:10}}),(0,B.jsx)(d,{contentStyle:{backgroundColor:`hsl(var(--card))`,border:`1px solid hsl(var(--border))`,borderRadius:`8px`},formatter:e=>G(e),labelFormatter:e=>p.find(t=>t.name===e)?.fullName||e}),(0,B.jsx)(l,{dataKey:`cost`,radius:[4,4,0,0],children:p.map(e=>(0,B.jsx)(n,{fill:U[e.fullName.split(`-`)[0]?.toLowerCase()]||`#6b7280`},e.fullName))})]})})})]})]}),f.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h4`,{className:`text-sm font-medium mb-2`,children:`Detalle por Provider`}),(0,B.jsx)(`div`,{className:`rounded-lg border overflow-hidden`,children:(0,B.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,B.jsx)(`thead`,{className:`bg-muted/50`,children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{className:`text-left p-2 font-medium`,children:`Provider`}),(0,B.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Input`}),(0,B.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Output`}),(0,B.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Total`}),(0,B.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Costo`})]})}),(0,B.jsx)(`tbody`,{children:Object.entries(r.byProvider).map(([e,t])=>(0,B.jsxs)(`tr`,{className:`border-t`,children:[(0,B.jsx)(`td`,{className:`p-2 font-medium`,children:e}),(0,B.jsx)(`td`,{className:`p-2 text-right text-blue-500`,children:W(t.inputTokens)}),(0,B.jsx)(`td`,{className:`p-2 text-right text-purple-500`,children:W(t.outputTokens)}),(0,B.jsx)(`td`,{className:`p-2 text-right`,children:W(t.tokens)}),(0,B.jsx)(`td`,{className:`p-2 text-right font-medium text-green-500`,children:G(t.costUsd)})]},e))})]})})]})]}):(0,B.jsx)(`div`,{className:`h-32 flex items-center justify-center text-muted-foreground`,children:(0,B.jsxs)(`div`,{className:`text-center`,children:[(0,B.jsx)(S,{className:`h-8 w-8 mx-auto mb-2 opacity-50`}),(0,B.jsx)(`p`,{children:`No hay datos de uso aún`}),(0,B.jsx)(`p`,{className:`text-xs`,children:`Los tokens se registrarán automáticamente`})]})})]})]})}var Te=h,Ee=g,De=z.forwardRef(({className:e,...t},n)=>(0,B.jsx)(_,{className:D(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));De.displayName=_.displayName;var q=z.forwardRef(({className:e,...t},n)=>(0,B.jsxs)(Ee,{children:[(0,B.jsx)(De,{}),(0,B.jsx)(m,{ref:n,className:D(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...t})]}));q.displayName=m.displayName;var J=({className:e,...t})=>(0,B.jsx)(`div`,{className:D(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});J.displayName=`AlertDialogHeader`;var Y=({className:e,...t})=>(0,B.jsx)(`div`,{className:D(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Y.displayName=`AlertDialogFooter`;var X=z.forwardRef(({className:e,...t},n)=>(0,B.jsx)(f,{ref:n,className:D(`text-lg font-semibold`,e),...t}));X.displayName=f.displayName;var Z=z.forwardRef(({className:e,...t},n)=>(0,B.jsx)(v,{ref:n,className:D(`text-sm text-muted-foreground`,e),...t}));Z.displayName=v.displayName;var Q=z.forwardRef(({className:e,...t},n)=>(0,B.jsx)(y,{ref:n,className:D(se(),e),...t}));Q.displayName=y.displayName;var $=z.forwardRef(({className:e,...t},n)=>(0,B.jsx)(p,{ref:n,className:D(se({variant:`outline`}),`mt-2 sm:mt-0`,e),...t}));$.displayName=p.displayName;function Oe(){let[e,t]=(0,z.useState)(!1),[n,r]=(0,z.useState)(0),[i,a]=(0,z.useState)([]),o=b(),{data:s,isLoading:c}=x({queryKey:[`version-check`],queryFn:()=>j(`/api/version`),refetchInterval:3e5,retry:2}),l=te({mutationFn:()=>j(`/api/update`,{method:`POST`,showLoader:`Actualizando Hive...`}),onSuccess:e=>{r(100),e.success?(a(e.instructions||[]),M.fire({title:`¡Actualización Completada!`,text:e.message||`Hive ha sido actualizado exitosamente.`,icon:`success`,confirmButtonText:`Continuar`})):(e.instructions&&a(e.instructions),M.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)},f=e=>{switch(e){case`docker`:return`Docker`;case`binary`:return`Binario`;case`npm`:return`npm`;case`bun`:return`Bun`;default:return`Desconocida`}},p=()=>{if(!s)return null;switch(s.status){case`up-to-date`:return(0,B.jsxs)(N,{variant:`outline`,className:`flex items-center gap-1 bg-green-500/10 text-green-400 border-green-500/20`,children:[(0,B.jsx)(ne,{className:`h-3 w-3`}),`Actualizado`]});case`update-available`:return(0,B.jsxs)(N,{className:`flex items-center gap-1 bg-blue-500 text-white border-blue-400 hover:bg-blue-600`,children:[(0,B.jsx)(_e,{className:`h-3 w-3`}),`v`,s.latest,` disponible`]});case`checking`:return(0,B.jsxs)(N,{variant:`outline`,className:`flex items-center gap-1`,children:[(0,B.jsx)(T,{className:`h-3 w-3 animate-spin`}),`Verificando...`]});case`error`:return(0,B.jsxs)(N,{variant:`destructive`,className:`flex items-center gap-1`,children:[(0,B.jsx)(oe,{className:`h-3 w-3`}),`Error`]})}},m=s?.status===`update-available`;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[(0,B.jsx)(`span`,{className:`hive-label mb-1`,children:`Versión`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p(),s&&(0,B.jsxs)(`span`,{className:`text-xs text-white/40 font-mono`,children:[`v`,s.current,` · `,f(s.installationType)]})]})]}),m&&(0,B.jsx)(de,{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,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(T,{className:`h-4 w-4 mr-2 animate-spin`}),`Actualizando...`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(w,{className:`h-4 w-4 mr-2`}),`Actualizar a v`,s.latest]})}),(0,B.jsx)(Te,{open:e,onOpenChange:t,children:(0,B.jsxs)(q,{children:[(0,B.jsxs)(J,{children:[(0,B.jsxs)(X,{className:`flex items-center gap-2`,children:[(0,B.jsx)(w,{className:`h-5 w-5 text-blue-500`}),`Actualizar Hive`]}),(0,B.jsxs)(Z,{className:`space-y-3`,children:[(0,B.jsxs)(`p`,{children:[`Se ha detectado una nueva versión disponible (`,(0,B.jsxs)(`strong`,{children:[`v`,s?.latest]}),`). Tu versión actual es `,(0,B.jsxs)(`strong`,{children:[`v`,s?.current]}),`.`]}),(0,B.jsx)(`div`,{className:`bg-muted p-3 rounded-lg space-y-2`,children:(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,B.jsx)(ae,{className:`h-4 w-4 text-blue-500 mt-0.5`}),(0,B.jsxs)(`div`,{className:`text-sm`,children:[(0,B.jsxs)(`p`,{className:`font-semibold mb-1`,children:[`Tipo de instalación: `,f(s?.installationType)]}),s?.installationType===`docker`&&(0,B.jsx)(`p`,{className:`text-muted-foreground`,children:`Para Docker, deberás ejecutar manualmente los comandos en tu terminal.`}),s?.installationType===`binary`&&(0,B.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,B.jsx)(`p`,{className:`text-muted-foreground`,children:`La actualización se realizará automáticamente. Deberás reiniciar el gateway después.`})]})]})}),l.isPending&&(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,B.jsx)(`span`,{children:`Progreso de actualización...`}),(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[n,`%`]})]}),(0,B.jsx)(ge,{value:n,className:`h-2`})]})]})]}),(0,B.jsxs)(Y,{children:[(0,B.jsx)($,{disabled:l.isPending,children:`Cancelar`}),(0,B.jsx)(Q,{onClick:d,disabled:l.isPending,className:`bg-blue-600 hover:bg-blue-700`,children:l.isPending?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(T,{className:`h-4 w-4 mr-2 animate-spin`}),`Actualizando...`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(w,{className:`h-4 w-4 mr-2`}),`Confirmar actualización`]})})]})]})}),i.length>0&&(0,B.jsx)(Te,{open:!0,onOpenChange:()=>a([]),children:(0,B.jsxs)(q,{children:[(0,B.jsxs)(J,{children:[(0,B.jsx)(X,{children:`Instrucciones de Actualización`}),(0,B.jsxs)(Z,{className:`space-y-3`,children:[(0,B.jsx)(`p`,{children:`Sigue estos pasos para completar la actualización:`}),(0,B.jsx)(`ol`,{className:`list-decimal list-inside space-y-2 bg-muted p-4 rounded-lg`,children:i.map((e,t)=>(0,B.jsx)(`li`,{className:`text-sm`,children:e},t))}),(0,B.jsxs)(`div`,{className:`flex items-start gap-2 text-xs text-muted-foreground`,children:[(0,B.jsx)(re,{className:`h-4 w-4 mt-0.5`}),(0,B.jsx)(`p`,{children:`Después de completar los pasos, recarga esta página para ver la nueva versión.`})]})]})]}),(0,B.jsx)(Y,{children:(0,B.jsx)(Q,{children:`Entendido`})})]})})]})}function ke({icon:e,...t}){return(0,B.jsx)(e,{...t})}var Ae={"harmful_count exceeded helpful_count":`más resultados dañinos que útiles en sus verificaciones`};function je(e){return e?Ae[e]??e:`revisión pendiente`}function Me(){let{status:e}=le(),{allAgents:r}=Se(),f=ue(e=>e.graphNodes),{data:p}=x({queryKey:[`system-stats`],queryFn:()=>j(`/api/system-stats`),refetchInterval:5e3}),{data:m=[]}=x({queryKey:[`activity-stats`],queryFn:()=>j(`/api/activity-stats?hours=12`),refetchInterval:6e4}),{data:h=[]}=x({queryKey:[`agent-proposals`],queryFn:()=>j(`/api/agents/proposals`).then(e=>e.proposals),refetchInterval:3e4}),g=(0,z.useMemo)(()=>r||[],[r]),{desks:_}=me((0,z.useMemo)(()=>g.filter(e=>e.source===`catalog`),[g]),f),v=_.filter(e=>e.state===`thinking`||e.state===`tool_call`).length,y=[{label:`Agentes Activos`,value:g.length,icon:A,color:`text-blue-500`,trend:`${v} trabajando`},{label:`Sesiones Canvas`,value:p?.connections??0,icon:ce,color:`text-orange-500`,trend:`Live`},{label:`Mensajes / 1h`,value:m.at(-1)?.count??0,icon:S,color:`text-green-500`,trend:`Última hora`}],b=(0,z.useMemo)(()=>{let e=_.filter(e=>e.state===`idle`).length,t=_.filter(e=>e.state===`stuck`).length,n=_.filter(e=>e.state===`disabled`).length;return[{name:`Idle`,value:e,color:`hsl(var(--muted))`},{name:`Trabajando`,value:v,color:`hsl(var(--primary))`},...t>0?[{name:`Atascado`,value:t,color:`#ef4444`}]:[],...n>0?[{name:`Deshabilitado`,value:n,color:`hsl(var(--muted-foreground))`}]:[]].filter(e=>e.value>0||e.name===`Idle`)},[_,v]),ee=m.reduce((e,t)=>e+t.count,0);return(0,B.jsxs)(`div`,{className:`hive-page-container`,children:[(0,B.jsxs)(`div`,{className:`hive-page-header`,children:[(0,B.jsxs)(`div`,{className:`relative z-10`,children:[(0,B.jsxs)(`div`,{className:`hive-page-header__eyebrow`,children:[(0,B.jsx)(`div`,{className:`hive-page-header__dot`}),(0,B.jsx)(`span`,{className:`hive-page-header__label`,children:`SISTEMA OPERATIVO HIVE`})]}),(0,B.jsxs)(`h2`,{className:`hive-title-page`,children:[`Centro de `,(0,B.jsx)(`span`,{className:`hive-title-page__accent`,children:`Control`})]}),(0,B.jsx)(`p`,{className:`hive-subtitle`,children:`Monitoreo en tiempo real del enjambre y estado de los nodos cognitivos.`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-6 relative z-10`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col items-end`,children:[(0,B.jsx)(`span`,{className:`hive-label mb-1`,children:`Estado Hive`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`div`,{className:e===`connected`?`hive-status-dot--active`:`hive-status-dot--disabled`}),(0,B.jsx)(`span`,{className:e===`connected`?`hive-status-label--active`:`hive-status-label--disabled`,children:e===`connected`?`EN LÍNEA`:`DESCONECTADO`})]})]}),(0,B.jsx)(`div`,{className:`h-10 w-px bg-white/10 hidden sm:block`}),(0,B.jsx)(Oe,{})]})]}),(0,B.jsx)(`div`,{className:`grid gap-6 sm:grid-cols-2 lg:grid-cols-3 mb-8`,children:y.map(e=>(0,B.jsxs)(`div`,{className:`hive-card hive-card--active group`,children:[(0,B.jsxs)(`div`,{className:`hive-card-body`,children:[(0,B.jsxs)(`div`,{className:`flex flex-row items-center justify-between mb-4`,children:[(0,B.jsx)(`span`,{className:`hive-title-section`,children:e.label}),(0,B.jsx)(`div`,{className:`p-2 rounded-lg bg-white/5 border border-white/5`,children:(0,B.jsx)(ke,{icon:e.icon,className:`h-4 w-4 ${e.color}`})})]}),(0,B.jsxs)(`div`,{className:`flex items-end justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-3xl font-black text-white group-hover:text-blue-400 transition-colors`,children:e.value}),(0,B.jsxs)(`p`,{className:`text-[10px] font-bold text-white/30 uppercase tracking-widest mt-1 flex items-center gap-1`,children:[(0,B.jsx)(C,{className:`h-2.5 w-2.5 text-green-500`}),e.trend]})]}),(0,B.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,B.jsx)(C,{className:`h-4 w-4 text-blue-400`})})]})]}),(0,B.jsx)(`div`,{className:`hive-strip--bottom`})]},e.label))}),(0,B.jsx)(Ce,{}),(0,B.jsx)(we,{}),(0,B.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-3 mb-8`,children:[(0,B.jsx)(`div`,{className:`lg:col-span-2 hive-card`,children:(0,B.jsxs)(`div`,{className:`hive-card-body !pb-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-6`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`hive-title-section`,children:`Actividad del Enjambre`}),(0,B.jsxs)(`p`,{className:`text-[10px] text-white/40 uppercase tracking-widest font-bold`,children:[`Últimas 12 horas · `,ee,` mensajes`]})]}),(0,B.jsx)(S,{className:`h-5 w-5 text-blue-500 animate-pulse shadow-blue-glow`})]}),(0,B.jsx)(`div`,{className:`h-[280px] w-full`,children:m.length>0?(0,B.jsx)(a,{width:`100%`,height:`100%`,children:(0,B.jsxs)(u,{data:m,children:[(0,B.jsx)(`defs`,{children:(0,B.jsxs)(`linearGradient`,{id:`colorCount`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,B.jsx)(`stop`,{offset:`5%`,stopColor:`#3b82f6`,stopOpacity:.2}),(0,B.jsx)(`stop`,{offset:`95%`,stopColor:`#3b82f6`,stopOpacity:0})]})}),(0,B.jsx)(s,{strokeDasharray:`3 3`,vertical:!1,stroke:`rgba(255,255,255,0.05)`}),(0,B.jsx)(i,{dataKey:`time`,axisLine:!1,tickLine:!1,tick:{fill:`rgba(255,255,255,0.3)`,fontSize:10,fontWeight:`bold`}}),(0,B.jsx)(c,{axisLine:!1,tickLine:!1,tick:{fill:`rgba(255,255,255,0.3)`,fontSize:10,fontWeight:`bold`},allowDecimals:!1}),(0,B.jsx)(d,{contentStyle:{backgroundColor:`#09090b`,borderRadius:`12px`,border:`1px solid rgba(255,255,255,0.1)`,color:`#fff`},itemStyle:{color:`#3b82f6`},formatter:e=>[e,`Mensajes`]}),(0,B.jsx)(t,{type:`monotone`,dataKey:`count`,stroke:`#3b82f6`,strokeWidth:4,fillOpacity:1,fill:`url(#colorCount)`})]})}):(0,B.jsx)(`div`,{className:`h-full flex items-center justify-center text-white/30 text-sm`,children:`Cargando actividad...`})})]})}),(0,B.jsx)(`div`,{className:`hive-card`,children:(0,B.jsxs)(`div`,{className:`hive-card-body`,children:[(0,B.jsx)(`h3`,{className:`hive-title-section mb-6`,children:`Salud del Enjambre`}),(0,B.jsx)(`div`,{className:`h-[210px]`,children:b.length>0?(0,B.jsx)(a,{width:`100%`,height:`100%`,children:(0,B.jsxs)(o,{data:b,layout:`vertical`,children:[(0,B.jsx)(i,{type:`number`,hide:!0,allowDecimals:!1}),(0,B.jsx)(c,{dataKey:`name`,type:`category`,axisLine:!1,tickLine:!1,tick:{fill:`rgba(255,255,255,0.5)`,fontSize:10,fontWeight:`bold`},width:70}),(0,B.jsx)(d,{cursor:{fill:`rgba(255,255,255,0.02)`}}),(0,B.jsx)(l,{dataKey:`value`,radius:[0,8,8,0],barSize:16,children:b.map(e=>(0,B.jsx)(n,{fill:e.color},e.name))})]})}):(0,B.jsx)(`div`,{className:`h-full flex items-center justify-center text-white/30 text-sm`,children:`Sin agentes configurados`})}),(0,B.jsxs)(`div`,{className:`mt-4 pt-4 border-t border-white/5 grid grid-cols-2 gap-4`,children:[(0,B.jsxs)(`div`,{className:`hive-stat`,children:[(0,B.jsx)(`span`,{className:`hive-stat__label`,children:`Necesitan atención`}),(0,B.jsx)(`span`,{className:`hive-stat__value hive-stat__value--active`,style:h.length>0?{color:`#ef4444`}:void 0,children:h.length})]}),(0,B.jsxs)(`div`,{className:`hive-stat`,children:[(0,B.jsx)(`span`,{className:`hive-stat__label`,children:`Uptime`}),(0,B.jsx)(`span`,{className:`hive-stat__value hive-stat__value--active`,children:p?.uptime??`—`})]})]}),h.length>0&&(0,B.jsx)(`div`,{className:`mt-3 pt-3 border-t border-white/5 space-y-1.5`,children:h.map(e=>(0,B.jsxs)(`div`,{className:`flex items-baseline gap-1.5 text-[10px]`,title:e.reason??void 0,children:[(0,B.jsx)(`span`,{className:`text-red-400`,children:`●`}),(0,B.jsx)(`span`,{className:`text-white/70 font-bold truncate`,children:e.agentName}),(0,B.jsxs)(`span`,{className:`text-white/30 truncate`,children:[`— `,je(e.reason)]})]},e.id))})]})})]})]})}export{Me as DashboardPage};
@@ -1 +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-Df8o0tkC.js";import{t as a}from"./loader-circle-BmBOgYze.js";import{c as o}from"./vendor-router-gqiZ7xhx.js";import{A as s,j as c}from"./index-Cyw7L0Li.js";import{t as l}from"./label-B_15zZlR.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};
1
+ import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{o as n}from"./vendor-query-Dj8xYhQD.js";import{n as r,t as i}from"./eye-C8sKSSkg.js";import{t as a}from"./loader-circle-BhqRN2nO.js";import{c as o}from"./vendor-router-zpB-76nT.js";import{O as s,k as c}from"./index-Bejlp-R1.js";import{t as l}from"./label-k0jYxoWW.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};