@agentprojectcontext/apx 1.77.3 → 1.79.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 (356) hide show
  1. package/README.md +23 -9
  2. package/package.json +12 -12
  3. package/src/core/agent/build-agent-system.js +3 -2
  4. package/src/core/agent/constants.js +3 -2
  5. package/src/core/agent/loop/greeting-guard.js +55 -0
  6. package/src/core/agent/loop/side-effects.js +52 -0
  7. package/src/core/agent/prompt-builder.js +49 -8
  8. package/src/core/agent/run-agent.js +43 -53
  9. package/src/core/agent/security.js +1 -1
  10. package/src/core/agent/self-memory.js +4 -2
  11. package/src/core/agent/skills/index-store.js +2 -2
  12. package/src/core/agent/skills/loader.js +3 -22
  13. package/src/core/agent/super-agent.js +0 -2
  14. package/src/core/agent/tool-summary.js +65 -0
  15. package/src/core/agent/tools/handlers/call-runtime.js +4 -4
  16. package/src/core/agent/tools/handlers/list-commitments.js +80 -0
  17. package/src/core/agent/tools/handlers/list-tasks.js +66 -27
  18. package/src/core/agent/tools/handlers/record-commitment.js +68 -0
  19. package/src/core/agent/tools/handlers/search-sessions.js +1 -1
  20. package/src/core/agent/tools/handlers/send-telegram.js +68 -2
  21. package/src/core/agent/tools/handlers/set-permission-mode.js +11 -4
  22. package/src/core/agent/tools/names.js +64 -0
  23. package/src/core/agent/tools/registry.js +9 -0
  24. package/src/core/agent/tools/tool-call-parser.js +70 -1
  25. package/src/core/apc/context-copy.js +1 -1
  26. package/src/core/apc/frontmatter.js +85 -0
  27. package/src/core/apc/parser.js +9 -21
  28. package/src/core/apc/paths.js +8 -8
  29. package/src/core/apc/scaffold.js +5 -4
  30. package/src/core/channels/telegram/ask-callbacks.js +35 -0
  31. package/src/core/channels/telegram/config.js +201 -0
  32. package/src/core/channels/telegram/dispatch.js +3 -0
  33. package/src/core/channels/telegram/reply.js +30 -5
  34. package/src/core/config/index.js +25 -183
  35. package/src/core/config/paths.js +57 -1
  36. package/src/core/config/redact.js +22 -0
  37. package/src/core/confirmation/adapters/web.js +1 -1
  38. package/src/core/daemon/service.js +238 -0
  39. package/src/core/deck/manifest.js +12 -12
  40. package/src/core/desktop/autostart.js +3 -2
  41. package/src/core/desktop/process.js +4 -4
  42. package/src/core/engines/gemini.js +322 -60
  43. package/src/core/engines/openai-compatible.js +21 -2
  44. package/src/core/engines/presets.js +2 -2
  45. package/src/core/http-tools/browser.js +1 -1
  46. package/src/core/http-tools/catalog.js +551 -0
  47. package/src/core/http-tools/fetch.js +1 -1
  48. package/src/core/http-tools/glob.js +3 -3
  49. package/src/core/http-tools/grep.js +2 -9
  50. package/src/core/http-tools/inline-handlers.js +59 -0
  51. package/src/core/http-tools/registry.js +31 -615
  52. package/src/core/http-tools/search.js +2 -2
  53. package/src/core/identity/self.js +6 -7
  54. package/src/core/identity/telegram.js +3 -3
  55. package/src/core/logging.js +6 -5
  56. package/src/core/mcp/sources.js +12 -16
  57. package/src/core/memory/consolidate.js +225 -0
  58. package/src/core/memory/indexer.js +2 -5
  59. package/src/core/nudge/index.js +192 -0
  60. package/src/core/nudge/policy.js +143 -0
  61. package/src/core/nudge/store.js +141 -0
  62. package/src/core/profiles/bundled/secretary/PROFILE.md +8 -9
  63. package/src/core/profiles/bundled/secretary/config.schema.json +33 -3
  64. package/src/core/profiles/bundled/secretary/routines/day-close.json +7 -3
  65. package/src/core/profiles/bundled/secretary/routines/day-open.json +7 -3
  66. package/src/core/profiles/bundled/secretary/routines/watch.json +13 -0
  67. package/src/core/profiles/lifecycle.js +0 -2
  68. package/src/core/profiles/store.js +2 -7
  69. package/src/core/routines/runner.js +103 -4
  70. package/src/core/routines/signals.js +270 -0
  71. package/src/core/runtime-skills/apx-agency-agents/SKILL.md +2 -2
  72. package/src/core/runtime-skills/apx-profile/SKILL.md +3 -3
  73. package/src/core/runtime-skills/apx-project/SKILL.md +1 -1
  74. package/src/core/runtime-skills/apx-task/SKILL.md +8 -8
  75. package/src/core/runtime-skills/apx-telegram/SKILL.md +4 -4
  76. package/src/core/runtime-skills/apx-voice/SKILL.md +4 -4
  77. package/src/core/runtimes/detect.js +2 -2
  78. package/src/core/sessions/index.js +800 -0
  79. package/src/core/stores/code-sessions.js +3 -14
  80. package/src/core/stores/commitments.js +331 -0
  81. package/src/core/stores/engine-sessions.js +0 -4
  82. package/src/core/stores/messages.js +4 -5
  83. package/src/core/stores/organization.js +9 -11
  84. package/src/core/stores/routines.js +23 -14
  85. package/src/core/stores/runtime-callbacks.js +2 -1
  86. package/src/core/util/json-file.js +128 -0
  87. package/src/core/util/thinking.js +51 -0
  88. package/src/core/vars/sources.js +14 -21
  89. package/src/core/voice/stt-models.js +1 -1
  90. package/src/core/voice/tts.js +5 -4
  91. package/src/host/daemon/api/admin-config.js +5 -5
  92. package/src/host/daemon/api/admin.js +8 -7
  93. package/src/host/daemon/api/agents.js +16 -16
  94. package/src/host/daemon/api/artifact-preview.js +8 -8
  95. package/src/host/daemon/api/artifacts.js +7 -7
  96. package/src/host/daemon/api/code.js +8 -8
  97. package/src/host/daemon/api/commitments.js +135 -0
  98. package/src/host/daemon/api/config.js +6 -6
  99. package/src/host/daemon/api/confirm.js +2 -2
  100. package/src/host/daemon/api/connections.js +2 -2
  101. package/src/host/daemon/api/conversations.js +12 -12
  102. package/src/host/daemon/api/deck.js +6 -6
  103. package/src/host/daemon/api/desktop.js +8 -8
  104. package/src/host/daemon/api/embeddings.js +4 -4
  105. package/src/host/daemon/api/engines.js +8 -7
  106. package/src/host/daemon/api/exec.js +5 -4
  107. package/src/host/daemon/api/files-project.js +6 -6
  108. package/src/host/daemon/api/health.js +2 -2
  109. package/src/host/daemon/api/identity.js +3 -3
  110. package/src/host/daemon/api/inbox.js +2 -2
  111. package/src/host/daemon/api/integrations.js +23 -19
  112. package/src/host/daemon/api/mcps.js +16 -12
  113. package/src/host/daemon/api/messages.js +5 -5
  114. package/src/host/daemon/api/nudges.js +112 -0
  115. package/src/host/daemon/api/organization.js +8 -8
  116. package/src/host/daemon/api/pairing.js +6 -6
  117. package/src/host/daemon/api/plugins.js +3 -3
  118. package/src/host/daemon/api/prefix.js +20 -0
  119. package/src/host/daemon/api/profiles.js +9 -9
  120. package/src/host/daemon/api/projects.js +5 -5
  121. package/src/host/daemon/api/routines.js +32 -8
  122. package/src/host/daemon/api/run.js +2 -2
  123. package/src/host/daemon/api/runtimes.js +6 -6
  124. package/src/host/daemon/api/self-memory.js +50 -0
  125. package/src/host/daemon/api/sessions-search.js +18 -11
  126. package/src/host/daemon/api/sessions.js +6 -6
  127. package/src/host/daemon/api/shared.js +59 -13
  128. package/src/host/daemon/api/skills.js +12 -12
  129. package/src/host/daemon/api/super-agent.js +4 -4
  130. package/src/host/daemon/api/tasks.js +11 -11
  131. package/src/host/daemon/api/telegram.js +61 -24
  132. package/src/host/daemon/api/tools.js +7 -7
  133. package/src/host/daemon/api/top-level.js +7 -7
  134. package/src/host/daemon/api/transcribe.js +6 -6
  135. package/src/host/daemon/api/tts.js +3 -3
  136. package/src/host/daemon/api/vars.js +11 -8
  137. package/src/host/daemon/api/voice.js +9 -7
  138. package/src/host/daemon/api/web.js +28 -32
  139. package/src/host/daemon/api.js +83 -48
  140. package/src/host/daemon/callback-reconciler.js +16 -0
  141. package/src/host/daemon/db.js +1 -1
  142. package/src/host/daemon/desktop-ws.js +7 -3
  143. package/src/host/daemon/index.js +11 -5
  144. package/src/host/daemon/plugins/desktop/index.js +8 -2
  145. package/src/host/daemon/plugins/telegram/index.js +7 -2
  146. package/src/host/daemon/stt-venv.js +20 -81
  147. package/src/host/daemon/wakeup.js +18 -4
  148. package/src/interfaces/acp/index.js +3 -3
  149. package/src/interfaces/acp/session.js +2 -2
  150. package/src/interfaces/cli/commands/a2a.js +2 -2
  151. package/src/interfaces/cli/commands/agent.js +3 -3
  152. package/src/interfaces/cli/commands/artifact.js +13 -13
  153. package/src/interfaces/cli/commands/chat.js +3 -3
  154. package/src/interfaces/cli/commands/command.js +2 -2
  155. package/src/interfaces/cli/commands/commitment.js +154 -0
  156. package/src/interfaces/cli/commands/config.js +4 -4
  157. package/src/interfaces/cli/commands/daemon.js +74 -18
  158. package/src/interfaces/cli/commands/desktop.js +7 -14
  159. package/src/interfaces/cli/commands/exec.js +2 -2
  160. package/src/interfaces/cli/commands/log.js +3 -4
  161. package/src/interfaces/cli/commands/mcp.js +9 -9
  162. package/src/interfaces/cli/commands/memory.js +75 -2
  163. package/src/interfaces/cli/commands/messages.js +5 -5
  164. package/src/interfaces/cli/commands/model.js +0 -18
  165. package/src/interfaces/cli/commands/nudge.js +130 -0
  166. package/src/interfaces/cli/commands/obsidian.js +5 -5
  167. package/src/interfaces/cli/commands/org.js +5 -5
  168. package/src/interfaces/cli/commands/pair.js +6 -6
  169. package/src/interfaces/cli/commands/plugins.js +2 -2
  170. package/src/interfaces/cli/commands/profile.js +10 -10
  171. package/src/interfaces/cli/commands/project-config.js +6 -6
  172. package/src/interfaces/cli/commands/project.js +10 -10
  173. package/src/interfaces/cli/commands/routine.js +8 -9
  174. package/src/interfaces/cli/commands/runtime.js +2 -2
  175. package/src/interfaces/cli/commands/search.js +0 -1
  176. package/src/interfaces/cli/commands/session.js +12 -40
  177. package/src/interfaces/cli/commands/sessions.js +21 -798
  178. package/src/interfaces/cli/commands/setup.js +16 -6
  179. package/src/interfaces/cli/commands/skills.js +1 -2
  180. package/src/interfaces/cli/commands/status.js +3 -3
  181. package/src/interfaces/cli/commands/task.js +8 -8
  182. package/src/interfaces/cli/commands/telegram.js +21 -21
  183. package/src/interfaces/cli/commands/voice.js +6 -6
  184. package/src/interfaces/cli/help/index.js +2245 -0
  185. package/src/interfaces/cli/http.js +9 -4
  186. package/src/interfaces/cli/index.js +14 -2857
  187. package/src/interfaces/cli/routes/acp.js +13 -0
  188. package/src/interfaces/cli/routes/agent.js +27 -0
  189. package/src/interfaces/cli/routes/artifact.js +28 -0
  190. package/src/interfaces/cli/routes/chat.js +11 -0
  191. package/src/interfaces/cli/routes/code.js +11 -0
  192. package/src/interfaces/cli/routes/command.js +21 -0
  193. package/src/interfaces/cli/routes/commitment.js +19 -0
  194. package/src/interfaces/cli/routes/config.js +16 -0
  195. package/src/interfaces/cli/routes/connections.js +11 -0
  196. package/src/interfaces/cli/routes/conversations.js +21 -0
  197. package/src/interfaces/cli/routes/daemon.js +25 -0
  198. package/src/interfaces/cli/routes/desktop.js +20 -0
  199. package/src/interfaces/cli/routes/env.js +13 -0
  200. package/src/interfaces/cli/routes/exec.js +11 -0
  201. package/src/interfaces/cli/routes/identity.js +11 -0
  202. package/src/interfaces/cli/routes/index.js +75 -0
  203. package/src/interfaces/cli/routes/init.js +11 -0
  204. package/src/interfaces/cli/routes/log.js +20 -0
  205. package/src/interfaces/cli/routes/mcp.js +22 -0
  206. package/src/interfaces/cli/routes/memory.js +19 -0
  207. package/src/interfaces/cli/routes/messages.js +16 -0
  208. package/src/interfaces/cli/routes/model.js +11 -0
  209. package/src/interfaces/cli/routes/nudge.js +17 -0
  210. package/src/interfaces/cli/routes/obsidian.js +17 -0
  211. package/src/interfaces/cli/routes/org.js +34 -0
  212. package/src/interfaces/cli/routes/overlay.js +10 -0
  213. package/src/interfaces/cli/routes/pair.js +17 -0
  214. package/src/interfaces/cli/routes/panel.js +16 -0
  215. package/src/interfaces/cli/routes/permission.js +11 -0
  216. package/src/interfaces/cli/routes/plugins.js +21 -0
  217. package/src/interfaces/cli/routes/profile.js +27 -0
  218. package/src/interfaces/cli/routes/project.js +41 -0
  219. package/src/interfaces/cli/routes/restart.js +15 -0
  220. package/src/interfaces/cli/routes/routine.js +28 -0
  221. package/src/interfaces/cli/routes/run.js +11 -0
  222. package/src/interfaces/cli/routes/search.js +11 -0
  223. package/src/interfaces/cli/routes/send.js +11 -0
  224. package/src/interfaces/cli/routes/session.js +26 -0
  225. package/src/interfaces/cli/routes/sessions.js +15 -0
  226. package/src/interfaces/cli/routes/setup.js +18 -0
  227. package/src/interfaces/cli/routes/skills.js +20 -0
  228. package/src/interfaces/cli/routes/status.js +12 -0
  229. package/src/interfaces/cli/routes/task.js +26 -0
  230. package/src/interfaces/cli/routes/telegram.js +39 -0
  231. package/src/interfaces/cli/routes/update.js +24 -0
  232. package/src/interfaces/cli/routes/voice.js +17 -0
  233. package/src/interfaces/desktop/main.js +6 -7
  234. package/src/interfaces/desktop/renderer.js +0 -5
  235. package/src/interfaces/mcp-server/index.js +15 -14
  236. package/src/interfaces/tui/_shims/globals.d.ts +8 -0
  237. package/src/interfaces/tui/tsconfig.json +4 -1
  238. package/src/interfaces/web/README.md +6 -6
  239. package/src/interfaces/web/dist/assets/index-CvEoGtTf.js +849 -0
  240. package/src/interfaces/web/dist/assets/index-CvEoGtTf.js.map +1 -0
  241. package/src/interfaces/web/dist/assets/index-DzBBXFaO.css +1 -0
  242. package/src/interfaces/web/dist/index.html +2 -2
  243. package/src/interfaces/web/package-lock.json +11 -10
  244. package/src/interfaces/web/src/components/AddProjectDialog.tsx +1 -1
  245. package/src/interfaces/web/src/components/Section.tsx +18 -3
  246. package/src/interfaces/web/src/components/agents/AgentFormFields.tsx +1 -1
  247. package/src/interfaces/web/src/components/chat/ChatList.tsx +2 -2
  248. package/src/interfaces/web/src/components/chat/MessageBubble.tsx +13 -0
  249. package/src/interfaces/web/src/components/chat/SkillPicker.tsx +1 -1
  250. package/src/interfaces/web/src/components/code/CodeFileTree.tsx +1 -1
  251. package/src/interfaces/web/src/components/code/CodeTerminal.tsx +1 -1
  252. package/src/interfaces/web/src/components/cron/CronPicker.tsx +196 -0
  253. package/src/interfaces/web/src/components/desktop/DesktopStatusCard.tsx +1 -1
  254. package/src/interfaces/web/src/components/files/FileBrowser.tsx +2 -2
  255. package/src/interfaces/web/src/components/inbox/InboxList.tsx +145 -0
  256. package/src/interfaces/web/src/components/memory/MemoryBrowser.tsx +36 -6
  257. package/src/interfaces/web/src/components/routines/ExecutionsList.tsx +1 -1
  258. package/src/interfaces/web/src/components/routines/RoutineDetail.tsx +16 -4
  259. package/src/interfaces/web/src/components/routines/RoutineEditor.tsx +14 -4
  260. package/src/interfaces/web/src/components/routines/shared.ts +14 -5
  261. package/src/interfaces/web/src/components/settings/DesktopSettingsPanel.tsx +1 -1
  262. package/src/interfaces/web/src/components/settings/MemoryPanel.tsx +1 -1
  263. package/src/interfaces/web/src/components/settings/NudgePanel.tsx +183 -0
  264. package/src/interfaces/web/src/components/settings/ProfilePanel.tsx +36 -12
  265. package/src/interfaces/web/src/components/settings/SkillsInspectorPanel.tsx +1 -1
  266. package/src/interfaces/web/src/components/settings/SkillsManager.tsx +2 -2
  267. package/src/interfaces/web/src/components/tasks/TaskDetailPanel.tsx +1 -1
  268. package/src/interfaces/web/src/components/ui/filter-chips.tsx +47 -0
  269. package/src/interfaces/web/src/components/ui.tsx +1 -0
  270. package/src/interfaces/web/src/constants/index.ts +1 -0
  271. package/src/interfaces/web/src/hooks/useChat.ts +5 -1
  272. package/src/interfaces/web/src/hooks/useDaemonStatus.ts +1 -1
  273. package/src/interfaces/web/src/hooks/useDevices.ts +1 -1
  274. package/src/interfaces/web/src/hooks/useEngines.ts +1 -1
  275. package/src/interfaces/web/src/hooks/useGlobalConfig.ts +2 -2
  276. package/src/interfaces/web/src/hooks/useIdentity.ts +1 -1
  277. package/src/interfaces/web/src/hooks/useInbox.ts +1 -1
  278. package/src/interfaces/web/src/hooks/useNudges.ts +38 -0
  279. package/src/interfaces/web/src/hooks/useProfiles.ts +3 -3
  280. package/src/interfaces/web/src/hooks/useProjects.ts +1 -1
  281. package/src/interfaces/web/src/hooks/useTelegram.ts +3 -3
  282. package/src/interfaces/web/src/hooks/useTokenBootstrap.ts +3 -3
  283. package/src/interfaces/web/src/i18n/en.ts +127 -0
  284. package/src/interfaces/web/src/i18n/es.ts +127 -0
  285. package/src/interfaces/web/src/lib/api/admin.ts +11 -11
  286. package/src/interfaces/web/src/lib/api/agents.ts +14 -14
  287. package/src/interfaces/web/src/lib/api/artifacts.ts +11 -11
  288. package/src/interfaces/web/src/lib/api/code.ts +1 -1
  289. package/src/interfaces/web/src/lib/api/commitments.ts +57 -0
  290. package/src/interfaces/web/src/lib/api/conversations.ts +8 -8
  291. package/src/interfaces/web/src/lib/api/deck.ts +3 -3
  292. package/src/interfaces/web/src/lib/api/desktop.ts +8 -8
  293. package/src/interfaces/web/src/lib/api/embeddings.ts +3 -3
  294. package/src/interfaces/web/src/lib/api/engines.ts +3 -3
  295. package/src/interfaces/web/src/lib/api/filesystem.ts +2 -2
  296. package/src/interfaces/web/src/lib/api/health.ts +1 -1
  297. package/src/interfaces/web/src/lib/api/identity.ts +2 -2
  298. package/src/interfaces/web/src/lib/api/inbox.ts +1 -1
  299. package/src/interfaces/web/src/lib/api/integrations.ts +8 -8
  300. package/src/interfaces/web/src/lib/api/mcps.ts +6 -6
  301. package/src/interfaces/web/src/lib/api/messages.ts +3 -3
  302. package/src/interfaces/web/src/lib/api/notebook.ts +23 -0
  303. package/src/interfaces/web/src/lib/api/nudges.ts +53 -0
  304. package/src/interfaces/web/src/lib/api/organization.ts +7 -7
  305. package/src/interfaces/web/src/lib/api/profiles.ts +8 -8
  306. package/src/interfaces/web/src/lib/api/projectFiles.ts +5 -5
  307. package/src/interfaces/web/src/lib/api/projects.ts +12 -12
  308. package/src/interfaces/web/src/lib/api/routines.ts +7 -7
  309. package/src/interfaces/web/src/lib/api/sessions.ts +2 -2
  310. package/src/interfaces/web/src/lib/api/skills.ts +11 -11
  311. package/src/interfaces/web/src/lib/api/super_agent.ts +3 -3
  312. package/src/interfaces/web/src/lib/api/tasks.ts +12 -12
  313. package/src/interfaces/web/src/lib/api/telegram.ts +14 -14
  314. package/src/interfaces/web/src/lib/api/tools.ts +1 -1
  315. package/src/interfaces/web/src/lib/api/vars.ts +4 -4
  316. package/src/interfaces/web/src/lib/api/voice.ts +6 -6
  317. package/src/interfaces/web/src/lib/cron.ts +196 -0
  318. package/src/interfaces/web/src/lib/when.ts +32 -0
  319. package/src/interfaces/web/src/screens/InboxScreen.tsx +107 -77
  320. package/src/interfaces/web/src/screens/ProjectScreen.tsx +5 -2
  321. package/src/interfaces/web/src/screens/SettingsScreen.tsx +17 -3
  322. package/src/interfaces/web/src/screens/base/AgentDefaultsTab.tsx +1 -1
  323. package/src/interfaces/web/src/screens/base/CommitmentsTab.tsx +239 -0
  324. package/src/interfaces/web/src/screens/base/GlobalTasksTab.tsx +103 -20
  325. package/src/interfaces/web/src/screens/base/LogsTab.tsx +18 -3
  326. package/src/interfaces/web/src/screens/base/SessionsTab.tsx +1 -1
  327. package/src/interfaces/web/src/screens/modules/CodeScreen.tsx +1 -1
  328. package/src/interfaces/web/src/screens/modules/DeckScreen.tsx +1 -1
  329. package/src/interfaces/web/src/screens/modules/DesktopScreen.tsx +1 -1
  330. package/src/interfaces/web/src/screens/modules/VoiceScreen.tsx +1 -1
  331. package/src/interfaces/web/src/screens/project/AgentDetailScreen.tsx +8 -8
  332. package/src/interfaces/web/src/screens/project/AgentsTab.tsx +2 -2
  333. package/src/interfaces/web/src/screens/project/ChatTab.tsx +24 -6
  334. package/src/interfaces/web/src/screens/project/ConfigTab.tsx +1 -1
  335. package/src/interfaces/web/src/screens/project/McpsTab.tsx +3 -3
  336. package/src/interfaces/web/src/screens/project/Overview.tsx +6 -6
  337. package/src/interfaces/web/src/screens/project/RoutinesTab.tsx +15 -13
  338. package/src/interfaces/web/src/screens/project/StructureTab.tsx +1 -1
  339. package/src/interfaces/web/src/screens/project/TasksTab.tsx +1 -1
  340. package/src/interfaces/web/src/screens/project/VarsTab.tsx +1 -1
  341. package/src/interfaces/web/src/types/daemon.ts +10 -1
  342. package/src/interfaces/web/vite.config.ts +13 -18
  343. package/src/interfaces/web/dist/assets/index-BptlbKjU.js +0 -824
  344. package/src/interfaces/web/dist/assets/index-BptlbKjU.js.map +0 -1
  345. package/src/interfaces/web/dist/assets/index-D_EJEA1n.css +0 -1
  346. package/src/skills/apc-context/SKILL.md +0 -159
  347. /package/src/{host/daemon → core}/runtimes/_spawn.js +0 -0
  348. /package/src/{host/daemon → core}/runtimes/aider.js +0 -0
  349. /package/src/{host/daemon → core}/runtimes/antigravity.js +0 -0
  350. /package/src/{host/daemon → core}/runtimes/claude-code.js +0 -0
  351. /package/src/{host/daemon → core}/runtimes/codex.js +0 -0
  352. /package/src/{host/daemon → core}/runtimes/cursor-agent.js +0 -0
  353. /package/src/{host/daemon → core}/runtimes/gemini-cli.js +0 -0
  354. /package/src/{host/daemon → core}/runtimes/index.js +0 -0
  355. /package/src/{host/daemon → core}/runtimes/opencode.js +0 -0
  356. /package/src/{host/daemon → core}/runtimes/qwen-code.js +0 -0
@@ -0,0 +1,849 @@
1
+ function W5(e,t){for(var a=0;a<t.length;a++){const r=t[a];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const l=Object.getOwnPropertyDescriptor(r,i);l&&Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const l of i)if(l.type==="childList")for(const d of l.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function a(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(i){if(i.ep)return;i.ep=!0;const l=a(i);fetch(i.href,l)}})();function xb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fg={exports:{}},uc={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var _j;function Z5(){if(_j)return uc;_j=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(r,i,l){var d=null;if(l!==void 0&&(d=""+l),i.key!==void 0&&(d=""+i.key),"key"in i){l={};for(var f in i)f!=="key"&&(l[f]=i[f])}else l=i;return i=l.ref,{$$typeof:e,type:r,key:d,ref:i!==void 0?i:null,props:l}}return uc.Fragment=t,uc.jsx=a,uc.jsxs=a,uc}var vj;function J5(){return vj||(vj=1,Fg.exports=Z5()),Fg.exports}var n=J5(),Gg={exports:{}},dt={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var yj;function e3(){if(yj)return dt;yj=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),_=Symbol.iterator;function y($){return $===null||typeof $!="object"?null:($=_&&$[_]||$["@@iterator"],typeof $=="function"?$:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,k={};function C($,K,J){this.props=$,this.context=K,this.refs=k,this.updater=J||S}C.prototype.isReactComponent={},C.prototype.setState=function($,K){if(typeof $!="object"&&typeof $!="function"&&$!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,$,K,"setState")},C.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function w(){}w.prototype=C.prototype;function E($,K,J){this.props=$,this.context=K,this.refs=k,this.updater=J||S}var R=E.prototype=new w;R.constructor=E,j(R,C.prototype),R.isPureReactComponent=!0;var T=Array.isArray;function A(){}var z={H:null,A:null,T:null,S:null},M=Object.prototype.hasOwnProperty;function D($,K,J){var G=J.ref;return{$$typeof:e,type:$,key:K,ref:G!==void 0?G:null,props:J}}function L($,K){return D($.type,K,$.props)}function I($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function P($){var K={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(J){return K[J]})}var B=/\/+/g;function q($,K){return typeof $=="object"&&$!==null&&$.key!=null?P(""+$.key):K.toString(36)}function Y($){switch($.status){case"fulfilled":return $.value;case"rejected":throw $.reason;default:switch(typeof $.status=="string"?$.then(A,A):($.status="pending",$.then(function(K){$.status==="pending"&&($.status="fulfilled",$.value=K)},function(K){$.status==="pending"&&($.status="rejected",$.reason=K)})),$.status){case"fulfilled":return $.value;case"rejected":throw $.reason}}throw $}function U($,K,J,G,te){var se=typeof $;(se==="undefined"||se==="boolean")&&($=null);var pe=!1;if($===null)pe=!0;else switch(se){case"bigint":case"string":case"number":pe=!0;break;case"object":switch($.$$typeof){case e:case t:pe=!0;break;case h:return pe=$._init,U(pe($._payload),K,J,G,te)}}if(pe)return te=te($),pe=G===""?"."+q($,0):G,T(te)?(J="",pe!=null&&(J=pe.replace(B,"$&/")+"/"),U(te,K,J,"",function(_e){return _e})):te!=null&&(I(te)&&(te=L(te,J+(te.key==null||$&&$.key===te.key?"":(""+te.key).replace(B,"$&/")+"/")+pe)),K.push(te)),1;pe=0;var F=G===""?".":G+":";if(T($))for(var oe=0;oe<$.length;oe++)G=$[oe],se=F+q(G,oe),pe+=U(G,K,J,se,te);else if(oe=y($),typeof oe=="function")for($=oe.call($),oe=0;!(G=$.next()).done;)G=G.value,se=F+q(G,oe++),pe+=U(G,K,J,se,te);else if(se==="object"){if(typeof $.then=="function")return U(Y($),K,J,G,te);throw K=String($),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return pe}function V($,K,J){if($==null)return $;var G=[],te=0;return U($,G,"","",function(se){return K.call(J,se,te++)}),G}function X($){if($._status===-1){var K=$._result;K=K(),K.then(function(J){($._status===0||$._status===-1)&&($._status=1,$._result=J)},function(J){($._status===0||$._status===-1)&&($._status=2,$._result=J)}),$._status===-1&&($._status=0,$._result=K)}if($._status===1)return $._result.default;throw $._result}var Q=typeof reportError=="function"?reportError:function($){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof $=="object"&&$!==null&&typeof $.message=="string"?String($.message):String($),error:$});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",$);return}console.error($)},W={map:V,forEach:function($,K,J){V($,function(){K.apply(this,arguments)},J)},count:function($){var K=0;return V($,function(){K++}),K},toArray:function($){return V($,function(K){return K})||[]},only:function($){if(!I($))throw Error("React.Children.only expected to receive a single React element child.");return $}};return dt.Activity=b,dt.Children=W,dt.Component=C,dt.Fragment=a,dt.Profiler=i,dt.PureComponent=E,dt.StrictMode=r,dt.Suspense=p,dt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,dt.__COMPILER_RUNTIME={__proto__:null,c:function($){return z.H.useMemoCache($)}},dt.cache=function($){return function(){return $.apply(null,arguments)}},dt.cacheSignal=function(){return null},dt.cloneElement=function($,K,J){if($==null)throw Error("The argument must be a React element, but you passed "+$+".");var G=j({},$.props),te=$.key;if(K!=null)for(se in K.key!==void 0&&(te=""+K.key),K)!M.call(K,se)||se==="key"||se==="__self"||se==="__source"||se==="ref"&&K.ref===void 0||(G[se]=K[se]);var se=arguments.length-2;if(se===1)G.children=J;else if(1<se){for(var pe=Array(se),F=0;F<se;F++)pe[F]=arguments[F+2];G.children=pe}return D($.type,te,G)},dt.createContext=function($){return $={$$typeof:d,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null},$.Provider=$,$.Consumer={$$typeof:l,_context:$},$},dt.createElement=function($,K,J){var G,te={},se=null;if(K!=null)for(G in K.key!==void 0&&(se=""+K.key),K)M.call(K,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(te[G]=K[G]);var pe=arguments.length-2;if(pe===1)te.children=J;else if(1<pe){for(var F=Array(pe),oe=0;oe<pe;oe++)F[oe]=arguments[oe+2];te.children=F}if($&&$.defaultProps)for(G in pe=$.defaultProps,pe)te[G]===void 0&&(te[G]=pe[G]);return D($,se,te)},dt.createRef=function(){return{current:null}},dt.forwardRef=function($){return{$$typeof:f,render:$}},dt.isValidElement=I,dt.lazy=function($){return{$$typeof:h,_payload:{_status:-1,_result:$},_init:X}},dt.memo=function($,K){return{$$typeof:g,type:$,compare:K===void 0?null:K}},dt.startTransition=function($){var K=z.T,J={};z.T=J;try{var G=$(),te=z.S;te!==null&&te(J,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(A,Q)}catch(se){Q(se)}finally{K!==null&&J.types!==null&&(K.types=J.types),z.T=K}},dt.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},dt.use=function($){return z.H.use($)},dt.useActionState=function($,K,J){return z.H.useActionState($,K,J)},dt.useCallback=function($,K){return z.H.useCallback($,K)},dt.useContext=function($){return z.H.useContext($)},dt.useDebugValue=function(){},dt.useDeferredValue=function($,K){return z.H.useDeferredValue($,K)},dt.useEffect=function($,K){return z.H.useEffect($,K)},dt.useEffectEvent=function($){return z.H.useEffectEvent($)},dt.useId=function(){return z.H.useId()},dt.useImperativeHandle=function($,K,J){return z.H.useImperativeHandle($,K,J)},dt.useInsertionEffect=function($,K){return z.H.useInsertionEffect($,K)},dt.useLayoutEffect=function($,K){return z.H.useLayoutEffect($,K)},dt.useMemo=function($,K){return z.H.useMemo($,K)},dt.useOptimistic=function($,K){return z.H.useOptimistic($,K)},dt.useReducer=function($,K,J){return z.H.useReducer($,K,J)},dt.useRef=function($){return z.H.useRef($)},dt.useState=function($){return z.H.useState($)},dt.useSyncExternalStore=function($,K,J){return z.H.useSyncExternalStore($,K,J)},dt.useTransition=function(){return z.H.useTransition()},dt.version="19.2.8",dt}var jj;function Wc(){return jj||(jj=1,Gg.exports=e3()),Gg.exports}var x=Wc();const Zc=xb(x),t3=W5({__proto__:null,default:Zc},[x]);var Yg={exports:{}},dc={},Kg={exports:{}},Xg={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var kj;function n3(){return kj||(kj=1,(function(e){function t(U,V){var X=U.length;U.push(V);e:for(;0<X;){var Q=X-1>>>1,W=U[Q];if(0<i(W,V))U[Q]=V,U[X]=W,X=Q;else break e}}function a(U){return U.length===0?null:U[0]}function r(U){if(U.length===0)return null;var V=U[0],X=U.pop();if(X!==V){U[0]=X;e:for(var Q=0,W=U.length,$=W>>>1;Q<$;){var K=2*(Q+1)-1,J=U[K],G=K+1,te=U[G];if(0>i(J,X))G<W&&0>i(te,J)?(U[Q]=te,U[G]=X,Q=G):(U[Q]=J,U[K]=X,Q=K);else if(G<W&&0>i(te,X))U[Q]=te,U[G]=X,Q=G;else break e}}return V}function i(U,V){var X=U.sortIndex-V.sortIndex;return X!==0?X:U.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var p=[],g=[],h=1,b=null,_=3,y=!1,S=!1,j=!1,k=!1,C=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function R(U){for(var V=a(g);V!==null;){if(V.callback===null)r(g);else if(V.startTime<=U)r(g),V.sortIndex=V.expirationTime,t(p,V);else break;V=a(g)}}function T(U){if(j=!1,R(U),!S)if(a(p)!==null)S=!0,A||(A=!0,P());else{var V=a(g);V!==null&&Y(T,V.startTime-U)}}var A=!1,z=-1,M=5,D=-1;function L(){return k?!0:!(e.unstable_now()-D<M)}function I(){if(k=!1,A){var U=e.unstable_now();D=U;var V=!0;try{e:{S=!1,j&&(j=!1,w(z),z=-1),y=!0;var X=_;try{t:{for(R(U),b=a(p);b!==null&&!(b.expirationTime>U&&L());){var Q=b.callback;if(typeof Q=="function"){b.callback=null,_=b.priorityLevel;var W=Q(b.expirationTime<=U);if(U=e.unstable_now(),typeof W=="function"){b.callback=W,R(U),V=!0;break t}b===a(p)&&r(p),R(U)}else r(p);b=a(p)}if(b!==null)V=!0;else{var $=a(g);$!==null&&Y(T,$.startTime-U),V=!1}}break e}finally{b=null,_=X,y=!1}V=void 0}}finally{V?P():A=!1}}}var P;if(typeof E=="function")P=function(){E(I)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,q=B.port2;B.port1.onmessage=I,P=function(){q.postMessage(null)}}else P=function(){C(I,0)};function Y(U,V){z=C(function(){U(e.unstable_now())},V)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(U){U.callback=null},e.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<U?Math.floor(1e3/U):5},e.unstable_getCurrentPriorityLevel=function(){return _},e.unstable_next=function(U){switch(_){case 1:case 2:case 3:var V=3;break;default:V=_}var X=_;_=V;try{return U()}finally{_=X}},e.unstable_requestPaint=function(){k=!0},e.unstable_runWithPriority=function(U,V){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var X=_;_=U;try{return V()}finally{_=X}},e.unstable_scheduleCallback=function(U,V,X){var Q=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?Q+X:Q):X=Q,U){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=X+W,U={id:h++,callback:V,priorityLevel:U,startTime:X,expirationTime:W,sortIndex:-1},X>Q?(U.sortIndex=X,t(g,U),a(p)===null&&U===a(g)&&(j?(w(z),z=-1):j=!0,Y(T,X-Q))):(U.sortIndex=W,t(p,U),S||y||(S=!0,A||(A=!0,P()))),U},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(U){var V=_;return function(){var X=_;_=V;try{return U.apply(this,arguments)}finally{_=X}}}})(Xg)),Xg}var wj;function s3(){return wj||(wj=1,Kg.exports=n3()),Kg.exports}var Qg={exports:{}},Yn={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var Sj;function a3(){if(Sj)return Yn;Sj=1;var e=Wc();function t(p){var g="https://react.dev/errors/"+p;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)g+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+p+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var r={d:{f:a,r:function(){throw Error(t(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},i=Symbol.for("react.portal");function l(p,g,h){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:b==null?null:""+b,children:p,containerInfo:g,implementation:h}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(p,g){if(p==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return Yn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Yn.createPortal=function(p,g){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(t(299));return l(p,g,null,h)},Yn.flushSync=function(p){var g=d.T,h=r.p;try{if(d.T=null,r.p=2,p)return p()}finally{d.T=g,r.p=h,r.d.f()}},Yn.preconnect=function(p,g){typeof p=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,r.d.C(p,g))},Yn.prefetchDNS=function(p){typeof p=="string"&&r.d.D(p)},Yn.preinit=function(p,g){if(typeof p=="string"&&g&&typeof g.as=="string"){var h=g.as,b=f(h,g.crossOrigin),_=typeof g.integrity=="string"?g.integrity:void 0,y=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;h==="style"?r.d.S(p,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:b,integrity:_,fetchPriority:y}):h==="script"&&r.d.X(p,{crossOrigin:b,integrity:_,fetchPriority:y,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Yn.preinitModule=function(p,g){if(typeof p=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var h=f(g.as,g.crossOrigin);r.d.M(p,{crossOrigin:h,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&r.d.M(p)},Yn.preload=function(p,g){if(typeof p=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var h=g.as,b=f(h,g.crossOrigin);r.d.L(p,h,{crossOrigin:b,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},Yn.preloadModule=function(p,g){if(typeof p=="string")if(g){var h=f(g.as,g.crossOrigin);r.d.m(p,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:h,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else r.d.m(p)},Yn.requestFormReset=function(p){r.d.r(p)},Yn.unstable_batchedUpdates=function(p,g){return p(g)},Yn.useFormState=function(p,g,h){return d.H.useFormState(p,g,h)},Yn.useFormStatus=function(){return d.H.useHostTransitionStatus()},Yn.version="19.2.8",Yn}var Cj;function U2(){if(Cj)return Qg.exports;Cj=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Qg.exports=a3(),Qg.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var Nj;function r3(){if(Nj)return dc;Nj=1;var e=s3(),t=Wc(),a=U2();function r(s){var o="https://react.dev/errors/"+s;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)o+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+s+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function l(s){var o=s,c=s;if(s.alternate)for(;o.return;)o=o.return;else{s=o;do o=s,(o.flags&4098)!==0&&(c=o.return),s=o.return;while(s)}return o.tag===3?c:null}function d(s){if(s.tag===13){var o=s.memoizedState;if(o===null&&(s=s.alternate,s!==null&&(o=s.memoizedState)),o!==null)return o.dehydrated}return null}function f(s){if(s.tag===31){var o=s.memoizedState;if(o===null&&(s=s.alternate,s!==null&&(o=s.memoizedState)),o!==null)return o.dehydrated}return null}function p(s){if(l(s)!==s)throw Error(r(188))}function g(s){var o=s.alternate;if(!o){if(o=l(s),o===null)throw Error(r(188));return o!==s?null:s}for(var c=s,m=o;;){var v=c.return;if(v===null)break;var N=v.alternate;if(N===null){if(m=v.return,m!==null){c=m;continue}break}if(v.child===N.child){for(N=v.child;N;){if(N===c)return p(v),s;if(N===m)return p(v),o;N=N.sibling}throw Error(r(188))}if(c.return!==m.return)c=v,m=N;else{for(var O=!1,H=v.child;H;){if(H===c){O=!0,c=v,m=N;break}if(H===m){O=!0,m=v,c=N;break}H=H.sibling}if(!O){for(H=N.child;H;){if(H===c){O=!0,c=N,m=v;break}if(H===m){O=!0,m=N,c=v;break}H=H.sibling}if(!O)throw Error(r(189))}}if(c.alternate!==m)throw Error(r(190))}if(c.tag!==3)throw Error(r(188));return c.stateNode.current===c?s:o}function h(s){var o=s.tag;if(o===5||o===26||o===27||o===6)return s;for(s=s.child;s!==null;){if(o=h(s),o!==null)return o;s=s.sibling}return null}var b=Object.assign,_=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),E=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function P(s){return s===null||typeof s!="object"?null:(s=I&&s[I]||s["@@iterator"],typeof s=="function"?s:null)}var B=Symbol.for("react.client.reference");function q(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===B?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case j:return"Fragment";case C:return"Profiler";case k:return"StrictMode";case T:return"Suspense";case A:return"SuspenseList";case D:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case S:return"Portal";case E:return s.displayName||"Context";case w:return(s._context.displayName||"Context")+".Consumer";case R:var o=s.render;return s=s.displayName,s||(s=o.displayName||o.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case z:return o=s.displayName||null,o!==null?o:q(s.type)||"Memo";case M:o=s._payload,s=s._init;try{return q(s(o))}catch{}}return null}var Y=Array.isArray,U=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},Q=[],W=-1;function $(s){return{current:s}}function K(s){0>W||(s.current=Q[W],Q[W]=null,W--)}function J(s,o){W++,Q[W]=s.current,s.current=o}var G=$(null),te=$(null),se=$(null),pe=$(null);function F(s,o){switch(J(se,o),J(te,s),J(G,null),o.nodeType){case 9:case 11:s=(s=o.documentElement)&&(s=s.namespaceURI)?q1(s):0;break;default:if(s=o.tagName,o=o.namespaceURI)o=q1(o),s=H1(o,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}K(G),J(G,s)}function oe(){K(G),K(te),K(se)}function _e(s){s.memoizedState!==null&&J(pe,s);var o=G.current,c=H1(o,s.type);o!==c&&(J(te,s),J(G,c))}function le(s){te.current===s&&(K(G),K(te)),pe.current===s&&(K(pe),oc._currentValue=X)}var be,ke;function Re(s){if(be===void 0)try{throw Error()}catch(c){var o=c.stack.trim().match(/\n( *(at )?)/);be=o&&o[1]||"",ke=-1<c.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+be+s+ke}var Ae=!1;function Ie(s,o){if(!s||Ae)return"";Ae=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(o){var Se=function(){throw Error()};if(Object.defineProperty(Se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Se,[])}catch(he){var fe=he}Reflect.construct(s,[],Se)}else{try{Se.call()}catch(he){fe=he}s.call(Se.prototype)}}else{try{throw Error()}catch(he){fe=he}(Se=s())&&typeof Se.catch=="function"&&Se.catch(function(){})}}catch(he){if(he&&fe&&typeof he.stack=="string")return[he.stack,fe.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var N=m.DetermineComponentFrameRoot(),O=N[0],H=N[1];if(O&&H){var Z=O.split(`
44
+ `),ue=H.split(`
45
+ `);for(v=m=0;m<Z.length&&!Z[m].includes("DetermineComponentFrameRoot");)m++;for(;v<ue.length&&!ue[v].includes("DetermineComponentFrameRoot");)v++;if(m===Z.length||v===ue.length)for(m=Z.length-1,v=ue.length-1;1<=m&&0<=v&&Z[m]!==ue[v];)v--;for(;1<=m&&0<=v;m--,v--)if(Z[m]!==ue[v]){if(m!==1||v!==1)do if(m--,v--,0>v||Z[m]!==ue[v]){var ve=`
46
+ `+Z[m].replace(" at new "," at ");return s.displayName&&ve.includes("<anonymous>")&&(ve=ve.replace("<anonymous>",s.displayName)),ve}while(1<=m&&0<=v);break}}}finally{Ae=!1,Error.prepareStackTrace=c}return(c=s?s.displayName||s.name:"")?Re(c):""}function Oe(s,o){switch(s.tag){case 26:case 27:case 5:return Re(s.type);case 16:return Re("Lazy");case 13:return s.child!==o&&o!==null?Re("Suspense Fallback"):Re("Suspense");case 19:return Re("SuspenseList");case 0:case 15:return Ie(s.type,!1);case 11:return Ie(s.type.render,!1);case 1:return Ie(s.type,!0);case 31:return Re("Activity");default:return""}}function Te(s){try{var o="",c=null;do o+=Oe(s,c),c=s,s=s.return;while(s);return o}catch(m){return`
47
+ Error generating stack: `+m.message+`
48
+ `+m.stack}}var Ee=Object.prototype.hasOwnProperty,Me=e.unstable_scheduleCallback,De=e.unstable_cancelCallback,He=e.unstable_shouldYield,Qe=e.unstable_requestPaint,ge=e.unstable_now,de=e.unstable_getCurrentPriorityLevel,Le=e.unstable_ImmediatePriority,ye=e.unstable_UserBlockingPriority,Ne=e.unstable_NormalPriority,We=e.unstable_LowPriority,Ge=e.unstable_IdlePriority,it=e.log,Tt=e.unstable_setDisableYieldValue,_t=null,Ct=null;function je(s){if(typeof it=="function"&&Tt(s),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(_t,s)}catch{}}var ze=Math.clz32?Math.clz32:ft,Ye=Math.log,Ze=Math.LN2;function ft(s){return s>>>=0,s===0?32:31-(Ye(s)/Ze|0)|0}var Rt=256,Qt=262144,ot=4194304;function Lt(s){var o=s&42;if(o!==0)return o;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function on(s,o,c){var m=s.pendingLanes;if(m===0)return 0;var v=0,N=s.suspendedLanes,O=s.pingedLanes;s=s.warmLanes;var H=m&134217727;return H!==0?(m=H&~N,m!==0?v=Lt(m):(O&=H,O!==0?v=Lt(O):c||(c=H&~s,c!==0&&(v=Lt(c))))):(H=m&~N,H!==0?v=Lt(H):O!==0?v=Lt(O):c||(c=m&~s,c!==0&&(v=Lt(c)))),v===0?0:o!==0&&o!==v&&(o&N)===0&&(N=v&-v,c=o&-o,N>=c||N===32&&(c&4194048)!==0)?o:v}function Kt(s,o){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&o)===0}function Gn(s,o){switch(s){case 1:case 2:case 4:case 8:case 64:return o+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function An(){var s=ot;return ot<<=1,(ot&62914560)===0&&(ot=4194304),s}function as(s){for(var o=[],c=0;31>c;c++)o.push(s);return o}function dn(s,o){s.pendingLanes|=o,o!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function hs(s,o,c,m,v,N){var O=s.pendingLanes;s.pendingLanes=c,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=c,s.entangledLanes&=c,s.errorRecoveryDisabledLanes&=c,s.shellSuspendCounter=0;var H=s.entanglements,Z=s.expirationTimes,ue=s.hiddenUpdates;for(c=O&~c;0<c;){var ve=31-ze(c),Se=1<<ve;H[ve]=0,Z[ve]=-1;var fe=ue[ve];if(fe!==null)for(ue[ve]=null,ve=0;ve<fe.length;ve++){var he=fe[ve];he!==null&&(he.lane&=-536870913)}c&=~Se}m!==0&&Rs(s,m,0),N!==0&&v===0&&s.tag!==0&&(s.suspendedLanes|=N&~(O&~o))}function Rs(s,o,c){s.pendingLanes|=o,s.suspendedLanes&=~o;var m=31-ze(o);s.entangledLanes|=o,s.entanglements[m]=s.entanglements[m]|1073741824|c&261930}function oa(s,o){var c=s.entangledLanes|=o;for(s=s.entanglements;c;){var m=31-ze(c),v=1<<m;v&o|s[m]&o&&(s[m]|=o),c&=~v}}function ht(s,o){var c=o&-o;return c=(c&42)!==0?1:Ut(c),(c&(s.suspendedLanes|o))!==0?0:c}function Ut(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Ln(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function rs(){var s=V.p;return s!==0?s:(s=window.event,s===void 0?32:fj(s.type))}function xs(s,o){var c=V.p;try{return V.p=s,o()}finally{V.p=c}}var Mn=Math.random().toString(36).slice(2),Wt="__reactFiber$"+Mn,vn="__reactProps$"+Mn,ia="__reactContainer$"+Mn,pr="__reactEvents$"+Mn,BR="__reactListeners$"+Mn,UR="__reactHandles$"+Mn,Rv="__reactResources$"+Mn,yl="__reactMarker$"+Mn;function Lp(s){delete s[Wt],delete s[vn],delete s[pr],delete s[BR],delete s[UR]}function ei(s){var o=s[Wt];if(o)return o;for(var c=s.parentNode;c;){if(o=c[ia]||c[Wt]){if(c=o.alternate,o.child!==null||c!==null&&c.child!==null)for(s=Q1(s);s!==null;){if(c=s[Wt])return c;s=Q1(s)}return o}s=c,c=s.parentNode}return null}function ti(s){if(s=s[Wt]||s[ia]){var o=s.tag;if(o===5||o===6||o===13||o===31||o===26||o===27||o===3)return s}return null}function jl(s){var o=s.tag;if(o===5||o===26||o===27||o===6)return s.stateNode;throw Error(r(33))}function ni(s){var o=s[Rv];return o||(o=s[Rv]={hoistableStyles:new Map,hoistableScripts:new Map}),o}function zn(s){s[yl]=!0}var Tv=new Set,Av={};function oo(s,o){si(s,o),si(s+"Capture",o)}function si(s,o){for(Av[s]=o,s=0;s<o.length;s++)Tv.add(o[s])}var qR=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Mv={},zv={};function HR(s){return Ee.call(zv,s)?!0:Ee.call(Mv,s)?!1:qR.test(s)?zv[s]=!0:(Mv[s]=!0,!1)}function xu(s,o,c){if(HR(o))if(c===null)s.removeAttribute(o);else{switch(typeof c){case"undefined":case"function":case"symbol":s.removeAttribute(o);return;case"boolean":var m=o.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){s.removeAttribute(o);return}}s.setAttribute(o,""+c)}}function bu(s,o,c){if(c===null)s.removeAttribute(o);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(o);return}s.setAttribute(o,""+c)}}function Ea(s,o,c,m){if(m===null)s.removeAttribute(c);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(c);return}s.setAttributeNS(o,c,""+m)}}function Ts(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Ov(s){var o=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function VR(s,o,c){var m=Object.getOwnPropertyDescriptor(s.constructor.prototype,o);if(!s.hasOwnProperty(o)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var v=m.get,N=m.set;return Object.defineProperty(s,o,{configurable:!0,get:function(){return v.call(this)},set:function(O){c=""+O,N.call(this,O)}}),Object.defineProperty(s,o,{enumerable:m.enumerable}),{getValue:function(){return c},setValue:function(O){c=""+O},stopTracking:function(){s._valueTracker=null,delete s[o]}}}}function Ip(s){if(!s._valueTracker){var o=Ov(s)?"checked":"value";s._valueTracker=VR(s,o,""+s[o])}}function Dv(s){if(!s)return!1;var o=s._valueTracker;if(!o)return!0;var c=o.getValue(),m="";return s&&(m=Ov(s)?s.checked?"true":"false":s.value),s=m,s!==c?(o.setValue(s),!0):!1}function _u(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var FR=/[\n"\\]/g;function As(s){return s.replace(FR,function(o){return"\\"+o.charCodeAt(0).toString(16)+" "})}function $p(s,o,c,m,v,N,O,H){s.name="",O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?s.type=O:s.removeAttribute("type"),o!=null?O==="number"?(o===0&&s.value===""||s.value!=o)&&(s.value=""+Ts(o)):s.value!==""+Ts(o)&&(s.value=""+Ts(o)):O!=="submit"&&O!=="reset"||s.removeAttribute("value"),o!=null?Bp(s,O,Ts(o)):c!=null?Bp(s,O,Ts(c)):m!=null&&s.removeAttribute("value"),v==null&&N!=null&&(s.defaultChecked=!!N),v!=null&&(s.checked=v&&typeof v!="function"&&typeof v!="symbol"),H!=null&&typeof H!="function"&&typeof H!="symbol"&&typeof H!="boolean"?s.name=""+Ts(H):s.removeAttribute("name")}function Pv(s,o,c,m,v,N,O,H){if(N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"&&(s.type=N),o!=null||c!=null){if(!(N!=="submit"&&N!=="reset"||o!=null)){Ip(s);return}c=c!=null?""+Ts(c):"",o=o!=null?""+Ts(o):c,H||o===s.value||(s.value=o),s.defaultValue=o}m=m??v,m=typeof m!="function"&&typeof m!="symbol"&&!!m,s.checked=H?s.checked:!!m,s.defaultChecked=!!m,O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(s.name=O),Ip(s)}function Bp(s,o,c){o==="number"&&_u(s.ownerDocument)===s||s.defaultValue===""+c||(s.defaultValue=""+c)}function ai(s,o,c,m){if(s=s.options,o){o={};for(var v=0;v<c.length;v++)o["$"+c[v]]=!0;for(c=0;c<s.length;c++)v=o.hasOwnProperty("$"+s[c].value),s[c].selected!==v&&(s[c].selected=v),v&&m&&(s[c].defaultSelected=!0)}else{for(c=""+Ts(c),o=null,v=0;v<s.length;v++){if(s[v].value===c){s[v].selected=!0,m&&(s[v].defaultSelected=!0);return}o!==null||s[v].disabled||(o=s[v])}o!==null&&(o.selected=!0)}}function Lv(s,o,c){if(o!=null&&(o=""+Ts(o),o!==s.value&&(s.value=o),c==null)){s.defaultValue!==o&&(s.defaultValue=o);return}s.defaultValue=c!=null?""+Ts(c):""}function Iv(s,o,c,m){if(o==null){if(m!=null){if(c!=null)throw Error(r(92));if(Y(m)){if(1<m.length)throw Error(r(93));m=m[0]}c=m}c==null&&(c=""),o=c}c=Ts(o),s.defaultValue=c,m=s.textContent,m===c&&m!==""&&m!==null&&(s.value=m),Ip(s)}function ri(s,o){if(o){var c=s.firstChild;if(c&&c===s.lastChild&&c.nodeType===3){c.nodeValue=o;return}}s.textContent=o}var GR=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function $v(s,o,c){var m=o.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?m?s.setProperty(o,""):o==="float"?s.cssFloat="":s[o]="":m?s.setProperty(o,c):typeof c!="number"||c===0||GR.has(o)?o==="float"?s.cssFloat=c:s[o]=(""+c).trim():s[o]=c+"px"}function Bv(s,o,c){if(o!=null&&typeof o!="object")throw Error(r(62));if(s=s.style,c!=null){for(var m in c)!c.hasOwnProperty(m)||o!=null&&o.hasOwnProperty(m)||(m.indexOf("--")===0?s.setProperty(m,""):m==="float"?s.cssFloat="":s[m]="");for(var v in o)m=o[v],o.hasOwnProperty(v)&&c[v]!==m&&$v(s,v,m)}else for(var N in o)o.hasOwnProperty(N)&&$v(s,N,o[N])}function Up(s){if(s.indexOf("-")===-1)return!1;switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var YR=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),KR=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function vu(s){return KR.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Ra(){}var qp=null;function Hp(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var oi=null,ii=null;function Uv(s){var o=ti(s);if(o&&(s=o.stateNode)){var c=s[vn]||null;e:switch(s=o.stateNode,o.type){case"input":if($p(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),o=c.name,c.type==="radio"&&o!=null){for(c=s;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+As(""+o)+'"][type="radio"]'),o=0;o<c.length;o++){var m=c[o];if(m!==s&&m.form===s.form){var v=m[vn]||null;if(!v)throw Error(r(90));$p(m,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(o=0;o<c.length;o++)m=c[o],m.form===s.form&&Dv(m)}break e;case"textarea":Lv(s,c.value,c.defaultValue);break e;case"select":o=c.value,o!=null&&ai(s,!!c.multiple,o,!1)}}}var Vp=!1;function qv(s,o,c){if(Vp)return s(o,c);Vp=!0;try{var m=s(o);return m}finally{if(Vp=!1,(oi!==null||ii!==null)&&(id(),oi&&(o=oi,s=ii,ii=oi=null,Uv(o),s)))for(o=0;o<s.length;o++)Uv(s[o])}}function kl(s,o){var c=s.stateNode;if(c===null)return null;var m=c[vn]||null;if(m===null)return null;c=m[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(s=s.type,m=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!m;break e;default:s=!1}if(s)return null;if(c&&typeof c!="function")throw Error(r(231,o,typeof c));return c}var Ta=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fp=!1;if(Ta)try{var wl={};Object.defineProperty(wl,"passive",{get:function(){Fp=!0}}),window.addEventListener("test",wl,wl),window.removeEventListener("test",wl,wl)}catch{Fp=!1}var mr=null,Gp=null,yu=null;function Hv(){if(yu)return yu;var s,o=Gp,c=o.length,m,v="value"in mr?mr.value:mr.textContent,N=v.length;for(s=0;s<c&&o[s]===v[s];s++);var O=c-s;for(m=1;m<=O&&o[c-m]===v[N-m];m++);return yu=v.slice(s,1<m?1-m:void 0)}function ju(s){var o=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&o===13&&(s=13)):s=o,s===10&&(s=13),32<=s||s===13?s:0}function ku(){return!0}function Vv(){return!1}function os(s){function o(c,m,v,N,O){this._reactName=c,this._targetInst=v,this.type=m,this.nativeEvent=N,this.target=O,this.currentTarget=null;for(var H in s)s.hasOwnProperty(H)&&(c=s[H],this[H]=c?c(N):N[H]);return this.isDefaultPrevented=(N.defaultPrevented!=null?N.defaultPrevented:N.returnValue===!1)?ku:Vv,this.isPropagationStopped=Vv,this}return b(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=ku)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=ku)},persist:function(){},isPersistent:ku}),o}var io={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wu=os(io),Sl=b({},io,{view:0,detail:0}),XR=os(Sl),Yp,Kp,Cl,Su=b({},Sl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qp,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Cl&&(Cl&&s.type==="mousemove"?(Yp=s.screenX-Cl.screenX,Kp=s.screenY-Cl.screenY):Kp=Yp=0,Cl=s),Yp)},movementY:function(s){return"movementY"in s?s.movementY:Kp}}),Fv=os(Su),QR=b({},Su,{dataTransfer:0}),WR=os(QR),ZR=b({},Sl,{relatedTarget:0}),Xp=os(ZR),JR=b({},io,{animationName:0,elapsedTime:0,pseudoElement:0}),eT=os(JR),tT=b({},io,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),nT=os(tT),sT=b({},io,{data:0}),Gv=os(sT),aT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},rT={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},oT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function iT(s){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(s):(s=oT[s])?!!o[s]:!1}function Qp(){return iT}var lT=b({},Sl,{key:function(s){if(s.key){var o=aT[s.key]||s.key;if(o!=="Unidentified")return o}return s.type==="keypress"?(s=ju(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?rT[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qp,charCode:function(s){return s.type==="keypress"?ju(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?ju(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),cT=os(lT),uT=b({},Su,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Yv=os(uT),dT=b({},Sl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qp}),fT=os(dT),pT=b({},io,{propertyName:0,elapsedTime:0,pseudoElement:0}),mT=os(pT),gT=b({},Su,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),hT=os(gT),xT=b({},io,{newState:0,oldState:0}),bT=os(xT),_T=[9,13,27,32],Wp=Ta&&"CompositionEvent"in window,Nl=null;Ta&&"documentMode"in document&&(Nl=document.documentMode);var vT=Ta&&"TextEvent"in window&&!Nl,Kv=Ta&&(!Wp||Nl&&8<Nl&&11>=Nl),Xv=" ",Qv=!1;function Wv(s,o){switch(s){case"keyup":return _T.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zv(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var li=!1;function yT(s,o){switch(s){case"compositionend":return Zv(o);case"keypress":return o.which!==32?null:(Qv=!0,Xv);case"textInput":return s=o.data,s===Xv&&Qv?null:s;default:return null}}function jT(s,o){if(li)return s==="compositionend"||!Wp&&Wv(s,o)?(s=Hv(),yu=Gp=mr=null,li=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return Kv&&o.locale!=="ko"?null:o.data;default:return null}}var kT={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Jv(s){var o=s&&s.nodeName&&s.nodeName.toLowerCase();return o==="input"?!!kT[s.type]:o==="textarea"}function ey(s,o,c,m){oi?ii?ii.push(m):ii=[m]:oi=m,o=md(o,"onChange"),0<o.length&&(c=new wu("onChange","change",null,c,m),s.push({event:c,listeners:o}))}var El=null,Rl=null;function wT(s){P1(s,0)}function Cu(s){var o=jl(s);if(Dv(o))return s}function ty(s,o){if(s==="change")return o}var ny=!1;if(Ta){var Zp;if(Ta){var Jp="oninput"in document;if(!Jp){var sy=document.createElement("div");sy.setAttribute("oninput","return;"),Jp=typeof sy.oninput=="function"}Zp=Jp}else Zp=!1;ny=Zp&&(!document.documentMode||9<document.documentMode)}function ay(){El&&(El.detachEvent("onpropertychange",ry),Rl=El=null)}function ry(s){if(s.propertyName==="value"&&Cu(Rl)){var o=[];ey(o,Rl,s,Hp(s)),qv(wT,o)}}function ST(s,o,c){s==="focusin"?(ay(),El=o,Rl=c,El.attachEvent("onpropertychange",ry)):s==="focusout"&&ay()}function CT(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Cu(Rl)}function NT(s,o){if(s==="click")return Cu(o)}function ET(s,o){if(s==="input"||s==="change")return Cu(o)}function RT(s,o){return s===o&&(s!==0||1/s===1/o)||s!==s&&o!==o}var bs=typeof Object.is=="function"?Object.is:RT;function Tl(s,o){if(bs(s,o))return!0;if(typeof s!="object"||s===null||typeof o!="object"||o===null)return!1;var c=Object.keys(s),m=Object.keys(o);if(c.length!==m.length)return!1;for(m=0;m<c.length;m++){var v=c[m];if(!Ee.call(o,v)||!bs(s[v],o[v]))return!1}return!0}function oy(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function iy(s,o){var c=oy(s);s=0;for(var m;c;){if(c.nodeType===3){if(m=s+c.textContent.length,s<=o&&m>=o)return{node:c,offset:o-s};s=m}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=oy(c)}}function ly(s,o){return s&&o?s===o?!0:s&&s.nodeType===3?!1:o&&o.nodeType===3?ly(s,o.parentNode):"contains"in s?s.contains(o):s.compareDocumentPosition?!!(s.compareDocumentPosition(o)&16):!1:!1}function cy(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var o=_u(s.document);o instanceof s.HTMLIFrameElement;){try{var c=typeof o.contentWindow.location.href=="string"}catch{c=!1}if(c)s=o.contentWindow;else break;o=_u(s.document)}return o}function em(s){var o=s&&s.nodeName&&s.nodeName.toLowerCase();return o&&(o==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||o==="textarea"||s.contentEditable==="true")}var TT=Ta&&"documentMode"in document&&11>=document.documentMode,ci=null,tm=null,Al=null,nm=!1;function uy(s,o,c){var m=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;nm||ci==null||ci!==_u(m)||(m=ci,"selectionStart"in m&&em(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Al&&Tl(Al,m)||(Al=m,m=md(tm,"onSelect"),0<m.length&&(o=new wu("onSelect","select",null,o,c),s.push({event:o,listeners:m}),o.target=ci)))}function lo(s,o){var c={};return c[s.toLowerCase()]=o.toLowerCase(),c["Webkit"+s]="webkit"+o,c["Moz"+s]="moz"+o,c}var ui={animationend:lo("Animation","AnimationEnd"),animationiteration:lo("Animation","AnimationIteration"),animationstart:lo("Animation","AnimationStart"),transitionrun:lo("Transition","TransitionRun"),transitionstart:lo("Transition","TransitionStart"),transitioncancel:lo("Transition","TransitionCancel"),transitionend:lo("Transition","TransitionEnd")},sm={},dy={};Ta&&(dy=document.createElement("div").style,"AnimationEvent"in window||(delete ui.animationend.animation,delete ui.animationiteration.animation,delete ui.animationstart.animation),"TransitionEvent"in window||delete ui.transitionend.transition);function co(s){if(sm[s])return sm[s];if(!ui[s])return s;var o=ui[s],c;for(c in o)if(o.hasOwnProperty(c)&&c in dy)return sm[s]=o[c];return s}var fy=co("animationend"),py=co("animationiteration"),my=co("animationstart"),AT=co("transitionrun"),MT=co("transitionstart"),zT=co("transitioncancel"),gy=co("transitionend"),hy=new Map,am="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");am.push("scrollEnd");function Ys(s,o){hy.set(s,o),oo(o,[s])}var Nu=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Ms=[],di=0,rm=0;function Eu(){for(var s=di,o=rm=di=0;o<s;){var c=Ms[o];Ms[o++]=null;var m=Ms[o];Ms[o++]=null;var v=Ms[o];Ms[o++]=null;var N=Ms[o];if(Ms[o++]=null,m!==null&&v!==null){var O=m.pending;O===null?v.next=v:(v.next=O.next,O.next=v),m.pending=v}N!==0&&xy(c,v,N)}}function Ru(s,o,c,m){Ms[di++]=s,Ms[di++]=o,Ms[di++]=c,Ms[di++]=m,rm|=m,s.lanes|=m,s=s.alternate,s!==null&&(s.lanes|=m)}function om(s,o,c,m){return Ru(s,o,c,m),Tu(s)}function uo(s,o){return Ru(s,null,null,o),Tu(s)}function xy(s,o,c){s.lanes|=c;var m=s.alternate;m!==null&&(m.lanes|=c);for(var v=!1,N=s.return;N!==null;)N.childLanes|=c,m=N.alternate,m!==null&&(m.childLanes|=c),N.tag===22&&(s=N.stateNode,s===null||s._visibility&1||(v=!0)),s=N,N=N.return;return s.tag===3?(N=s.stateNode,v&&o!==null&&(v=31-ze(c),s=N.hiddenUpdates,m=s[v],m===null?s[v]=[o]:m.push(o),o.lane=c|536870912),N):null}function Tu(s){if(50<Jl)throw Jl=0,gg=null,Error(r(185));for(var o=s.return;o!==null;)s=o,o=s.return;return s.tag===3?s.stateNode:null}var fi={};function OT(s,o,c,m){this.tag=s,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _s(s,o,c,m){return new OT(s,o,c,m)}function im(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Aa(s,o){var c=s.alternate;return c===null?(c=_s(s.tag,o,s.key,s.mode),c.elementType=s.elementType,c.type=s.type,c.stateNode=s.stateNode,c.alternate=s,s.alternate=c):(c.pendingProps=o,c.type=s.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=s.flags&65011712,c.childLanes=s.childLanes,c.lanes=s.lanes,c.child=s.child,c.memoizedProps=s.memoizedProps,c.memoizedState=s.memoizedState,c.updateQueue=s.updateQueue,o=s.dependencies,c.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},c.sibling=s.sibling,c.index=s.index,c.ref=s.ref,c.refCleanup=s.refCleanup,c}function by(s,o){s.flags&=65011714;var c=s.alternate;return c===null?(s.childLanes=0,s.lanes=o,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,o=c.dependencies,s.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),s}function Au(s,o,c,m,v,N){var O=0;if(m=s,typeof s=="function")im(s)&&(O=1);else if(typeof s=="string")O=$5(s,c,G.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case D:return s=_s(31,c,o,v),s.elementType=D,s.lanes=N,s;case j:return fo(c.children,v,N,o);case k:O=8,v|=24;break;case C:return s=_s(12,c,o,v|2),s.elementType=C,s.lanes=N,s;case T:return s=_s(13,c,o,v),s.elementType=T,s.lanes=N,s;case A:return s=_s(19,c,o,v),s.elementType=A,s.lanes=N,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case E:O=10;break e;case w:O=9;break e;case R:O=11;break e;case z:O=14;break e;case M:O=16,m=null;break e}O=29,c=Error(r(130,s===null?"null":typeof s,"")),m=null}return o=_s(O,c,o,v),o.elementType=s,o.type=m,o.lanes=N,o}function fo(s,o,c,m){return s=_s(7,s,m,o),s.lanes=c,s}function lm(s,o,c){return s=_s(6,s,null,o),s.lanes=c,s}function _y(s){var o=_s(18,null,null,0);return o.stateNode=s,o}function cm(s,o,c){return o=_s(4,s.children!==null?s.children:[],s.key,o),o.lanes=c,o.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},o}var vy=new WeakMap;function zs(s,o){if(typeof s=="object"&&s!==null){var c=vy.get(s);return c!==void 0?c:(o={value:s,source:o,stack:Te(o)},vy.set(s,o),o)}return{value:s,source:o,stack:Te(o)}}var pi=[],mi=0,Mu=null,Ml=0,Os=[],Ds=0,gr=null,la=1,ca="";function Ma(s,o){pi[mi++]=Ml,pi[mi++]=Mu,Mu=s,Ml=o}function yy(s,o,c){Os[Ds++]=la,Os[Ds++]=ca,Os[Ds++]=gr,gr=s;var m=la;s=ca;var v=32-ze(m)-1;m&=~(1<<v),c+=1;var N=32-ze(o)+v;if(30<N){var O=v-v%5;N=(m&(1<<O)-1).toString(32),m>>=O,v-=O,la=1<<32-ze(o)+v|c<<v|m,ca=N+s}else la=1<<N|c<<v|m,ca=s}function um(s){s.return!==null&&(Ma(s,1),yy(s,1,0))}function dm(s){for(;s===Mu;)Mu=pi[--mi],pi[mi]=null,Ml=pi[--mi],pi[mi]=null;for(;s===gr;)gr=Os[--Ds],Os[Ds]=null,ca=Os[--Ds],Os[Ds]=null,la=Os[--Ds],Os[Ds]=null}function jy(s,o){Os[Ds++]=la,Os[Ds++]=ca,Os[Ds++]=gr,la=o.id,ca=o.overflow,gr=s}var In=null,en=null,Nt=!1,hr=null,Ps=!1,fm=Error(r(519));function xr(s){var o=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw zl(zs(o,s)),fm}function ky(s){var o=s.stateNode,c=s.type,m=s.memoizedProps;switch(o[Wt]=s,o[vn]=m,c){case"dialog":jt("cancel",o),jt("close",o);break;case"iframe":case"object":case"embed":jt("load",o);break;case"video":case"audio":for(c=0;c<tc.length;c++)jt(tc[c],o);break;case"source":jt("error",o);break;case"img":case"image":case"link":jt("error",o),jt("load",o);break;case"details":jt("toggle",o);break;case"input":jt("invalid",o),Pv(o,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":jt("invalid",o);break;case"textarea":jt("invalid",o),Iv(o,m.value,m.defaultValue,m.children)}c=m.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||o.textContent===""+c||m.suppressHydrationWarning===!0||B1(o.textContent,c)?(m.popover!=null&&(jt("beforetoggle",o),jt("toggle",o)),m.onScroll!=null&&jt("scroll",o),m.onScrollEnd!=null&&jt("scrollend",o),m.onClick!=null&&(o.onclick=Ra),o=!0):o=!1,o||xr(s,!0)}function wy(s){for(In=s.return;In;)switch(In.tag){case 5:case 31:case 13:Ps=!1;return;case 27:case 3:Ps=!0;return;default:In=In.return}}function gi(s){if(s!==In)return!1;if(!Nt)return wy(s),Nt=!0,!1;var o=s.tag,c;if((c=o!==3&&o!==27)&&((c=o===5)&&(c=s.type,c=!(c!=="form"&&c!=="button")||Tg(s.type,s.memoizedProps)),c=!c),c&&en&&xr(s),wy(s),o===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));en=X1(s)}else if(o===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));en=X1(s)}else o===27?(o=en,Ar(s.type)?(s=Dg,Dg=null,en=s):en=o):en=In?Is(s.stateNode.nextSibling):null;return!0}function po(){en=In=null,Nt=!1}function pm(){var s=hr;return s!==null&&(us===null?us=s:us.push.apply(us,s),hr=null),s}function zl(s){hr===null?hr=[s]:hr.push(s)}var mm=$(null),mo=null,za=null;function br(s,o,c){J(mm,o._currentValue),o._currentValue=c}function Oa(s){s._currentValue=mm.current,K(mm)}function gm(s,o,c){for(;s!==null;){var m=s.alternate;if((s.childLanes&o)!==o?(s.childLanes|=o,m!==null&&(m.childLanes|=o)):m!==null&&(m.childLanes&o)!==o&&(m.childLanes|=o),s===c)break;s=s.return}}function hm(s,o,c,m){var v=s.child;for(v!==null&&(v.return=s);v!==null;){var N=v.dependencies;if(N!==null){var O=v.child;N=N.firstContext;e:for(;N!==null;){var H=N;N=v;for(var Z=0;Z<o.length;Z++)if(H.context===o[Z]){N.lanes|=c,H=N.alternate,H!==null&&(H.lanes|=c),gm(N.return,c,s),m||(O=null);break e}N=H.next}}else if(v.tag===18){if(O=v.return,O===null)throw Error(r(341));O.lanes|=c,N=O.alternate,N!==null&&(N.lanes|=c),gm(O,c,s),O=null}else O=v.child;if(O!==null)O.return=v;else for(O=v;O!==null;){if(O===s){O=null;break}if(v=O.sibling,v!==null){v.return=O.return,O=v;break}O=O.return}v=O}}function hi(s,o,c,m){s=null;for(var v=o,N=!1;v!==null;){if(!N){if((v.flags&524288)!==0)N=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var O=v.alternate;if(O===null)throw Error(r(387));if(O=O.memoizedProps,O!==null){var H=v.type;bs(v.pendingProps.value,O.value)||(s!==null?s.push(H):s=[H])}}else if(v===pe.current){if(O=v.alternate,O===null)throw Error(r(387));O.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(s!==null?s.push(oc):s=[oc])}v=v.return}s!==null&&hm(o,s,c,m),o.flags|=262144}function zu(s){for(s=s.firstContext;s!==null;){if(!bs(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function go(s){mo=s,za=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function $n(s){return Sy(mo,s)}function Ou(s,o){return mo===null&&go(s),Sy(s,o)}function Sy(s,o){var c=o._currentValue;if(o={context:o,memoizedValue:c,next:null},za===null){if(s===null)throw Error(r(308));za=o,s.dependencies={lanes:0,firstContext:o},s.flags|=524288}else za=za.next=o;return c}var DT=typeof AbortController<"u"?AbortController:function(){var s=[],o=this.signal={aborted:!1,addEventListener:function(c,m){s.push(m)}};this.abort=function(){o.aborted=!0,s.forEach(function(c){return c()})}},PT=e.unstable_scheduleCallback,LT=e.unstable_NormalPriority,yn={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function xm(){return{controller:new DT,data:new Map,refCount:0}}function Ol(s){s.refCount--,s.refCount===0&&PT(LT,function(){s.controller.abort()})}var Dl=null,bm=0,xi=0,bi=null;function IT(s,o){if(Dl===null){var c=Dl=[];bm=0,xi=yg(),bi={status:"pending",value:void 0,then:function(m){c.push(m)}}}return bm++,o.then(Cy,Cy),o}function Cy(){if(--bm===0&&Dl!==null){bi!==null&&(bi.status="fulfilled");var s=Dl;Dl=null,xi=0,bi=null;for(var o=0;o<s.length;o++)(0,s[o])()}}function $T(s,o){var c=[],m={status:"pending",value:null,reason:null,then:function(v){c.push(v)}};return s.then(function(){m.status="fulfilled",m.value=o;for(var v=0;v<c.length;v++)(0,c[v])(o)},function(v){for(m.status="rejected",m.reason=v,v=0;v<c.length;v++)(0,c[v])(void 0)}),m}var Ny=U.S;U.S=function(s,o){u1=ge(),typeof o=="object"&&o!==null&&typeof o.then=="function"&&IT(s,o),Ny!==null&&Ny(s,o)};var ho=$(null);function _m(){var s=ho.current;return s!==null?s:Xt.pooledCache}function Du(s,o){o===null?J(ho,ho.current):J(ho,o.pool)}function Ey(){var s=_m();return s===null?null:{parent:yn._currentValue,pool:s}}var _i=Error(r(460)),vm=Error(r(474)),Pu=Error(r(542)),Lu={then:function(){}};function Ry(s){return s=s.status,s==="fulfilled"||s==="rejected"}function Ty(s,o,c){switch(c=s[c],c===void 0?s.push(o):c!==o&&(o.then(Ra,Ra),o=c),o.status){case"fulfilled":return o.value;case"rejected":throw s=o.reason,My(s),s;default:if(typeof o.status=="string")o.then(Ra,Ra);else{if(s=Xt,s!==null&&100<s.shellSuspendCounter)throw Error(r(482));s=o,s.status="pending",s.then(function(m){if(o.status==="pending"){var v=o;v.status="fulfilled",v.value=m}},function(m){if(o.status==="pending"){var v=o;v.status="rejected",v.reason=m}})}switch(o.status){case"fulfilled":return o.value;case"rejected":throw s=o.reason,My(s),s}throw bo=o,_i}}function xo(s){try{var o=s._init;return o(s._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(bo=c,_i):c}}var bo=null;function Ay(){if(bo===null)throw Error(r(459));var s=bo;return bo=null,s}function My(s){if(s===_i||s===Pu)throw Error(r(483))}var vi=null,Pl=0;function Iu(s){var o=Pl;return Pl+=1,vi===null&&(vi=[]),Ty(vi,s,o)}function Ll(s,o){o=o.props.ref,s.ref=o!==void 0?o:null}function $u(s,o){throw o.$$typeof===_?Error(r(525)):(s=Object.prototype.toString.call(o),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":s)))}function zy(s){function o(re,ee){if(s){var ce=re.deletions;ce===null?(re.deletions=[ee],re.flags|=16):ce.push(ee)}}function c(re,ee){if(!s)return null;for(;ee!==null;)o(re,ee),ee=ee.sibling;return null}function m(re){for(var ee=new Map;re!==null;)re.key!==null?ee.set(re.key,re):ee.set(re.index,re),re=re.sibling;return ee}function v(re,ee){return re=Aa(re,ee),re.index=0,re.sibling=null,re}function N(re,ee,ce){return re.index=ce,s?(ce=re.alternate,ce!==null?(ce=ce.index,ce<ee?(re.flags|=67108866,ee):ce):(re.flags|=67108866,ee)):(re.flags|=1048576,ee)}function O(re){return s&&re.alternate===null&&(re.flags|=67108866),re}function H(re,ee,ce,we){return ee===null||ee.tag!==6?(ee=lm(ce,re.mode,we),ee.return=re,ee):(ee=v(ee,ce),ee.return=re,ee)}function Z(re,ee,ce,we){var et=ce.type;return et===j?ve(re,ee,ce.props.children,we,ce.key):ee!==null&&(ee.elementType===et||typeof et=="object"&&et!==null&&et.$$typeof===M&&xo(et)===ee.type)?(ee=v(ee,ce.props),Ll(ee,ce),ee.return=re,ee):(ee=Au(ce.type,ce.key,ce.props,null,re.mode,we),Ll(ee,ce),ee.return=re,ee)}function ue(re,ee,ce,we){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==ce.containerInfo||ee.stateNode.implementation!==ce.implementation?(ee=cm(ce,re.mode,we),ee.return=re,ee):(ee=v(ee,ce.children||[]),ee.return=re,ee)}function ve(re,ee,ce,we,et){return ee===null||ee.tag!==7?(ee=fo(ce,re.mode,we,et),ee.return=re,ee):(ee=v(ee,ce),ee.return=re,ee)}function Se(re,ee,ce){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return ee=lm(""+ee,re.mode,ce),ee.return=re,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case y:return ce=Au(ee.type,ee.key,ee.props,null,re.mode,ce),Ll(ce,ee),ce.return=re,ce;case S:return ee=cm(ee,re.mode,ce),ee.return=re,ee;case M:return ee=xo(ee),Se(re,ee,ce)}if(Y(ee)||P(ee))return ee=fo(ee,re.mode,ce,null),ee.return=re,ee;if(typeof ee.then=="function")return Se(re,Iu(ee),ce);if(ee.$$typeof===E)return Se(re,Ou(re,ee),ce);$u(re,ee)}return null}function fe(re,ee,ce,we){var et=ee!==null?ee.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return et!==null?null:H(re,ee,""+ce,we);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case y:return ce.key===et?Z(re,ee,ce,we):null;case S:return ce.key===et?ue(re,ee,ce,we):null;case M:return ce=xo(ce),fe(re,ee,ce,we)}if(Y(ce)||P(ce))return et!==null?null:ve(re,ee,ce,we,null);if(typeof ce.then=="function")return fe(re,ee,Iu(ce),we);if(ce.$$typeof===E)return fe(re,ee,Ou(re,ce),we);$u(re,ce)}return null}function he(re,ee,ce,we,et){if(typeof we=="string"&&we!==""||typeof we=="number"||typeof we=="bigint")return re=re.get(ce)||null,H(ee,re,""+we,et);if(typeof we=="object"&&we!==null){switch(we.$$typeof){case y:return re=re.get(we.key===null?ce:we.key)||null,Z(ee,re,we,et);case S:return re=re.get(we.key===null?ce:we.key)||null,ue(ee,re,we,et);case M:return we=xo(we),he(re,ee,ce,we,et)}if(Y(we)||P(we))return re=re.get(ce)||null,ve(ee,re,we,et,null);if(typeof we.then=="function")return he(re,ee,ce,Iu(we),et);if(we.$$typeof===E)return he(re,ee,ce,Ou(ee,we),et);$u(ee,we)}return null}function Fe(re,ee,ce,we){for(var et=null,Mt=null,Ke=ee,mt=ee=0,wt=null;Ke!==null&&mt<ce.length;mt++){Ke.index>mt?(wt=Ke,Ke=null):wt=Ke.sibling;var zt=fe(re,Ke,ce[mt],we);if(zt===null){Ke===null&&(Ke=wt);break}s&&Ke&&zt.alternate===null&&o(re,Ke),ee=N(zt,ee,mt),Mt===null?et=zt:Mt.sibling=zt,Mt=zt,Ke=wt}if(mt===ce.length)return c(re,Ke),Nt&&Ma(re,mt),et;if(Ke===null){for(;mt<ce.length;mt++)Ke=Se(re,ce[mt],we),Ke!==null&&(ee=N(Ke,ee,mt),Mt===null?et=Ke:Mt.sibling=Ke,Mt=Ke);return Nt&&Ma(re,mt),et}for(Ke=m(Ke);mt<ce.length;mt++)wt=he(Ke,re,mt,ce[mt],we),wt!==null&&(s&&wt.alternate!==null&&Ke.delete(wt.key===null?mt:wt.key),ee=N(wt,ee,mt),Mt===null?et=wt:Mt.sibling=wt,Mt=wt);return s&&Ke.forEach(function(Pr){return o(re,Pr)}),Nt&&Ma(re,mt),et}function at(re,ee,ce,we){if(ce==null)throw Error(r(151));for(var et=null,Mt=null,Ke=ee,mt=ee=0,wt=null,zt=ce.next();Ke!==null&&!zt.done;mt++,zt=ce.next()){Ke.index>mt?(wt=Ke,Ke=null):wt=Ke.sibling;var Pr=fe(re,Ke,zt.value,we);if(Pr===null){Ke===null&&(Ke=wt);break}s&&Ke&&Pr.alternate===null&&o(re,Ke),ee=N(Pr,ee,mt),Mt===null?et=Pr:Mt.sibling=Pr,Mt=Pr,Ke=wt}if(zt.done)return c(re,Ke),Nt&&Ma(re,mt),et;if(Ke===null){for(;!zt.done;mt++,zt=ce.next())zt=Se(re,zt.value,we),zt!==null&&(ee=N(zt,ee,mt),Mt===null?et=zt:Mt.sibling=zt,Mt=zt);return Nt&&Ma(re,mt),et}for(Ke=m(Ke);!zt.done;mt++,zt=ce.next())zt=he(Ke,re,mt,zt.value,we),zt!==null&&(s&&zt.alternate!==null&&Ke.delete(zt.key===null?mt:zt.key),ee=N(zt,ee,mt),Mt===null?et=zt:Mt.sibling=zt,Mt=zt);return s&&Ke.forEach(function(Q5){return o(re,Q5)}),Nt&&Ma(re,mt),et}function Vt(re,ee,ce,we){if(typeof ce=="object"&&ce!==null&&ce.type===j&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case y:e:{for(var et=ce.key;ee!==null;){if(ee.key===et){if(et=ce.type,et===j){if(ee.tag===7){c(re,ee.sibling),we=v(ee,ce.props.children),we.return=re,re=we;break e}}else if(ee.elementType===et||typeof et=="object"&&et!==null&&et.$$typeof===M&&xo(et)===ee.type){c(re,ee.sibling),we=v(ee,ce.props),Ll(we,ce),we.return=re,re=we;break e}c(re,ee);break}else o(re,ee);ee=ee.sibling}ce.type===j?(we=fo(ce.props.children,re.mode,we,ce.key),we.return=re,re=we):(we=Au(ce.type,ce.key,ce.props,null,re.mode,we),Ll(we,ce),we.return=re,re=we)}return O(re);case S:e:{for(et=ce.key;ee!==null;){if(ee.key===et)if(ee.tag===4&&ee.stateNode.containerInfo===ce.containerInfo&&ee.stateNode.implementation===ce.implementation){c(re,ee.sibling),we=v(ee,ce.children||[]),we.return=re,re=we;break e}else{c(re,ee);break}else o(re,ee);ee=ee.sibling}we=cm(ce,re.mode,we),we.return=re,re=we}return O(re);case M:return ce=xo(ce),Vt(re,ee,ce,we)}if(Y(ce))return Fe(re,ee,ce,we);if(P(ce)){if(et=P(ce),typeof et!="function")throw Error(r(150));return ce=et.call(ce),at(re,ee,ce,we)}if(typeof ce.then=="function")return Vt(re,ee,Iu(ce),we);if(ce.$$typeof===E)return Vt(re,ee,Ou(re,ce),we);$u(re,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint"?(ce=""+ce,ee!==null&&ee.tag===6?(c(re,ee.sibling),we=v(ee,ce),we.return=re,re=we):(c(re,ee),we=lm(ce,re.mode,we),we.return=re,re=we),O(re)):c(re,ee)}return function(re,ee,ce,we){try{Pl=0;var et=Vt(re,ee,ce,we);return vi=null,et}catch(Ke){if(Ke===_i||Ke===Pu)throw Ke;var Mt=_s(29,Ke,null,re.mode);return Mt.lanes=we,Mt.return=re,Mt}finally{}}}var _o=zy(!0),Oy=zy(!1),_r=!1;function ym(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function jm(s,o){s=s.updateQueue,o.updateQueue===s&&(o.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function vr(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function yr(s,o,c){var m=s.updateQueue;if(m===null)return null;if(m=m.shared,(Pt&2)!==0){var v=m.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),m.pending=o,o=Tu(s),xy(s,null,c),o}return Ru(s,m,o,c),Tu(s)}function Il(s,o,c){if(o=o.updateQueue,o!==null&&(o=o.shared,(c&4194048)!==0)){var m=o.lanes;m&=s.pendingLanes,c|=m,o.lanes=c,oa(s,c)}}function km(s,o){var c=s.updateQueue,m=s.alternate;if(m!==null&&(m=m.updateQueue,c===m)){var v=null,N=null;if(c=c.firstBaseUpdate,c!==null){do{var O={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};N===null?v=N=O:N=N.next=O,c=c.next}while(c!==null);N===null?v=N=o:N=N.next=o}else v=N=o;c={baseState:m.baseState,firstBaseUpdate:v,lastBaseUpdate:N,shared:m.shared,callbacks:m.callbacks},s.updateQueue=c;return}s=c.lastBaseUpdate,s===null?c.firstBaseUpdate=o:s.next=o,c.lastBaseUpdate=o}var wm=!1;function $l(){if(wm){var s=bi;if(s!==null)throw s}}function Bl(s,o,c,m){wm=!1;var v=s.updateQueue;_r=!1;var N=v.firstBaseUpdate,O=v.lastBaseUpdate,H=v.shared.pending;if(H!==null){v.shared.pending=null;var Z=H,ue=Z.next;Z.next=null,O===null?N=ue:O.next=ue,O=Z;var ve=s.alternate;ve!==null&&(ve=ve.updateQueue,H=ve.lastBaseUpdate,H!==O&&(H===null?ve.firstBaseUpdate=ue:H.next=ue,ve.lastBaseUpdate=Z))}if(N!==null){var Se=v.baseState;O=0,ve=ue=Z=null,H=N;do{var fe=H.lane&-536870913,he=fe!==H.lane;if(he?(kt&fe)===fe:(m&fe)===fe){fe!==0&&fe===xi&&(wm=!0),ve!==null&&(ve=ve.next={lane:0,tag:H.tag,payload:H.payload,callback:null,next:null});e:{var Fe=s,at=H;fe=o;var Vt=c;switch(at.tag){case 1:if(Fe=at.payload,typeof Fe=="function"){Se=Fe.call(Vt,Se,fe);break e}Se=Fe;break e;case 3:Fe.flags=Fe.flags&-65537|128;case 0:if(Fe=at.payload,fe=typeof Fe=="function"?Fe.call(Vt,Se,fe):Fe,fe==null)break e;Se=b({},Se,fe);break e;case 2:_r=!0}}fe=H.callback,fe!==null&&(s.flags|=64,he&&(s.flags|=8192),he=v.callbacks,he===null?v.callbacks=[fe]:he.push(fe))}else he={lane:fe,tag:H.tag,payload:H.payload,callback:H.callback,next:null},ve===null?(ue=ve=he,Z=Se):ve=ve.next=he,O|=fe;if(H=H.next,H===null){if(H=v.shared.pending,H===null)break;he=H,H=he.next,he.next=null,v.lastBaseUpdate=he,v.shared.pending=null}}while(!0);ve===null&&(Z=Se),v.baseState=Z,v.firstBaseUpdate=ue,v.lastBaseUpdate=ve,N===null&&(v.shared.lanes=0),Cr|=O,s.lanes=O,s.memoizedState=Se}}function Dy(s,o){if(typeof s!="function")throw Error(r(191,s));s.call(o)}function Py(s,o){var c=s.callbacks;if(c!==null)for(s.callbacks=null,s=0;s<c.length;s++)Dy(c[s],o)}var yi=$(null),Bu=$(0);function Ly(s,o){s=Ha,J(Bu,s),J(yi,o),Ha=s|o.baseLanes}function Sm(){J(Bu,Ha),J(yi,yi.current)}function Cm(){Ha=Bu.current,K(yi),K(Bu)}var vs=$(null),Ls=null;function jr(s){var o=s.alternate;J(hn,hn.current&1),J(vs,s),Ls===null&&(o===null||yi.current!==null||o.memoizedState!==null)&&(Ls=s)}function Nm(s){J(hn,hn.current),J(vs,s),Ls===null&&(Ls=s)}function Iy(s){s.tag===22?(J(hn,hn.current),J(vs,s),Ls===null&&(Ls=s)):kr()}function kr(){J(hn,hn.current),J(vs,vs.current)}function ys(s){K(vs),Ls===s&&(Ls=null),K(hn)}var hn=$(0);function Uu(s){for(var o=s;o!==null;){if(o.tag===13){var c=o.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||zg(c)||Og(c)))return o}else if(o.tag===19&&(o.memoizedProps.revealOrder==="forwards"||o.memoizedProps.revealOrder==="backwards"||o.memoizedProps.revealOrder==="unstable_legacy-backwards"||o.memoizedProps.revealOrder==="together")){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Da=0,pt=null,qt=null,jn=null,qu=!1,ji=!1,vo=!1,Hu=0,Ul=0,ki=null,BT=0;function fn(){throw Error(r(321))}function Em(s,o){if(o===null)return!1;for(var c=0;c<o.length&&c<s.length;c++)if(!bs(s[c],o[c]))return!1;return!0}function Rm(s,o,c,m,v,N){return Da=N,pt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,U.H=s===null||s.memoizedState===null?y0:Vm,vo=!1,N=c(m,v),vo=!1,ji&&(N=By(o,c,m,v)),$y(s),N}function $y(s){U.H=Vl;var o=qt!==null&&qt.next!==null;if(Da=0,jn=qt=pt=null,qu=!1,Ul=0,ki=null,o)throw Error(r(300));s===null||kn||(s=s.dependencies,s!==null&&zu(s)&&(kn=!0))}function By(s,o,c,m){pt=s;var v=0;do{if(ji&&(ki=null),Ul=0,ji=!1,25<=v)throw Error(r(301));if(v+=1,jn=qt=null,s.updateQueue!=null){var N=s.updateQueue;N.lastEffect=null,N.events=null,N.stores=null,N.memoCache!=null&&(N.memoCache.index=0)}U.H=j0,N=o(c,m)}while(ji);return N}function UT(){var s=U.H,o=s.useState()[0];return o=typeof o.then=="function"?ql(o):o,s=s.useState()[0],(qt!==null?qt.memoizedState:null)!==s&&(pt.flags|=1024),o}function Tm(){var s=Hu!==0;return Hu=0,s}function Am(s,o,c){o.updateQueue=s.updateQueue,o.flags&=-2053,s.lanes&=~c}function Mm(s){if(qu){for(s=s.memoizedState;s!==null;){var o=s.queue;o!==null&&(o.pending=null),s=s.next}qu=!1}Da=0,jn=qt=pt=null,ji=!1,Ul=Hu=0,ki=null}function Wn(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jn===null?pt.memoizedState=jn=s:jn=jn.next=s,jn}function xn(){if(qt===null){var s=pt.alternate;s=s!==null?s.memoizedState:null}else s=qt.next;var o=jn===null?pt.memoizedState:jn.next;if(o!==null)jn=o,qt=s;else{if(s===null)throw pt.alternate===null?Error(r(467)):Error(r(310));qt=s,s={memoizedState:qt.memoizedState,baseState:qt.baseState,baseQueue:qt.baseQueue,queue:qt.queue,next:null},jn===null?pt.memoizedState=jn=s:jn=jn.next=s}return jn}function Vu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ql(s){var o=Ul;return Ul+=1,ki===null&&(ki=[]),s=Ty(ki,s,o),o=pt,(jn===null?o.memoizedState:jn.next)===null&&(o=o.alternate,U.H=o===null||o.memoizedState===null?y0:Vm),s}function Fu(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return ql(s);if(s.$$typeof===E)return $n(s)}throw Error(r(438,String(s)))}function zm(s){var o=null,c=pt.updateQueue;if(c!==null&&(o=c.memoCache),o==null){var m=pt.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(o={data:m.data.map(function(v){return v.slice()}),index:0})))}if(o==null&&(o={data:[],index:0}),c===null&&(c=Vu(),pt.updateQueue=c),c.memoCache=o,c=o.data[o.index],c===void 0)for(c=o.data[o.index]=Array(s),m=0;m<s;m++)c[m]=L;return o.index++,c}function Pa(s,o){return typeof o=="function"?o(s):o}function Gu(s){var o=xn();return Om(o,qt,s)}function Om(s,o,c){var m=s.queue;if(m===null)throw Error(r(311));m.lastRenderedReducer=c;var v=s.baseQueue,N=m.pending;if(N!==null){if(v!==null){var O=v.next;v.next=N.next,N.next=O}o.baseQueue=v=N,m.pending=null}if(N=s.baseState,v===null)s.memoizedState=N;else{o=v.next;var H=O=null,Z=null,ue=o,ve=!1;do{var Se=ue.lane&-536870913;if(Se!==ue.lane?(kt&Se)===Se:(Da&Se)===Se){var fe=ue.revertLane;if(fe===0)Z!==null&&(Z=Z.next={lane:0,revertLane:0,gesture:null,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null}),Se===xi&&(ve=!0);else if((Da&fe)===fe){ue=ue.next,fe===xi&&(ve=!0);continue}else Se={lane:0,revertLane:ue.revertLane,gesture:null,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null},Z===null?(H=Z=Se,O=N):Z=Z.next=Se,pt.lanes|=fe,Cr|=fe;Se=ue.action,vo&&c(N,Se),N=ue.hasEagerState?ue.eagerState:c(N,Se)}else fe={lane:Se,revertLane:ue.revertLane,gesture:ue.gesture,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null},Z===null?(H=Z=fe,O=N):Z=Z.next=fe,pt.lanes|=Se,Cr|=Se;ue=ue.next}while(ue!==null&&ue!==o);if(Z===null?O=N:Z.next=H,!bs(N,s.memoizedState)&&(kn=!0,ve&&(c=bi,c!==null)))throw c;s.memoizedState=N,s.baseState=O,s.baseQueue=Z,m.lastRenderedState=N}return v===null&&(m.lanes=0),[s.memoizedState,m.dispatch]}function Dm(s){var o=xn(),c=o.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=s;var m=c.dispatch,v=c.pending,N=o.memoizedState;if(v!==null){c.pending=null;var O=v=v.next;do N=s(N,O.action),O=O.next;while(O!==v);bs(N,o.memoizedState)||(kn=!0),o.memoizedState=N,o.baseQueue===null&&(o.baseState=N),c.lastRenderedState=N}return[N,m]}function Uy(s,o,c){var m=pt,v=xn(),N=Nt;if(N){if(c===void 0)throw Error(r(407));c=c()}else c=o();var O=!bs((qt||v).memoizedState,c);if(O&&(v.memoizedState=c,kn=!0),v=v.queue,Im(Vy.bind(null,m,v,s),[s]),v.getSnapshot!==o||O||jn!==null&&jn.memoizedState.tag&1){if(m.flags|=2048,wi(9,{destroy:void 0},Hy.bind(null,m,v,c,o),null),Xt===null)throw Error(r(349));N||(Da&127)!==0||qy(m,o,c)}return c}function qy(s,o,c){s.flags|=16384,s={getSnapshot:o,value:c},o=pt.updateQueue,o===null?(o=Vu(),pt.updateQueue=o,o.stores=[s]):(c=o.stores,c===null?o.stores=[s]:c.push(s))}function Hy(s,o,c,m){o.value=c,o.getSnapshot=m,Fy(o)&&Gy(s)}function Vy(s,o,c){return c(function(){Fy(o)&&Gy(s)})}function Fy(s){var o=s.getSnapshot;s=s.value;try{var c=o();return!bs(s,c)}catch{return!0}}function Gy(s){var o=uo(s,2);o!==null&&ds(o,s,2)}function Pm(s){var o=Wn();if(typeof s=="function"){var c=s;if(s=c(),vo){je(!0);try{c()}finally{je(!1)}}}return o.memoizedState=o.baseState=s,o.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pa,lastRenderedState:s},o}function Yy(s,o,c,m){return s.baseState=c,Om(s,qt,typeof m=="function"?m:Pa)}function qT(s,o,c,m,v){if(Xu(s))throw Error(r(485));if(s=o.action,s!==null){var N={payload:v,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(O){N.listeners.push(O)}};U.T!==null?c(!0):N.isTransition=!1,m(N),c=o.pending,c===null?(N.next=o.pending=N,Ky(o,N)):(N.next=c.next,o.pending=c.next=N)}}function Ky(s,o){var c=o.action,m=o.payload,v=s.state;if(o.isTransition){var N=U.T,O={};U.T=O;try{var H=c(v,m),Z=U.S;Z!==null&&Z(O,H),Xy(s,o,H)}catch(ue){Lm(s,o,ue)}finally{N!==null&&O.types!==null&&(N.types=O.types),U.T=N}}else try{N=c(v,m),Xy(s,o,N)}catch(ue){Lm(s,o,ue)}}function Xy(s,o,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(m){Qy(s,o,m)},function(m){return Lm(s,o,m)}):Qy(s,o,c)}function Qy(s,o,c){o.status="fulfilled",o.value=c,Wy(o),s.state=c,o=s.pending,o!==null&&(c=o.next,c===o?s.pending=null:(c=c.next,o.next=c,Ky(s,c)))}function Lm(s,o,c){var m=s.pending;if(s.pending=null,m!==null){m=m.next;do o.status="rejected",o.reason=c,Wy(o),o=o.next;while(o!==m)}s.action=null}function Wy(s){s=s.listeners;for(var o=0;o<s.length;o++)(0,s[o])()}function Zy(s,o){return o}function Jy(s,o){if(Nt){var c=Xt.formState;if(c!==null){e:{var m=pt;if(Nt){if(en){t:{for(var v=en,N=Ps;v.nodeType!==8;){if(!N){v=null;break t}if(v=Is(v.nextSibling),v===null){v=null;break t}}N=v.data,v=N==="F!"||N==="F"?v:null}if(v){en=Is(v.nextSibling),m=v.data==="F!";break e}}xr(m)}m=!1}m&&(o=c[0])}}return c=Wn(),c.memoizedState=c.baseState=o,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zy,lastRenderedState:o},c.queue=m,c=b0.bind(null,pt,m),m.dispatch=c,m=Pm(!1),N=Hm.bind(null,pt,!1,m.queue),m=Wn(),v={state:o,dispatch:null,action:s,pending:null},m.queue=v,c=qT.bind(null,pt,v,N,c),v.dispatch=c,m.memoizedState=s,[o,c,!1]}function e0(s){var o=xn();return t0(o,qt,s)}function t0(s,o,c){if(o=Om(s,o,Zy)[0],s=Gu(Pa)[0],typeof o=="object"&&o!==null&&typeof o.then=="function")try{var m=ql(o)}catch(O){throw O===_i?Pu:O}else m=o;o=xn();var v=o.queue,N=v.dispatch;return c!==o.memoizedState&&(pt.flags|=2048,wi(9,{destroy:void 0},HT.bind(null,v,c),null)),[m,N,s]}function HT(s,o){s.action=o}function n0(s){var o=xn(),c=qt;if(c!==null)return t0(o,c,s);xn(),o=o.memoizedState,c=xn();var m=c.queue.dispatch;return c.memoizedState=s,[o,m,!1]}function wi(s,o,c,m){return s={tag:s,create:c,deps:m,inst:o,next:null},o=pt.updateQueue,o===null&&(o=Vu(),pt.updateQueue=o),c=o.lastEffect,c===null?o.lastEffect=s.next=s:(m=c.next,c.next=s,s.next=m,o.lastEffect=s),s}function s0(){return xn().memoizedState}function Yu(s,o,c,m){var v=Wn();pt.flags|=s,v.memoizedState=wi(1|o,{destroy:void 0},c,m===void 0?null:m)}function Ku(s,o,c,m){var v=xn();m=m===void 0?null:m;var N=v.memoizedState.inst;qt!==null&&m!==null&&Em(m,qt.memoizedState.deps)?v.memoizedState=wi(o,N,c,m):(pt.flags|=s,v.memoizedState=wi(1|o,N,c,m))}function a0(s,o){Yu(8390656,8,s,o)}function Im(s,o){Ku(2048,8,s,o)}function VT(s){pt.flags|=4;var o=pt.updateQueue;if(o===null)o=Vu(),pt.updateQueue=o,o.events=[s];else{var c=o.events;c===null?o.events=[s]:c.push(s)}}function r0(s){var o=xn().memoizedState;return VT({ref:o,nextImpl:s}),function(){if((Pt&2)!==0)throw Error(r(440));return o.impl.apply(void 0,arguments)}}function o0(s,o){return Ku(4,2,s,o)}function i0(s,o){return Ku(4,4,s,o)}function l0(s,o){if(typeof o=="function"){s=s();var c=o(s);return function(){typeof c=="function"?c():o(null)}}if(o!=null)return s=s(),o.current=s,function(){o.current=null}}function c0(s,o,c){c=c!=null?c.concat([s]):null,Ku(4,4,l0.bind(null,o,s),c)}function $m(){}function u0(s,o){var c=xn();o=o===void 0?null:o;var m=c.memoizedState;return o!==null&&Em(o,m[1])?m[0]:(c.memoizedState=[s,o],s)}function d0(s,o){var c=xn();o=o===void 0?null:o;var m=c.memoizedState;if(o!==null&&Em(o,m[1]))return m[0];if(m=s(),vo){je(!0);try{s()}finally{je(!1)}}return c.memoizedState=[m,o],m}function Bm(s,o,c){return c===void 0||(Da&1073741824)!==0&&(kt&261930)===0?s.memoizedState=o:(s.memoizedState=c,s=f1(),pt.lanes|=s,Cr|=s,c)}function f0(s,o,c,m){return bs(c,o)?c:yi.current!==null?(s=Bm(s,c,m),bs(s,o)||(kn=!0),s):(Da&42)===0||(Da&1073741824)!==0&&(kt&261930)===0?(kn=!0,s.memoizedState=c):(s=f1(),pt.lanes|=s,Cr|=s,o)}function p0(s,o,c,m,v){var N=V.p;V.p=N!==0&&8>N?N:8;var O=U.T,H={};U.T=H,Hm(s,!1,o,c);try{var Z=v(),ue=U.S;if(ue!==null&&ue(H,Z),Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var ve=$T(Z,m);Hl(s,o,ve,ws(s))}else Hl(s,o,m,ws(s))}catch(Se){Hl(s,o,{then:function(){},status:"rejected",reason:Se},ws())}finally{V.p=N,O!==null&&H.types!==null&&(O.types=H.types),U.T=O}}function FT(){}function Um(s,o,c,m){if(s.tag!==5)throw Error(r(476));var v=m0(s).queue;p0(s,v,o,X,c===null?FT:function(){return g0(s),c(m)})}function m0(s){var o=s.memoizedState;if(o!==null)return o;o={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pa,lastRenderedState:X},next:null};var c={};return o.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pa,lastRenderedState:c},next:null},s.memoizedState=o,s=s.alternate,s!==null&&(s.memoizedState=o),o}function g0(s){var o=m0(s);o.next===null&&(o=s.alternate.memoizedState),Hl(s,o.next.queue,{},ws())}function qm(){return $n(oc)}function h0(){return xn().memoizedState}function x0(){return xn().memoizedState}function GT(s){for(var o=s.return;o!==null;){switch(o.tag){case 24:case 3:var c=ws();s=vr(c);var m=yr(o,s,c);m!==null&&(ds(m,o,c),Il(m,o,c)),o={cache:xm()},s.payload=o;return}o=o.return}}function YT(s,o,c){var m=ws();c={lane:m,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Xu(s)?_0(o,c):(c=om(s,o,c,m),c!==null&&(ds(c,s,m),v0(c,o,m)))}function b0(s,o,c){var m=ws();Hl(s,o,c,m)}function Hl(s,o,c,m){var v={lane:m,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Xu(s))_0(o,v);else{var N=s.alternate;if(s.lanes===0&&(N===null||N.lanes===0)&&(N=o.lastRenderedReducer,N!==null))try{var O=o.lastRenderedState,H=N(O,c);if(v.hasEagerState=!0,v.eagerState=H,bs(H,O))return Ru(s,o,v,0),Xt===null&&Eu(),!1}catch{}finally{}if(c=om(s,o,v,m),c!==null)return ds(c,s,m),v0(c,o,m),!0}return!1}function Hm(s,o,c,m){if(m={lane:2,revertLane:yg(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},Xu(s)){if(o)throw Error(r(479))}else o=om(s,c,m,2),o!==null&&ds(o,s,2)}function Xu(s){var o=s.alternate;return s===pt||o!==null&&o===pt}function _0(s,o){ji=qu=!0;var c=s.pending;c===null?o.next=o:(o.next=c.next,c.next=o),s.pending=o}function v0(s,o,c){if((c&4194048)!==0){var m=o.lanes;m&=s.pendingLanes,c|=m,o.lanes=c,oa(s,c)}}var Vl={readContext:$n,use:Fu,useCallback:fn,useContext:fn,useEffect:fn,useImperativeHandle:fn,useLayoutEffect:fn,useInsertionEffect:fn,useMemo:fn,useReducer:fn,useRef:fn,useState:fn,useDebugValue:fn,useDeferredValue:fn,useTransition:fn,useSyncExternalStore:fn,useId:fn,useHostTransitionStatus:fn,useFormState:fn,useActionState:fn,useOptimistic:fn,useMemoCache:fn,useCacheRefresh:fn};Vl.useEffectEvent=fn;var y0={readContext:$n,use:Fu,useCallback:function(s,o){return Wn().memoizedState=[s,o===void 0?null:o],s},useContext:$n,useEffect:a0,useImperativeHandle:function(s,o,c){c=c!=null?c.concat([s]):null,Yu(4194308,4,l0.bind(null,o,s),c)},useLayoutEffect:function(s,o){return Yu(4194308,4,s,o)},useInsertionEffect:function(s,o){Yu(4,2,s,o)},useMemo:function(s,o){var c=Wn();o=o===void 0?null:o;var m=s();if(vo){je(!0);try{s()}finally{je(!1)}}return c.memoizedState=[m,o],m},useReducer:function(s,o,c){var m=Wn();if(c!==void 0){var v=c(o);if(vo){je(!0);try{c(o)}finally{je(!1)}}}else v=o;return m.memoizedState=m.baseState=v,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:v},m.queue=s,s=s.dispatch=YT.bind(null,pt,s),[m.memoizedState,s]},useRef:function(s){var o=Wn();return s={current:s},o.memoizedState=s},useState:function(s){s=Pm(s);var o=s.queue,c=b0.bind(null,pt,o);return o.dispatch=c,[s.memoizedState,c]},useDebugValue:$m,useDeferredValue:function(s,o){var c=Wn();return Bm(c,s,o)},useTransition:function(){var s=Pm(!1);return s=p0.bind(null,pt,s.queue,!0,!1),Wn().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,o,c){var m=pt,v=Wn();if(Nt){if(c===void 0)throw Error(r(407));c=c()}else{if(c=o(),Xt===null)throw Error(r(349));(kt&127)!==0||qy(m,o,c)}v.memoizedState=c;var N={value:c,getSnapshot:o};return v.queue=N,a0(Vy.bind(null,m,N,s),[s]),m.flags|=2048,wi(9,{destroy:void 0},Hy.bind(null,m,N,c,o),null),c},useId:function(){var s=Wn(),o=Xt.identifierPrefix;if(Nt){var c=ca,m=la;c=(m&~(1<<32-ze(m)-1)).toString(32)+c,o="_"+o+"R_"+c,c=Hu++,0<c&&(o+="H"+c.toString(32)),o+="_"}else c=BT++,o="_"+o+"r_"+c.toString(32)+"_";return s.memoizedState=o},useHostTransitionStatus:qm,useFormState:Jy,useActionState:Jy,useOptimistic:function(s){var o=Wn();o.memoizedState=o.baseState=s;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return o.queue=c,o=Hm.bind(null,pt,!0,c),c.dispatch=o,[s,o]},useMemoCache:zm,useCacheRefresh:function(){return Wn().memoizedState=GT.bind(null,pt)},useEffectEvent:function(s){var o=Wn(),c={impl:s};return o.memoizedState=c,function(){if((Pt&2)!==0)throw Error(r(440));return c.impl.apply(void 0,arguments)}}},Vm={readContext:$n,use:Fu,useCallback:u0,useContext:$n,useEffect:Im,useImperativeHandle:c0,useInsertionEffect:o0,useLayoutEffect:i0,useMemo:d0,useReducer:Gu,useRef:s0,useState:function(){return Gu(Pa)},useDebugValue:$m,useDeferredValue:function(s,o){var c=xn();return f0(c,qt.memoizedState,s,o)},useTransition:function(){var s=Gu(Pa)[0],o=xn().memoizedState;return[typeof s=="boolean"?s:ql(s),o]},useSyncExternalStore:Uy,useId:h0,useHostTransitionStatus:qm,useFormState:e0,useActionState:e0,useOptimistic:function(s,o){var c=xn();return Yy(c,qt,s,o)},useMemoCache:zm,useCacheRefresh:x0};Vm.useEffectEvent=r0;var j0={readContext:$n,use:Fu,useCallback:u0,useContext:$n,useEffect:Im,useImperativeHandle:c0,useInsertionEffect:o0,useLayoutEffect:i0,useMemo:d0,useReducer:Dm,useRef:s0,useState:function(){return Dm(Pa)},useDebugValue:$m,useDeferredValue:function(s,o){var c=xn();return qt===null?Bm(c,s,o):f0(c,qt.memoizedState,s,o)},useTransition:function(){var s=Dm(Pa)[0],o=xn().memoizedState;return[typeof s=="boolean"?s:ql(s),o]},useSyncExternalStore:Uy,useId:h0,useHostTransitionStatus:qm,useFormState:n0,useActionState:n0,useOptimistic:function(s,o){var c=xn();return qt!==null?Yy(c,qt,s,o):(c.baseState=s,[s,c.queue.dispatch])},useMemoCache:zm,useCacheRefresh:x0};j0.useEffectEvent=r0;function Fm(s,o,c,m){o=s.memoizedState,c=c(m,o),c=c==null?o:b({},o,c),s.memoizedState=c,s.lanes===0&&(s.updateQueue.baseState=c)}var Gm={enqueueSetState:function(s,o,c){s=s._reactInternals;var m=ws(),v=vr(m);v.payload=o,c!=null&&(v.callback=c),o=yr(s,v,m),o!==null&&(ds(o,s,m),Il(o,s,m))},enqueueReplaceState:function(s,o,c){s=s._reactInternals;var m=ws(),v=vr(m);v.tag=1,v.payload=o,c!=null&&(v.callback=c),o=yr(s,v,m),o!==null&&(ds(o,s,m),Il(o,s,m))},enqueueForceUpdate:function(s,o){s=s._reactInternals;var c=ws(),m=vr(c);m.tag=2,o!=null&&(m.callback=o),o=yr(s,m,c),o!==null&&(ds(o,s,c),Il(o,s,c))}};function k0(s,o,c,m,v,N,O){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(m,N,O):o.prototype&&o.prototype.isPureReactComponent?!Tl(c,m)||!Tl(v,N):!0}function w0(s,o,c,m){s=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(c,m),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(c,m),o.state!==s&&Gm.enqueueReplaceState(o,o.state,null)}function yo(s,o){var c=o;if("ref"in o){c={};for(var m in o)m!=="ref"&&(c[m]=o[m])}if(s=s.defaultProps){c===o&&(c=b({},c));for(var v in s)c[v]===void 0&&(c[v]=s[v])}return c}function S0(s){Nu(s)}function C0(s){console.error(s)}function N0(s){Nu(s)}function Qu(s,o){try{var c=s.onUncaughtError;c(o.value,{componentStack:o.stack})}catch(m){setTimeout(function(){throw m})}}function E0(s,o,c){try{var m=s.onCaughtError;m(c.value,{componentStack:c.stack,errorBoundary:o.tag===1?o.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function Ym(s,o,c){return c=vr(c),c.tag=3,c.payload={element:null},c.callback=function(){Qu(s,o)},c}function R0(s){return s=vr(s),s.tag=3,s}function T0(s,o,c,m){var v=c.type.getDerivedStateFromError;if(typeof v=="function"){var N=m.value;s.payload=function(){return v(N)},s.callback=function(){E0(o,c,m)}}var O=c.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(s.callback=function(){E0(o,c,m),typeof v!="function"&&(Nr===null?Nr=new Set([this]):Nr.add(this));var H=m.stack;this.componentDidCatch(m.value,{componentStack:H!==null?H:""})})}function KT(s,o,c,m,v){if(c.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(o=c.alternate,o!==null&&hi(o,c,v,!0),c=vs.current,c!==null){switch(c.tag){case 31:case 13:return Ls===null?ld():c.alternate===null&&pn===0&&(pn=3),c.flags&=-257,c.flags|=65536,c.lanes=v,m===Lu?c.flags|=16384:(o=c.updateQueue,o===null?c.updateQueue=new Set([m]):o.add(m),bg(s,m,v)),!1;case 22:return c.flags|=65536,m===Lu?c.flags|=16384:(o=c.updateQueue,o===null?(o={transitions:null,markerInstances:null,retryQueue:new Set([m])},c.updateQueue=o):(c=o.retryQueue,c===null?o.retryQueue=new Set([m]):c.add(m)),bg(s,m,v)),!1}throw Error(r(435,c.tag))}return bg(s,m,v),ld(),!1}if(Nt)return o=vs.current,o!==null?((o.flags&65536)===0&&(o.flags|=256),o.flags|=65536,o.lanes=v,m!==fm&&(s=Error(r(422),{cause:m}),zl(zs(s,c)))):(m!==fm&&(o=Error(r(423),{cause:m}),zl(zs(o,c))),s=s.current.alternate,s.flags|=65536,v&=-v,s.lanes|=v,m=zs(m,c),v=Ym(s.stateNode,m,v),km(s,v),pn!==4&&(pn=2)),!1;var N=Error(r(520),{cause:m});if(N=zs(N,c),Zl===null?Zl=[N]:Zl.push(N),pn!==4&&(pn=2),o===null)return!0;m=zs(m,c),c=o;do{switch(c.tag){case 3:return c.flags|=65536,s=v&-v,c.lanes|=s,s=Ym(c.stateNode,m,s),km(c,s),!1;case 1:if(o=c.type,N=c.stateNode,(c.flags&128)===0&&(typeof o.getDerivedStateFromError=="function"||N!==null&&typeof N.componentDidCatch=="function"&&(Nr===null||!Nr.has(N))))return c.flags|=65536,v&=-v,c.lanes|=v,v=R0(v),T0(v,s,c,m),km(c,v),!1}c=c.return}while(c!==null);return!1}var Km=Error(r(461)),kn=!1;function Bn(s,o,c,m){o.child=s===null?Oy(o,null,c,m):_o(o,s.child,c,m)}function A0(s,o,c,m,v){c=c.render;var N=o.ref;if("ref"in m){var O={};for(var H in m)H!=="ref"&&(O[H]=m[H])}else O=m;return go(o),m=Rm(s,o,c,O,N,v),H=Tm(),s!==null&&!kn?(Am(s,o,v),La(s,o,v)):(Nt&&H&&um(o),o.flags|=1,Bn(s,o,m,v),o.child)}function M0(s,o,c,m,v){if(s===null){var N=c.type;return typeof N=="function"&&!im(N)&&N.defaultProps===void 0&&c.compare===null?(o.tag=15,o.type=N,z0(s,o,N,m,v)):(s=Au(c.type,null,m,o,o.mode,v),s.ref=o.ref,s.return=o,o.child=s)}if(N=s.child,!ng(s,v)){var O=N.memoizedProps;if(c=c.compare,c=c!==null?c:Tl,c(O,m)&&s.ref===o.ref)return La(s,o,v)}return o.flags|=1,s=Aa(N,m),s.ref=o.ref,s.return=o,o.child=s}function z0(s,o,c,m,v){if(s!==null){var N=s.memoizedProps;if(Tl(N,m)&&s.ref===o.ref)if(kn=!1,o.pendingProps=m=N,ng(s,v))(s.flags&131072)!==0&&(kn=!0);else return o.lanes=s.lanes,La(s,o,v)}return Xm(s,o,c,m,v)}function O0(s,o,c,m){var v=m.children,N=s!==null?s.memoizedState:null;if(s===null&&o.stateNode===null&&(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.mode==="hidden"){if((o.flags&128)!==0){if(N=N!==null?N.baseLanes|c:c,s!==null){for(m=o.child=s.child,v=0;m!==null;)v=v|m.lanes|m.childLanes,m=m.sibling;m=v&~N}else m=0,o.child=null;return D0(s,o,N,c,m)}if((c&536870912)!==0)o.memoizedState={baseLanes:0,cachePool:null},s!==null&&Du(o,N!==null?N.cachePool:null),N!==null?Ly(o,N):Sm(),Iy(o);else return m=o.lanes=536870912,D0(s,o,N!==null?N.baseLanes|c:c,c,m)}else N!==null?(Du(o,N.cachePool),Ly(o,N),kr(),o.memoizedState=null):(s!==null&&Du(o,null),Sm(),kr());return Bn(s,o,v,c),o.child}function Fl(s,o){return s!==null&&s.tag===22||o.stateNode!==null||(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.sibling}function D0(s,o,c,m,v){var N=_m();return N=N===null?null:{parent:yn._currentValue,pool:N},o.memoizedState={baseLanes:c,cachePool:N},s!==null&&Du(o,null),Sm(),Iy(o),s!==null&&hi(s,o,m,!0),o.childLanes=v,null}function Wu(s,o){return o=Ju({mode:o.mode,children:o.children},s.mode),o.ref=s.ref,s.child=o,o.return=s,o}function P0(s,o,c){return _o(o,s.child,null,c),s=Wu(o,o.pendingProps),s.flags|=2,ys(o),o.memoizedState=null,s}function XT(s,o,c){var m=o.pendingProps,v=(o.flags&128)!==0;if(o.flags&=-129,s===null){if(Nt){if(m.mode==="hidden")return s=Wu(o,m),o.lanes=536870912,Fl(null,s);if(Nm(o),(s=en)?(s=K1(s,Ps),s=s!==null&&s.data==="&"?s:null,s!==null&&(o.memoizedState={dehydrated:s,treeContext:gr!==null?{id:la,overflow:ca}:null,retryLane:536870912,hydrationErrors:null},c=_y(s),c.return=o,o.child=c,In=o,en=null)):s=null,s===null)throw xr(o);return o.lanes=536870912,null}return Wu(o,m)}var N=s.memoizedState;if(N!==null){var O=N.dehydrated;if(Nm(o),v)if(o.flags&256)o.flags&=-257,o=P0(s,o,c);else if(o.memoizedState!==null)o.child=s.child,o.flags|=128,o=null;else throw Error(r(558));else if(kn||hi(s,o,c,!1),v=(c&s.childLanes)!==0,kn||v){if(m=Xt,m!==null&&(O=ht(m,c),O!==0&&O!==N.retryLane))throw N.retryLane=O,uo(s,O),ds(m,s,O),Km;ld(),o=P0(s,o,c)}else s=N.treeContext,en=Is(O.nextSibling),In=o,Nt=!0,hr=null,Ps=!1,s!==null&&jy(o,s),o=Wu(o,m),o.flags|=4096;return o}return s=Aa(s.child,{mode:m.mode,children:m.children}),s.ref=o.ref,o.child=s,s.return=o,s}function Zu(s,o){var c=o.ref;if(c===null)s!==null&&s.ref!==null&&(o.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(r(284));(s===null||s.ref!==c)&&(o.flags|=4194816)}}function Xm(s,o,c,m,v){return go(o),c=Rm(s,o,c,m,void 0,v),m=Tm(),s!==null&&!kn?(Am(s,o,v),La(s,o,v)):(Nt&&m&&um(o),o.flags|=1,Bn(s,o,c,v),o.child)}function L0(s,o,c,m,v,N){return go(o),o.updateQueue=null,c=By(o,m,c,v),$y(s),m=Tm(),s!==null&&!kn?(Am(s,o,N),La(s,o,N)):(Nt&&m&&um(o),o.flags|=1,Bn(s,o,c,N),o.child)}function I0(s,o,c,m,v){if(go(o),o.stateNode===null){var N=fi,O=c.contextType;typeof O=="object"&&O!==null&&(N=$n(O)),N=new c(m,N),o.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,N.updater=Gm,o.stateNode=N,N._reactInternals=o,N=o.stateNode,N.props=m,N.state=o.memoizedState,N.refs={},ym(o),O=c.contextType,N.context=typeof O=="object"&&O!==null?$n(O):fi,N.state=o.memoizedState,O=c.getDerivedStateFromProps,typeof O=="function"&&(Fm(o,c,O,m),N.state=o.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof N.getSnapshotBeforeUpdate=="function"||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(O=N.state,typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount(),O!==N.state&&Gm.enqueueReplaceState(N,N.state,null),Bl(o,m,N,v),$l(),N.state=o.memoizedState),typeof N.componentDidMount=="function"&&(o.flags|=4194308),m=!0}else if(s===null){N=o.stateNode;var H=o.memoizedProps,Z=yo(c,H);N.props=Z;var ue=N.context,ve=c.contextType;O=fi,typeof ve=="object"&&ve!==null&&(O=$n(ve));var Se=c.getDerivedStateFromProps;ve=typeof Se=="function"||typeof N.getSnapshotBeforeUpdate=="function",H=o.pendingProps!==H,ve||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(H||ue!==O)&&w0(o,N,m,O),_r=!1;var fe=o.memoizedState;N.state=fe,Bl(o,m,N,v),$l(),ue=o.memoizedState,H||fe!==ue||_r?(typeof Se=="function"&&(Fm(o,c,Se,m),ue=o.memoizedState),(Z=_r||k0(o,c,Z,m,fe,ue,O))?(ve||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount()),typeof N.componentDidMount=="function"&&(o.flags|=4194308)):(typeof N.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=ue),N.props=m,N.state=ue,N.context=O,m=Z):(typeof N.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{N=o.stateNode,jm(s,o),O=o.memoizedProps,ve=yo(c,O),N.props=ve,Se=o.pendingProps,fe=N.context,ue=c.contextType,Z=fi,typeof ue=="object"&&ue!==null&&(Z=$n(ue)),H=c.getDerivedStateFromProps,(ue=typeof H=="function"||typeof N.getSnapshotBeforeUpdate=="function")||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(O!==Se||fe!==Z)&&w0(o,N,m,Z),_r=!1,fe=o.memoizedState,N.state=fe,Bl(o,m,N,v),$l();var he=o.memoizedState;O!==Se||fe!==he||_r||s!==null&&s.dependencies!==null&&zu(s.dependencies)?(typeof H=="function"&&(Fm(o,c,H,m),he=o.memoizedState),(ve=_r||k0(o,c,ve,m,fe,he,Z)||s!==null&&s.dependencies!==null&&zu(s.dependencies))?(ue||typeof N.UNSAFE_componentWillUpdate!="function"&&typeof N.componentWillUpdate!="function"||(typeof N.componentWillUpdate=="function"&&N.componentWillUpdate(m,he,Z),typeof N.UNSAFE_componentWillUpdate=="function"&&N.UNSAFE_componentWillUpdate(m,he,Z)),typeof N.componentDidUpdate=="function"&&(o.flags|=4),typeof N.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof N.componentDidUpdate!="function"||O===s.memoizedProps&&fe===s.memoizedState||(o.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||O===s.memoizedProps&&fe===s.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=he),N.props=m,N.state=he,N.context=Z,m=ve):(typeof N.componentDidUpdate!="function"||O===s.memoizedProps&&fe===s.memoizedState||(o.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||O===s.memoizedProps&&fe===s.memoizedState||(o.flags|=1024),m=!1)}return N=m,Zu(s,o),m=(o.flags&128)!==0,N||m?(N=o.stateNode,c=m&&typeof c.getDerivedStateFromError!="function"?null:N.render(),o.flags|=1,s!==null&&m?(o.child=_o(o,s.child,null,v),o.child=_o(o,null,c,v)):Bn(s,o,c,v),o.memoizedState=N.state,s=o.child):s=La(s,o,v),s}function $0(s,o,c,m){return po(),o.flags|=256,Bn(s,o,c,m),o.child}var Qm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wm(s){return{baseLanes:s,cachePool:Ey()}}function Zm(s,o,c){return s=s!==null?s.childLanes&~c:0,o&&(s|=ks),s}function B0(s,o,c){var m=o.pendingProps,v=!1,N=(o.flags&128)!==0,O;if((O=N)||(O=s!==null&&s.memoizedState===null?!1:(hn.current&2)!==0),O&&(v=!0,o.flags&=-129),O=(o.flags&32)!==0,o.flags&=-33,s===null){if(Nt){if(v?jr(o):kr(),(s=en)?(s=K1(s,Ps),s=s!==null&&s.data!=="&"?s:null,s!==null&&(o.memoizedState={dehydrated:s,treeContext:gr!==null?{id:la,overflow:ca}:null,retryLane:536870912,hydrationErrors:null},c=_y(s),c.return=o,o.child=c,In=o,en=null)):s=null,s===null)throw xr(o);return Og(s)?o.lanes=32:o.lanes=536870912,null}var H=m.children;return m=m.fallback,v?(kr(),v=o.mode,H=Ju({mode:"hidden",children:H},v),m=fo(m,v,c,null),H.return=o,m.return=o,H.sibling=m,o.child=H,m=o.child,m.memoizedState=Wm(c),m.childLanes=Zm(s,O,c),o.memoizedState=Qm,Fl(null,m)):(jr(o),Jm(o,H))}var Z=s.memoizedState;if(Z!==null&&(H=Z.dehydrated,H!==null)){if(N)o.flags&256?(jr(o),o.flags&=-257,o=eg(s,o,c)):o.memoizedState!==null?(kr(),o.child=s.child,o.flags|=128,o=null):(kr(),H=m.fallback,v=o.mode,m=Ju({mode:"visible",children:m.children},v),H=fo(H,v,c,null),H.flags|=2,m.return=o,H.return=o,m.sibling=H,o.child=m,_o(o,s.child,null,c),m=o.child,m.memoizedState=Wm(c),m.childLanes=Zm(s,O,c),o.memoizedState=Qm,o=Fl(null,m));else if(jr(o),Og(H)){if(O=H.nextSibling&&H.nextSibling.dataset,O)var ue=O.dgst;O=ue,m=Error(r(419)),m.stack="",m.digest=O,zl({value:m,source:null,stack:null}),o=eg(s,o,c)}else if(kn||hi(s,o,c,!1),O=(c&s.childLanes)!==0,kn||O){if(O=Xt,O!==null&&(m=ht(O,c),m!==0&&m!==Z.retryLane))throw Z.retryLane=m,uo(s,m),ds(O,s,m),Km;zg(H)||ld(),o=eg(s,o,c)}else zg(H)?(o.flags|=192,o.child=s.child,o=null):(s=Z.treeContext,en=Is(H.nextSibling),In=o,Nt=!0,hr=null,Ps=!1,s!==null&&jy(o,s),o=Jm(o,m.children),o.flags|=4096);return o}return v?(kr(),H=m.fallback,v=o.mode,Z=s.child,ue=Z.sibling,m=Aa(Z,{mode:"hidden",children:m.children}),m.subtreeFlags=Z.subtreeFlags&65011712,ue!==null?H=Aa(ue,H):(H=fo(H,v,c,null),H.flags|=2),H.return=o,m.return=o,m.sibling=H,o.child=m,Fl(null,m),m=o.child,H=s.child.memoizedState,H===null?H=Wm(c):(v=H.cachePool,v!==null?(Z=yn._currentValue,v=v.parent!==Z?{parent:Z,pool:Z}:v):v=Ey(),H={baseLanes:H.baseLanes|c,cachePool:v}),m.memoizedState=H,m.childLanes=Zm(s,O,c),o.memoizedState=Qm,Fl(s.child,m)):(jr(o),c=s.child,s=c.sibling,c=Aa(c,{mode:"visible",children:m.children}),c.return=o,c.sibling=null,s!==null&&(O=o.deletions,O===null?(o.deletions=[s],o.flags|=16):O.push(s)),o.child=c,o.memoizedState=null,c)}function Jm(s,o){return o=Ju({mode:"visible",children:o},s.mode),o.return=s,s.child=o}function Ju(s,o){return s=_s(22,s,null,o),s.lanes=0,s}function eg(s,o,c){return _o(o,s.child,null,c),s=Jm(o,o.pendingProps.children),s.flags|=2,o.memoizedState=null,s}function U0(s,o,c){s.lanes|=o;var m=s.alternate;m!==null&&(m.lanes|=o),gm(s.return,o,c)}function tg(s,o,c,m,v,N){var O=s.memoizedState;O===null?s.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:c,tailMode:v,treeForkCount:N}:(O.isBackwards=o,O.rendering=null,O.renderingStartTime=0,O.last=m,O.tail=c,O.tailMode=v,O.treeForkCount=N)}function q0(s,o,c){var m=o.pendingProps,v=m.revealOrder,N=m.tail;m=m.children;var O=hn.current,H=(O&2)!==0;if(H?(O=O&1|2,o.flags|=128):O&=1,J(hn,O),Bn(s,o,m,c),m=Nt?Ml:0,!H&&s!==null&&(s.flags&128)!==0)e:for(s=o.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&U0(s,c,o);else if(s.tag===19)U0(s,c,o);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===o)break e;for(;s.sibling===null;){if(s.return===null||s.return===o)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(v){case"forwards":for(c=o.child,v=null;c!==null;)s=c.alternate,s!==null&&Uu(s)===null&&(v=c),c=c.sibling;c=v,c===null?(v=o.child,o.child=null):(v=c.sibling,c.sibling=null),tg(o,!1,v,c,N,m);break;case"backwards":case"unstable_legacy-backwards":for(c=null,v=o.child,o.child=null;v!==null;){if(s=v.alternate,s!==null&&Uu(s)===null){o.child=v;break}s=v.sibling,v.sibling=c,c=v,v=s}tg(o,!0,c,null,N,m);break;case"together":tg(o,!1,null,null,void 0,m);break;default:o.memoizedState=null}return o.child}function La(s,o,c){if(s!==null&&(o.dependencies=s.dependencies),Cr|=o.lanes,(c&o.childLanes)===0)if(s!==null){if(hi(s,o,c,!1),(c&o.childLanes)===0)return null}else return null;if(s!==null&&o.child!==s.child)throw Error(r(153));if(o.child!==null){for(s=o.child,c=Aa(s,s.pendingProps),o.child=c,c.return=o;s.sibling!==null;)s=s.sibling,c=c.sibling=Aa(s,s.pendingProps),c.return=o;c.sibling=null}return o.child}function ng(s,o){return(s.lanes&o)!==0?!0:(s=s.dependencies,!!(s!==null&&zu(s)))}function QT(s,o,c){switch(o.tag){case 3:F(o,o.stateNode.containerInfo),br(o,yn,s.memoizedState.cache),po();break;case 27:case 5:_e(o);break;case 4:F(o,o.stateNode.containerInfo);break;case 10:br(o,o.type,o.memoizedProps.value);break;case 31:if(o.memoizedState!==null)return o.flags|=128,Nm(o),null;break;case 13:var m=o.memoizedState;if(m!==null)return m.dehydrated!==null?(jr(o),o.flags|=128,null):(c&o.child.childLanes)!==0?B0(s,o,c):(jr(o),s=La(s,o,c),s!==null?s.sibling:null);jr(o);break;case 19:var v=(s.flags&128)!==0;if(m=(c&o.childLanes)!==0,m||(hi(s,o,c,!1),m=(c&o.childLanes)!==0),v){if(m)return q0(s,o,c);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),J(hn,hn.current),m)break;return null;case 22:return o.lanes=0,O0(s,o,c,o.pendingProps);case 24:br(o,yn,s.memoizedState.cache)}return La(s,o,c)}function H0(s,o,c){if(s!==null)if(s.memoizedProps!==o.pendingProps)kn=!0;else{if(!ng(s,c)&&(o.flags&128)===0)return kn=!1,QT(s,o,c);kn=(s.flags&131072)!==0}else kn=!1,Nt&&(o.flags&1048576)!==0&&yy(o,Ml,o.index);switch(o.lanes=0,o.tag){case 16:e:{var m=o.pendingProps;if(s=xo(o.elementType),o.type=s,typeof s=="function")im(s)?(m=yo(s,m),o.tag=1,o=I0(null,o,s,m,c)):(o.tag=0,o=Xm(null,o,s,m,c));else{if(s!=null){var v=s.$$typeof;if(v===R){o.tag=11,o=A0(null,o,s,m,c);break e}else if(v===z){o.tag=14,o=M0(null,o,s,m,c);break e}}throw o=q(s)||s,Error(r(306,o,""))}}return o;case 0:return Xm(s,o,o.type,o.pendingProps,c);case 1:return m=o.type,v=yo(m,o.pendingProps),I0(s,o,m,v,c);case 3:e:{if(F(o,o.stateNode.containerInfo),s===null)throw Error(r(387));m=o.pendingProps;var N=o.memoizedState;v=N.element,jm(s,o),Bl(o,m,null,c);var O=o.memoizedState;if(m=O.cache,br(o,yn,m),m!==N.cache&&hm(o,[yn],c,!0),$l(),m=O.element,N.isDehydrated)if(N={element:m,isDehydrated:!1,cache:O.cache},o.updateQueue.baseState=N,o.memoizedState=N,o.flags&256){o=$0(s,o,m,c);break e}else if(m!==v){v=zs(Error(r(424)),o),zl(v),o=$0(s,o,m,c);break e}else{switch(s=o.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(en=Is(s.firstChild),In=o,Nt=!0,hr=null,Ps=!0,c=Oy(o,null,m,c),o.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(po(),m===v){o=La(s,o,c);break e}Bn(s,o,m,c)}o=o.child}return o;case 26:return Zu(s,o),s===null?(c=ej(o.type,null,o.pendingProps,null))?o.memoizedState=c:Nt||(c=o.type,s=o.pendingProps,m=gd(se.current).createElement(c),m[Wt]=o,m[vn]=s,Un(m,c,s),zn(m),o.stateNode=m):o.memoizedState=ej(o.type,s.memoizedProps,o.pendingProps,s.memoizedState),null;case 27:return _e(o),s===null&&Nt&&(m=o.stateNode=W1(o.type,o.pendingProps,se.current),In=o,Ps=!0,v=en,Ar(o.type)?(Dg=v,en=Is(m.firstChild)):en=v),Bn(s,o,o.pendingProps.children,c),Zu(s,o),s===null&&(o.flags|=4194304),o.child;case 5:return s===null&&Nt&&((v=m=en)&&(m=C5(m,o.type,o.pendingProps,Ps),m!==null?(o.stateNode=m,In=o,en=Is(m.firstChild),Ps=!1,v=!0):v=!1),v||xr(o)),_e(o),v=o.type,N=o.pendingProps,O=s!==null?s.memoizedProps:null,m=N.children,Tg(v,N)?m=null:O!==null&&Tg(v,O)&&(o.flags|=32),o.memoizedState!==null&&(v=Rm(s,o,UT,null,null,c),oc._currentValue=v),Zu(s,o),Bn(s,o,m,c),o.child;case 6:return s===null&&Nt&&((s=c=en)&&(c=N5(c,o.pendingProps,Ps),c!==null?(o.stateNode=c,In=o,en=null,s=!0):s=!1),s||xr(o)),null;case 13:return B0(s,o,c);case 4:return F(o,o.stateNode.containerInfo),m=o.pendingProps,s===null?o.child=_o(o,null,m,c):Bn(s,o,m,c),o.child;case 11:return A0(s,o,o.type,o.pendingProps,c);case 7:return Bn(s,o,o.pendingProps,c),o.child;case 8:return Bn(s,o,o.pendingProps.children,c),o.child;case 12:return Bn(s,o,o.pendingProps.children,c),o.child;case 10:return m=o.pendingProps,br(o,o.type,m.value),Bn(s,o,m.children,c),o.child;case 9:return v=o.type._context,m=o.pendingProps.children,go(o),v=$n(v),m=m(v),o.flags|=1,Bn(s,o,m,c),o.child;case 14:return M0(s,o,o.type,o.pendingProps,c);case 15:return z0(s,o,o.type,o.pendingProps,c);case 19:return q0(s,o,c);case 31:return XT(s,o,c);case 22:return O0(s,o,c,o.pendingProps);case 24:return go(o),m=$n(yn),s===null?(v=_m(),v===null&&(v=Xt,N=xm(),v.pooledCache=N,N.refCount++,N!==null&&(v.pooledCacheLanes|=c),v=N),o.memoizedState={parent:m,cache:v},ym(o),br(o,yn,v)):((s.lanes&c)!==0&&(jm(s,o),Bl(o,null,null,c),$l()),v=s.memoizedState,N=o.memoizedState,v.parent!==m?(v={parent:m,cache:m},o.memoizedState=v,o.lanes===0&&(o.memoizedState=o.updateQueue.baseState=v),br(o,yn,m)):(m=N.cache,br(o,yn,m),m!==v.cache&&hm(o,[yn],c,!0))),Bn(s,o,o.pendingProps.children,c),o.child;case 29:throw o.pendingProps}throw Error(r(156,o.tag))}function Ia(s){s.flags|=4}function sg(s,o,c,m,v){if((o=(s.mode&32)!==0)&&(o=!1),o){if(s.flags|=16777216,(v&335544128)===v)if(s.stateNode.complete)s.flags|=8192;else if(h1())s.flags|=8192;else throw bo=Lu,vm}else s.flags&=-16777217}function V0(s,o){if(o.type!=="stylesheet"||(o.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!rj(o))if(h1())s.flags|=8192;else throw bo=Lu,vm}function ed(s,o){o!==null&&(s.flags|=4),s.flags&16384&&(o=s.tag!==22?An():536870912,s.lanes|=o,Ei|=o)}function Gl(s,o){if(!Nt)switch(s.tailMode){case"hidden":o=s.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?s.tail=null:c.sibling=null;break;case"collapsed":c=s.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?o||s.tail===null?s.tail=null:s.tail.sibling=null:m.sibling=null}}function tn(s){var o=s.alternate!==null&&s.alternate.child===s.child,c=0,m=0;if(o)for(var v=s.child;v!==null;)c|=v.lanes|v.childLanes,m|=v.subtreeFlags&65011712,m|=v.flags&65011712,v.return=s,v=v.sibling;else for(v=s.child;v!==null;)c|=v.lanes|v.childLanes,m|=v.subtreeFlags,m|=v.flags,v.return=s,v=v.sibling;return s.subtreeFlags|=m,s.childLanes=c,o}function WT(s,o,c){var m=o.pendingProps;switch(dm(o),o.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tn(o),null;case 1:return tn(o),null;case 3:return c=o.stateNode,m=null,s!==null&&(m=s.memoizedState.cache),o.memoizedState.cache!==m&&(o.flags|=2048),Oa(yn),oe(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(s===null||s.child===null)&&(gi(o)?Ia(o):s===null||s.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,pm())),tn(o),null;case 26:var v=o.type,N=o.memoizedState;return s===null?(Ia(o),N!==null?(tn(o),V0(o,N)):(tn(o),sg(o,v,null,m,c))):N?N!==s.memoizedState?(Ia(o),tn(o),V0(o,N)):(tn(o),o.flags&=-16777217):(s=s.memoizedProps,s!==m&&Ia(o),tn(o),sg(o,v,s,m,c)),null;case 27:if(le(o),c=se.current,v=o.type,s!==null&&o.stateNode!=null)s.memoizedProps!==m&&Ia(o);else{if(!m){if(o.stateNode===null)throw Error(r(166));return tn(o),null}s=G.current,gi(o)?ky(o):(s=W1(v,m,c),o.stateNode=s,Ia(o))}return tn(o),null;case 5:if(le(o),v=o.type,s!==null&&o.stateNode!=null)s.memoizedProps!==m&&Ia(o);else{if(!m){if(o.stateNode===null)throw Error(r(166));return tn(o),null}if(N=G.current,gi(o))ky(o);else{var O=gd(se.current);switch(N){case 1:N=O.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:N=O.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":N=O.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":N=O.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":N=O.createElement("div"),N.innerHTML="<script><\/script>",N=N.removeChild(N.firstChild);break;case"select":N=typeof m.is=="string"?O.createElement("select",{is:m.is}):O.createElement("select"),m.multiple?N.multiple=!0:m.size&&(N.size=m.size);break;default:N=typeof m.is=="string"?O.createElement(v,{is:m.is}):O.createElement(v)}}N[Wt]=o,N[vn]=m;e:for(O=o.child;O!==null;){if(O.tag===5||O.tag===6)N.appendChild(O.stateNode);else if(O.tag!==4&&O.tag!==27&&O.child!==null){O.child.return=O,O=O.child;continue}if(O===o)break e;for(;O.sibling===null;){if(O.return===null||O.return===o)break e;O=O.return}O.sibling.return=O.return,O=O.sibling}o.stateNode=N;e:switch(Un(N,v,m),v){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&Ia(o)}}return tn(o),sg(o,o.type,s===null?null:s.memoizedProps,o.pendingProps,c),null;case 6:if(s&&o.stateNode!=null)s.memoizedProps!==m&&Ia(o);else{if(typeof m!="string"&&o.stateNode===null)throw Error(r(166));if(s=se.current,gi(o)){if(s=o.stateNode,c=o.memoizedProps,m=null,v=In,v!==null)switch(v.tag){case 27:case 5:m=v.memoizedProps}s[Wt]=o,s=!!(s.nodeValue===c||m!==null&&m.suppressHydrationWarning===!0||B1(s.nodeValue,c)),s||xr(o,!0)}else s=gd(s).createTextNode(m),s[Wt]=o,o.stateNode=s}return tn(o),null;case 31:if(c=o.memoizedState,s===null||s.memoizedState!==null){if(m=gi(o),c!==null){if(s===null){if(!m)throw Error(r(318));if(s=o.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));s[Wt]=o}else po(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;tn(o),s=!1}else c=pm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),s=!0;if(!s)return o.flags&256?(ys(o),o):(ys(o),null);if((o.flags&128)!==0)throw Error(r(558))}return tn(o),null;case 13:if(m=o.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(v=gi(o),m!==null&&m.dehydrated!==null){if(s===null){if(!v)throw Error(r(318));if(v=o.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(r(317));v[Wt]=o}else po(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;tn(o),v=!1}else v=pm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=v),v=!0;if(!v)return o.flags&256?(ys(o),o):(ys(o),null)}return ys(o),(o.flags&128)!==0?(o.lanes=c,o):(c=m!==null,s=s!==null&&s.memoizedState!==null,c&&(m=o.child,v=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(v=m.alternate.memoizedState.cachePool.pool),N=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(N=m.memoizedState.cachePool.pool),N!==v&&(m.flags|=2048)),c!==s&&c&&(o.child.flags|=8192),ed(o,o.updateQueue),tn(o),null);case 4:return oe(),s===null&&Sg(o.stateNode.containerInfo),tn(o),null;case 10:return Oa(o.type),tn(o),null;case 19:if(K(hn),m=o.memoizedState,m===null)return tn(o),null;if(v=(o.flags&128)!==0,N=m.rendering,N===null)if(v)Gl(m,!1);else{if(pn!==0||s!==null&&(s.flags&128)!==0)for(s=o.child;s!==null;){if(N=Uu(s),N!==null){for(o.flags|=128,Gl(m,!1),s=N.updateQueue,o.updateQueue=s,ed(o,s),o.subtreeFlags=0,s=c,c=o.child;c!==null;)by(c,s),c=c.sibling;return J(hn,hn.current&1|2),Nt&&Ma(o,m.treeForkCount),o.child}s=s.sibling}m.tail!==null&&ge()>rd&&(o.flags|=128,v=!0,Gl(m,!1),o.lanes=4194304)}else{if(!v)if(s=Uu(N),s!==null){if(o.flags|=128,v=!0,s=s.updateQueue,o.updateQueue=s,ed(o,s),Gl(m,!0),m.tail===null&&m.tailMode==="hidden"&&!N.alternate&&!Nt)return tn(o),null}else 2*ge()-m.renderingStartTime>rd&&c!==536870912&&(o.flags|=128,v=!0,Gl(m,!1),o.lanes=4194304);m.isBackwards?(N.sibling=o.child,o.child=N):(s=m.last,s!==null?s.sibling=N:o.child=N,m.last=N)}return m.tail!==null?(s=m.tail,m.rendering=s,m.tail=s.sibling,m.renderingStartTime=ge(),s.sibling=null,c=hn.current,J(hn,v?c&1|2:c&1),Nt&&Ma(o,m.treeForkCount),s):(tn(o),null);case 22:case 23:return ys(o),Cm(),m=o.memoizedState!==null,s!==null?s.memoizedState!==null!==m&&(o.flags|=8192):m&&(o.flags|=8192),m?(c&536870912)!==0&&(o.flags&128)===0&&(tn(o),o.subtreeFlags&6&&(o.flags|=8192)):tn(o),c=o.updateQueue,c!==null&&ed(o,c.retryQueue),c=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),m=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(m=o.memoizedState.cachePool.pool),m!==c&&(o.flags|=2048),s!==null&&K(ho),null;case 24:return c=null,s!==null&&(c=s.memoizedState.cache),o.memoizedState.cache!==c&&(o.flags|=2048),Oa(yn),tn(o),null;case 25:return null;case 30:return null}throw Error(r(156,o.tag))}function ZT(s,o){switch(dm(o),o.tag){case 1:return s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 3:return Oa(yn),oe(),s=o.flags,(s&65536)!==0&&(s&128)===0?(o.flags=s&-65537|128,o):null;case 26:case 27:case 5:return le(o),null;case 31:if(o.memoizedState!==null){if(ys(o),o.alternate===null)throw Error(r(340));po()}return s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 13:if(ys(o),s=o.memoizedState,s!==null&&s.dehydrated!==null){if(o.alternate===null)throw Error(r(340));po()}return s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 19:return K(hn),null;case 4:return oe(),null;case 10:return Oa(o.type),null;case 22:case 23:return ys(o),Cm(),s!==null&&K(ho),s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 24:return Oa(yn),null;case 25:return null;default:return null}}function F0(s,o){switch(dm(o),o.tag){case 3:Oa(yn),oe();break;case 26:case 27:case 5:le(o);break;case 4:oe();break;case 31:o.memoizedState!==null&&ys(o);break;case 13:ys(o);break;case 19:K(hn);break;case 10:Oa(o.type);break;case 22:case 23:ys(o),Cm(),s!==null&&K(ho);break;case 24:Oa(yn)}}function Yl(s,o){try{var c=o.updateQueue,m=c!==null?c.lastEffect:null;if(m!==null){var v=m.next;c=v;do{if((c.tag&s)===s){m=void 0;var N=c.create,O=c.inst;m=N(),O.destroy=m}c=c.next}while(c!==v)}}catch(H){$t(o,o.return,H)}}function wr(s,o,c){try{var m=o.updateQueue,v=m!==null?m.lastEffect:null;if(v!==null){var N=v.next;m=N;do{if((m.tag&s)===s){var O=m.inst,H=O.destroy;if(H!==void 0){O.destroy=void 0,v=o;var Z=c,ue=H;try{ue()}catch(ve){$t(v,Z,ve)}}}m=m.next}while(m!==N)}}catch(ve){$t(o,o.return,ve)}}function G0(s){var o=s.updateQueue;if(o!==null){var c=s.stateNode;try{Py(o,c)}catch(m){$t(s,s.return,m)}}}function Y0(s,o,c){c.props=yo(s.type,s.memoizedProps),c.state=s.memoizedState;try{c.componentWillUnmount()}catch(m){$t(s,o,m)}}function Kl(s,o){try{var c=s.ref;if(c!==null){switch(s.tag){case 26:case 27:case 5:var m=s.stateNode;break;case 30:m=s.stateNode;break;default:m=s.stateNode}typeof c=="function"?s.refCleanup=c(m):c.current=m}}catch(v){$t(s,o,v)}}function ua(s,o){var c=s.ref,m=s.refCleanup;if(c!==null)if(typeof m=="function")try{m()}catch(v){$t(s,o,v)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(v){$t(s,o,v)}else c.current=null}function K0(s){var o=s.type,c=s.memoizedProps,m=s.stateNode;try{e:switch(o){case"button":case"input":case"select":case"textarea":c.autoFocus&&m.focus();break e;case"img":c.src?m.src=c.src:c.srcSet&&(m.srcset=c.srcSet)}}catch(v){$t(s,s.return,v)}}function ag(s,o,c){try{var m=s.stateNode;v5(m,s.type,c,o),m[vn]=o}catch(v){$t(s,s.return,v)}}function X0(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Ar(s.type)||s.tag===4}function rg(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||X0(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Ar(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function og(s,o,c){var m=s.tag;if(m===5||m===6)s=s.stateNode,o?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(s,o):(o=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,o.appendChild(s),c=c._reactRootContainer,c!=null||o.onclick!==null||(o.onclick=Ra));else if(m!==4&&(m===27&&Ar(s.type)&&(c=s.stateNode,o=null),s=s.child,s!==null))for(og(s,o,c),s=s.sibling;s!==null;)og(s,o,c),s=s.sibling}function td(s,o,c){var m=s.tag;if(m===5||m===6)s=s.stateNode,o?c.insertBefore(s,o):c.appendChild(s);else if(m!==4&&(m===27&&Ar(s.type)&&(c=s.stateNode),s=s.child,s!==null))for(td(s,o,c),s=s.sibling;s!==null;)td(s,o,c),s=s.sibling}function Q0(s){var o=s.stateNode,c=s.memoizedProps;try{for(var m=s.type,v=o.attributes;v.length;)o.removeAttributeNode(v[0]);Un(o,m,c),o[Wt]=s,o[vn]=c}catch(N){$t(s,s.return,N)}}var $a=!1,wn=!1,ig=!1,W0=typeof WeakSet=="function"?WeakSet:Set,On=null;function JT(s,o){if(s=s.containerInfo,Eg=jd,s=cy(s),em(s)){if("selectionStart"in s)var c={start:s.selectionStart,end:s.selectionEnd};else e:{c=(c=s.ownerDocument)&&c.defaultView||window;var m=c.getSelection&&c.getSelection();if(m&&m.rangeCount!==0){c=m.anchorNode;var v=m.anchorOffset,N=m.focusNode;m=m.focusOffset;try{c.nodeType,N.nodeType}catch{c=null;break e}var O=0,H=-1,Z=-1,ue=0,ve=0,Se=s,fe=null;t:for(;;){for(var he;Se!==c||v!==0&&Se.nodeType!==3||(H=O+v),Se!==N||m!==0&&Se.nodeType!==3||(Z=O+m),Se.nodeType===3&&(O+=Se.nodeValue.length),(he=Se.firstChild)!==null;)fe=Se,Se=he;for(;;){if(Se===s)break t;if(fe===c&&++ue===v&&(H=O),fe===N&&++ve===m&&(Z=O),(he=Se.nextSibling)!==null)break;Se=fe,fe=Se.parentNode}Se=he}c=H===-1||Z===-1?null:{start:H,end:Z}}else c=null}c=c||{start:0,end:0}}else c=null;for(Rg={focusedElem:s,selectionRange:c},jd=!1,On=o;On!==null;)if(o=On,s=o.child,(o.subtreeFlags&1028)!==0&&s!==null)s.return=o,On=s;else for(;On!==null;){switch(o=On,N=o.alternate,s=o.flags,o.tag){case 0:if((s&4)!==0&&(s=o.updateQueue,s=s!==null?s.events:null,s!==null))for(c=0;c<s.length;c++)v=s[c],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&N!==null){s=void 0,c=o,v=N.memoizedProps,N=N.memoizedState,m=c.stateNode;try{var Fe=yo(c.type,v);s=m.getSnapshotBeforeUpdate(Fe,N),m.__reactInternalSnapshotBeforeUpdate=s}catch(at){$t(c,c.return,at)}}break;case 3:if((s&1024)!==0){if(s=o.stateNode.containerInfo,c=s.nodeType,c===9)Mg(s);else if(c===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Mg(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(r(163))}if(s=o.sibling,s!==null){s.return=o.return,On=s;break}On=o.return}}function Z0(s,o,c){var m=c.flags;switch(c.tag){case 0:case 11:case 15:Ua(s,c),m&4&&Yl(5,c);break;case 1:if(Ua(s,c),m&4)if(s=c.stateNode,o===null)try{s.componentDidMount()}catch(O){$t(c,c.return,O)}else{var v=yo(c.type,o.memoizedProps);o=o.memoizedState;try{s.componentDidUpdate(v,o,s.__reactInternalSnapshotBeforeUpdate)}catch(O){$t(c,c.return,O)}}m&64&&G0(c),m&512&&Kl(c,c.return);break;case 3:if(Ua(s,c),m&64&&(s=c.updateQueue,s!==null)){if(o=null,c.child!==null)switch(c.child.tag){case 27:case 5:o=c.child.stateNode;break;case 1:o=c.child.stateNode}try{Py(s,o)}catch(O){$t(c,c.return,O)}}break;case 27:o===null&&m&4&&Q0(c);case 26:case 5:Ua(s,c),o===null&&m&4&&K0(c),m&512&&Kl(c,c.return);break;case 12:Ua(s,c);break;case 31:Ua(s,c),m&4&&t1(s,c);break;case 13:Ua(s,c),m&4&&n1(s,c),m&64&&(s=c.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(c=l5.bind(null,c),E5(s,c))));break;case 22:if(m=c.memoizedState!==null||$a,!m){o=o!==null&&o.memoizedState!==null||wn,v=$a;var N=wn;$a=m,(wn=o)&&!N?qa(s,c,(c.subtreeFlags&8772)!==0):Ua(s,c),$a=v,wn=N}break;case 30:break;default:Ua(s,c)}}function J0(s){var o=s.alternate;o!==null&&(s.alternate=null,J0(o)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(o=s.stateNode,o!==null&&Lp(o)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var ln=null,is=!1;function Ba(s,o,c){for(c=c.child;c!==null;)e1(s,o,c),c=c.sibling}function e1(s,o,c){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(_t,c)}catch{}switch(c.tag){case 26:wn||ua(c,o),Ba(s,o,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:wn||ua(c,o);var m=ln,v=is;Ar(c.type)&&(ln=c.stateNode,is=!1),Ba(s,o,c),sc(c.stateNode),ln=m,is=v;break;case 5:wn||ua(c,o);case 6:if(m=ln,v=is,ln=null,Ba(s,o,c),ln=m,is=v,ln!==null)if(is)try{(ln.nodeType===9?ln.body:ln.nodeName==="HTML"?ln.ownerDocument.body:ln).removeChild(c.stateNode)}catch(N){$t(c,o,N)}else try{ln.removeChild(c.stateNode)}catch(N){$t(c,o,N)}break;case 18:ln!==null&&(is?(s=ln,G1(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,c.stateNode),Pi(s)):G1(ln,c.stateNode));break;case 4:m=ln,v=is,ln=c.stateNode.containerInfo,is=!0,Ba(s,o,c),ln=m,is=v;break;case 0:case 11:case 14:case 15:wr(2,c,o),wn||wr(4,c,o),Ba(s,o,c);break;case 1:wn||(ua(c,o),m=c.stateNode,typeof m.componentWillUnmount=="function"&&Y0(c,o,m)),Ba(s,o,c);break;case 21:Ba(s,o,c);break;case 22:wn=(m=wn)||c.memoizedState!==null,Ba(s,o,c),wn=m;break;default:Ba(s,o,c)}}function t1(s,o){if(o.memoizedState===null&&(s=o.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Pi(s)}catch(c){$t(o,o.return,c)}}}function n1(s,o){if(o.memoizedState===null&&(s=o.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Pi(s)}catch(c){$t(o,o.return,c)}}function e5(s){switch(s.tag){case 31:case 13:case 19:var o=s.stateNode;return o===null&&(o=s.stateNode=new W0),o;case 22:return s=s.stateNode,o=s._retryCache,o===null&&(o=s._retryCache=new W0),o;default:throw Error(r(435,s.tag))}}function nd(s,o){var c=e5(s);o.forEach(function(m){if(!c.has(m)){c.add(m);var v=c5.bind(null,s,m);m.then(v,v)}})}function ls(s,o){var c=o.deletions;if(c!==null)for(var m=0;m<c.length;m++){var v=c[m],N=s,O=o,H=O;e:for(;H!==null;){switch(H.tag){case 27:if(Ar(H.type)){ln=H.stateNode,is=!1;break e}break;case 5:ln=H.stateNode,is=!1;break e;case 3:case 4:ln=H.stateNode.containerInfo,is=!0;break e}H=H.return}if(ln===null)throw Error(r(160));e1(N,O,v),ln=null,is=!1,N=v.alternate,N!==null&&(N.return=null),v.return=null}if(o.subtreeFlags&13886)for(o=o.child;o!==null;)s1(o,s),o=o.sibling}var Ks=null;function s1(s,o){var c=s.alternate,m=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:ls(o,s),cs(s),m&4&&(wr(3,s,s.return),Yl(3,s),wr(5,s,s.return));break;case 1:ls(o,s),cs(s),m&512&&(wn||c===null||ua(c,c.return)),m&64&&$a&&(s=s.updateQueue,s!==null&&(m=s.callbacks,m!==null&&(c=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=c===null?m:c.concat(m))));break;case 26:var v=Ks;if(ls(o,s),cs(s),m&512&&(wn||c===null||ua(c,c.return)),m&4){var N=c!==null?c.memoizedState:null;if(m=s.memoizedState,c===null)if(m===null)if(s.stateNode===null){e:{m=s.type,c=s.memoizedProps,v=v.ownerDocument||v;t:switch(m){case"title":N=v.getElementsByTagName("title")[0],(!N||N[yl]||N[Wt]||N.namespaceURI==="http://www.w3.org/2000/svg"||N.hasAttribute("itemprop"))&&(N=v.createElement(m),v.head.insertBefore(N,v.querySelector("head > title"))),Un(N,m,c),N[Wt]=s,zn(N),m=N;break e;case"link":var O=sj("link","href",v).get(m+(c.href||""));if(O){for(var H=0;H<O.length;H++)if(N=O[H],N.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&N.getAttribute("rel")===(c.rel==null?null:c.rel)&&N.getAttribute("title")===(c.title==null?null:c.title)&&N.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){O.splice(H,1);break t}}N=v.createElement(m),Un(N,m,c),v.head.appendChild(N);break;case"meta":if(O=sj("meta","content",v).get(m+(c.content||""))){for(H=0;H<O.length;H++)if(N=O[H],N.getAttribute("content")===(c.content==null?null:""+c.content)&&N.getAttribute("name")===(c.name==null?null:c.name)&&N.getAttribute("property")===(c.property==null?null:c.property)&&N.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&N.getAttribute("charset")===(c.charSet==null?null:c.charSet)){O.splice(H,1);break t}}N=v.createElement(m),Un(N,m,c),v.head.appendChild(N);break;default:throw Error(r(468,m))}N[Wt]=s,zn(N),m=N}s.stateNode=m}else aj(v,s.type,s.stateNode);else s.stateNode=nj(v,m,s.memoizedProps);else N!==m?(N===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):N.count--,m===null?aj(v,s.type,s.stateNode):nj(v,m,s.memoizedProps)):m===null&&s.stateNode!==null&&ag(s,s.memoizedProps,c.memoizedProps)}break;case 27:ls(o,s),cs(s),m&512&&(wn||c===null||ua(c,c.return)),c!==null&&m&4&&ag(s,s.memoizedProps,c.memoizedProps);break;case 5:if(ls(o,s),cs(s),m&512&&(wn||c===null||ua(c,c.return)),s.flags&32){v=s.stateNode;try{ri(v,"")}catch(Fe){$t(s,s.return,Fe)}}m&4&&s.stateNode!=null&&(v=s.memoizedProps,ag(s,v,c!==null?c.memoizedProps:v)),m&1024&&(ig=!0);break;case 6:if(ls(o,s),cs(s),m&4){if(s.stateNode===null)throw Error(r(162));m=s.memoizedProps,c=s.stateNode;try{c.nodeValue=m}catch(Fe){$t(s,s.return,Fe)}}break;case 3:if(bd=null,v=Ks,Ks=hd(o.containerInfo),ls(o,s),Ks=v,cs(s),m&4&&c!==null&&c.memoizedState.isDehydrated)try{Pi(o.containerInfo)}catch(Fe){$t(s,s.return,Fe)}ig&&(ig=!1,a1(s));break;case 4:m=Ks,Ks=hd(s.stateNode.containerInfo),ls(o,s),cs(s),Ks=m;break;case 12:ls(o,s),cs(s);break;case 31:ls(o,s),cs(s),m&4&&(m=s.updateQueue,m!==null&&(s.updateQueue=null,nd(s,m)));break;case 13:ls(o,s),cs(s),s.child.flags&8192&&s.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(ad=ge()),m&4&&(m=s.updateQueue,m!==null&&(s.updateQueue=null,nd(s,m)));break;case 22:v=s.memoizedState!==null;var Z=c!==null&&c.memoizedState!==null,ue=$a,ve=wn;if($a=ue||v,wn=ve||Z,ls(o,s),wn=ve,$a=ue,cs(s),m&8192)e:for(o=s.stateNode,o._visibility=v?o._visibility&-2:o._visibility|1,v&&(c===null||Z||$a||wn||jo(s)),c=null,o=s;;){if(o.tag===5||o.tag===26){if(c===null){Z=c=o;try{if(N=Z.stateNode,v)O=N.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{H=Z.stateNode;var Se=Z.memoizedProps.style,fe=Se!=null&&Se.hasOwnProperty("display")?Se.display:null;H.style.display=fe==null||typeof fe=="boolean"?"":(""+fe).trim()}}catch(Fe){$t(Z,Z.return,Fe)}}}else if(o.tag===6){if(c===null){Z=o;try{Z.stateNode.nodeValue=v?"":Z.memoizedProps}catch(Fe){$t(Z,Z.return,Fe)}}}else if(o.tag===18){if(c===null){Z=o;try{var he=Z.stateNode;v?Y1(he,!0):Y1(Z.stateNode,!1)}catch(Fe){$t(Z,Z.return,Fe)}}}else if((o.tag!==22&&o.tag!==23||o.memoizedState===null||o===s)&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===s)break e;for(;o.sibling===null;){if(o.return===null||o.return===s)break e;c===o&&(c=null),o=o.return}c===o&&(c=null),o.sibling.return=o.return,o=o.sibling}m&4&&(m=s.updateQueue,m!==null&&(c=m.retryQueue,c!==null&&(m.retryQueue=null,nd(s,c))));break;case 19:ls(o,s),cs(s),m&4&&(m=s.updateQueue,m!==null&&(s.updateQueue=null,nd(s,m)));break;case 30:break;case 21:break;default:ls(o,s),cs(s)}}function cs(s){var o=s.flags;if(o&2){try{for(var c,m=s.return;m!==null;){if(X0(m)){c=m;break}m=m.return}if(c==null)throw Error(r(160));switch(c.tag){case 27:var v=c.stateNode,N=rg(s);td(s,N,v);break;case 5:var O=c.stateNode;c.flags&32&&(ri(O,""),c.flags&=-33);var H=rg(s);td(s,H,O);break;case 3:case 4:var Z=c.stateNode.containerInfo,ue=rg(s);og(s,ue,Z);break;default:throw Error(r(161))}}catch(ve){$t(s,s.return,ve)}s.flags&=-3}o&4096&&(s.flags&=-4097)}function a1(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var o=s;a1(o),o.tag===5&&o.flags&1024&&o.stateNode.reset(),s=s.sibling}}function Ua(s,o){if(o.subtreeFlags&8772)for(o=o.child;o!==null;)Z0(s,o.alternate,o),o=o.sibling}function jo(s){for(s=s.child;s!==null;){var o=s;switch(o.tag){case 0:case 11:case 14:case 15:wr(4,o,o.return),jo(o);break;case 1:ua(o,o.return);var c=o.stateNode;typeof c.componentWillUnmount=="function"&&Y0(o,o.return,c),jo(o);break;case 27:sc(o.stateNode);case 26:case 5:ua(o,o.return),jo(o);break;case 22:o.memoizedState===null&&jo(o);break;case 30:jo(o);break;default:jo(o)}s=s.sibling}}function qa(s,o,c){for(c=c&&(o.subtreeFlags&8772)!==0,o=o.child;o!==null;){var m=o.alternate,v=s,N=o,O=N.flags;switch(N.tag){case 0:case 11:case 15:qa(v,N,c),Yl(4,N);break;case 1:if(qa(v,N,c),m=N,v=m.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(ue){$t(m,m.return,ue)}if(m=N,v=m.updateQueue,v!==null){var H=m.stateNode;try{var Z=v.shared.hiddenCallbacks;if(Z!==null)for(v.shared.hiddenCallbacks=null,v=0;v<Z.length;v++)Dy(Z[v],H)}catch(ue){$t(m,m.return,ue)}}c&&O&64&&G0(N),Kl(N,N.return);break;case 27:Q0(N);case 26:case 5:qa(v,N,c),c&&m===null&&O&4&&K0(N),Kl(N,N.return);break;case 12:qa(v,N,c);break;case 31:qa(v,N,c),c&&O&4&&t1(v,N);break;case 13:qa(v,N,c),c&&O&4&&n1(v,N);break;case 22:N.memoizedState===null&&qa(v,N,c),Kl(N,N.return);break;case 30:break;default:qa(v,N,c)}o=o.sibling}}function lg(s,o){var c=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),s=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(s=o.memoizedState.cachePool.pool),s!==c&&(s!=null&&s.refCount++,c!=null&&Ol(c))}function cg(s,o){s=null,o.alternate!==null&&(s=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==s&&(o.refCount++,s!=null&&Ol(s))}function Xs(s,o,c,m){if(o.subtreeFlags&10256)for(o=o.child;o!==null;)r1(s,o,c,m),o=o.sibling}function r1(s,o,c,m){var v=o.flags;switch(o.tag){case 0:case 11:case 15:Xs(s,o,c,m),v&2048&&Yl(9,o);break;case 1:Xs(s,o,c,m);break;case 3:Xs(s,o,c,m),v&2048&&(s=null,o.alternate!==null&&(s=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==s&&(o.refCount++,s!=null&&Ol(s)));break;case 12:if(v&2048){Xs(s,o,c,m),s=o.stateNode;try{var N=o.memoizedProps,O=N.id,H=N.onPostCommit;typeof H=="function"&&H(O,o.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(Z){$t(o,o.return,Z)}}else Xs(s,o,c,m);break;case 31:Xs(s,o,c,m);break;case 13:Xs(s,o,c,m);break;case 23:break;case 22:N=o.stateNode,O=o.alternate,o.memoizedState!==null?N._visibility&2?Xs(s,o,c,m):Xl(s,o):N._visibility&2?Xs(s,o,c,m):(N._visibility|=2,Si(s,o,c,m,(o.subtreeFlags&10256)!==0||!1)),v&2048&&lg(O,o);break;case 24:Xs(s,o,c,m),v&2048&&cg(o.alternate,o);break;default:Xs(s,o,c,m)}}function Si(s,o,c,m,v){for(v=v&&((o.subtreeFlags&10256)!==0||!1),o=o.child;o!==null;){var N=s,O=o,H=c,Z=m,ue=O.flags;switch(O.tag){case 0:case 11:case 15:Si(N,O,H,Z,v),Yl(8,O);break;case 23:break;case 22:var ve=O.stateNode;O.memoizedState!==null?ve._visibility&2?Si(N,O,H,Z,v):Xl(N,O):(ve._visibility|=2,Si(N,O,H,Z,v)),v&&ue&2048&&lg(O.alternate,O);break;case 24:Si(N,O,H,Z,v),v&&ue&2048&&cg(O.alternate,O);break;default:Si(N,O,H,Z,v)}o=o.sibling}}function Xl(s,o){if(o.subtreeFlags&10256)for(o=o.child;o!==null;){var c=s,m=o,v=m.flags;switch(m.tag){case 22:Xl(c,m),v&2048&&lg(m.alternate,m);break;case 24:Xl(c,m),v&2048&&cg(m.alternate,m);break;default:Xl(c,m)}o=o.sibling}}var Ql=8192;function Ci(s,o,c){if(s.subtreeFlags&Ql)for(s=s.child;s!==null;)o1(s,o,c),s=s.sibling}function o1(s,o,c){switch(s.tag){case 26:Ci(s,o,c),s.flags&Ql&&s.memoizedState!==null&&B5(c,Ks,s.memoizedState,s.memoizedProps);break;case 5:Ci(s,o,c);break;case 3:case 4:var m=Ks;Ks=hd(s.stateNode.containerInfo),Ci(s,o,c),Ks=m;break;case 22:s.memoizedState===null&&(m=s.alternate,m!==null&&m.memoizedState!==null?(m=Ql,Ql=16777216,Ci(s,o,c),Ql=m):Ci(s,o,c));break;default:Ci(s,o,c)}}function i1(s){var o=s.alternate;if(o!==null&&(s=o.child,s!==null)){o.child=null;do o=s.sibling,s.sibling=null,s=o;while(s!==null)}}function Wl(s){var o=s.deletions;if((s.flags&16)!==0){if(o!==null)for(var c=0;c<o.length;c++){var m=o[c];On=m,c1(m,s)}i1(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)l1(s),s=s.sibling}function l1(s){switch(s.tag){case 0:case 11:case 15:Wl(s),s.flags&2048&&wr(9,s,s.return);break;case 3:Wl(s);break;case 12:Wl(s);break;case 22:var o=s.stateNode;s.memoizedState!==null&&o._visibility&2&&(s.return===null||s.return.tag!==13)?(o._visibility&=-3,sd(s)):Wl(s);break;default:Wl(s)}}function sd(s){var o=s.deletions;if((s.flags&16)!==0){if(o!==null)for(var c=0;c<o.length;c++){var m=o[c];On=m,c1(m,s)}i1(s)}for(s=s.child;s!==null;){switch(o=s,o.tag){case 0:case 11:case 15:wr(8,o,o.return),sd(o);break;case 22:c=o.stateNode,c._visibility&2&&(c._visibility&=-3,sd(o));break;default:sd(o)}s=s.sibling}}function c1(s,o){for(;On!==null;){var c=On;switch(c.tag){case 0:case 11:case 15:wr(8,c,o);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var m=c.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:Ol(c.memoizedState.cache)}if(m=c.child,m!==null)m.return=c,On=m;else e:for(c=s;On!==null;){m=On;var v=m.sibling,N=m.return;if(J0(m),m===c){On=null;break e}if(v!==null){v.return=N,On=v;break e}On=N}}}var t5={getCacheForType:function(s){var o=$n(yn),c=o.data.get(s);return c===void 0&&(c=s(),o.data.set(s,c)),c},cacheSignal:function(){return $n(yn).controller.signal}},n5=typeof WeakMap=="function"?WeakMap:Map,Pt=0,Xt=null,yt=null,kt=0,It=0,js=null,Sr=!1,Ni=!1,ug=!1,Ha=0,pn=0,Cr=0,ko=0,dg=0,ks=0,Ei=0,Zl=null,us=null,fg=!1,ad=0,u1=0,rd=1/0,od=null,Nr=null,Cn=0,Er=null,Ri=null,Va=0,pg=0,mg=null,d1=null,Jl=0,gg=null;function ws(){return(Pt&2)!==0&&kt!==0?kt&-kt:U.T!==null?yg():rs()}function f1(){if(ks===0)if((kt&536870912)===0||Nt){var s=Qt;Qt<<=1,(Qt&3932160)===0&&(Qt=262144),ks=s}else ks=536870912;return s=vs.current,s!==null&&(s.flags|=32),ks}function ds(s,o,c){(s===Xt&&(It===2||It===9)||s.cancelPendingCommit!==null)&&(Ti(s,0),Rr(s,kt,ks,!1)),dn(s,c),((Pt&2)===0||s!==Xt)&&(s===Xt&&((Pt&2)===0&&(ko|=c),pn===4&&Rr(s,kt,ks,!1)),da(s))}function p1(s,o,c){if((Pt&6)!==0)throw Error(r(327));var m=!c&&(o&127)===0&&(o&s.expiredLanes)===0||Kt(s,o),v=m?r5(s,o):xg(s,o,!0),N=m;do{if(v===0){Ni&&!m&&Rr(s,o,0,!1);break}else{if(c=s.current.alternate,N&&!s5(c)){v=xg(s,o,!1),N=!1;continue}if(v===2){if(N=o,s.errorRecoveryDisabledLanes&N)var O=0;else O=s.pendingLanes&-536870913,O=O!==0?O:O&536870912?536870912:0;if(O!==0){o=O;e:{var H=s;v=Zl;var Z=H.current.memoizedState.isDehydrated;if(Z&&(Ti(H,O).flags|=256),O=xg(H,O,!1),O!==2){if(ug&&!Z){H.errorRecoveryDisabledLanes|=N,ko|=N,v=4;break e}N=us,us=v,N!==null&&(us===null?us=N:us.push.apply(us,N))}v=O}if(N=!1,v!==2)continue}}if(v===1){Ti(s,0),Rr(s,o,0,!0);break}e:{switch(m=s,N=v,N){case 0:case 1:throw Error(r(345));case 4:if((o&4194048)!==o)break;case 6:Rr(m,o,ks,!Sr);break e;case 2:us=null;break;case 3:case 5:break;default:throw Error(r(329))}if((o&62914560)===o&&(v=ad+300-ge(),10<v)){if(Rr(m,o,ks,!Sr),on(m,0,!0)!==0)break e;Va=o,m.timeoutHandle=V1(m1.bind(null,m,c,us,od,fg,o,ks,ko,Ei,Sr,N,"Throttled",-0,0),v);break e}m1(m,c,us,od,fg,o,ks,ko,Ei,Sr,N,null,-0,0)}}break}while(!0);da(s)}function m1(s,o,c,m,v,N,O,H,Z,ue,ve,Se,fe,he){if(s.timeoutHandle=-1,Se=o.subtreeFlags,Se&8192||(Se&16785408)===16785408){Se={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ra},o1(o,N,Se);var Fe=(N&62914560)===N?ad-ge():(N&4194048)===N?u1-ge():0;if(Fe=U5(Se,Fe),Fe!==null){Va=N,s.cancelPendingCommit=Fe(j1.bind(null,s,o,N,c,m,v,O,H,Z,ve,Se,null,fe,he)),Rr(s,N,O,!ue);return}}j1(s,o,N,c,m,v,O,H,Z)}function s5(s){for(var o=s;;){var c=o.tag;if((c===0||c===11||c===15)&&o.flags&16384&&(c=o.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var m=0;m<c.length;m++){var v=c[m],N=v.getSnapshot;v=v.value;try{if(!bs(N(),v))return!1}catch{return!1}}if(c=o.child,o.subtreeFlags&16384&&c!==null)c.return=o,o=c;else{if(o===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Rr(s,o,c,m){o&=~dg,o&=~ko,s.suspendedLanes|=o,s.pingedLanes&=~o,m&&(s.warmLanes|=o),m=s.expirationTimes;for(var v=o;0<v;){var N=31-ze(v),O=1<<N;m[N]=-1,v&=~O}c!==0&&Rs(s,c,o)}function id(){return(Pt&6)===0?(ec(0),!1):!0}function hg(){if(yt!==null){if(It===0)var s=yt.return;else s=yt,za=mo=null,Mm(s),vi=null,Pl=0,s=yt;for(;s!==null;)F0(s.alternate,s),s=s.return;yt=null}}function Ti(s,o){var c=s.timeoutHandle;c!==-1&&(s.timeoutHandle=-1,k5(c)),c=s.cancelPendingCommit,c!==null&&(s.cancelPendingCommit=null,c()),Va=0,hg(),Xt=s,yt=c=Aa(s.current,null),kt=o,It=0,js=null,Sr=!1,Ni=Kt(s,o),ug=!1,Ei=ks=dg=ko=Cr=pn=0,us=Zl=null,fg=!1,(o&8)!==0&&(o|=o&32);var m=s.entangledLanes;if(m!==0)for(s=s.entanglements,m&=o;0<m;){var v=31-ze(m),N=1<<v;o|=s[v],m&=~N}return Ha=o,Eu(),c}function g1(s,o){pt=null,U.H=Vl,o===_i||o===Pu?(o=Ay(),It=3):o===vm?(o=Ay(),It=4):It=o===Km?8:o!==null&&typeof o=="object"&&typeof o.then=="function"?6:1,js=o,yt===null&&(pn=1,Qu(s,zs(o,s.current)))}function h1(){var s=vs.current;return s===null?!0:(kt&4194048)===kt?Ls===null:(kt&62914560)===kt||(kt&536870912)!==0?s===Ls:!1}function x1(){var s=U.H;return U.H=Vl,s===null?Vl:s}function b1(){var s=U.A;return U.A=t5,s}function ld(){pn=4,Sr||(kt&4194048)!==kt&&vs.current!==null||(Ni=!0),(Cr&134217727)===0&&(ko&134217727)===0||Xt===null||Rr(Xt,kt,ks,!1)}function xg(s,o,c){var m=Pt;Pt|=2;var v=x1(),N=b1();(Xt!==s||kt!==o)&&(od=null,Ti(s,o)),o=!1;var O=pn;e:do try{if(It!==0&&yt!==null){var H=yt,Z=js;switch(It){case 8:hg(),O=6;break e;case 3:case 2:case 9:case 6:vs.current===null&&(o=!0);var ue=It;if(It=0,js=null,Ai(s,H,Z,ue),c&&Ni){O=0;break e}break;default:ue=It,It=0,js=null,Ai(s,H,Z,ue)}}a5(),O=pn;break}catch(ve){g1(s,ve)}while(!0);return o&&s.shellSuspendCounter++,za=mo=null,Pt=m,U.H=v,U.A=N,yt===null&&(Xt=null,kt=0,Eu()),O}function a5(){for(;yt!==null;)_1(yt)}function r5(s,o){var c=Pt;Pt|=2;var m=x1(),v=b1();Xt!==s||kt!==o?(od=null,rd=ge()+500,Ti(s,o)):Ni=Kt(s,o);e:do try{if(It!==0&&yt!==null){o=yt;var N=js;t:switch(It){case 1:It=0,js=null,Ai(s,o,N,1);break;case 2:case 9:if(Ry(N)){It=0,js=null,v1(o);break}o=function(){It!==2&&It!==9||Xt!==s||(It=7),da(s)},N.then(o,o);break e;case 3:It=7;break e;case 4:It=5;break e;case 7:Ry(N)?(It=0,js=null,v1(o)):(It=0,js=null,Ai(s,o,N,7));break;case 5:var O=null;switch(yt.tag){case 26:O=yt.memoizedState;case 5:case 27:var H=yt;if(O?rj(O):H.stateNode.complete){It=0,js=null;var Z=H.sibling;if(Z!==null)yt=Z;else{var ue=H.return;ue!==null?(yt=ue,cd(ue)):yt=null}break t}}It=0,js=null,Ai(s,o,N,5);break;case 6:It=0,js=null,Ai(s,o,N,6);break;case 8:hg(),pn=6;break e;default:throw Error(r(462))}}o5();break}catch(ve){g1(s,ve)}while(!0);return za=mo=null,U.H=m,U.A=v,Pt=c,yt!==null?0:(Xt=null,kt=0,Eu(),pn)}function o5(){for(;yt!==null&&!He();)_1(yt)}function _1(s){var o=H0(s.alternate,s,Ha);s.memoizedProps=s.pendingProps,o===null?cd(s):yt=o}function v1(s){var o=s,c=o.alternate;switch(o.tag){case 15:case 0:o=L0(c,o,o.pendingProps,o.type,void 0,kt);break;case 11:o=L0(c,o,o.pendingProps,o.type.render,o.ref,kt);break;case 5:Mm(o);default:F0(c,o),o=yt=by(o,Ha),o=H0(c,o,Ha)}s.memoizedProps=s.pendingProps,o===null?cd(s):yt=o}function Ai(s,o,c,m){za=mo=null,Mm(o),vi=null,Pl=0;var v=o.return;try{if(KT(s,v,o,c,kt)){pn=1,Qu(s,zs(c,s.current)),yt=null;return}}catch(N){if(v!==null)throw yt=v,N;pn=1,Qu(s,zs(c,s.current)),yt=null;return}o.flags&32768?(Nt||m===1?s=!0:Ni||(kt&536870912)!==0?s=!1:(Sr=s=!0,(m===2||m===9||m===3||m===6)&&(m=vs.current,m!==null&&m.tag===13&&(m.flags|=16384))),y1(o,s)):cd(o)}function cd(s){var o=s;do{if((o.flags&32768)!==0){y1(o,Sr);return}s=o.return;var c=WT(o.alternate,o,Ha);if(c!==null){yt=c;return}if(o=o.sibling,o!==null){yt=o;return}yt=o=s}while(o!==null);pn===0&&(pn=5)}function y1(s,o){do{var c=ZT(s.alternate,s);if(c!==null){c.flags&=32767,yt=c;return}if(c=s.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!o&&(s=s.sibling,s!==null)){yt=s;return}yt=s=c}while(s!==null);pn=6,yt=null}function j1(s,o,c,m,v,N,O,H,Z){s.cancelPendingCommit=null;do ud();while(Cn!==0);if((Pt&6)!==0)throw Error(r(327));if(o!==null){if(o===s.current)throw Error(r(177));if(N=o.lanes|o.childLanes,N|=rm,hs(s,c,N,O,H,Z),s===Xt&&(yt=Xt=null,kt=0),Ri=o,Er=s,Va=c,pg=N,mg=v,d1=m,(o.subtreeFlags&10256)!==0||(o.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,u5(Ne,function(){return N1(),null})):(s.callbackNode=null,s.callbackPriority=0),m=(o.flags&13878)!==0,(o.subtreeFlags&13878)!==0||m){m=U.T,U.T=null,v=V.p,V.p=2,O=Pt,Pt|=4;try{JT(s,o,c)}finally{Pt=O,V.p=v,U.T=m}}Cn=1,k1(),w1(),S1()}}function k1(){if(Cn===1){Cn=0;var s=Er,o=Ri,c=(o.flags&13878)!==0;if((o.subtreeFlags&13878)!==0||c){c=U.T,U.T=null;var m=V.p;V.p=2;var v=Pt;Pt|=4;try{s1(o,s);var N=Rg,O=cy(s.containerInfo),H=N.focusedElem,Z=N.selectionRange;if(O!==H&&H&&H.ownerDocument&&ly(H.ownerDocument.documentElement,H)){if(Z!==null&&em(H)){var ue=Z.start,ve=Z.end;if(ve===void 0&&(ve=ue),"selectionStart"in H)H.selectionStart=ue,H.selectionEnd=Math.min(ve,H.value.length);else{var Se=H.ownerDocument||document,fe=Se&&Se.defaultView||window;if(fe.getSelection){var he=fe.getSelection(),Fe=H.textContent.length,at=Math.min(Z.start,Fe),Vt=Z.end===void 0?at:Math.min(Z.end,Fe);!he.extend&&at>Vt&&(O=Vt,Vt=at,at=O);var re=iy(H,at),ee=iy(H,Vt);if(re&&ee&&(he.rangeCount!==1||he.anchorNode!==re.node||he.anchorOffset!==re.offset||he.focusNode!==ee.node||he.focusOffset!==ee.offset)){var ce=Se.createRange();ce.setStart(re.node,re.offset),he.removeAllRanges(),at>Vt?(he.addRange(ce),he.extend(ee.node,ee.offset)):(ce.setEnd(ee.node,ee.offset),he.addRange(ce))}}}}for(Se=[],he=H;he=he.parentNode;)he.nodeType===1&&Se.push({element:he,left:he.scrollLeft,top:he.scrollTop});for(typeof H.focus=="function"&&H.focus(),H=0;H<Se.length;H++){var we=Se[H];we.element.scrollLeft=we.left,we.element.scrollTop=we.top}}jd=!!Eg,Rg=Eg=null}finally{Pt=v,V.p=m,U.T=c}}s.current=o,Cn=2}}function w1(){if(Cn===2){Cn=0;var s=Er,o=Ri,c=(o.flags&8772)!==0;if((o.subtreeFlags&8772)!==0||c){c=U.T,U.T=null;var m=V.p;V.p=2;var v=Pt;Pt|=4;try{Z0(s,o.alternate,o)}finally{Pt=v,V.p=m,U.T=c}}Cn=3}}function S1(){if(Cn===4||Cn===3){Cn=0,Qe();var s=Er,o=Ri,c=Va,m=d1;(o.subtreeFlags&10256)!==0||(o.flags&10256)!==0?Cn=5:(Cn=0,Ri=Er=null,C1(s,s.pendingLanes));var v=s.pendingLanes;if(v===0&&(Nr=null),Ln(c),o=o.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(_t,o,void 0,(o.current.flags&128)===128)}catch{}if(m!==null){o=U.T,v=V.p,V.p=2,U.T=null;try{for(var N=s.onRecoverableError,O=0;O<m.length;O++){var H=m[O];N(H.value,{componentStack:H.stack})}}finally{U.T=o,V.p=v}}(Va&3)!==0&&ud(),da(s),v=s.pendingLanes,(c&261930)!==0&&(v&42)!==0?s===gg?Jl++:(Jl=0,gg=s):Jl=0,ec(0)}}function C1(s,o){(s.pooledCacheLanes&=o)===0&&(o=s.pooledCache,o!=null&&(s.pooledCache=null,Ol(o)))}function ud(){return k1(),w1(),S1(),N1()}function N1(){if(Cn!==5)return!1;var s=Er,o=pg;pg=0;var c=Ln(Va),m=U.T,v=V.p;try{V.p=32>c?32:c,U.T=null,c=mg,mg=null;var N=Er,O=Va;if(Cn=0,Ri=Er=null,Va=0,(Pt&6)!==0)throw Error(r(331));var H=Pt;if(Pt|=4,l1(N.current),r1(N,N.current,O,c),Pt=H,ec(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(_t,N)}catch{}return!0}finally{V.p=v,U.T=m,C1(s,o)}}function E1(s,o,c){o=zs(c,o),o=Ym(s.stateNode,o,2),s=yr(s,o,2),s!==null&&(dn(s,2),da(s))}function $t(s,o,c){if(s.tag===3)E1(s,s,c);else for(;o!==null;){if(o.tag===3){E1(o,s,c);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Nr===null||!Nr.has(m))){s=zs(c,s),c=R0(2),m=yr(o,c,2),m!==null&&(T0(c,m,o,s),dn(m,2),da(m));break}}o=o.return}}function bg(s,o,c){var m=s.pingCache;if(m===null){m=s.pingCache=new n5;var v=new Set;m.set(o,v)}else v=m.get(o),v===void 0&&(v=new Set,m.set(o,v));v.has(c)||(ug=!0,v.add(c),s=i5.bind(null,s,o,c),o.then(s,s))}function i5(s,o,c){var m=s.pingCache;m!==null&&m.delete(o),s.pingedLanes|=s.suspendedLanes&c,s.warmLanes&=~c,Xt===s&&(kt&c)===c&&(pn===4||pn===3&&(kt&62914560)===kt&&300>ge()-ad?(Pt&2)===0&&Ti(s,0):dg|=c,Ei===kt&&(Ei=0)),da(s)}function R1(s,o){o===0&&(o=An()),s=uo(s,o),s!==null&&(dn(s,o),da(s))}function l5(s){var o=s.memoizedState,c=0;o!==null&&(c=o.retryLane),R1(s,c)}function c5(s,o){var c=0;switch(s.tag){case 31:case 13:var m=s.stateNode,v=s.memoizedState;v!==null&&(c=v.retryLane);break;case 19:m=s.stateNode;break;case 22:m=s.stateNode._retryCache;break;default:throw Error(r(314))}m!==null&&m.delete(o),R1(s,c)}function u5(s,o){return Me(s,o)}var dd=null,Mi=null,_g=!1,fd=!1,vg=!1,Tr=0;function da(s){s!==Mi&&s.next===null&&(Mi===null?dd=Mi=s:Mi=Mi.next=s),fd=!0,_g||(_g=!0,f5())}function ec(s,o){if(!vg&&fd){vg=!0;do for(var c=!1,m=dd;m!==null;){if(s!==0){var v=m.pendingLanes;if(v===0)var N=0;else{var O=m.suspendedLanes,H=m.pingedLanes;N=(1<<31-ze(42|s)+1)-1,N&=v&~(O&~H),N=N&201326741?N&201326741|1:N?N|2:0}N!==0&&(c=!0,z1(m,N))}else N=kt,N=on(m,m===Xt?N:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(N&3)===0||Kt(m,N)||(c=!0,z1(m,N));m=m.next}while(c);vg=!1}}function d5(){T1()}function T1(){fd=_g=!1;var s=0;Tr!==0&&j5()&&(s=Tr);for(var o=ge(),c=null,m=dd;m!==null;){var v=m.next,N=A1(m,o);N===0?(m.next=null,c===null?dd=v:c.next=v,v===null&&(Mi=c)):(c=m,(s!==0||(N&3)!==0)&&(fd=!0)),m=v}Cn!==0&&Cn!==5||ec(s),Tr!==0&&(Tr=0)}function A1(s,o){for(var c=s.suspendedLanes,m=s.pingedLanes,v=s.expirationTimes,N=s.pendingLanes&-62914561;0<N;){var O=31-ze(N),H=1<<O,Z=v[O];Z===-1?((H&c)===0||(H&m)!==0)&&(v[O]=Gn(H,o)):Z<=o&&(s.expiredLanes|=H),N&=~H}if(o=Xt,c=kt,c=on(s,s===o?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),m=s.callbackNode,c===0||s===o&&(It===2||It===9)||s.cancelPendingCommit!==null)return m!==null&&m!==null&&De(m),s.callbackNode=null,s.callbackPriority=0;if((c&3)===0||Kt(s,c)){if(o=c&-c,o===s.callbackPriority)return o;switch(m!==null&&De(m),Ln(c)){case 2:case 8:c=ye;break;case 32:c=Ne;break;case 268435456:c=Ge;break;default:c=Ne}return m=M1.bind(null,s),c=Me(c,m),s.callbackPriority=o,s.callbackNode=c,o}return m!==null&&m!==null&&De(m),s.callbackPriority=2,s.callbackNode=null,2}function M1(s,o){if(Cn!==0&&Cn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var c=s.callbackNode;if(ud()&&s.callbackNode!==c)return null;var m=kt;return m=on(s,s===Xt?m:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),m===0?null:(p1(s,m,o),A1(s,ge()),s.callbackNode!=null&&s.callbackNode===c?M1.bind(null,s):null)}function z1(s,o){if(ud())return null;p1(s,o,!0)}function f5(){w5(function(){(Pt&6)!==0?Me(Le,d5):T1()})}function yg(){if(Tr===0){var s=xi;s===0&&(s=Rt,Rt<<=1,(Rt&261888)===0&&(Rt=256)),Tr=s}return Tr}function O1(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:vu(""+s)}function D1(s,o){var c=o.ownerDocument.createElement("input");return c.name=o.name,c.value=o.value,s.id&&c.setAttribute("form",s.id),o.parentNode.insertBefore(c,o),s=new FormData(s),c.parentNode.removeChild(c),s}function p5(s,o,c,m,v){if(o==="submit"&&c&&c.stateNode===v){var N=O1((v[vn]||null).action),O=m.submitter;O&&(o=(o=O[vn]||null)?O1(o.formAction):O.getAttribute("formAction"),o!==null&&(N=o,O=null));var H=new wu("action","action",null,m,v);s.push({event:H,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(Tr!==0){var Z=O?D1(v,O):new FormData(v);Um(c,{pending:!0,data:Z,method:v.method,action:N},null,Z)}}else typeof N=="function"&&(H.preventDefault(),Z=O?D1(v,O):new FormData(v),Um(c,{pending:!0,data:Z,method:v.method,action:N},N,Z))},currentTarget:v}]})}}for(var jg=0;jg<am.length;jg++){var kg=am[jg],m5=kg.toLowerCase(),g5=kg[0].toUpperCase()+kg.slice(1);Ys(m5,"on"+g5)}Ys(fy,"onAnimationEnd"),Ys(py,"onAnimationIteration"),Ys(my,"onAnimationStart"),Ys("dblclick","onDoubleClick"),Ys("focusin","onFocus"),Ys("focusout","onBlur"),Ys(AT,"onTransitionRun"),Ys(MT,"onTransitionStart"),Ys(zT,"onTransitionCancel"),Ys(gy,"onTransitionEnd"),si("onMouseEnter",["mouseout","mouseover"]),si("onMouseLeave",["mouseout","mouseover"]),si("onPointerEnter",["pointerout","pointerover"]),si("onPointerLeave",["pointerout","pointerover"]),oo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),oo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),oo("onBeforeInput",["compositionend","keypress","textInput","paste"]),oo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),oo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),oo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var tc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),h5=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(tc));function P1(s,o){o=(o&4)!==0;for(var c=0;c<s.length;c++){var m=s[c],v=m.event;m=m.listeners;e:{var N=void 0;if(o)for(var O=m.length-1;0<=O;O--){var H=m[O],Z=H.instance,ue=H.currentTarget;if(H=H.listener,Z!==N&&v.isPropagationStopped())break e;N=H,v.currentTarget=ue;try{N(v)}catch(ve){Nu(ve)}v.currentTarget=null,N=Z}else for(O=0;O<m.length;O++){if(H=m[O],Z=H.instance,ue=H.currentTarget,H=H.listener,Z!==N&&v.isPropagationStopped())break e;N=H,v.currentTarget=ue;try{N(v)}catch(ve){Nu(ve)}v.currentTarget=null,N=Z}}}}function jt(s,o){var c=o[pr];c===void 0&&(c=o[pr]=new Set);var m=s+"__bubble";c.has(m)||(L1(o,s,2,!1),c.add(m))}function wg(s,o,c){var m=0;o&&(m|=4),L1(c,s,m,o)}var pd="_reactListening"+Math.random().toString(36).slice(2);function Sg(s){if(!s[pd]){s[pd]=!0,Tv.forEach(function(c){c!=="selectionchange"&&(h5.has(c)||wg(c,!1,s),wg(c,!0,s))});var o=s.nodeType===9?s:s.ownerDocument;o===null||o[pd]||(o[pd]=!0,wg("selectionchange",!1,o))}}function L1(s,o,c,m){switch(fj(o)){case 2:var v=V5;break;case 8:v=F5;break;default:v=Bg}c=v.bind(null,o,c,s),v=void 0,!Fp||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),m?v!==void 0?s.addEventListener(o,c,{capture:!0,passive:v}):s.addEventListener(o,c,!0):v!==void 0?s.addEventListener(o,c,{passive:v}):s.addEventListener(o,c,!1)}function Cg(s,o,c,m,v){var N=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var O=m.tag;if(O===3||O===4){var H=m.stateNode.containerInfo;if(H===v)break;if(O===4)for(O=m.return;O!==null;){var Z=O.tag;if((Z===3||Z===4)&&O.stateNode.containerInfo===v)return;O=O.return}for(;H!==null;){if(O=ei(H),O===null)return;if(Z=O.tag,Z===5||Z===6||Z===26||Z===27){m=N=O;continue e}H=H.parentNode}}m=m.return}qv(function(){var ue=N,ve=Hp(c),Se=[];e:{var fe=hy.get(s);if(fe!==void 0){var he=wu,Fe=s;switch(s){case"keypress":if(ju(c)===0)break e;case"keydown":case"keyup":he=cT;break;case"focusin":Fe="focus",he=Xp;break;case"focusout":Fe="blur",he=Xp;break;case"beforeblur":case"afterblur":he=Xp;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":he=Fv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":he=WR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":he=fT;break;case fy:case py:case my:he=eT;break;case gy:he=mT;break;case"scroll":case"scrollend":he=XR;break;case"wheel":he=hT;break;case"copy":case"cut":case"paste":he=nT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":he=Yv;break;case"toggle":case"beforetoggle":he=bT}var at=(o&4)!==0,Vt=!at&&(s==="scroll"||s==="scrollend"),re=at?fe!==null?fe+"Capture":null:fe;at=[];for(var ee=ue,ce;ee!==null;){var we=ee;if(ce=we.stateNode,we=we.tag,we!==5&&we!==26&&we!==27||ce===null||re===null||(we=kl(ee,re),we!=null&&at.push(nc(ee,we,ce))),Vt)break;ee=ee.return}0<at.length&&(fe=new he(fe,Fe,null,c,ve),Se.push({event:fe,listeners:at}))}}if((o&7)===0){e:{if(fe=s==="mouseover"||s==="pointerover",he=s==="mouseout"||s==="pointerout",fe&&c!==qp&&(Fe=c.relatedTarget||c.fromElement)&&(ei(Fe)||Fe[ia]))break e;if((he||fe)&&(fe=ve.window===ve?ve:(fe=ve.ownerDocument)?fe.defaultView||fe.parentWindow:window,he?(Fe=c.relatedTarget||c.toElement,he=ue,Fe=Fe?ei(Fe):null,Fe!==null&&(Vt=l(Fe),at=Fe.tag,Fe!==Vt||at!==5&&at!==27&&at!==6)&&(Fe=null)):(he=null,Fe=ue),he!==Fe)){if(at=Fv,we="onMouseLeave",re="onMouseEnter",ee="mouse",(s==="pointerout"||s==="pointerover")&&(at=Yv,we="onPointerLeave",re="onPointerEnter",ee="pointer"),Vt=he==null?fe:jl(he),ce=Fe==null?fe:jl(Fe),fe=new at(we,ee+"leave",he,c,ve),fe.target=Vt,fe.relatedTarget=ce,we=null,ei(ve)===ue&&(at=new at(re,ee+"enter",Fe,c,ve),at.target=ce,at.relatedTarget=Vt,we=at),Vt=we,he&&Fe)t:{for(at=x5,re=he,ee=Fe,ce=0,we=re;we;we=at(we))ce++;we=0;for(var et=ee;et;et=at(et))we++;for(;0<ce-we;)re=at(re),ce--;for(;0<we-ce;)ee=at(ee),we--;for(;ce--;){if(re===ee||ee!==null&&re===ee.alternate){at=re;break t}re=at(re),ee=at(ee)}at=null}else at=null;he!==null&&I1(Se,fe,he,at,!1),Fe!==null&&Vt!==null&&I1(Se,Vt,Fe,at,!0)}}e:{if(fe=ue?jl(ue):window,he=fe.nodeName&&fe.nodeName.toLowerCase(),he==="select"||he==="input"&&fe.type==="file")var Mt=ty;else if(Jv(fe))if(ny)Mt=ET;else{Mt=CT;var Ke=ST}else he=fe.nodeName,!he||he.toLowerCase()!=="input"||fe.type!=="checkbox"&&fe.type!=="radio"?ue&&Up(ue.elementType)&&(Mt=ty):Mt=NT;if(Mt&&(Mt=Mt(s,ue))){ey(Se,Mt,c,ve);break e}Ke&&Ke(s,fe,ue),s==="focusout"&&ue&&fe.type==="number"&&ue.memoizedProps.value!=null&&Bp(fe,"number",fe.value)}switch(Ke=ue?jl(ue):window,s){case"focusin":(Jv(Ke)||Ke.contentEditable==="true")&&(ci=Ke,tm=ue,Al=null);break;case"focusout":Al=tm=ci=null;break;case"mousedown":nm=!0;break;case"contextmenu":case"mouseup":case"dragend":nm=!1,uy(Se,c,ve);break;case"selectionchange":if(TT)break;case"keydown":case"keyup":uy(Se,c,ve)}var mt;if(Wp)e:{switch(s){case"compositionstart":var wt="onCompositionStart";break e;case"compositionend":wt="onCompositionEnd";break e;case"compositionupdate":wt="onCompositionUpdate";break e}wt=void 0}else li?Wv(s,c)&&(wt="onCompositionEnd"):s==="keydown"&&c.keyCode===229&&(wt="onCompositionStart");wt&&(Kv&&c.locale!=="ko"&&(li||wt!=="onCompositionStart"?wt==="onCompositionEnd"&&li&&(mt=Hv()):(mr=ve,Gp="value"in mr?mr.value:mr.textContent,li=!0)),Ke=md(ue,wt),0<Ke.length&&(wt=new Gv(wt,s,null,c,ve),Se.push({event:wt,listeners:Ke}),mt?wt.data=mt:(mt=Zv(c),mt!==null&&(wt.data=mt)))),(mt=vT?yT(s,c):jT(s,c))&&(wt=md(ue,"onBeforeInput"),0<wt.length&&(Ke=new Gv("onBeforeInput","beforeinput",null,c,ve),Se.push({event:Ke,listeners:wt}),Ke.data=mt)),p5(Se,s,ue,c,ve)}P1(Se,o)})}function nc(s,o,c){return{instance:s,listener:o,currentTarget:c}}function md(s,o){for(var c=o+"Capture",m=[];s!==null;){var v=s,N=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||N===null||(v=kl(s,c),v!=null&&m.unshift(nc(s,v,N)),v=kl(s,o),v!=null&&m.push(nc(s,v,N))),s.tag===3)return m;s=s.return}return[]}function x5(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function I1(s,o,c,m,v){for(var N=o._reactName,O=[];c!==null&&c!==m;){var H=c,Z=H.alternate,ue=H.stateNode;if(H=H.tag,Z!==null&&Z===m)break;H!==5&&H!==26&&H!==27||ue===null||(Z=ue,v?(ue=kl(c,N),ue!=null&&O.unshift(nc(c,ue,Z))):v||(ue=kl(c,N),ue!=null&&O.push(nc(c,ue,Z)))),c=c.return}O.length!==0&&s.push({event:o,listeners:O})}var b5=/\r\n?/g,_5=/\u0000|\uFFFD/g;function $1(s){return(typeof s=="string"?s:""+s).replace(b5,`
49
+ `).replace(_5,"")}function B1(s,o){return o=$1(o),$1(s)===o}function Ht(s,o,c,m,v,N){switch(c){case"children":typeof m=="string"?o==="body"||o==="textarea"&&m===""||ri(s,m):(typeof m=="number"||typeof m=="bigint")&&o!=="body"&&ri(s,""+m);break;case"className":bu(s,"class",m);break;case"tabIndex":bu(s,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":bu(s,c,m);break;case"style":Bv(s,m,N);break;case"data":if(o!=="object"){bu(s,"data",m);break}case"src":case"href":if(m===""&&(o!=="a"||c!=="href")){s.removeAttribute(c);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){s.removeAttribute(c);break}m=vu(""+m),s.setAttribute(c,m);break;case"action":case"formAction":if(typeof m=="function"){s.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof N=="function"&&(c==="formAction"?(o!=="input"&&Ht(s,o,"name",v.name,v,null),Ht(s,o,"formEncType",v.formEncType,v,null),Ht(s,o,"formMethod",v.formMethod,v,null),Ht(s,o,"formTarget",v.formTarget,v,null)):(Ht(s,o,"encType",v.encType,v,null),Ht(s,o,"method",v.method,v,null),Ht(s,o,"target",v.target,v,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){s.removeAttribute(c);break}m=vu(""+m),s.setAttribute(c,m);break;case"onClick":m!=null&&(s.onclick=Ra);break;case"onScroll":m!=null&&jt("scroll",s);break;case"onScrollEnd":m!=null&&jt("scrollend",s);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(c=m.__html,c!=null){if(v.children!=null)throw Error(r(60));s.innerHTML=c}}break;case"multiple":s.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":s.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){s.removeAttribute("xlink:href");break}c=vu(""+m),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":m!=null&&typeof m!="function"&&typeof m!="symbol"?s.setAttribute(c,""+m):s.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":m&&typeof m!="function"&&typeof m!="symbol"?s.setAttribute(c,""):s.removeAttribute(c);break;case"capture":case"download":m===!0?s.setAttribute(c,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?s.setAttribute(c,m):s.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?s.setAttribute(c,m):s.removeAttribute(c);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?s.removeAttribute(c):s.setAttribute(c,m);break;case"popover":jt("beforetoggle",s),jt("toggle",s),xu(s,"popover",m);break;case"xlinkActuate":Ea(s,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":Ea(s,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":Ea(s,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":Ea(s,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":Ea(s,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":Ea(s,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":Ea(s,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":Ea(s,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":Ea(s,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":xu(s,"is",m);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=YR.get(c)||c,xu(s,c,m))}}function Ng(s,o,c,m,v,N){switch(c){case"style":Bv(s,m,N);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(c=m.__html,c!=null){if(v.children!=null)throw Error(r(60));s.innerHTML=c}}break;case"children":typeof m=="string"?ri(s,m):(typeof m=="number"||typeof m=="bigint")&&ri(s,""+m);break;case"onScroll":m!=null&&jt("scroll",s);break;case"onScrollEnd":m!=null&&jt("scrollend",s);break;case"onClick":m!=null&&(s.onclick=Ra);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Av.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(v=c.endsWith("Capture"),o=c.slice(2,v?c.length-7:void 0),N=s[vn]||null,N=N!=null?N[c]:null,typeof N=="function"&&s.removeEventListener(o,N,v),typeof m=="function")){typeof N!="function"&&N!==null&&(c in s?s[c]=null:s.hasAttribute(c)&&s.removeAttribute(c)),s.addEventListener(o,m,v);break e}c in s?s[c]=m:m===!0?s.setAttribute(c,""):xu(s,c,m)}}}function Un(s,o,c){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":jt("error",s),jt("load",s);var m=!1,v=!1,N;for(N in c)if(c.hasOwnProperty(N)){var O=c[N];if(O!=null)switch(N){case"src":m=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,o));default:Ht(s,o,N,O,c,null)}}v&&Ht(s,o,"srcSet",c.srcSet,c,null),m&&Ht(s,o,"src",c.src,c,null);return;case"input":jt("invalid",s);var H=N=O=v=null,Z=null,ue=null;for(m in c)if(c.hasOwnProperty(m)){var ve=c[m];if(ve!=null)switch(m){case"name":v=ve;break;case"type":O=ve;break;case"checked":Z=ve;break;case"defaultChecked":ue=ve;break;case"value":N=ve;break;case"defaultValue":H=ve;break;case"children":case"dangerouslySetInnerHTML":if(ve!=null)throw Error(r(137,o));break;default:Ht(s,o,m,ve,c,null)}}Pv(s,N,H,Z,ue,O,v,!1);return;case"select":jt("invalid",s),m=O=N=null;for(v in c)if(c.hasOwnProperty(v)&&(H=c[v],H!=null))switch(v){case"value":N=H;break;case"defaultValue":O=H;break;case"multiple":m=H;default:Ht(s,o,v,H,c,null)}o=N,c=O,s.multiple=!!m,o!=null?ai(s,!!m,o,!1):c!=null&&ai(s,!!m,c,!0);return;case"textarea":jt("invalid",s),N=v=m=null;for(O in c)if(c.hasOwnProperty(O)&&(H=c[O],H!=null))switch(O){case"value":m=H;break;case"defaultValue":v=H;break;case"children":N=H;break;case"dangerouslySetInnerHTML":if(H!=null)throw Error(r(91));break;default:Ht(s,o,O,H,c,null)}Iv(s,m,v,N);return;case"option":for(Z in c)if(c.hasOwnProperty(Z)&&(m=c[Z],m!=null))switch(Z){case"selected":s.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:Ht(s,o,Z,m,c,null)}return;case"dialog":jt("beforetoggle",s),jt("toggle",s),jt("cancel",s),jt("close",s);break;case"iframe":case"object":jt("load",s);break;case"video":case"audio":for(m=0;m<tc.length;m++)jt(tc[m],s);break;case"image":jt("error",s),jt("load",s);break;case"details":jt("toggle",s);break;case"embed":case"source":case"link":jt("error",s),jt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ue in c)if(c.hasOwnProperty(ue)&&(m=c[ue],m!=null))switch(ue){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,o));default:Ht(s,o,ue,m,c,null)}return;default:if(Up(o)){for(ve in c)c.hasOwnProperty(ve)&&(m=c[ve],m!==void 0&&Ng(s,o,ve,m,c,void 0));return}}for(H in c)c.hasOwnProperty(H)&&(m=c[H],m!=null&&Ht(s,o,H,m,c,null))}function v5(s,o,c,m){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,N=null,O=null,H=null,Z=null,ue=null,ve=null;for(he in c){var Se=c[he];if(c.hasOwnProperty(he)&&Se!=null)switch(he){case"checked":break;case"value":break;case"defaultValue":Z=Se;default:m.hasOwnProperty(he)||Ht(s,o,he,null,m,Se)}}for(var fe in m){var he=m[fe];if(Se=c[fe],m.hasOwnProperty(fe)&&(he!=null||Se!=null))switch(fe){case"type":N=he;break;case"name":v=he;break;case"checked":ue=he;break;case"defaultChecked":ve=he;break;case"value":O=he;break;case"defaultValue":H=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(r(137,o));break;default:he!==Se&&Ht(s,o,fe,he,m,Se)}}$p(s,O,H,Z,ue,ve,N,v);return;case"select":he=O=H=fe=null;for(N in c)if(Z=c[N],c.hasOwnProperty(N)&&Z!=null)switch(N){case"value":break;case"multiple":he=Z;default:m.hasOwnProperty(N)||Ht(s,o,N,null,m,Z)}for(v in m)if(N=m[v],Z=c[v],m.hasOwnProperty(v)&&(N!=null||Z!=null))switch(v){case"value":fe=N;break;case"defaultValue":H=N;break;case"multiple":O=N;default:N!==Z&&Ht(s,o,v,N,m,Z)}o=H,c=O,m=he,fe!=null?ai(s,!!c,fe,!1):!!m!=!!c&&(o!=null?ai(s,!!c,o,!0):ai(s,!!c,c?[]:"",!1));return;case"textarea":he=fe=null;for(H in c)if(v=c[H],c.hasOwnProperty(H)&&v!=null&&!m.hasOwnProperty(H))switch(H){case"value":break;case"children":break;default:Ht(s,o,H,null,m,v)}for(O in m)if(v=m[O],N=c[O],m.hasOwnProperty(O)&&(v!=null||N!=null))switch(O){case"value":fe=v;break;case"defaultValue":he=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(r(91));break;default:v!==N&&Ht(s,o,O,v,m,N)}Lv(s,fe,he);return;case"option":for(var Fe in c)if(fe=c[Fe],c.hasOwnProperty(Fe)&&fe!=null&&!m.hasOwnProperty(Fe))switch(Fe){case"selected":s.selected=!1;break;default:Ht(s,o,Fe,null,m,fe)}for(Z in m)if(fe=m[Z],he=c[Z],m.hasOwnProperty(Z)&&fe!==he&&(fe!=null||he!=null))switch(Z){case"selected":s.selected=fe&&typeof fe!="function"&&typeof fe!="symbol";break;default:Ht(s,o,Z,fe,m,he)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var at in c)fe=c[at],c.hasOwnProperty(at)&&fe!=null&&!m.hasOwnProperty(at)&&Ht(s,o,at,null,m,fe);for(ue in m)if(fe=m[ue],he=c[ue],m.hasOwnProperty(ue)&&fe!==he&&(fe!=null||he!=null))switch(ue){case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(r(137,o));break;default:Ht(s,o,ue,fe,m,he)}return;default:if(Up(o)){for(var Vt in c)fe=c[Vt],c.hasOwnProperty(Vt)&&fe!==void 0&&!m.hasOwnProperty(Vt)&&Ng(s,o,Vt,void 0,m,fe);for(ve in m)fe=m[ve],he=c[ve],!m.hasOwnProperty(ve)||fe===he||fe===void 0&&he===void 0||Ng(s,o,ve,fe,m,he);return}}for(var re in c)fe=c[re],c.hasOwnProperty(re)&&fe!=null&&!m.hasOwnProperty(re)&&Ht(s,o,re,null,m,fe);for(Se in m)fe=m[Se],he=c[Se],!m.hasOwnProperty(Se)||fe===he||fe==null&&he==null||Ht(s,o,Se,fe,m,he)}function U1(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function y5(){if(typeof performance.getEntriesByType=="function"){for(var s=0,o=0,c=performance.getEntriesByType("resource"),m=0;m<c.length;m++){var v=c[m],N=v.transferSize,O=v.initiatorType,H=v.duration;if(N&&H&&U1(O)){for(O=0,H=v.responseEnd,m+=1;m<c.length;m++){var Z=c[m],ue=Z.startTime;if(ue>H)break;var ve=Z.transferSize,Se=Z.initiatorType;ve&&U1(Se)&&(Z=Z.responseEnd,O+=ve*(Z<H?1:(H-ue)/(Z-ue)))}if(--m,o+=8*(N+O)/(v.duration/1e3),s++,10<s)break}}if(0<s)return o/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Eg=null,Rg=null;function gd(s){return s.nodeType===9?s:s.ownerDocument}function q1(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function H1(s,o){if(s===0)switch(o){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&o==="foreignObject"?0:s}function Tg(s,o){return s==="textarea"||s==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.children=="bigint"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var Ag=null;function j5(){var s=window.event;return s&&s.type==="popstate"?s===Ag?!1:(Ag=s,!0):(Ag=null,!1)}var V1=typeof setTimeout=="function"?setTimeout:void 0,k5=typeof clearTimeout=="function"?clearTimeout:void 0,F1=typeof Promise=="function"?Promise:void 0,w5=typeof queueMicrotask=="function"?queueMicrotask:typeof F1<"u"?function(s){return F1.resolve(null).then(s).catch(S5)}:V1;function S5(s){setTimeout(function(){throw s})}function Ar(s){return s==="head"}function G1(s,o){var c=o,m=0;do{var v=c.nextSibling;if(s.removeChild(c),v&&v.nodeType===8)if(c=v.data,c==="/$"||c==="/&"){if(m===0){s.removeChild(v),Pi(o);return}m--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")m++;else if(c==="html")sc(s.ownerDocument.documentElement);else if(c==="head"){c=s.ownerDocument.head,sc(c);for(var N=c.firstChild;N;){var O=N.nextSibling,H=N.nodeName;N[yl]||H==="SCRIPT"||H==="STYLE"||H==="LINK"&&N.rel.toLowerCase()==="stylesheet"||c.removeChild(N),N=O}}else c==="body"&&sc(s.ownerDocument.body);c=v}while(c);Pi(o)}function Y1(s,o){var c=s;s=0;do{var m=c.nextSibling;if(c.nodeType===1?o?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(o?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),m&&m.nodeType===8)if(c=m.data,c==="/$"){if(s===0)break;s--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||s++;c=m}while(c)}function Mg(s){var o=s.firstChild;for(o&&o.nodeType===10&&(o=o.nextSibling);o;){var c=o;switch(o=o.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Mg(c),Lp(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}s.removeChild(c)}}function C5(s,o,c,m){for(;s.nodeType===1;){var v=c;if(s.nodeName.toLowerCase()!==o.toLowerCase()){if(!m&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(m){if(!s[yl])switch(o){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(N=s.getAttribute("rel"),N==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(N!==v.rel||s.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||s.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||s.getAttribute("title")!==(v.title==null?null:v.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(N=s.getAttribute("src"),(N!==(v.src==null?null:v.src)||s.getAttribute("type")!==(v.type==null?null:v.type)||s.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&N&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(o==="input"&&s.type==="hidden"){var N=v.name==null?null:""+v.name;if(v.type==="hidden"&&s.getAttribute("name")===N)return s}else return s;if(s=Is(s.nextSibling),s===null)break}return null}function N5(s,o,c){if(o==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!c||(s=Is(s.nextSibling),s===null))return null;return s}function K1(s,o){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!o||(s=Is(s.nextSibling),s===null))return null;return s}function zg(s){return s.data==="$?"||s.data==="$~"}function Og(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function E5(s,o){var c=s.ownerDocument;if(s.data==="$~")s._reactRetry=o;else if(s.data!=="$?"||c.readyState!=="loading")o();else{var m=function(){o(),c.removeEventListener("DOMContentLoaded",m)};c.addEventListener("DOMContentLoaded",m),s._reactRetry=m}}function Is(s){for(;s!=null;s=s.nextSibling){var o=s.nodeType;if(o===1||o===3)break;if(o===8){if(o=s.data,o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"||o==="F!"||o==="F")break;if(o==="/$"||o==="/&")return null}}return s}var Dg=null;function X1(s){s=s.nextSibling;for(var o=0;s;){if(s.nodeType===8){var c=s.data;if(c==="/$"||c==="/&"){if(o===0)return Is(s.nextSibling);o--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||o++}s=s.nextSibling}return null}function Q1(s){s=s.previousSibling;for(var o=0;s;){if(s.nodeType===8){var c=s.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(o===0)return s;o--}else c!=="/$"&&c!=="/&"||o++}s=s.previousSibling}return null}function W1(s,o,c){switch(o=gd(c),s){case"html":if(s=o.documentElement,!s)throw Error(r(452));return s;case"head":if(s=o.head,!s)throw Error(r(453));return s;case"body":if(s=o.body,!s)throw Error(r(454));return s;default:throw Error(r(451))}}function sc(s){for(var o=s.attributes;o.length;)s.removeAttributeNode(o[0]);Lp(s)}var $s=new Map,Z1=new Set;function hd(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Fa=V.d;V.d={f:R5,r:T5,D:A5,C:M5,L:z5,m:O5,X:P5,S:D5,M:L5};function R5(){var s=Fa.f(),o=id();return s||o}function T5(s){var o=ti(s);o!==null&&o.tag===5&&o.type==="form"?g0(o):Fa.r(s)}var zi=typeof document>"u"?null:document;function J1(s,o,c){var m=zi;if(m&&typeof o=="string"&&o){var v=As(o);v='link[rel="'+s+'"][href="'+v+'"]',typeof c=="string"&&(v+='[crossorigin="'+c+'"]'),Z1.has(v)||(Z1.add(v),s={rel:s,crossOrigin:c,href:o},m.querySelector(v)===null&&(o=m.createElement("link"),Un(o,"link",s),zn(o),m.head.appendChild(o)))}}function A5(s){Fa.D(s),J1("dns-prefetch",s,null)}function M5(s,o){Fa.C(s,o),J1("preconnect",s,o)}function z5(s,o,c){Fa.L(s,o,c);var m=zi;if(m&&s&&o){var v='link[rel="preload"][as="'+As(o)+'"]';o==="image"&&c&&c.imageSrcSet?(v+='[imagesrcset="'+As(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(v+='[imagesizes="'+As(c.imageSizes)+'"]')):v+='[href="'+As(s)+'"]';var N=v;switch(o){case"style":N=Oi(s);break;case"script":N=Di(s)}$s.has(N)||(s=b({rel:"preload",href:o==="image"&&c&&c.imageSrcSet?void 0:s,as:o},c),$s.set(N,s),m.querySelector(v)!==null||o==="style"&&m.querySelector(ac(N))||o==="script"&&m.querySelector(rc(N))||(o=m.createElement("link"),Un(o,"link",s),zn(o),m.head.appendChild(o)))}}function O5(s,o){Fa.m(s,o);var c=zi;if(c&&s){var m=o&&typeof o.as=="string"?o.as:"script",v='link[rel="modulepreload"][as="'+As(m)+'"][href="'+As(s)+'"]',N=v;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":N=Di(s)}if(!$s.has(N)&&(s=b({rel:"modulepreload",href:s},o),$s.set(N,s),c.querySelector(v)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(rc(N)))return}m=c.createElement("link"),Un(m,"link",s),zn(m),c.head.appendChild(m)}}}function D5(s,o,c){Fa.S(s,o,c);var m=zi;if(m&&s){var v=ni(m).hoistableStyles,N=Oi(s);o=o||"default";var O=v.get(N);if(!O){var H={loading:0,preload:null};if(O=m.querySelector(ac(N)))H.loading=5;else{s=b({rel:"stylesheet",href:s,"data-precedence":o},c),(c=$s.get(N))&&Pg(s,c);var Z=O=m.createElement("link");zn(Z),Un(Z,"link",s),Z._p=new Promise(function(ue,ve){Z.onload=ue,Z.onerror=ve}),Z.addEventListener("load",function(){H.loading|=1}),Z.addEventListener("error",function(){H.loading|=2}),H.loading|=4,xd(O,o,m)}O={type:"stylesheet",instance:O,count:1,state:H},v.set(N,O)}}}function P5(s,o){Fa.X(s,o);var c=zi;if(c&&s){var m=ni(c).hoistableScripts,v=Di(s),N=m.get(v);N||(N=c.querySelector(rc(v)),N||(s=b({src:s,async:!0},o),(o=$s.get(v))&&Lg(s,o),N=c.createElement("script"),zn(N),Un(N,"link",s),c.head.appendChild(N)),N={type:"script",instance:N,count:1,state:null},m.set(v,N))}}function L5(s,o){Fa.M(s,o);var c=zi;if(c&&s){var m=ni(c).hoistableScripts,v=Di(s),N=m.get(v);N||(N=c.querySelector(rc(v)),N||(s=b({src:s,async:!0,type:"module"},o),(o=$s.get(v))&&Lg(s,o),N=c.createElement("script"),zn(N),Un(N,"link",s),c.head.appendChild(N)),N={type:"script",instance:N,count:1,state:null},m.set(v,N))}}function ej(s,o,c,m){var v=(v=se.current)?hd(v):null;if(!v)throw Error(r(446));switch(s){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(o=Oi(c.href),c=ni(v).hoistableStyles,m=c.get(o),m||(m={type:"style",instance:null,count:0,state:null},c.set(o,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){s=Oi(c.href);var N=ni(v).hoistableStyles,O=N.get(s);if(O||(v=v.ownerDocument||v,O={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},N.set(s,O),(N=v.querySelector(ac(s)))&&!N._p&&(O.instance=N,O.state.loading=5),$s.has(s)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},$s.set(s,c),N||I5(v,s,c,O.state))),o&&m===null)throw Error(r(528,""));return O}if(o&&m!==null)throw Error(r(529,""));return null;case"script":return o=c.async,c=c.src,typeof c=="string"&&o&&typeof o!="function"&&typeof o!="symbol"?(o=Di(c),c=ni(v).hoistableScripts,m=c.get(o),m||(m={type:"script",instance:null,count:0,state:null},c.set(o,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function Oi(s){return'href="'+As(s)+'"'}function ac(s){return'link[rel="stylesheet"]['+s+"]"}function tj(s){return b({},s,{"data-precedence":s.precedence,precedence:null})}function I5(s,o,c,m){s.querySelector('link[rel="preload"][as="style"]['+o+"]")?m.loading=1:(o=s.createElement("link"),m.preload=o,o.addEventListener("load",function(){return m.loading|=1}),o.addEventListener("error",function(){return m.loading|=2}),Un(o,"link",c),zn(o),s.head.appendChild(o))}function Di(s){return'[src="'+As(s)+'"]'}function rc(s){return"script[async]"+s}function nj(s,o,c){if(o.count++,o.instance===null)switch(o.type){case"style":var m=s.querySelector('style[data-href~="'+As(c.href)+'"]');if(m)return o.instance=m,zn(m),m;var v=b({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return m=(s.ownerDocument||s).createElement("style"),zn(m),Un(m,"style",v),xd(m,c.precedence,s),o.instance=m;case"stylesheet":v=Oi(c.href);var N=s.querySelector(ac(v));if(N)return o.state.loading|=4,o.instance=N,zn(N),N;m=tj(c),(v=$s.get(v))&&Pg(m,v),N=(s.ownerDocument||s).createElement("link"),zn(N);var O=N;return O._p=new Promise(function(H,Z){O.onload=H,O.onerror=Z}),Un(N,"link",m),o.state.loading|=4,xd(N,c.precedence,s),o.instance=N;case"script":return N=Di(c.src),(v=s.querySelector(rc(N)))?(o.instance=v,zn(v),v):(m=c,(v=$s.get(N))&&(m=b({},c),Lg(m,v)),s=s.ownerDocument||s,v=s.createElement("script"),zn(v),Un(v,"link",m),s.head.appendChild(v),o.instance=v);case"void":return null;default:throw Error(r(443,o.type))}else o.type==="stylesheet"&&(o.state.loading&4)===0&&(m=o.instance,o.state.loading|=4,xd(m,c.precedence,s));return o.instance}function xd(s,o,c){for(var m=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=m.length?m[m.length-1]:null,N=v,O=0;O<m.length;O++){var H=m[O];if(H.dataset.precedence===o)N=H;else if(N!==v)break}N?N.parentNode.insertBefore(s,N.nextSibling):(o=c.nodeType===9?c.head:c,o.insertBefore(s,o.firstChild))}function Pg(s,o){s.crossOrigin==null&&(s.crossOrigin=o.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=o.referrerPolicy),s.title==null&&(s.title=o.title)}function Lg(s,o){s.crossOrigin==null&&(s.crossOrigin=o.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=o.referrerPolicy),s.integrity==null&&(s.integrity=o.integrity)}var bd=null;function sj(s,o,c){if(bd===null){var m=new Map,v=bd=new Map;v.set(c,m)}else v=bd,m=v.get(c),m||(m=new Map,v.set(c,m));if(m.has(s))return m;for(m.set(s,null),c=c.getElementsByTagName(s),v=0;v<c.length;v++){var N=c[v];if(!(N[yl]||N[Wt]||s==="link"&&N.getAttribute("rel")==="stylesheet")&&N.namespaceURI!=="http://www.w3.org/2000/svg"){var O=N.getAttribute(o)||"";O=s+O;var H=m.get(O);H?H.push(N):m.set(O,[N])}}return m}function aj(s,o,c){s=s.ownerDocument||s,s.head.insertBefore(c,o==="title"?s.querySelector("head > title"):null)}function $5(s,o,c){if(c===1||o.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof o.precedence!="string"||typeof o.href!="string"||o.href==="")break;return!0;case"link":if(typeof o.rel!="string"||typeof o.href!="string"||o.href===""||o.onLoad||o.onError)break;switch(o.rel){case"stylesheet":return s=o.disabled,typeof o.precedence=="string"&&s==null;default:return!0}case"script":if(o.async&&typeof o.async!="function"&&typeof o.async!="symbol"&&!o.onLoad&&!o.onError&&o.src&&typeof o.src=="string")return!0}return!1}function rj(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function B5(s,o,c,m){if(c.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var v=Oi(m.href),N=o.querySelector(ac(v));if(N){o=N._p,o!==null&&typeof o=="object"&&typeof o.then=="function"&&(s.count++,s=_d.bind(s),o.then(s,s)),c.state.loading|=4,c.instance=N,zn(N);return}N=o.ownerDocument||o,m=tj(m),(v=$s.get(v))&&Pg(m,v),N=N.createElement("link"),zn(N);var O=N;O._p=new Promise(function(H,Z){O.onload=H,O.onerror=Z}),Un(N,"link",m),c.instance=N}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(c,o),(o=c.state.preload)&&(c.state.loading&3)===0&&(s.count++,c=_d.bind(s),o.addEventListener("load",c),o.addEventListener("error",c))}}var Ig=0;function U5(s,o){return s.stylesheets&&s.count===0&&yd(s,s.stylesheets),0<s.count||0<s.imgCount?function(c){var m=setTimeout(function(){if(s.stylesheets&&yd(s,s.stylesheets),s.unsuspend){var N=s.unsuspend;s.unsuspend=null,N()}},6e4+o);0<s.imgBytes&&Ig===0&&(Ig=62500*y5());var v=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&yd(s,s.stylesheets),s.unsuspend)){var N=s.unsuspend;s.unsuspend=null,N()}},(s.imgBytes>Ig?50:800)+o);return s.unsuspend=c,function(){s.unsuspend=null,clearTimeout(m),clearTimeout(v)}}:null}function _d(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)yd(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var vd=null;function yd(s,o){s.stylesheets=null,s.unsuspend!==null&&(s.count++,vd=new Map,o.forEach(q5,s),vd=null,_d.call(s))}function q5(s,o){if(!(o.state.loading&4)){var c=vd.get(s);if(c)var m=c.get(null);else{c=new Map,vd.set(s,c);for(var v=s.querySelectorAll("link[data-precedence],style[data-precedence]"),N=0;N<v.length;N++){var O=v[N];(O.nodeName==="LINK"||O.getAttribute("media")!=="not all")&&(c.set(O.dataset.precedence,O),m=O)}m&&c.set(null,m)}v=o.instance,O=v.getAttribute("data-precedence"),N=c.get(O)||m,N===m&&c.set(null,v),c.set(O,v),this.count++,m=_d.bind(this),v.addEventListener("load",m),v.addEventListener("error",m),N?N.parentNode.insertBefore(v,N.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(v,s.firstChild)),o.state.loading|=4}}var oc={$$typeof:E,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function H5(s,o,c,m,v,N,O,H,Z){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=as(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=as(0),this.hiddenUpdates=as(null),this.identifierPrefix=m,this.onUncaughtError=v,this.onCaughtError=N,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Z,this.incompleteTransitions=new Map}function oj(s,o,c,m,v,N,O,H,Z,ue,ve,Se){return s=new H5(s,o,c,O,Z,ue,ve,Se,H),o=1,N===!0&&(o|=24),N=_s(3,null,null,o),s.current=N,N.stateNode=s,o=xm(),o.refCount++,s.pooledCache=o,o.refCount++,N.memoizedState={element:m,isDehydrated:c,cache:o},ym(N),s}function ij(s){return s?(s=fi,s):fi}function lj(s,o,c,m,v,N){v=ij(v),m.context===null?m.context=v:m.pendingContext=v,m=vr(o),m.payload={element:c},N=N===void 0?null:N,N!==null&&(m.callback=N),c=yr(s,m,o),c!==null&&(ds(c,s,o),Il(c,s,o))}function cj(s,o){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var c=s.retryLane;s.retryLane=c!==0&&c<o?c:o}}function $g(s,o){cj(s,o),(s=s.alternate)&&cj(s,o)}function uj(s){if(s.tag===13||s.tag===31){var o=uo(s,67108864);o!==null&&ds(o,s,67108864),$g(s,67108864)}}function dj(s){if(s.tag===13||s.tag===31){var o=ws();o=Ut(o);var c=uo(s,o);c!==null&&ds(c,s,o),$g(s,o)}}var jd=!0;function V5(s,o,c,m){var v=U.T;U.T=null;var N=V.p;try{V.p=2,Bg(s,o,c,m)}finally{V.p=N,U.T=v}}function F5(s,o,c,m){var v=U.T;U.T=null;var N=V.p;try{V.p=8,Bg(s,o,c,m)}finally{V.p=N,U.T=v}}function Bg(s,o,c,m){if(jd){var v=Ug(m);if(v===null)Cg(s,o,m,kd,c),pj(s,m);else if(Y5(v,s,o,c,m))m.stopPropagation();else if(pj(s,m),o&4&&-1<G5.indexOf(s)){for(;v!==null;){var N=ti(v);if(N!==null)switch(N.tag){case 3:if(N=N.stateNode,N.current.memoizedState.isDehydrated){var O=Lt(N.pendingLanes);if(O!==0){var H=N;for(H.pendingLanes|=2,H.entangledLanes|=2;O;){var Z=1<<31-ze(O);H.entanglements[1]|=Z,O&=~Z}da(N),(Pt&6)===0&&(rd=ge()+500,ec(0))}}break;case 31:case 13:H=uo(N,2),H!==null&&ds(H,N,2),id(),$g(N,2)}if(N=Ug(m),N===null&&Cg(s,o,m,kd,c),N===v)break;v=N}v!==null&&m.stopPropagation()}else Cg(s,o,m,null,c)}}function Ug(s){return s=Hp(s),qg(s)}var kd=null;function qg(s){if(kd=null,s=ei(s),s!==null){var o=l(s);if(o===null)s=null;else{var c=o.tag;if(c===13){if(s=d(o),s!==null)return s;s=null}else if(c===31){if(s=f(o),s!==null)return s;s=null}else if(c===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;s=null}else o!==s&&(s=null)}}return kd=s,null}function fj(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(de()){case Le:return 2;case ye:return 8;case Ne:case We:return 32;case Ge:return 268435456;default:return 32}default:return 32}}var Hg=!1,Mr=null,zr=null,Or=null,ic=new Map,lc=new Map,Dr=[],G5="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function pj(s,o){switch(s){case"focusin":case"focusout":Mr=null;break;case"dragenter":case"dragleave":zr=null;break;case"mouseover":case"mouseout":Or=null;break;case"pointerover":case"pointerout":ic.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":lc.delete(o.pointerId)}}function cc(s,o,c,m,v,N){return s===null||s.nativeEvent!==N?(s={blockedOn:o,domEventName:c,eventSystemFlags:m,nativeEvent:N,targetContainers:[v]},o!==null&&(o=ti(o),o!==null&&uj(o)),s):(s.eventSystemFlags|=m,o=s.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),s)}function Y5(s,o,c,m,v){switch(o){case"focusin":return Mr=cc(Mr,s,o,c,m,v),!0;case"dragenter":return zr=cc(zr,s,o,c,m,v),!0;case"mouseover":return Or=cc(Or,s,o,c,m,v),!0;case"pointerover":var N=v.pointerId;return ic.set(N,cc(ic.get(N)||null,s,o,c,m,v)),!0;case"gotpointercapture":return N=v.pointerId,lc.set(N,cc(lc.get(N)||null,s,o,c,m,v)),!0}return!1}function mj(s){var o=ei(s.target);if(o!==null){var c=l(o);if(c!==null){if(o=c.tag,o===13){if(o=d(c),o!==null){s.blockedOn=o,xs(s.priority,function(){dj(c)});return}}else if(o===31){if(o=f(c),o!==null){s.blockedOn=o,xs(s.priority,function(){dj(c)});return}}else if(o===3&&c.stateNode.current.memoizedState.isDehydrated){s.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}s.blockedOn=null}function wd(s){if(s.blockedOn!==null)return!1;for(var o=s.targetContainers;0<o.length;){var c=Ug(s.nativeEvent);if(c===null){c=s.nativeEvent;var m=new c.constructor(c.type,c);qp=m,c.target.dispatchEvent(m),qp=null}else return o=ti(c),o!==null&&uj(o),s.blockedOn=c,!1;o.shift()}return!0}function gj(s,o,c){wd(s)&&c.delete(o)}function K5(){Hg=!1,Mr!==null&&wd(Mr)&&(Mr=null),zr!==null&&wd(zr)&&(zr=null),Or!==null&&wd(Or)&&(Or=null),ic.forEach(gj),lc.forEach(gj)}function Sd(s,o){s.blockedOn===o&&(s.blockedOn=null,Hg||(Hg=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,K5)))}var Cd=null;function hj(s){Cd!==s&&(Cd=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Cd===s&&(Cd=null);for(var o=0;o<s.length;o+=3){var c=s[o],m=s[o+1],v=s[o+2];if(typeof m!="function"){if(qg(m||c)===null)continue;break}var N=ti(c);N!==null&&(s.splice(o,3),o-=3,Um(N,{pending:!0,data:v,method:c.method,action:m},m,v))}}))}function Pi(s){function o(Z){return Sd(Z,s)}Mr!==null&&Sd(Mr,s),zr!==null&&Sd(zr,s),Or!==null&&Sd(Or,s),ic.forEach(o),lc.forEach(o);for(var c=0;c<Dr.length;c++){var m=Dr[c];m.blockedOn===s&&(m.blockedOn=null)}for(;0<Dr.length&&(c=Dr[0],c.blockedOn===null);)mj(c),c.blockedOn===null&&Dr.shift();if(c=(s.ownerDocument||s).$$reactFormReplay,c!=null)for(m=0;m<c.length;m+=3){var v=c[m],N=c[m+1],O=v[vn]||null;if(typeof N=="function")O||hj(c);else if(O){var H=null;if(N&&N.hasAttribute("formAction")){if(v=N,O=N[vn]||null)H=O.formAction;else if(qg(v)!==null)continue}else H=O.action;typeof H=="function"?c[m+1]=H:(c.splice(m,3),m-=3),hj(c)}}}function xj(){function s(N){N.canIntercept&&N.info==="react-transition"&&N.intercept({handler:function(){return new Promise(function(O){return v=O})},focusReset:"manual",scroll:"manual"})}function o(){v!==null&&(v(),v=null),m||setTimeout(c,20)}function c(){if(!m&&!navigation.transition){var N=navigation.currentEntry;N&&N.url!=null&&navigation.navigate(N.url,{state:N.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var m=!1,v=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",o),navigation.addEventListener("navigateerror",o),setTimeout(c,100),function(){m=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",o),navigation.removeEventListener("navigateerror",o),v!==null&&(v(),v=null)}}}function Vg(s){this._internalRoot=s}Nd.prototype.render=Vg.prototype.render=function(s){var o=this._internalRoot;if(o===null)throw Error(r(409));var c=o.current,m=ws();lj(c,m,s,o,null,null)},Nd.prototype.unmount=Vg.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var o=s.containerInfo;lj(s.current,2,null,s,null,null),id(),o[ia]=null}};function Nd(s){this._internalRoot=s}Nd.prototype.unstable_scheduleHydration=function(s){if(s){var o=rs();s={blockedOn:null,target:s,priority:o};for(var c=0;c<Dr.length&&o!==0&&o<Dr[c].priority;c++);Dr.splice(c,0,s),c===0&&mj(s)}};var bj=t.version;if(bj!=="19.2.8")throw Error(r(527,bj,"19.2.8"));V.findDOMNode=function(s){var o=s._reactInternals;if(o===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=g(o),s=s!==null?h(s):null,s=s===null?null:s.stateNode,s};var X5={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:U,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ed=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ed.isDisabled&&Ed.supportsFiber)try{_t=Ed.inject(X5),Ct=Ed}catch{}}return dc.createRoot=function(s,o){if(!i(s))throw Error(r(299));var c=!1,m="",v=S0,N=C0,O=N0;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onUncaughtError!==void 0&&(v=o.onUncaughtError),o.onCaughtError!==void 0&&(N=o.onCaughtError),o.onRecoverableError!==void 0&&(O=o.onRecoverableError)),o=oj(s,1,!1,null,null,c,m,null,v,N,O,xj),s[ia]=o.current,Sg(s),new Vg(o)},dc.hydrateRoot=function(s,o,c){if(!i(s))throw Error(r(299));var m=!1,v="",N=S0,O=C0,H=N0,Z=null;return c!=null&&(c.unstable_strictMode===!0&&(m=!0),c.identifierPrefix!==void 0&&(v=c.identifierPrefix),c.onUncaughtError!==void 0&&(N=c.onUncaughtError),c.onCaughtError!==void 0&&(O=c.onCaughtError),c.onRecoverableError!==void 0&&(H=c.onRecoverableError),c.formState!==void 0&&(Z=c.formState)),o=oj(s,1,!0,o,c??null,m,v,Z,N,O,H,xj),o.context=ij(null),c=o.current,m=ws(),m=Ut(m),v=vr(m),v.callback=null,yr(c,v,m),c=m,o.current.lanes=c,dn(o,c),da(o),s[ia]=o.current,Sg(s),new Nd(o)},dc.version="19.2.8",dc}var Ej;function o3(){if(Ej)return Yg.exports;Ej=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Yg.exports=r3(),Yg.exports}var i3=o3();const l3=xb(i3);/**
50
+ * react-router v7.18.2
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */var bb=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,q2=/^[\\/]{2}/;function c3(e,t){return t+e.replace(/\\/g,"/")}var Rj="popstate";function Tj(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function u3(e={}){function t(r,i){let l=i.state?.masked,{pathname:d,search:f,hash:p}=l||r.location;return gx("",{pathname:d,search:f,hash:p},i.state&&i.state.usr||null,i.state&&i.state.key||"default",l?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function a(r,i){return typeof i=="string"?i:Ic(i)}return f3(t,a,null,e)}function cn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Fs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function d3(){return Math.random().toString(36).substring(2,10)}function Aj(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function gx(e,t,a=null,r,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?pl(t):t,state:a,key:t&&t.key||r||d3(),mask:i}}function Ic({pathname:e="/",search:t="",hash:a=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),a&&a!=="#"&&(e+=a.charAt(0)==="#"?a:"#"+a),e}function pl(e){let t={};if(e){let a=e.indexOf("#");a>=0&&(t.hash=e.substring(a),e=e.substring(0,a));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function f3(e,t,a,r={}){let{window:i=document.defaultView,v5Compat:l=!1}=r,d=i.history,f="POP",p=null,g=h();g==null&&(g=0,d.replaceState({...d.state,idx:g},""));function h(){return(d.state||{idx:null}).idx}function b(){f="POP";let k=h(),C=k==null?null:k-g;g=k,p&&p({action:f,location:j.location,delta:C})}function _(k,C){f="PUSH";let w=Tj(k)?k:gx(j.location,k,C);g=h()+1;let E=Aj(w,g),R=j.createHref(w.mask||w);try{d.pushState(E,"",R)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;i.location.assign(R)}l&&p&&p({action:f,location:j.location,delta:1})}function y(k,C){f="REPLACE";let w=Tj(k)?k:gx(j.location,k,C);g=h();let E=Aj(w,g),R=j.createHref(w.mask||w);d.replaceState(E,"",R),l&&p&&p({action:f,location:j.location,delta:0})}function S(k){return p3(i,k)}let j={get action(){return f},get location(){return e(i,d)},listen(k){if(p)throw new Error("A history only accepts one active listener");return i.addEventListener(Rj,b),p=k,()=>{i.removeEventListener(Rj,b),p=null}},createHref(k){return t(i,k)},createURL:S,encodeLocation(k){let C=S(k);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:_,replace:y,go(k){return d.go(k)}};return j}function p3(e,t,a=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),cn(r,"No window.location.(origin|href) available to create URL");let i=typeof t=="string"?t:Ic(t);return i=i.replace(/ $/,"%20"),!a&&q2.test(i)&&(i=r+i),new URL(i,r)}function H2(e,t,a="/"){return m3(e,t,a,!1)}function m3(e,t,a,r,i){let l=typeof t=="string"?pl(t):t,d=rr(l.pathname||"/",a);if(d==null)return null;let f=g3(e),p=null,g=C3(d);for(let h=0;p==null&&h<f.length;++h)p=S3(f[h],g,r);return p}function g3(e){let t=V2(e);return h3(t),t}function V2(e,t=[],a=[],r="",i=!1){let l=(d,f,p=i,g)=>{let h={relativePath:g===void 0?d.path||"":g,caseSensitive:d.caseSensitive===!0,childrenIndex:f,route:d};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(r)&&p)return;cn(h.relativePath.startsWith(r),`Absolute route path "${h.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(r.length)}let b=ea([r,h.relativePath]),_=a.concat(h);d.children&&d.children.length>0&&(cn(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),V2(d.children,t,_,b,p)),!(d.path==null&&!d.index)&&t.push({path:b,score:k3(b,d.index),routesMeta:_.map((y,S)=>{let[j,k]=Y2(y.relativePath,y.caseSensitive,S===_.length-1);return{...y,matcher:j,compiledParams:k}})})};return e.forEach((d,f)=>{if(d.path===""||!d.path?.includes("?"))l(d,f);else for(let p of F2(d.path))l(d,f,!0,p)}),t}function F2(e){let t=e.split("/");if(t.length===0)return[];let[a,...r]=t,i=a.endsWith("?"),l=a.replace(/\?$/,"");if(r.length===0)return i?[l,""]:[l];let d=F2(r.join("/")),f=[];return f.push(...d.map(p=>p===""?l:[l,p].join("/"))),i&&f.push(...d),f.map(p=>e.startsWith("/")&&p===""?"/":p)}function h3(e){e.sort((t,a)=>t.score!==a.score?a.score-t.score:w3(t.routesMeta.map(r=>r.childrenIndex),a.routesMeta.map(r=>r.childrenIndex)))}var x3=/^:[\w-]+$/,b3=3,_3=2,v3=1,y3=10,j3=-2,Mj=e=>e==="*";function k3(e,t){let a=e.split("/"),r=a.length;return a.some(Mj)&&(r+=j3),t&&(r+=_3),a.filter(i=>!Mj(i)).reduce((i,l)=>i+(x3.test(l)?b3:l===""?v3:y3),r)}function w3(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function S3(e,t,a=!1){let{routesMeta:r}=e,i={},l="/",d=[];for(let f=0;f<r.length;++f){let p=r[f],g=f===r.length-1,h=l==="/"?t:t.slice(l.length)||"/",b={path:p.relativePath,caseSensitive:p.caseSensitive,end:g},_=p.matcher&&p.compiledParams?G2(b,h,p.matcher,p.compiledParams):gf(b,h),y=p.route;if(!_&&g&&a&&!r[r.length-1].route.index&&(_=gf({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},h)),!_)return null;Object.assign(i,_.params),d.push({params:i,pathname:ea([l,_.pathname]),pathnameBase:R3(ea([l,_.pathnameBase])),route:y}),_.pathnameBase!=="/"&&(l=ea([l,_.pathnameBase]))}return d}function gf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[a,r]=Y2(e.path,e.caseSensitive,e.end);return G2(e,t,a,r)}function G2(e,t,a,r){let i=t.match(a);if(!i)return null;let l=i[0],d=l.replace(/(.)\/+$/,"$1"),f=i.slice(1);return{params:r.reduce((g,{paramName:h,isOptional:b},_)=>{if(h==="*"){let S=f[_]||"";d=l.slice(0,l.length-S.length).replace(/(.)\/+$/,"$1")}const y=f[_];return b&&!y?g[h]=void 0:g[h]=(y||"").replace(/%2F/g,"/"),g},{}),pathname:l,pathnameBase:d,pattern:e}}function Y2(e,t=!1,a=!0){Fs(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,f,p,g,h)=>{if(r.push({paramName:f,isOptional:p!=null}),p){let b=h.charAt(g+d.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function C3(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Fs(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function rr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let a=t.endsWith("/")?t.length-1:t.length,r=e.charAt(a);return r&&r!=="/"?null:e.slice(a)||"/"}function N3(e,t="/"){let{pathname:a,search:r="",hash:i=""}=typeof e=="string"?pl(e):e,l;return a?(a=K2(a),a.startsWith("/")?l=zj(a.substring(1),"/"):l=zj(a,t)):l=t,{pathname:l,search:T3(r),hash:A3(i)}}function zj(e,t){let a=hf(t).split("/");return e.split("/").forEach(i=>{i===".."?a.length>1&&a.pop():i!=="."&&a.push(i)}),a.length>1?a.join("/"):"/"}function Wg(e,t,a,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${a}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function E3(e){return e.filter((t,a)=>a===0||t.route.path&&t.route.path.length>0)}function _b(e){let t=E3(e);return t.map((a,r)=>r===t.length-1?a.pathname:a.pathnameBase)}function Vf(e,t,a,r=!1){let i;typeof e=="string"?i=pl(e):(i={...e},cn(!i.pathname||!i.pathname.includes("?"),Wg("?","pathname","search",i)),cn(!i.pathname||!i.pathname.includes("#"),Wg("#","pathname","hash",i)),cn(!i.search||!i.search.includes("#"),Wg("#","search","hash",i)));let l=e===""||i.pathname==="",d=l?"/":i.pathname,f;if(d==null)f=a;else{let b=t.length-1;if(!r&&d.startsWith("..")){let _=d.split("/");for(;_[0]==="..";)_.shift(),b-=1;i.pathname=_.join("/")}f=b>=0?t[b]:"/"}let p=N3(i,f),g=d&&d!=="/"&&d.endsWith("/"),h=(l||d===".")&&a.endsWith("/");return!p.pathname.endsWith("/")&&(g||h)&&(p.pathname+="/"),p}var K2=e=>e.replace(/[\\/]{2,}/g,"/"),ea=e=>K2(e.join("/")),hf=e=>e.replace(/\/+$/,""),R3=e=>hf(e).replace(/^\/*/,"/"),T3=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,A3=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,M3=class{constructor(e,t,a,r=!1){this.status=e,this.statusText=t||"",this.internal=r,a instanceof Error?(this.data=a.toString(),this.error=a):this.data=a}};function z3(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function O3(e){let t=e.map(a=>a.route.path).filter(Boolean);return ea(t)||"/"}var X2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Q2(e,t){let a=e;if(typeof a!="string"||!bb.test(a))return{absoluteURL:void 0,isExternal:!1,to:a};let r=a,i=!1;if(X2)try{let l=new URL(window.location.href),d=q2.test(a)?new URL(c3(a,l.protocol)):new URL(a),f=rr(d.pathname,t);d.origin===l.origin&&f!=null?a=f+d.search+d.hash:i=!0}catch{Fs(!1,`<Link to="${a}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var W2=["POST","PUT","PATCH","DELETE"];new Set(W2);var D3=["GET",...W2];new Set(D3);var P3=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function L3(e){try{return P3.includes(new URL(e).protocol)}catch{return!1}}var ml=x.createContext(null);ml.displayName="DataRouter";var Ff=x.createContext(null);Ff.displayName="DataRouterState";var Z2=x.createContext(!1);function I3(){return x.useContext(Z2)}var J2=x.createContext({isTransitioning:!1});J2.displayName="ViewTransition";var $3=x.createContext(new Map);$3.displayName="Fetchers";var B3=x.createContext(null);B3.displayName="Await";var Es=x.createContext(null);Es.displayName="Navigation";var Jc=x.createContext(null);Jc.displayName="Location";var na=x.createContext({outlet:null,matches:[],isDataRoute:!1});na.displayName="Route";var vb=x.createContext(null);vb.displayName="RouteError";var eS="REACT_ROUTER_ERROR",U3="REDIRECT",q3="ROUTE_ERROR_RESPONSE";function H3(e){if(e.startsWith(`${eS}:${U3}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function V3(e){if(e.startsWith(`${eS}:${q3}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new M3(t.status,t.statusText,t.data)}catch{}}function F3(e,{relative:t}={}){cn(gl(),"useHref() may be used only in the context of a <Router> component.");let{basename:a,navigator:r}=x.useContext(Es),{hash:i,pathname:l,search:d}=eu(e,{relative:t}),f=l;return a!=="/"&&(f=l==="/"?a:ea([a,l])),r.createHref({pathname:f,search:d,hash:i})}function gl(){return x.useContext(Jc)!=null}function ns(){return cn(gl(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(Jc).location}var tS="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function nS(e){x.useContext(Es).static||x.useLayoutEffect(e)}function Sn(){let{isDataRoute:e}=x.useContext(na);return e?aA():G3()}function G3(){cn(gl(),"useNavigate() may be used only in the context of a <Router> component.");let e=x.useContext(ml),{basename:t,navigator:a}=x.useContext(Es),{matches:r}=x.useContext(na),{pathname:i}=ns(),l=JSON.stringify(_b(r)),d=x.useRef(!1);return nS(()=>{d.current=!0}),x.useCallback((p,g={})=>{if(Fs(d.current,tS),!d.current)return;if(typeof p=="number"){a.go(p);return}let h=Vf(p,JSON.parse(l),i,g.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:ea([t,h.pathname])),(g.replace?a.replace:a.push)(h,g.state,g)},[t,a,l,i,e])}x.createContext(null);function sS(){let{matches:e}=x.useContext(na);return e[e.length-1]?.params??{}}function eu(e,{relative:t}={}){let{matches:a}=x.useContext(na),{pathname:r}=ns(),i=JSON.stringify(_b(a));return x.useMemo(()=>Vf(e,JSON.parse(i),r,t==="path"),[e,i,r,t])}function Y3(e,t){return aS(e,t)}function aS(e,t,a){cn(gl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=x.useContext(Es),{matches:i}=x.useContext(na),l=i[i.length-1],d=l?l.params:{},f=l?l.pathname:"/",p=l?l.pathnameBase:"/",g=l&&l.route;{let k=g&&g.path||"";oS(f,!g||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
+
60
+ Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let h=ns(),b;if(t){let k=typeof t=="string"?pl(t):t;cn(p==="/"||k.pathname?.startsWith(p),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${k.pathname}" was given in the \`location\` prop.`),b=k}else b=h;let _=b.pathname||"/",y=_;if(p!=="/"){let k=p.replace(/^\//,"").split("/");y="/"+_.replace(/^\//,"").split("/").slice(k.length).join("/")}let S=a&&a.state.matches.length?a.state.matches.map(k=>Object.assign(k,{route:a.manifest[k.route.id]||k.route})):H2(e,{pathname:y});Fs(g||S!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),Fs(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${b.pathname}${b.search}${b.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=Z3(S&&S.map(k=>Object.assign({},k,{params:Object.assign({},d,k.params),pathname:ea([p,r.encodeLocation?r.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?p:ea([p,r.encodeLocation?r.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),i,a);return t&&j?x.createElement(Jc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...b},navigationType:"POP"}},j):j}function K3(){let e=sA(),t=z3(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),a=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},l={padding:"2px 4px",backgroundColor:r},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=x.createElement(x.Fragment,null,x.createElement("p",null,"💿 Hey developer 👋"),x.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",x.createElement("code",{style:l},"ErrorBoundary")," or"," ",x.createElement("code",{style:l},"errorElement")," prop on your route.")),x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),a?x.createElement("pre",{style:i},a):null,d)}var X3=x.createElement(K3,null),rS=class extends x.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const a=V3(e.digest);a&&(e=a)}let t=e!==void 0?x.createElement(na.Provider,{value:this.props.routeContext},x.createElement(vb.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?x.createElement(Q3,{error:e},t):t}};rS.contextType=Z2;var Zg=new WeakMap;function Q3({children:e,error:t}){let{basename:a}=x.useContext(Es);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=H3(t.digest);if(r){let i=Zg.get(t);if(i)throw i;let l=Q2(r.location,a),d=l.absoluteURL||l.to;if(L3(d))throw new Error("Invalid redirect location");if(X2&&!Zg.get(t))if(l.isExternal||r.reloadDocument)window.location.href=d;else{const f=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:r.replace}));throw Zg.set(t,f),f}return x.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d}`})}}return e}function W3({routeContext:e,match:t,children:a}){let r=x.useContext(ml);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),x.createElement(na.Provider,{value:e},a)}function Z3(e,t=[],a){let r=a?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,l=r?.errors;if(l!=null){let h=i.findIndex(b=>b.route.id&&l?.[b.route.id]!==void 0);cn(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),i=i.slice(0,Math.min(i.length,h+1))}let d=!1,f=-1;if(a&&r){d=r.renderFallback;for(let h=0;h<i.length;h++){let b=i[h];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(f=h),b.route.id){let{loaderData:_,errors:y}=r,S=b.route.loader&&!_.hasOwnProperty(b.route.id)&&(!y||y[b.route.id]===void 0);if(b.route.lazy||S){a.isStatic&&(d=!0),f>=0?i=i.slice(0,f+1):i=[i[0]];break}}}}let p=a?.onError,g=r&&p?(h,b)=>{p(h,{location:r.location,params:r.matches?.[0]?.params??{},pattern:O3(r.matches),errorInfo:b})}:void 0;return i.reduceRight((h,b,_)=>{let y,S=!1,j=null,k=null;r&&(y=l&&b.route.id?l[b.route.id]:void 0,j=b.route.errorElement||X3,d&&(f<0&&_===0?(oS("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,k=null):f===_&&(S=!0,k=b.route.hydrateFallbackElement||null)));let C=t.concat(i.slice(0,_+1)),w=()=>{let E;return y?E=j:S?E=k:b.route.Component?E=x.createElement(b.route.Component,null):b.route.element?E=b.route.element:E=h,x.createElement(W3,{match:b,routeContext:{outlet:h,matches:C,isDataRoute:r!=null},children:E})};return r&&(b.route.ErrorBoundary||b.route.errorElement||_===0)?x.createElement(rS,{location:r.location,revalidation:r.revalidation,component:j,error:y,children:w(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:g}):w()},null)}function yb(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function J3(e){let t=x.useContext(ml);return cn(t,yb(e)),t}function eA(e){let t=x.useContext(Ff);return cn(t,yb(e)),t}function tA(e){let t=x.useContext(na);return cn(t,yb(e)),t}function jb(e){let t=tA(e),a=t.matches[t.matches.length-1];return cn(a.route.id,`${e} can only be used on routes that contain a unique "id"`),a.route.id}function nA(){return jb("useRouteId")}function sA(){let e=x.useContext(vb),t=eA("useRouteError"),a=jb("useRouteError");return e!==void 0?e:t.errors?.[a]}function aA(){let{router:e}=J3("useNavigate"),t=jb("useNavigate"),a=x.useRef(!1);return nS(()=>{a.current=!0}),x.useCallback(async(i,l={})=>{Fs(a.current,tS),a.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:t,...l}))},[e,t])}var Oj={};function oS(e,t,a){!t&&!Oj[e]&&(Oj[e]=!0,Fs(!1,a))}x.memo(rA);function rA({routes:e,manifest:t,future:a,state:r,isStatic:i,onError:l}){return aS(e,void 0,{manifest:t,state:r,isStatic:i,onError:l})}function oA({to:e,replace:t,state:a,relative:r}){cn(gl(),"<Navigate> may be used only in the context of a <Router> component.");let{static:i}=x.useContext(Es);Fs(!i,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:l}=x.useContext(na),{pathname:d}=ns(),f=Sn(),p=Vf(e,_b(l),d,r==="path"),g=JSON.stringify(p);return x.useEffect(()=>{f(JSON.parse(g),{replace:t,state:a,relative:r})},[f,g,r,t,a]),null}function At(e){cn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function iA({basename:e="/",children:t=null,location:a,navigationType:r="POP",navigator:i,static:l=!1,useTransitions:d}){cn(!gl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),p=x.useMemo(()=>({basename:f,navigator:i,static:l,useTransitions:d,future:{}}),[f,i,l,d]);typeof a=="string"&&(a=pl(a));let{pathname:g="/",search:h="",hash:b="",state:_=null,key:y="default",mask:S}=a,j=x.useMemo(()=>{let k=rr(g,f);return k==null?null:{location:{pathname:k,search:h,hash:b,state:_,key:y,mask:S},navigationType:r}},[f,g,h,b,_,y,r,S]);return Fs(j!=null,`<Router basename="${f}"> is not able to match the URL "${g}${h}${b}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:x.createElement(Es.Provider,{value:p},x.createElement(Jc.Provider,{children:t,value:j}))}function iS({children:e,location:t}){return Y3(hx(e),t)}function hx(e,t=[]){let a=[];return x.Children.forEach(e,(r,i)=>{if(!x.isValidElement(r))return;let l=[...t,i];if(r.type===x.Fragment){a.push.apply(a,hx(r.props.children,l));return}cn(r.type===At,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),cn(!r.props.index||!r.props.children,"An index route cannot have child routes.");let d={id:r.props.id||l.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(d.children=hx(r.props.children,l)),a.push(d)}),a}var af="get",rf="application/x-www-form-urlencoded";function Gf(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function lA(e){return Gf(e)&&e.tagName.toLowerCase()==="button"}function cA(e){return Gf(e)&&e.tagName.toLowerCase()==="form"}function uA(e){return Gf(e)&&e.tagName.toLowerCase()==="input"}function dA(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function fA(e,t){return e.button===0&&(!t||t==="_self")&&!dA(e)}function xx(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,a)=>{let r=e[a];return t.concat(Array.isArray(r)?r.map(i=>[a,i]):[[a,r]])},[]))}function pA(e,t){let a=xx(e);return t&&t.forEach((r,i)=>{a.has(i)||t.getAll(i).forEach(l=>{a.append(i,l)})}),a}var Rd=null;function mA(){if(Rd===null)try{new FormData(document.createElement("form"),0),Rd=!1}catch{Rd=!0}return Rd}var gA=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Jg(e){return e!=null&&!gA.has(e)?(Fs(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${rf}"`),null):e}function hA(e,t){let a,r,i,l,d;if(cA(e)){let f=e.getAttribute("action");r=f?rr(f,t):null,a=e.getAttribute("method")||af,i=Jg(e.getAttribute("enctype"))||rf,l=new FormData(e)}else if(lA(e)||uA(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=e.getAttribute("formaction")||f.getAttribute("action");if(r=p?rr(p,t):null,a=e.getAttribute("formmethod")||f.getAttribute("method")||af,i=Jg(e.getAttribute("formenctype"))||Jg(f.getAttribute("enctype"))||rf,l=new FormData(f,e),!mA()){let{name:g,type:h,value:b}=e;if(h==="image"){let _=g?`${g}.`:"";l.append(`${_}x`,"0"),l.append(`${_}y`,"0")}else g&&l.append(g,b)}}else{if(Gf(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');a=af,r=null,i=rf,d=e}return l&&i==="text/plain"&&(d=l,l=void 0),{action:r,method:a.toLowerCase(),encType:i,formData:l,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function kb(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function lS(e,t,a,r){let i=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return a?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname==="/"?i.pathname=`_root.${r}`:t&&rr(i.pathname,t)==="/"?i.pathname=`${hf(t)}/_root.${r}`:i.pathname=`${hf(i.pathname)}.${r}`,i}async function xA(e,t){if(e.id in t)return t[e.id];try{let a=await import(e.module);return t[e.id]=a,a}catch(a){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(a),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function bA(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function _A(e,t,a){let r=await Promise.all(e.map(async i=>{let l=t.routes[i.route.id];if(l){let d=await xA(l,a);return d.links?d.links():[]}return[]}));return kA(r.flat(1).filter(bA).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function Dj(e,t,a,r,i,l){let d=(p,g)=>a[g]?p.route.id!==a[g].route.id:!0,f=(p,g)=>a[g].pathname!==p.pathname||a[g].route.path?.endsWith("*")&&a[g].params["*"]!==p.params["*"];return l==="assets"?t.filter((p,g)=>d(p,g)||f(p,g)):l==="data"?t.filter((p,g)=>{let h=r.routes[p.route.id];if(!h||!h.hasLoader)return!1;if(d(p,g)||f(p,g))return!0;if(p.route.shouldRevalidate){let b=p.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:a[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function vA(e,t,{includeHydrateFallback:a}={}){return yA(e.map(r=>{let i=t.routes[r.route.id];if(!i)return[];let l=[i.module];return i.clientActionModule&&(l=l.concat(i.clientActionModule)),i.clientLoaderModule&&(l=l.concat(i.clientLoaderModule)),a&&i.hydrateFallbackModule&&(l=l.concat(i.hydrateFallbackModule)),i.imports&&(l=l.concat(i.imports)),l}).flat(1))}function yA(e){return[...new Set(e)]}function jA(e){let t={},a=Object.keys(e).sort();for(let r of a)t[r]=e[r];return t}function kA(e,t){let a=new Set;return new Set(t),e.reduce((r,i)=>{let l=JSON.stringify(jA(i));return a.has(l)||(a.add(l),r.push({key:l,link:i})),r},[])}function wb(){let e=x.useContext(ml);return kb(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function wA(){let e=x.useContext(Ff);return kb(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Sb=x.createContext(void 0);Sb.displayName="FrameworkContext";function Yf(){let e=x.useContext(Sb);return kb(e,"You must render this element inside a <HydratedRouter> element"),e}function SA(e,t){let a=x.useContext(Sb),[r,i]=x.useState(!1),[l,d]=x.useState(!1),{onFocus:f,onBlur:p,onMouseEnter:g,onMouseLeave:h,onTouchStart:b}=t,_=x.useRef(null);x.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let j=C=>{C.forEach(w=>{d(w.isIntersecting)})},k=new IntersectionObserver(j,{threshold:.5});return _.current&&k.observe(_.current),()=>{k.disconnect()}}},[e]),x.useEffect(()=>{if(r){let j=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(j)}}},[r]);let y=()=>{i(!0)},S=()=>{i(!1),d(!1)};return a?e!=="intent"?[l,_,{}]:[l,_,{onFocus:fc(f,y),onBlur:fc(p,S),onMouseEnter:fc(g,y),onMouseLeave:fc(h,S),onTouchStart:fc(b,y)}]:[!1,_,{}]}function fc(e,t){return a=>{e&&e(a),a.defaultPrevented||t(a)}}function CA({page:e,...t}){let a=I3(),{nonce:r}=Yf(),{router:i}=wb(),l=x.useMemo(()=>H2(i.routes,e,i.basename),[i.routes,e,i.basename]);return l?(t.nonce==null&&r&&(t={...t,nonce:r}),a?x.createElement(EA,{page:e,matches:l,...t}):x.createElement(RA,{page:e,matches:l,...t})):null}function NA(e){let{manifest:t,routeModules:a}=Yf(),[r,i]=x.useState([]);return x.useEffect(()=>{let l=!1;return _A(e,t,a).then(d=>{l||i(d)}),()=>{l=!0}},[e,t,a]),r}function EA({page:e,matches:t,...a}){let r=ns(),{future:i}=Yf(),{basename:l}=wb(),d=x.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let f=lS(e,l,i.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,g=[];for(let h of t)typeof h.route.shouldRevalidate=="function"?p=!0:g.push(h.route.id);return p&&g.length>0&&f.searchParams.set("_routes",g.join(",")),[f.pathname+f.search]},[l,i.v8_trailingSlashAwareDataRequests,e,r,t]);return x.createElement(x.Fragment,null,d.map(f=>x.createElement("link",{key:f,rel:"prefetch",as:"fetch",href:f,...a})))}function RA({page:e,matches:t,...a}){let r=ns(),{future:i,manifest:l,routeModules:d}=Yf(),{basename:f}=wb(),{loaderData:p,matches:g}=wA(),h=x.useMemo(()=>Dj(e,t,g,l,r,"data"),[e,t,g,l,r]),b=x.useMemo(()=>Dj(e,t,g,l,r,"assets"),[e,t,g,l,r]),_=x.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let j=new Set,k=!1;if(t.forEach(w=>{let E=l.routes[w.route.id];!E||!E.hasLoader||(!h.some(R=>R.route.id===w.route.id)&&w.route.id in p&&d[w.route.id]?.shouldRevalidate||E.hasClientLoader?k=!0:j.add(w.route.id))}),j.size===0)return[];let C=lS(e,f,i.v8_trailingSlashAwareDataRequests,"data");return k&&j.size>0&&C.searchParams.set("_routes",t.filter(w=>j.has(w.route.id)).map(w=>w.route.id).join(",")),[C.pathname+C.search]},[f,i.v8_trailingSlashAwareDataRequests,p,r,l,h,t,e,d]),y=x.useMemo(()=>vA(b,l),[b,l]),S=NA(b);return x.createElement(x.Fragment,null,_.map(j=>x.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...a})),y.map(j=>x.createElement("link",{key:j,rel:"modulepreload",href:j,...a})),S.map(({key:j,link:k})=>x.createElement("link",{key:j,nonce:a.nonce,...k,crossOrigin:k.crossOrigin??a.crossOrigin})))}function TA(...e){return t=>{e.forEach(a=>{typeof a=="function"?a(t):a!=null&&(a.current=t)})}}var AA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{AA&&(window.__reactRouterVersion="7.18.2")}catch{}function MA({basename:e,children:t,useTransitions:a,window:r}){let i=x.useRef();i.current==null&&(i.current=u3({window:r,v5Compat:!0}));let l=i.current,[d,f]=x.useState({action:l.action,location:l.location}),p=x.useCallback(g=>{a===!1?f(g):x.startTransition(()=>f(g))},[a]);return x.useLayoutEffect(()=>l.listen(p),[l,p]),x.createElement(iA,{basename:e,children:t,location:d.location,navigationType:d.action,navigator:l,useTransitions:a})}var Kf=x.forwardRef(function({onClick:t,discover:a="render",prefetch:r="none",relative:i,reloadDocument:l,replace:d,mask:f,state:p,target:g,to:h,preventScrollReset:b,viewTransition:_,defaultShouldRevalidate:y,...S},j){let{basename:k,navigator:C,useTransitions:w}=x.useContext(Es),E=typeof h=="string"&&bb.test(h),R=Q2(h,k);h=R.to;let T=F3(h,{relative:i}),A=ns(),z=null;if(f){let Y=Vf(f,[],A.mask?A.mask.pathname:"/",!0);k!=="/"&&(Y.pathname=Y.pathname==="/"?k:ea([k,Y.pathname])),z=C.createHref(Y)}let[M,D,L]=SA(r,S),I=DA(h,{replace:d,mask:f,state:p,target:g,preventScrollReset:b,relative:i,viewTransition:_,defaultShouldRevalidate:y,useTransitions:w});function P(Y){t&&t(Y),Y.defaultPrevented||I(Y)}let B=!(R.isExternal||l),q=x.createElement("a",{...S,...L,href:(B?z:void 0)||R.absoluteURL||T,onClick:B?P:t,ref:TA(j,D),target:g,"data-discover":!E&&a==="render"?"true":void 0});return M&&!E?x.createElement(x.Fragment,null,q,x.createElement(CA,{page:T})):q});Kf.displayName="Link";var xf=x.forwardRef(function({"aria-current":t="page",caseSensitive:a=!1,className:r="",end:i=!1,style:l,to:d,viewTransition:f,children:p,...g},h){let b=eu(d,{relative:g.relative}),_=ns(),y=x.useContext(Ff),{navigator:S,basename:j}=x.useContext(Es),k=y!=null&&BA(b)&&f===!0,C=S.encodeLocation?S.encodeLocation(b).pathname:b.pathname,w=_.pathname,E=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;a||(w=w.toLowerCase(),E=E?E.toLowerCase():null,C=C.toLowerCase()),E&&j&&(E=rr(E,j)||E);const R=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let T=w===C||!i&&w.startsWith(C)&&w.charAt(R)==="/",A=E!=null&&(E===C||!i&&E.startsWith(C)&&E.charAt(C.length)==="/"),z={isActive:T,isPending:A,isTransitioning:k},M=T?t:void 0,D;typeof r=="function"?D=r(z):D=[r,T?"active":null,A?"pending":null,k?"transitioning":null].filter(Boolean).join(" ");let L=typeof l=="function"?l(z):l;return x.createElement(Kf,{...g,"aria-current":M,className:D,ref:h,style:L,to:d,viewTransition:f},typeof p=="function"?p(z):p)});xf.displayName="NavLink";var zA=x.forwardRef(({discover:e="render",fetcherKey:t,navigate:a,reloadDocument:r,replace:i,state:l,method:d=af,action:f,onSubmit:p,relative:g,preventScrollReset:h,viewTransition:b,defaultShouldRevalidate:_,...y},S)=>{let{useTransitions:j}=x.useContext(Es),k=IA(),C=$A(f,{relative:g}),w=d.toLowerCase()==="get"?"get":"post",E=typeof f=="string"&&bb.test(f),R=T=>{if(p&&p(T),T.defaultPrevented)return;T.preventDefault();let A=T.nativeEvent.submitter,z=A?.getAttribute("formmethod")||d,M=()=>k(A||T.currentTarget,{fetcherKey:t,method:z,navigate:a,replace:i,state:l,relative:g,preventScrollReset:h,viewTransition:b,defaultShouldRevalidate:_});j&&a!==!1?x.startTransition(()=>M()):M()};return x.createElement("form",{ref:S,method:w,action:C,onSubmit:r?p:R,...y,"data-discover":!E&&e==="render"?"true":void 0})});zA.displayName="Form";function OA(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function cS(e){let t=x.useContext(ml);return cn(t,OA(e)),t}function DA(e,{target:t,replace:a,mask:r,state:i,preventScrollReset:l,relative:d,viewTransition:f,defaultShouldRevalidate:p,useTransitions:g}={}){let h=Sn(),b=ns(),_=eu(e,{relative:d});return x.useCallback(y=>{if(fA(y,t)){y.preventDefault();let S=a!==void 0?a:Ic(b)===Ic(_),j=()=>h(e,{replace:S,mask:r,state:i,preventScrollReset:l,relative:d,viewTransition:f,defaultShouldRevalidate:p});g?x.startTransition(()=>j()):j()}},[b,h,_,a,r,i,t,e,l,d,f,p,g])}function Vo(e){Fs(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=x.useRef(xx(e)),a=x.useRef(!1),r=ns(),i=x.useMemo(()=>pA(r.search,a.current?null:t.current),[r.search]),l=Sn(),d=x.useCallback((f,p)=>{const g=xx(typeof f=="function"?f(new URLSearchParams(i)):f);a.current=!0,l("?"+g,p)},[l,i]);return[i,d]}var PA=0,LA=()=>`__${String(++PA)}__`;function IA(){let{router:e}=cS("useSubmit"),{basename:t}=x.useContext(Es),a=nA(),r=e.fetch,i=e.navigate;return x.useCallback(async(l,d={})=>{let{action:f,method:p,encType:g,formData:h,body:b}=hA(l,t);if(d.navigate===!1){let _=d.fetcherKey||LA();await r(_,a,d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:h,body:b,formMethod:d.method||p,formEncType:d.encType||g,flushSync:d.flushSync})}else await i(d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:h,body:b,formMethod:d.method||p,formEncType:d.encType||g,replace:d.replace,state:d.state,fromRouteId:a,flushSync:d.flushSync,viewTransition:d.viewTransition})},[r,i,t,a])}function $A(e,{relative:t}={}){let{basename:a}=x.useContext(Es),r=x.useContext(na);cn(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),l={...eu(e||".",{relative:t})},d=ns();if(e==null){l.search=d.search;let f=new URLSearchParams(l.search),p=f.getAll("index");if(p.some(h=>h==="")){f.delete("index"),p.filter(b=>b).forEach(b=>f.append("index",b));let h=f.toString();l.search=h?`?${h}`:""}}return(!e||e===".")&&i.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),a!=="/"&&(l.pathname=l.pathname==="/"?a:ea([a,l.pathname])),Ic(l)}function BA(e,{relative:t}={}){let a=x.useContext(J2);cn(a!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=cS("useViewTransitionState"),i=eu(e,{relative:t});if(!a.isTransitioning)return!1;let l=rr(a.currentLocation.pathname,r)||a.currentLocation.pathname,d=rr(a.nextLocation.pathname,r)||a.nextLocation.pathname;return gf(i.pathname,d)!=null||gf(i.pathname,l)!=null}var Gs=U2();/**
61
+ * @license lucide-react v0.469.0 - ISC
62
+ *
63
+ * This source code is licensed under the ISC license.
64
+ * See the LICENSE file in the root directory of this source tree.
65
+ */const UA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),uS=(...e)=>e.filter((t,a,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===a).join(" ").trim();/**
66
+ * @license lucide-react v0.469.0 - ISC
67
+ *
68
+ * This source code is licensed under the ISC license.
69
+ * See the LICENSE file in the root directory of this source tree.
70
+ */var qA={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
71
+ * @license lucide-react v0.469.0 - ISC
72
+ *
73
+ * This source code is licensed under the ISC license.
74
+ * See the LICENSE file in the root directory of this source tree.
75
+ */const HA=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:r,className:i="",children:l,iconNode:d,...f},p)=>x.createElement("svg",{ref:p,...qA,width:t,height:t,stroke:e,strokeWidth:r?Number(a)*24/Number(t):a,className:uS("lucide",i),...f},[...d.map(([g,h])=>x.createElement(g,h)),...Array.isArray(l)?l:[l]]));/**
76
+ * @license lucide-react v0.469.0 - ISC
77
+ *
78
+ * This source code is licensed under the ISC license.
79
+ * See the LICENSE file in the root directory of this source tree.
80
+ */const xe=(e,t)=>{const a=x.forwardRef(({className:r,...i},l)=>x.createElement(HA,{ref:l,iconNode:t,className:uS(`lucide-${UA(e)}`,r),...i}));return a.displayName=`${e}`,a};/**
81
+ * @license lucide-react v0.469.0 - ISC
82
+ *
83
+ * This source code is licensed under the ISC license.
84
+ * See the LICENSE file in the root directory of this source tree.
85
+ */const Xf=xe("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
86
+ * @license lucide-react v0.469.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ */const dS=xe("ArrowDownLeft",[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]);/**
91
+ * @license lucide-react v0.469.0 - ISC
92
+ *
93
+ * This source code is licensed under the ISC license.
94
+ * See the LICENSE file in the root directory of this source tree.
95
+ */const VA=xe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
96
+ * @license lucide-react v0.469.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */const fS=xe("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
101
+ * @license lucide-react v0.469.0 - ISC
102
+ *
103
+ * This source code is licensed under the ISC license.
104
+ * See the LICENSE file in the root directory of this source tree.
105
+ */const Cb=xe("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
106
+ * @license lucide-react v0.469.0 - ISC
107
+ *
108
+ * This source code is licensed under the ISC license.
109
+ * See the LICENSE file in the root directory of this source tree.
110
+ */const FA=xe("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
111
+ * @license lucide-react v0.469.0 - ISC
112
+ *
113
+ * This source code is licensed under the ISC license.
114
+ * See the LICENSE file in the root directory of this source tree.
115
+ */const GA=xe("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
116
+ * @license lucide-react v0.469.0 - ISC
117
+ *
118
+ * This source code is licensed under the ISC license.
119
+ * See the LICENSE file in the root directory of this source tree.
120
+ */const YA=xe("BellRing",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]]);/**
121
+ * @license lucide-react v0.469.0 - ISC
122
+ *
123
+ * This source code is licensed under the ISC license.
124
+ * See the LICENSE file in the root directory of this source tree.
125
+ */const KA=xe("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
126
+ * @license lucide-react v0.469.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ */const rn=xe("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
131
+ * @license lucide-react v0.469.0 - ISC
132
+ *
133
+ * This source code is licensed under the ISC license.
134
+ * See the LICENSE file in the root directory of this source tree.
135
+ */const XA=xe("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
136
+ * @license lucide-react v0.469.0 - ISC
137
+ *
138
+ * This source code is licensed under the ISC license.
139
+ * See the LICENSE file in the root directory of this source tree.
140
+ */const QA=xe("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);/**
141
+ * @license lucide-react v0.469.0 - ISC
142
+ *
143
+ * This source code is licensed under the ISC license.
144
+ * See the LICENSE file in the root directory of this source tree.
145
+ */const $c=xe("Brain",[["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:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["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:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
146
+ * @license lucide-react v0.469.0 - ISC
147
+ *
148
+ * This source code is licensed under the ISC license.
149
+ * See the LICENSE file in the root directory of this source tree.
150
+ */const Nb=xe("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/**
151
+ * @license lucide-react v0.469.0 - ISC
152
+ *
153
+ * This source code is licensed under the ISC license.
154
+ * See the LICENSE file in the root directory of this source tree.
155
+ */const WA=xe("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
156
+ * @license lucide-react v0.469.0 - ISC
157
+ *
158
+ * This source code is licensed under the ISC license.
159
+ * See the LICENSE file in the root directory of this source tree.
160
+ */const ZA=xe("Cable",[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]]);/**
161
+ * @license lucide-react v0.469.0 - ISC
162
+ *
163
+ * This source code is licensed under the ISC license.
164
+ * See the LICENSE file in the root directory of this source tree.
165
+ */const Xr=xe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
166
+ * @license lucide-react v0.469.0 - ISC
167
+ *
168
+ * This source code is licensed under the ISC license.
169
+ * See the LICENSE file in the root directory of this source tree.
170
+ */const ms=xe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
171
+ * @license lucide-react v0.469.0 - ISC
172
+ *
173
+ * This source code is licensed under the ISC license.
174
+ * See the LICENSE file in the root directory of this source tree.
175
+ */const JA=xe("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
176
+ * @license lucide-react v0.469.0 - ISC
177
+ *
178
+ * This source code is licensed under the ISC license.
179
+ * See the LICENSE file in the root directory of this source tree.
180
+ */const eo=xe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
181
+ * @license lucide-react v0.469.0 - ISC
182
+ *
183
+ * This source code is licensed under the ISC license.
184
+ * See the LICENSE file in the root directory of this source tree.
185
+ */const Eb=xe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
186
+ * @license lucide-react v0.469.0 - ISC
187
+ *
188
+ * This source code is licensed under the ISC license.
189
+ * See the LICENSE file in the root directory of this source tree.
190
+ */const eM=xe("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
191
+ * @license lucide-react v0.469.0 - ISC
192
+ *
193
+ * This source code is licensed under the ISC license.
194
+ * See the LICENSE file in the root directory of this source tree.
195
+ */const tM=xe("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
196
+ * @license lucide-react v0.469.0 - ISC
197
+ *
198
+ * This source code is licensed under the ISC license.
199
+ * See the LICENSE file in the root directory of this source tree.
200
+ */const Qf=xe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
201
+ * @license lucide-react v0.469.0 - ISC
202
+ *
203
+ * This source code is licensed under the ISC license.
204
+ * See the LICENSE file in the root directory of this source tree.
205
+ */const nM=xe("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
206
+ * @license lucide-react v0.469.0 - ISC
207
+ *
208
+ * This source code is licensed under the ISC license.
209
+ * See the LICENSE file in the root directory of this source tree.
210
+ */const sM=xe("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"}]]);/**
211
+ * @license lucide-react v0.469.0 - ISC
212
+ *
213
+ * This source code is licensed under the ISC license.
214
+ * See the LICENSE file in the root directory of this source tree.
215
+ */const pS=xe("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
216
+ * @license lucide-react v0.469.0 - ISC
217
+ *
218
+ * This source code is licensed under the ISC license.
219
+ * See the LICENSE file in the root directory of this source tree.
220
+ */const aM=xe("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
221
+ * @license lucide-react v0.469.0 - ISC
222
+ *
223
+ * This source code is licensed under the ISC license.
224
+ * See the LICENSE file in the root directory of this source tree.
225
+ */const Rb=xe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
226
+ * @license lucide-react v0.469.0 - ISC
227
+ *
228
+ * This source code is licensed under the ISC license.
229
+ * See the LICENSE file in the root directory of this source tree.
230
+ */const rM=xe("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
231
+ * @license lucide-react v0.469.0 - ISC
232
+ *
233
+ * This source code is licensed under the ISC license.
234
+ * See the LICENSE file in the root directory of this source tree.
235
+ */const mS=xe("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
236
+ * @license lucide-react v0.469.0 - ISC
237
+ *
238
+ * This source code is licensed under the ISC license.
239
+ * See the LICENSE file in the root directory of this source tree.
240
+ */const oM=xe("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/**
241
+ * @license lucide-react v0.469.0 - ISC
242
+ *
243
+ * This source code is licensed under the ISC license.
244
+ * See the LICENSE file in the root directory of this source tree.
245
+ */const iM=xe("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/**
246
+ * @license lucide-react v0.469.0 - ISC
247
+ *
248
+ * This source code is licensed under the ISC license.
249
+ * See the LICENSE file in the root directory of this source tree.
250
+ */const zo=xe("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
251
+ * @license lucide-react v0.469.0 - ISC
252
+ *
253
+ * This source code is licensed under the ISC license.
254
+ * See the LICENSE file in the root directory of this source tree.
255
+ */const lM=xe("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
256
+ * @license lucide-react v0.469.0 - ISC
257
+ *
258
+ * This source code is licensed under the ISC license.
259
+ * See the LICENSE file in the root directory of this source tree.
260
+ */const cM=xe("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/**
261
+ * @license lucide-react v0.469.0 - ISC
262
+ *
263
+ * This source code is licensed under the ISC license.
264
+ * See the LICENSE file in the root directory of this source tree.
265
+ */const Tb=xe("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
266
+ * @license lucide-react v0.469.0 - ISC
267
+ *
268
+ * This source code is licensed under the ISC license.
269
+ * See the LICENSE file in the root directory of this source tree.
270
+ */const va=xe("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
271
+ * @license lucide-react v0.469.0 - ISC
272
+ *
273
+ * This source code is licensed under the ISC license.
274
+ * See the LICENSE file in the root directory of this source tree.
275
+ */const gS=xe("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
276
+ * @license lucide-react v0.469.0 - ISC
277
+ *
278
+ * This source code is licensed under the ISC license.
279
+ * See the LICENSE file in the root directory of this source tree.
280
+ */const uM=xe("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
281
+ * @license lucide-react v0.469.0 - ISC
282
+ *
283
+ * This source code is licensed under the ISC license.
284
+ * See the LICENSE file in the root directory of this source tree.
285
+ */const dM=xe("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/**
286
+ * @license lucide-react v0.469.0 - ISC
287
+ *
288
+ * This source code is licensed under the ISC license.
289
+ * See the LICENSE file in the root directory of this source tree.
290
+ */const Ab=xe("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
291
+ * @license lucide-react v0.469.0 - ISC
292
+ *
293
+ * This source code is licensed under the ISC license.
294
+ * See the LICENSE file in the root directory of this source tree.
295
+ */const Mb=xe("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
296
+ * @license lucide-react v0.469.0 - ISC
297
+ *
298
+ * This source code is licensed under the ISC license.
299
+ * See the LICENSE file in the root directory of this source tree.
300
+ */const Fo=xe("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
301
+ * @license lucide-react v0.469.0 - ISC
302
+ *
303
+ * This source code is licensed under the ISC license.
304
+ * See the LICENSE file in the root directory of this source tree.
305
+ */const zb=xe("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/**
306
+ * @license lucide-react v0.469.0 - ISC
307
+ *
308
+ * This source code is licensed under the ISC license.
309
+ * See the LICENSE file in the root directory of this source tree.
310
+ */const fM=xe("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/**
311
+ * @license lucide-react v0.469.0 - ISC
312
+ *
313
+ * This source code is licensed under the ISC license.
314
+ * See the LICENSE file in the root directory of this source tree.
315
+ */const bf=xe("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/**
316
+ * @license lucide-react v0.469.0 - ISC
317
+ *
318
+ * This source code is licensed under the ISC license.
319
+ * See the LICENSE file in the root directory of this source tree.
320
+ */const bx=xe("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);/**
321
+ * @license lucide-react v0.469.0 - ISC
322
+ *
323
+ * This source code is licensed under the ISC license.
324
+ * See the LICENSE file in the root directory of this source tree.
325
+ */const pM=xe("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/**
326
+ * @license lucide-react v0.469.0 - ISC
327
+ *
328
+ * This source code is licensed under the ISC license.
329
+ * See the LICENSE file in the root directory of this source tree.
330
+ */const mM=xe("FileQuestion",[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);/**
331
+ * @license lucide-react v0.469.0 - ISC
332
+ *
333
+ * This source code is licensed under the ISC license.
334
+ * See the LICENSE file in the root directory of this source tree.
335
+ */const Wf=xe("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
336
+ * @license lucide-react v0.469.0 - ISC
337
+ *
338
+ * This source code is licensed under the ISC license.
339
+ * See the LICENSE file in the root directory of this source tree.
340
+ */const gM=xe("FileX2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 12.5-5 5",key:"b853mi"}],["path",{d:"m3 12.5 5 5",key:"1qls4r"}]]);/**
341
+ * @license lucide-react v0.469.0 - ISC
342
+ *
343
+ * This source code is licensed under the ISC license.
344
+ * See the LICENSE file in the root directory of this source tree.
345
+ */const hS=xe("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
346
+ * @license lucide-react v0.469.0 - ISC
347
+ *
348
+ * This source code is licensed under the ISC license.
349
+ * See the LICENSE file in the root directory of this source tree.
350
+ */const _x=xe("FlaskConical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);/**
351
+ * @license lucide-react v0.469.0 - ISC
352
+ *
353
+ * This source code is licensed under the ISC license.
354
+ * See the LICENSE file in the root directory of this source tree.
355
+ */const hM=xe("FolderGit2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);/**
356
+ * @license lucide-react v0.469.0 - ISC
357
+ *
358
+ * This source code is licensed under the ISC license.
359
+ * See the LICENSE file in the root directory of this source tree.
360
+ */const xS=xe("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/**
361
+ * @license lucide-react v0.469.0 - ISC
362
+ *
363
+ * This source code is licensed under the ISC license.
364
+ * See the LICENSE file in the root directory of this source tree.
365
+ */const Go=xe("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
366
+ * @license lucide-react v0.469.0 - ISC
367
+ *
368
+ * This source code is licensed under the ISC license.
369
+ * See the LICENSE file in the root directory of this source tree.
370
+ */const Ob=xe("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/**
371
+ * @license lucide-react v0.469.0 - ISC
372
+ *
373
+ * This source code is licensed under the ISC license.
374
+ * See the LICENSE file in the root directory of this source tree.
375
+ */const bS=xe("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"}]]);/**
376
+ * @license lucide-react v0.469.0 - ISC
377
+ *
378
+ * This source code is licensed under the ISC license.
379
+ * See the LICENSE file in the root directory of this source tree.
380
+ */const xM=xe("Folders",[["path",{d:"M20 17a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.9a2 2 0 0 1-1.69-.9l-.81-1.2a2 2 0 0 0-1.67-.9H8a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2Z",key:"4u7rpt"}],["path",{d:"M2 8v11a2 2 0 0 0 2 2h14",key:"1eicx1"}]]);/**
381
+ * @license lucide-react v0.469.0 - ISC
382
+ *
383
+ * This source code is licensed under the ISC license.
384
+ * See the LICENSE file in the root directory of this source tree.
385
+ */const bM=xe("Frame",[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]]);/**
386
+ * @license lucide-react v0.469.0 - ISC
387
+ *
388
+ * This source code is licensed under the ISC license.
389
+ * See the LICENSE file in the root directory of this source tree.
390
+ */const Zf=xe("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
391
+ * @license lucide-react v0.469.0 - ISC
392
+ *
393
+ * This source code is licensed under the ISC license.
394
+ * See the LICENSE file in the root directory of this source tree.
395
+ */const _M=xe("Gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]]);/**
396
+ * @license lucide-react v0.469.0 - ISC
397
+ *
398
+ * This source code is licensed under the ISC license.
399
+ * See the LICENSE file in the root directory of this source tree.
400
+ */const tu=xe("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"}]]);/**
401
+ * @license lucide-react v0.469.0 - ISC
402
+ *
403
+ * This source code is licensed under the ISC license.
404
+ * See the LICENSE file in the root directory of this source tree.
405
+ */const vM=xe("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);/**
406
+ * @license lucide-react v0.469.0 - ISC
407
+ *
408
+ * This source code is licensed under the ISC license.
409
+ * See the LICENSE file in the root directory of this source tree.
410
+ */const _S=xe("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/**
411
+ * @license lucide-react v0.469.0 - ISC
412
+ *
413
+ * This source code is licensed under the ISC license.
414
+ * See the LICENSE file in the root directory of this source tree.
415
+ */const vS=xe("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
416
+ * @license lucide-react v0.469.0 - ISC
417
+ *
418
+ * This source code is licensed under the ISC license.
419
+ * See the LICENSE file in the root directory of this source tree.
420
+ */const yM=xe("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/**
421
+ * @license lucide-react v0.469.0 - ISC
422
+ *
423
+ * This source code is licensed under the ISC license.
424
+ * See the LICENSE file in the root directory of this source tree.
425
+ */const jM=xe("Handshake",[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]]);/**
426
+ * @license lucide-react v0.469.0 - ISC
427
+ *
428
+ * This source code is licensed under the ISC license.
429
+ * See the LICENSE file in the root directory of this source tree.
430
+ */const kM=xe("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"}]]);/**
431
+ * @license lucide-react v0.469.0 - ISC
432
+ *
433
+ * This source code is licensed under the ISC license.
434
+ * See the LICENSE file in the root directory of this source tree.
435
+ */const Do=xe("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"}]]);/**
436
+ * @license lucide-react v0.469.0 - ISC
437
+ *
438
+ * This source code is licensed under the ISC license.
439
+ * See the LICENSE file in the root directory of this source tree.
440
+ */const wM=xe("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
441
+ * @license lucide-react v0.469.0 - ISC
442
+ *
443
+ * This source code is licensed under the ISC license.
444
+ * See the LICENSE file in the root directory of this source tree.
445
+ */const yS=xe("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"}]]);/**
446
+ * @license lucide-react v0.469.0 - ISC
447
+ *
448
+ * This source code is licensed under the ISC license.
449
+ * See the LICENSE file in the root directory of this source tree.
450
+ */const SM=xe("IdCard",[["path",{d:"M16 10h2",key:"8sgtl7"}],["path",{d:"M16 14h2",key:"epxaof"}],["path",{d:"M6.17 15a3 3 0 0 1 5.66 0",key:"n6f512"}],["circle",{cx:"9",cy:"11",r:"2",key:"yxgjnd"}],["rect",{x:"2",y:"5",width:"20",height:"14",rx:"2",key:"qneu4z"}]]);/**
451
+ * @license lucide-react v0.469.0 - ISC
452
+ *
453
+ * This source code is licensed under the ISC license.
454
+ * See the LICENSE file in the root directory of this source tree.
455
+ */const vx=xe("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"}]]);/**
456
+ * @license lucide-react v0.469.0 - ISC
457
+ *
458
+ * This source code is licensed under the ISC license.
459
+ * See the LICENSE file in the root directory of this source tree.
460
+ */const Jf=xe("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
461
+ * @license lucide-react v0.469.0 - ISC
462
+ *
463
+ * This source code is licensed under the ISC license.
464
+ * See the LICENSE file in the root directory of this source tree.
465
+ */const jS=xe("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
466
+ * @license lucide-react v0.469.0 - ISC
467
+ *
468
+ * This source code is licensed under the ISC license.
469
+ * See the LICENSE file in the root directory of this source tree.
470
+ */const CM=xe("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/**
471
+ * @license lucide-react v0.469.0 - ISC
472
+ *
473
+ * This source code is licensed under the ISC license.
474
+ * See the LICENSE file in the root directory of this source tree.
475
+ */const NM=xe("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
476
+ * @license lucide-react v0.469.0 - ISC
477
+ *
478
+ * This source code is licensed under the ISC license.
479
+ * See the LICENSE file in the root directory of this source tree.
480
+ */const EM=xe("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"}]]);/**
481
+ * @license lucide-react v0.469.0 - ISC
482
+ *
483
+ * This source code is licensed under the ISC license.
484
+ * See the LICENSE file in the root directory of this source tree.
485
+ */const RM=xe("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
486
+ * @license lucide-react v0.469.0 - ISC
487
+ *
488
+ * This source code is licensed under the ISC license.
489
+ * See the LICENSE file in the root directory of this source tree.
490
+ */const TM=xe("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
491
+ * @license lucide-react v0.469.0 - ISC
492
+ *
493
+ * This source code is licensed under the ISC license.
494
+ * See the LICENSE file in the root directory of this source tree.
495
+ */const Js=xe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
496
+ * @license lucide-react v0.469.0 - ISC
497
+ *
498
+ * This source code is licensed under the ISC license.
499
+ * See the LICENSE file in the root directory of this source tree.
500
+ */const kS=xe("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
501
+ * @license lucide-react v0.469.0 - ISC
502
+ *
503
+ * This source code is licensed under the ISC license.
504
+ * See the LICENSE file in the root directory of this source tree.
505
+ */const AM=xe("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
506
+ * @license lucide-react v0.469.0 - ISC
507
+ *
508
+ * This source code is licensed under the ISC license.
509
+ * See the LICENSE file in the root directory of this source tree.
510
+ */const wS=xe("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["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"}]]);/**
511
+ * @license lucide-react v0.469.0 - ISC
512
+ *
513
+ * This source code is licensed under the ISC license.
514
+ * See the LICENSE file in the root directory of this source tree.
515
+ */const Db=xe("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
516
+ * @license lucide-react v0.469.0 - ISC
517
+ *
518
+ * This source code is licensed under the ISC license.
519
+ * See the LICENSE file in the root directory of this source tree.
520
+ */const nu=xe("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/**
521
+ * @license lucide-react v0.469.0 - ISC
522
+ *
523
+ * This source code is licensed under the ISC license.
524
+ * See the LICENSE file in the root directory of this source tree.
525
+ */const Pb=xe("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
526
+ * @license lucide-react v0.469.0 - ISC
527
+ *
528
+ * This source code is licensed under the ISC license.
529
+ * See the LICENSE file in the root directory of this source tree.
530
+ */const MM=xe("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
531
+ * @license lucide-react v0.469.0 - ISC
532
+ *
533
+ * This source code is licensed under the ISC license.
534
+ * See the LICENSE file in the root directory of this source tree.
535
+ */const zM=xe("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
536
+ * @license lucide-react v0.469.0 - ISC
537
+ *
538
+ * This source code is licensed under the ISC license.
539
+ * See the LICENSE file in the root directory of this source tree.
540
+ */const Lb=xe("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
541
+ * @license lucide-react v0.469.0 - ISC
542
+ *
543
+ * This source code is licensed under the ISC license.
544
+ * See the LICENSE file in the root directory of this source tree.
545
+ */const OM=xe("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
546
+ * @license lucide-react v0.469.0 - ISC
547
+ *
548
+ * This source code is licensed under the ISC license.
549
+ * See the LICENSE file in the root directory of this source tree.
550
+ */const DM=xe("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/**
551
+ * @license lucide-react v0.469.0 - ISC
552
+ *
553
+ * This source code is licensed under the ISC license.
554
+ * See the LICENSE file in the root directory of this source tree.
555
+ */const PM=xe("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]]);/**
556
+ * @license lucide-react v0.469.0 - ISC
557
+ *
558
+ * This source code is licensed under the ISC license.
559
+ * See the LICENSE file in the root directory of this source tree.
560
+ */const LM=xe("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
561
+ * @license lucide-react v0.469.0 - ISC
562
+ *
563
+ * This source code is licensed under the ISC license.
564
+ * See the LICENSE file in the root directory of this source tree.
565
+ */const SS=xe("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
566
+ * @license lucide-react v0.469.0 - ISC
567
+ *
568
+ * This source code is licensed under the ISC license.
569
+ * See the LICENSE file in the root directory of this source tree.
570
+ */const IM=xe("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
571
+ * @license lucide-react v0.469.0 - ISC
572
+ *
573
+ * This source code is licensed under the ISC license.
574
+ * See the LICENSE file in the root directory of this source tree.
575
+ */const $M=xe("PencilLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}],["path",{d:"m15 5 3 3",key:"1w25hb"}]]);/**
576
+ * @license lucide-react v0.469.0 - ISC
577
+ *
578
+ * This source code is licensed under the ISC license.
579
+ * See the LICENSE file in the root directory of this source tree.
580
+ */const wa=xe("Pencil",[["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"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
581
+ * @license lucide-react v0.469.0 - ISC
582
+ *
583
+ * This source code is licensed under the ISC license.
584
+ * See the LICENSE file in the root directory of this source tree.
585
+ */const Ib=xe("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
586
+ * @license lucide-react v0.469.0 - ISC
587
+ *
588
+ * This source code is licensed under the ISC license.
589
+ * See the LICENSE file in the root directory of this source tree.
590
+ */const BM=xe("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
591
+ * @license lucide-react v0.469.0 - ISC
592
+ *
593
+ * This source code is licensed under the ISC license.
594
+ * See the LICENSE file in the root directory of this source tree.
595
+ */const Ot=xe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
596
+ * @license lucide-react v0.469.0 - ISC
597
+ *
598
+ * This source code is licensed under the ISC license.
599
+ * See the LICENSE file in the root directory of this source tree.
600
+ */const ep=xe("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/**
601
+ * @license lucide-react v0.469.0 - ISC
602
+ *
603
+ * This source code is licensed under the ISC license.
604
+ * See the LICENSE file in the root directory of this source tree.
605
+ */const UM=xe("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"}]]);/**
606
+ * @license lucide-react v0.469.0 - ISC
607
+ *
608
+ * This source code is licensed under the ISC license.
609
+ * See the LICENSE file in the root directory of this source tree.
610
+ */const qM=xe("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/**
611
+ * @license lucide-react v0.469.0 - ISC
612
+ *
613
+ * This source code is licensed under the ISC license.
614
+ * See the LICENSE file in the root directory of this source tree.
615
+ */const Cs=xe("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
616
+ * @license lucide-react v0.469.0 - ISC
617
+ *
618
+ * This source code is licensed under the ISC license.
619
+ * See the LICENSE file in the root directory of this source tree.
620
+ */const hl=xe("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
621
+ * @license lucide-react v0.469.0 - ISC
622
+ *
623
+ * This source code is licensed under the ISC license.
624
+ * See the LICENSE file in the root directory of this source tree.
625
+ */const eh=xe("Route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);/**
626
+ * @license lucide-react v0.469.0 - ISC
627
+ *
628
+ * This source code is licensed under the ISC license.
629
+ * See the LICENSE file in the root directory of this source tree.
630
+ */const th=xe("Ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]);/**
631
+ * @license lucide-react v0.469.0 - ISC
632
+ *
633
+ * This source code is licensed under the ISC license.
634
+ * See the LICENSE file in the root directory of this source tree.
635
+ */const tp=xe("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
636
+ * @license lucide-react v0.469.0 - ISC
637
+ *
638
+ * This source code is licensed under the ISC license.
639
+ * See the LICENSE file in the root directory of this source tree.
640
+ */const $b=xe("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/**
641
+ * @license lucide-react v0.469.0 - ISC
642
+ *
643
+ * This source code is licensed under the ISC license.
644
+ * See the LICENSE file in the root directory of this source tree.
645
+ */const Oo=xe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
646
+ * @license lucide-react v0.469.0 - ISC
647
+ *
648
+ * This source code is licensed under the ISC license.
649
+ * See the LICENSE file in the root directory of this source tree.
650
+ */const Sa=xe("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
651
+ * @license lucide-react v0.469.0 - ISC
652
+ *
653
+ * This source code is licensed under the ISC license.
654
+ * See the LICENSE file in the root directory of this source tree.
655
+ */const CS=xe("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
656
+ * @license lucide-react v0.469.0 - ISC
657
+ *
658
+ * This source code is licensed under the ISC license.
659
+ * See the LICENSE file in the root directory of this source tree.
660
+ */const HM=xe("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
661
+ * @license lucide-react v0.469.0 - ISC
662
+ *
663
+ * This source code is licensed under the ISC license.
664
+ * See the LICENSE file in the root directory of this source tree.
665
+ */const np=xe("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
666
+ * @license lucide-react v0.469.0 - ISC
667
+ *
668
+ * This source code is licensed under the ISC license.
669
+ * See the LICENSE file in the root directory of this source tree.
670
+ */const VM=xe("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"}]]);/**
671
+ * @license lucide-react v0.469.0 - ISC
672
+ *
673
+ * This source code is licensed under the ISC license.
674
+ * See the LICENSE file in the root directory of this source tree.
675
+ */const FM=xe("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/**
676
+ * @license lucide-react v0.469.0 - ISC
677
+ *
678
+ * This source code is licensed under the ISC license.
679
+ * See the LICENSE file in the root directory of this source tree.
680
+ */const GM=xe("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
681
+ * @license lucide-react v0.469.0 - ISC
682
+ *
683
+ * This source code is licensed under the ISC license.
684
+ * See the LICENSE file in the root directory of this source tree.
685
+ */const sa=xe("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
686
+ * @license lucide-react v0.469.0 - ISC
687
+ *
688
+ * This source code is licensed under the ISC license.
689
+ * See the LICENSE file in the root directory of this source tree.
690
+ */const YM=xe("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
691
+ * @license lucide-react v0.469.0 - ISC
692
+ *
693
+ * This source code is licensed under the ISC license.
694
+ * See the LICENSE file in the root directory of this source tree.
695
+ */const Bb=xe("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
696
+ * @license lucide-react v0.469.0 - ISC
697
+ *
698
+ * This source code is licensed under the ISC license.
699
+ * See the LICENSE file in the root directory of this source tree.
700
+ */const KM=xe("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
701
+ * @license lucide-react v0.469.0 - ISC
702
+ *
703
+ * This source code is licensed under the ISC license.
704
+ * See the LICENSE file in the root directory of this source tree.
705
+ */const ya=xe("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
706
+ * @license lucide-react v0.469.0 - ISC
707
+ *
708
+ * This source code is licensed under the ISC license.
709
+ * See the LICENSE file in the root directory of this source tree.
710
+ */const XM=xe("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]]);/**
711
+ * @license lucide-react v0.469.0 - ISC
712
+ *
713
+ * This source code is licensed under the ISC license.
714
+ * See the LICENSE file in the root directory of this source tree.
715
+ */const QM=xe("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/**
716
+ * @license lucide-react v0.469.0 - ISC
717
+ *
718
+ * This source code is licensed under the ISC license.
719
+ * See the LICENSE file in the root directory of this source tree.
720
+ */const WM=xe("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
721
+ * @license lucide-react v0.469.0 - ISC
722
+ *
723
+ * This source code is licensed under the ISC license.
724
+ * See the LICENSE file in the root directory of this source tree.
725
+ */const _n=xe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
726
+ * @license lucide-react v0.469.0 - ISC
727
+ *
728
+ * This source code is licensed under the ISC license.
729
+ * See the LICENSE file in the root directory of this source tree.
730
+ */const Ub=xe("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
731
+ * @license lucide-react v0.469.0 - ISC
732
+ *
733
+ * This source code is licensed under the ISC license.
734
+ * See the LICENSE file in the root directory of this source tree.
735
+ */const NS=xe("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"}]]);/**
736
+ * @license lucide-react v0.469.0 - ISC
737
+ *
738
+ * This source code is licensed under the ISC license.
739
+ * See the LICENSE file in the root directory of this source tree.
740
+ */const qb=xe("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
741
+ * @license lucide-react v0.469.0 - ISC
742
+ *
743
+ * This source code is licensed under the ISC license.
744
+ * See the LICENSE file in the root directory of this source tree.
745
+ */const ZM=xe("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
746
+ * @license lucide-react v0.469.0 - ISC
747
+ *
748
+ * This source code is licensed under the ISC license.
749
+ * See the LICENSE file in the root directory of this source tree.
750
+ */const JM=xe("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
751
+ * @license lucide-react v0.469.0 - ISC
752
+ *
753
+ * This source code is licensed under the ISC license.
754
+ * See the LICENSE file in the root directory of this source tree.
755
+ */const e4=xe("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
756
+ * @license lucide-react v0.469.0 - ISC
757
+ *
758
+ * This source code is licensed under the ISC license.
759
+ * See the LICENSE file in the root directory of this source tree.
760
+ */const aa=xe("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
761
+ * @license lucide-react v0.469.0 - ISC
762
+ *
763
+ * This source code is licensed under the ISC license.
764
+ * See the LICENSE file in the root directory of this source tree.
765
+ */const gs=xe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
766
+ * @license lucide-react v0.469.0 - ISC
767
+ *
768
+ * This source code is licensed under the ISC license.
769
+ * See the LICENSE file in the root directory of this source tree.
770
+ */const xl=xe("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),sp={health:5e3,projects:15e3,telegramStatus:8e3,pairList:12e3},Dn={theme:"apx.theme",token:"apx.token",sidebarCollapsed:"apx.sidebar.collapsed",language:"apx.lang",robyChat:"apx.roby.chat"},Hb=["total","automatico","permiso"],Pj=["sky","violet","emerald","amber","rose","indigo","teal","fuchsia"],t4={icon:{light:"/logo/logo_only_white.webp",dark:"/logo/logo_only_dark.webp"},full:{light:"/logo/logo_white.webp",dark:"/logo/logo_dark.webp"},vertical:{light:"/logo/logo_vertical_white.webp",dark:"/logo/logo_vertical_dark.webp"}};function n4(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches}function nh(e){return e==="system"?n4()?"dark":"light":e}function Lj(){if(typeof window>"u")return"dark";const e=localStorage.getItem(Dn.theme);return e==="light"||e==="dark"||e==="system"?e:"dark"}const ES=x.createContext(null);function s4({children:e}){const[t,a]=x.useState(Lj),[r,i]=x.useState(()=>nh(Lj()));x.useEffect(()=>{const f=()=>{const p=nh(t);i(p),document.documentElement.classList.toggle("dark",p==="dark")};f();try{localStorage.setItem(Dn.theme,t)}catch{}if(t==="system"&&typeof window.matchMedia=="function"){const p=window.matchMedia("(prefers-color-scheme: dark)");return p.addEventListener("change",f),()=>p.removeEventListener("change",f)}},[t]);const l=x.useCallback(()=>{a(f=>nh(f)==="dark"?"light":"dark")},[]),d=x.useMemo(()=>({theme:r,preference:t,toggle:l,set:a}),[r,t,l]);return n.jsx(ES.Provider,{value:d,children:e})}function Vb(){const e=x.useContext(ES);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const a4=1367/458,r4=735/1016;function o4({size:e=32,title:t="APX",variant:a="icon"}){const{theme:r}=Vb(),i=t4[a][r];if(a==="full"){const l=e,d=Math.round(e*a4);return n.jsx("img",{src:i,alt:t,width:d,height:l,className:"block object-contain",draggable:!1})}if(a==="vertical"){const l=e,d=Math.round(e/r4);return n.jsx("img",{src:i,alt:t,width:l,height:d,className:"block object-contain",draggable:!1})}return n.jsx("img",{src:i,alt:t,width:e,height:e,className:"block object-contain",draggable:!1})}function RS(e){var t,a,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(a=RS(e[t]))&&(r&&(r+=" "),r+=a)}else for(a in e)e[a]&&(r&&(r+=" "),r+=a);return r}function Bc(){for(var e,t,a=0,r="",i=arguments.length;a<i;a++)(e=arguments[a])&&(t=RS(e))&&(r&&(r+=" "),r+=t);return r}const Fb="-",i4=e=>{const t=c4(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:d=>{const f=d.split(Fb);return f[0]===""&&f.length!==1&&f.shift(),TS(f,t)||l4(d)},getConflictingClassGroupIds:(d,f)=>{const p=a[d]||[];return f&&r[d]?[...p,...r[d]]:p}}},TS=(e,t)=>{if(e.length===0)return t.classGroupId;const a=e[0],r=t.nextPart.get(a),i=r?TS(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;const l=e.join(Fb);return t.validators.find(({validator:d})=>d(l))?.classGroupId},Ij=/^\[(.+)\]$/,l4=e=>{if(Ij.test(e)){const t=Ij.exec(e)[1],a=t?.substring(0,t.indexOf(":"));if(a)return"arbitrary.."+a}},c4=e=>{const{theme:t,prefix:a}=e,r={nextPart:new Map,validators:[]};return d4(Object.entries(e.classGroups),a).forEach(([l,d])=>{yx(d,r,l,t)}),r},yx=(e,t,a,r)=>{e.forEach(i=>{if(typeof i=="string"){const l=i===""?t:$j(t,i);l.classGroupId=a;return}if(typeof i=="function"){if(u4(i)){yx(i(r),t,a,r);return}t.validators.push({validator:i,classGroupId:a});return}Object.entries(i).forEach(([l,d])=>{yx(d,$j(t,l),a,r)})})},$j=(e,t)=>{let a=e;return t.split(Fb).forEach(r=>{a.nextPart.has(r)||a.nextPart.set(r,{nextPart:new Map,validators:[]}),a=a.nextPart.get(r)}),a},u4=e=>e.isThemeGetter,d4=(e,t)=>t?e.map(([a,r])=>{const i=r.map(l=>typeof l=="string"?t+l:typeof l=="object"?Object.fromEntries(Object.entries(l).map(([d,f])=>[t+d,f])):l);return[a,i]}):e,f4=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=new Map,r=new Map;const i=(l,d)=>{a.set(l,d),t++,t>e&&(t=0,r=a,a=new Map)};return{get(l){let d=a.get(l);if(d!==void 0)return d;if((d=r.get(l))!==void 0)return i(l,d),d},set(l,d){a.has(l)?a.set(l,d):i(l,d)}}},AS="!",p4=e=>{const{separator:t,experimentalParseClassName:a}=e,r=t.length===1,i=t[0],l=t.length,d=f=>{const p=[];let g=0,h=0,b;for(let k=0;k<f.length;k++){let C=f[k];if(g===0){if(C===i&&(r||f.slice(k,k+l)===t)){p.push(f.slice(h,k)),h=k+l;continue}if(C==="/"){b=k;continue}}C==="["?g++:C==="]"&&g--}const _=p.length===0?f:f.substring(h),y=_.startsWith(AS),S=y?_.substring(1):_,j=b&&b>h?b-h:void 0;return{modifiers:p,hasImportantModifier:y,baseClassName:S,maybePostfixModifierPosition:j}};return a?f=>a({className:f,parseClassName:d}):d},m4=e=>{if(e.length<=1)return e;const t=[];let a=[];return e.forEach(r=>{r[0]==="["?(t.push(...a.sort(),r),a=[]):a.push(r)}),t.push(...a.sort()),t},g4=e=>({cache:f4(e.cacheSize),parseClassName:p4(e),...i4(e)}),h4=/\s+/,x4=(e,t)=>{const{parseClassName:a,getClassGroupId:r,getConflictingClassGroupIds:i}=t,l=[],d=e.trim().split(h4);let f="";for(let p=d.length-1;p>=0;p-=1){const g=d[p],{modifiers:h,hasImportantModifier:b,baseClassName:_,maybePostfixModifierPosition:y}=a(g);let S=!!y,j=r(S?_.substring(0,y):_);if(!j){if(!S){f=g+(f.length>0?" "+f:f);continue}if(j=r(_),!j){f=g+(f.length>0?" "+f:f);continue}S=!1}const k=m4(h).join(":"),C=b?k+AS:k,w=C+j;if(l.includes(w))continue;l.push(w);const E=i(j,S);for(let R=0;R<E.length;++R){const T=E[R];l.push(C+T)}f=g+(f.length>0?" "+f:f)}return f};function b4(){let e=0,t,a,r="";for(;e<arguments.length;)(t=arguments[e++])&&(a=MS(t))&&(r&&(r+=" "),r+=a);return r}const MS=e=>{if(typeof e=="string")return e;let t,a="";for(let r=0;r<e.length;r++)e[r]&&(t=MS(e[r]))&&(a&&(a+=" "),a+=t);return a};function _4(e,...t){let a,r,i,l=d;function d(p){const g=t.reduce((h,b)=>b(h),e());return a=g4(g),r=a.cache.get,i=a.cache.set,l=f,f(p)}function f(p){const g=r(p);if(g)return g;const h=x4(p,a);return i(p,h),h}return function(){return l(b4.apply(null,arguments))}}const nn=e=>{const t=a=>a[e]||[];return t.isThemeGetter=!0,t},zS=/^\[(?:([a-z-]+):)?(.+)\]$/i,v4=/^\d+\/\d+$/,y4=new Set(["px","full","screen"]),j4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,k4=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,w4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,S4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,C4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ga=e=>Gi(e)||y4.has(e)||v4.test(e),Lr=e=>bl(e,"length",O4),Gi=e=>!!e&&!Number.isNaN(Number(e)),sh=e=>bl(e,"number",Gi),pc=e=>!!e&&Number.isInteger(Number(e)),N4=e=>e.endsWith("%")&&Gi(e.slice(0,-1)),gt=e=>zS.test(e),Ir=e=>j4.test(e),E4=new Set(["length","size","percentage"]),R4=e=>bl(e,E4,OS),T4=e=>bl(e,"position",OS),A4=new Set(["image","url"]),M4=e=>bl(e,A4,P4),z4=e=>bl(e,"",D4),mc=()=>!0,bl=(e,t,a)=>{const r=zS.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):a(r[2]):!1},O4=e=>k4.test(e)&&!w4.test(e),OS=()=>!1,D4=e=>S4.test(e),P4=e=>C4.test(e),L4=()=>{const e=nn("colors"),t=nn("spacing"),a=nn("blur"),r=nn("brightness"),i=nn("borderColor"),l=nn("borderRadius"),d=nn("borderSpacing"),f=nn("borderWidth"),p=nn("contrast"),g=nn("grayscale"),h=nn("hueRotate"),b=nn("invert"),_=nn("gap"),y=nn("gradientColorStops"),S=nn("gradientColorStopPositions"),j=nn("inset"),k=nn("margin"),C=nn("opacity"),w=nn("padding"),E=nn("saturate"),R=nn("scale"),T=nn("sepia"),A=nn("skew"),z=nn("space"),M=nn("translate"),D=()=>["auto","contain","none"],L=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto",gt,t],P=()=>[gt,t],B=()=>["",Ga,Lr],q=()=>["auto",Gi,gt],Y=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],U=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>["start","end","center","between","around","evenly","stretch"],Q=()=>["","0",gt],W=()=>["auto","avoid","all","avoid-page","page","left","right","column"],$=()=>[Gi,gt];return{cacheSize:500,separator:":",theme:{colors:[mc],spacing:[Ga,Lr],blur:["none","",Ir,gt],brightness:$(),borderColor:[e],borderRadius:["none","","full",Ir,gt],borderSpacing:P(),borderWidth:B(),contrast:$(),grayscale:Q(),hueRotate:$(),invert:Q(),gap:P(),gradientColorStops:[e],gradientColorStopPositions:[N4,Lr],inset:I(),margin:I(),opacity:$(),padding:P(),saturate:$(),scale:$(),sepia:Q(),skew:$(),space:P(),translate:P()},classGroups:{aspect:[{aspect:["auto","square","video",gt]}],container:["container"],columns:[{columns:[Ir]}],"break-after":[{"break-after":W()}],"break-before":[{"break-before":W()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Y(),gt]}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[j]}],"inset-x":[{"inset-x":[j]}],"inset-y":[{"inset-y":[j]}],start:[{start:[j]}],end:[{end:[j]}],top:[{top:[j]}],right:[{right:[j]}],bottom:[{bottom:[j]}],left:[{left:[j]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",pc,gt]}],basis:[{basis:I()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",gt]}],grow:[{grow:Q()}],shrink:[{shrink:Q()}],order:[{order:["first","last","none",pc,gt]}],"grid-cols":[{"grid-cols":[mc]}],"col-start-end":[{col:["auto",{span:["full",pc,gt]},gt]}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":[mc]}],"row-start-end":[{row:["auto",{span:[pc,gt]},gt]}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",gt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",gt]}],gap:[{gap:[_]}],"gap-x":[{"gap-x":[_]}],"gap-y":[{"gap-y":[_]}],"justify-content":[{justify:["normal",...X()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...X(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...X(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[k]}],mx:[{mx:[k]}],my:[{my:[k]}],ms:[{ms:[k]}],me:[{me:[k]}],mt:[{mt:[k]}],mr:[{mr:[k]}],mb:[{mb:[k]}],ml:[{ml:[k]}],"space-x":[{"space-x":[z]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[z]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",gt,t]}],"min-w":[{"min-w":[gt,t,"min","max","fit"]}],"max-w":[{"max-w":[gt,t,"none","full","min","max","fit","prose",{screen:[Ir]},Ir]}],h:[{h:[gt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[gt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[gt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[gt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Ir,Lr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",sh]}],"font-family":[{font:[mc]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",gt]}],"line-clamp":[{"line-clamp":["none",Gi,sh]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ga,gt]}],"list-image":[{"list-image":["none",gt]}],"list-style-type":[{list:["none","disc","decimal",gt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[C]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[C]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ga,Lr]}],"underline-offset":[{"underline-offset":["auto",Ga,gt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",gt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",gt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[C]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Y(),T4]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",R4]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},M4]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[S]}],"gradient-via-pos":[{via:[S]}],"gradient-to-pos":[{to:[S]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[l]}],"rounded-s":[{"rounded-s":[l]}],"rounded-e":[{"rounded-e":[l]}],"rounded-t":[{"rounded-t":[l]}],"rounded-r":[{"rounded-r":[l]}],"rounded-b":[{"rounded-b":[l]}],"rounded-l":[{"rounded-l":[l]}],"rounded-ss":[{"rounded-ss":[l]}],"rounded-se":[{"rounded-se":[l]}],"rounded-ee":[{"rounded-ee":[l]}],"rounded-es":[{"rounded-es":[l]}],"rounded-tl":[{"rounded-tl":[l]}],"rounded-tr":[{"rounded-tr":[l]}],"rounded-br":[{"rounded-br":[l]}],"rounded-bl":[{"rounded-bl":[l]}],"border-w":[{border:[f]}],"border-w-x":[{"border-x":[f]}],"border-w-y":[{"border-y":[f]}],"border-w-s":[{"border-s":[f]}],"border-w-e":[{"border-e":[f]}],"border-w-t":[{"border-t":[f]}],"border-w-r":[{"border-r":[f]}],"border-w-b":[{"border-b":[f]}],"border-w-l":[{"border-l":[f]}],"border-opacity":[{"border-opacity":[C]}],"border-style":[{border:[...U(),"hidden"]}],"divide-x":[{"divide-x":[f]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[f]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[C]}],"divide-style":[{divide:U()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...U()]}],"outline-offset":[{"outline-offset":[Ga,gt]}],"outline-w":[{outline:[Ga,Lr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[C]}],"ring-offset-w":[{"ring-offset":[Ga,Lr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ir,z4]}],"shadow-color":[{shadow:[mc]}],opacity:[{opacity:[C]}],"mix-blend":[{"mix-blend":[...V(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[r]}],contrast:[{contrast:[p]}],"drop-shadow":[{"drop-shadow":["","none",Ir,gt]}],grayscale:[{grayscale:[g]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[b]}],saturate:[{saturate:[E]}],sepia:[{sepia:[T]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[p]}],"backdrop-grayscale":[{"backdrop-grayscale":[g]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[b]}],"backdrop-opacity":[{"backdrop-opacity":[C]}],"backdrop-saturate":[{"backdrop-saturate":[E]}],"backdrop-sepia":[{"backdrop-sepia":[T]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[d]}],"border-spacing-x":[{"border-spacing-x":[d]}],"border-spacing-y":[{"border-spacing-y":[d]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",gt]}],duration:[{duration:$()}],ease:[{ease:["linear","in","out","in-out",gt]}],delay:[{delay:$()}],animate:[{animate:["none","spin","ping","pulse","bounce",gt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[pc,gt]}],"translate-x":[{"translate-x":[M]}],"translate-y":[{"translate-y":[M]}],"skew-x":[{"skew-x":[A]}],"skew-y":[{"skew-y":[A]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",gt]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",gt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",gt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ga,Lr,sh]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},DS=_4(L4);function me(...e){return DS(Bc(e))}const Bj={};function Vn(e,t){const a=x.useRef(Bj);return a.current===Bj&&(a.current=e(t)),a}const jx=[];let kx;function I4(){return kx}function $4(e){jx.push(e)}function Gb(e){const t=(a,r)=>{const i=Vn(B4).current;let l;try{kx=i;for(const d of jx)d.before(i);l=e(a,r);for(const d of jx)d.after(i);i.didInitialize=!0}finally{kx=void 0}return l};return t.displayName=e.displayName||e.name,t}function PS(e){return x.forwardRef(Gb(e))}function B4(){return{didInitialize:!1}}function En(){}const ja=Object.freeze([]),sn=Object.freeze({}),U4=()=>{},Pe=typeof document<"u"?x.useLayoutEffect:U4;function q4(e,t){return function(r,...i){const l=new URL(e);return l.searchParams.set("code",r.toString()),i.forEach(d=>l.searchParams.append("args[]",d)),`${t} error #${r}; visit ${l} for the full message.`}}const gn=q4("https://base-ui.com/production-error","Base UI"),LS=x.createContext(void 0);function su(e){const t=x.useContext(LS);if(t===void 0&&!e)throw new Error(gn(72));return t}function Yb(e){x.useEffect(e,ja)}const gc=0;class ta{static create(){return new ta}currentId=gc;start(t,a){this.clear(),this.currentId=setTimeout(()=>{this.currentId=gc,a()},t)}isStarted(){return this.currentId!==gc}clear=()=>{this.currentId!==gc&&(clearTimeout(this.currentId),this.currentId=gc)};disposeEffect=()=>this.clear}function Tn(){const e=Vn(ta.create).current;return Yb(e.disposeEffect),e}function H4(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:V4,platform:F4,maxTouchPoints:G4}=H4(),ap=V4.toLowerCase(),Uc=F4.toLowerCase(),rp=/^i(os$|p)/.test(Uc)||Uc==="macintel"&&G4>1,Uj="android",wx=Uc===Uj||ap.includes(Uj),Kb=!rp&&Uc.startsWith("mac");Uc.startsWith("win");const Y4=Kb||rp,ur=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!ur&&ap.includes("firefox");!ur&&ap.includes("chrom");const K4=Y4,Xb=/jsdom|happydom/.test(ap);function pa(e){e.preventDefault(),e.stopPropagation()}function X4(e){return"nativeEvent"in e}function Qb(e){return e.pointerType===""&&e.isTrusted?!0:wx&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Wb(e){return Xb?!1:!wx&&e.width===0&&e.height===0||wx&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function Fr(e,t){const a=["mouse","pen"];return t||a.push("",void 0),a.includes(e)}function Q4(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function op(){return typeof window<"u"}function Fn(e){return Zb(e)?(e.nodeName||"").toLowerCase():"#document"}function Jt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function dr(e){var t;return(t=(Zb(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Zb(e){return op()?e instanceof Node||e instanceof Jt(e).Node:!1}function bt(e){return op()?e instanceof Element||e instanceof Jt(e).Element:!1}function Yt(e){return op()?e instanceof HTMLElement||e instanceof Jt(e).HTMLElement:!1}function nl(e){return!op()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Jt(e).ShadowRoot}function au(e){const{overflow:t,overflowX:a,overflowY:r,display:i}=Ns(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+a)&&i!=="inline"&&i!=="contents"}function W4(e){return/^(table|td|th)$/.test(Fn(e))}function ip(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Z4=/transform|translate|scale|rotate|perspective|filter/,J4=/paint|layout|strict|content/,wo=e=>!!e&&e!=="none";let ah;function Jb(e){const t=bt(e)?Ns(e):e;return wo(t.transform)||wo(t.translate)||wo(t.scale)||wo(t.rotate)||wo(t.perspective)||!e_()&&(wo(t.backdropFilter)||wo(t.filter))||Z4.test(t.willChange||"")||J4.test(t.contain||"")}function ez(e){let t=or(e);for(;Yt(t)&&!tr(t);){if(Jb(t))return t;if(ip(t))return null;t=or(t)}return null}function e_(){return ah==null&&(ah=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ah}function tr(e){return/^(html|body|#document)$/.test(Fn(e))}function Ns(e){return Jt(e).getComputedStyle(e)}function lp(e){return bt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function or(e){if(Fn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||nl(e)&&e.host||dr(e);return nl(t)?t.host:t}function IS(e){const t=or(e);return tr(t)?(e.ownerDocument||e).body:Yt(t)&&au(t)?t:IS(t)}function qc(e,t,a){var r;t===void 0&&(t=[]),a===void 0&&(a=!0);const i=IS(e),l=i===((r=e.ownerDocument)==null?void 0:r.body),d=Jt(i);if(l){const f=Sx(d);return t.concat(d,d.visualViewport||[],au(i)?i:[],f&&a?qc(f):[])}else return t.concat(i,qc(i,[],a))}function Sx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Cx="data-base-ui-focusable",$S="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",cp="ArrowLeft",up="ArrowRight",BS="ArrowUp",t_="ArrowDown";function Xn(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Je(e,t){if(!e||!t)return!1;const a=t.getRootNode?.();if(e.contains(t))return!0;if(a&&nl(a)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Hn(e){return"composedPath"in e?e.composedPath()[0]:e.target}function _f(e,t){if(!bt(e))return!1;const a=e;if(t.hasElement(a))return!a.hasAttribute("data-trigger-disabled");for(const[,r]of t.entries())if(Je(r,a))return!r.hasAttribute("data-trigger-disabled");return!1}function rh(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const a=e;return a.target!=null&&t.contains(a.target)}function tz(e){return e.matches("html,body")}function dp(e){return Yt(e)&&e.matches($S)}function nz(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${$S}`)!=null}function Nx(e){return e?e.getAttribute("role")==="combobox"&&dp(e):!1}function sz(e){if(!e||Xb)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function vf(e){return e?e.hasAttribute(Cx)?e:e.querySelector(`[${Cx}]`)||e:null}function az(e,t){return t!=null&&!Fr(t)?0:typeof e=="function"?e():e}function Qr(e,t,a){const r=az(e,a);return typeof r=="number"?r:r?.[t]}function qj(e){return typeof e=="function"?e():e}function US(e,t){return t||e==="click"||e==="mousedown"}function rz(e){return e?.includes("mouse")&&e!=="mousedown"}const ka="none",_l="trigger-press",Rn="trigger-hover",Yi="trigger-focus",fp="outside-press",Ki="item-press",oz="close-press",Po="focus-out",pp="escape-key",Ex="list-navigation",qS="cancel-open",Sc="sibling-open",HS="disabled",Hj="missing",Vj="initial",n_="imperative-action",iz="window-resize";function rt(e,t,a,r){let i=!1,l=!1;const d=r??sn;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){l=!0},get isCanceled(){return i},get isPropagationAllowed(){return l},trigger:a,...d}}const VS=x.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new ta,currentIdRef:{current:null},currentContextRef:{current:null}});function lz(e,t){e.current=t.current}function cz(e){const{children:t,delay:a,timeoutMs:r=0}=e,i=x.useRef(a),l=x.useRef(a),d=x.useRef(null),f=x.useRef(null),p=Tn();return Pe(()=>{if(l.current=a,!d.current){i.current=a;return}i.current={open:Qr(i.current,"open"),close:Qr(a,"close")}},[a,d,i,l]),n.jsx(VS.Provider,{value:x.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:l,currentIdRef:d,timeoutMs:r,currentContextRef:f,timeout:p}),[r,p]),children:t})}function uz(e,t={open:!1}){const{open:a}=t,r="rootStore"in e?e.rootStore:e,i=r.useState("floatingId"),l=x.useContext(VS),{currentIdRef:d,delayRef:f,timeoutMs:p,initialDelayRef:g,currentContextRef:h,hasProvider:b,timeout:_}=l,[y,S]=x.useState(!1),j=x.useRef(a);return Pe(()=>{j.current=a},[a]),Pe(()=>{function k(){h.current?.setIsInstantPhase(!1),d.current=null,h.current=null,f.current=g.current,_.clear()}if(d.current&&!a&&d.current===i){if(S(!1),p){const C=i;return _.start(p,()=>{r.select("open")||d.current&&d.current!==C||k()}),()=>{(j.current||d.current!==C)&&_.clear()}}k()}},[a,i,d,f,p,g,h,_,r]),Pe(()=>{if(!a)return;const k=h.current,C=d.current;_.clear(),h.current={onOpenChange:r.setOpen,setIsInstantPhase:S},d.current=i,f.current={open:0,close:Qr(g.current,"close")},C!==null&&C!==i?(S(!0),k?.setIsInstantPhase(!0),k?.onOpenChange(!1,rt(ka))):(S(!1),k?.setIsInstantPhase(!1))},[a,i,r,d,f,g,h,_]),Pe(()=>()=>{if(d.current===i){if(h.current=null,!j.current)return;d.current=null,lz(f,g),_.clear()}},[h,d,f,i,g,_]),x.useMemo(()=>({hasProvider:b,delayRef:f,isInstantPhase:y}),[b,f,y])}function xt(e,t,a,r){return e.addEventListener(t,a,r),()=>{e.removeEventListener(t,a,r)}}function _a(...e){return()=>{for(let t=0;t<e.length;t+=1){const a=e[t];a&&a()}}}function ir(e,t,a,r){const i=Vn(FS).current;return fz(i,e,t,a,r)&&GS(i,[e,t,a,r]),i.callback}function dz(e){const t=Vn(FS).current;return pz(t,e)&&GS(t,e),t.callback}function FS(){return{callback:null,cleanup:null,refs:[]}}function fz(e,t,a,r,i){return e.refs[0]!==t||e.refs[1]!==a||e.refs[2]!==r||e.refs[3]!==i}function pz(e,t){return e.refs.length!==t.length||e.refs.some((a,r)=>a!==t[r])}function GS(e,t){if(e.refs=t,t.every(a=>a==null)){e.callback=null;return}e.callback=a=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),a!=null){const r=Array(t.length).fill(null);for(let i=0;i<t.length;i+=1){const l=t[i];if(l!=null)switch(typeof l){case"function":{const d=l(a);typeof d=="function"&&(r[i]=d);break}case"object":{l.current=a;break}}}e.cleanup=()=>{for(let i=0;i<t.length;i+=1){const l=t[i];if(l!=null)switch(typeof l){case"function":{const d=r[i];typeof d=="function"?d():l(null);break}case"object":{l.current=null;break}}}}}}}function mn(e){const t=Vn(mz,e).current;return t.next=e,Pe(t.effect),t}function mz(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const s_={...t3},oh=s_.useInsertionEffect,gz=oh&&oh!==s_.useLayoutEffect?oh:e=>e();function Ve(e){const t=Vn(hz).current;return t.next=e,gz(t.effect),t.trampoline}function hz(){const e={next:void 0,callback:xz,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function xz(){}const Td=null;class bz{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const a=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let i=0;i<a.length;i+=1)a[i]?.(t)};request(t){const a=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),a}cancel(t){const a=t-this.startId;a<0||a>=this.callbacks.length||(this.callbacks[a]=null,this.callbacksCount-=1)}}let Ad=new bz;class ga{static create(){return new ga}static request(t){return Ad.request(t)}static cancel(t){return Ad.cancel(t)}currentId=Td;request(t){this.cancel(),this.currentId=Ad.request(()=>{this.currentId=Td,t()})}cancel=()=>{this.currentId!==Td&&(Ad.cancel(this.currentId),this.currentId=Td)};disposeEffect=()=>this.cancel}function sl(){const e=Vn(ga.create).current;return Yb(e.disposeEffect),e}function vt(e){return e?.ownerDocument||document}const YS={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},a_={...YS,position:"fixed",top:0,left:0},KS={...YS,position:"absolute"},al=x.forwardRef(function(t,a){const[r,i]=x.useState();Pe(()=>{K4&&ur&&i("button")},[]);const l={tabIndex:0,role:r};return n.jsx("span",{...t,ref:a,style:a_,"aria-hidden":r?void 0:!0,...l,"data-base-ui-focus-guard":""})}),rl=Math.min,nr=Math.max,yf=Math.round,Md=Math.floor,sr=e=>({x:e,y:e}),_z={left:"right",right:"left",bottom:"top",top:"bottom"};function XS(e,t,a){return nr(e,rl(t,a))}function Wr(e,t){return typeof e=="function"?e(t):e}function Vs(e){return e.split("-")[0]}function to(e){return e.split("-")[1]}function r_(e){return e==="x"?"y":"x"}function o_(e){return e==="y"?"height":"width"}function Hs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function i_(e){return r_(Hs(e))}function vz(e,t,a){a===void 0&&(a=!1);const r=to(e),i=i_(e),l=o_(i);let d=i==="x"?r===(a?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(d=jf(d)),[d,jf(d)]}function yz(e){const t=jf(e);return[Rx(e),t,Rx(t)]}function Rx(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Fj=["left","right"],Gj=["right","left"],jz=["top","bottom"],kz=["bottom","top"];function wz(e,t,a){switch(e){case"top":case"bottom":return a?t?Gj:Fj:t?Fj:Gj;case"left":case"right":return t?jz:kz;default:return[]}}function Sz(e,t,a,r){const i=to(e);let l=wz(Vs(e),a==="start",r);return i&&(l=l.map(d=>d+"-"+i),t&&(l=l.concat(l.map(Rx)))),l}function jf(e){const t=Vs(e);return _z[t]+e.slice(t.length)}function Cz(e){var t,a,r,i;return{top:(t=e.top)!=null?t:0,right:(a=e.right)!=null?a:0,bottom:(r=e.bottom)!=null?r:0,left:(i=e.left)!=null?i:0}}function QS(e){return typeof e!="number"?Cz(e):{top:e,right:e,bottom:e,left:e}}function Hc(e){const{x:t,y:a,width:r,height:i}=e;return{width:r,height:i,top:a,left:t,right:t+r,bottom:a+i,x:t,y:a}}function zc(e,t){return t<0||t>=e.length}function of(e,t){return Wa(e.current,{disabledIndices:t})}function Tx(e,t){return Wa(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Wa(e,{startingIndex:t=-1,decrement:a=!1,disabledIndices:r,amount:i=1}={}){let l=t;do l+=a?-i:i;while(l>=0&&l<=e.length-1&&kf(e,l,r));return l}function kf(e,t,a){if(typeof a=="function"?a(t):a?.includes(t)??!1)return!0;const i=e[t];return i?!mp(i)||i.matches(":disabled")?!0:!a&&(i.hasAttribute("disabled")||i.getAttribute("aria-disabled")==="true"):!1}function Nz(e){return e.visibility==="hidden"||e.visibility==="collapse"}function mp(e,t=e?Ns(e):null){return!e||!e.isConnected||!t||Nz(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const Ez='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function Rz(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const a=e.getRootNode();return nl(a)?a.host:null}function Ax(e){for(const t of Array.from(e.children))if(Fn(t)==="summary")return t;return null}function Tz(e,t){const a=Ax(t);return!!a&&(e===a||Je(a,e))}function WS(e){const t=e?Fn(e):"";return e!=null&&e.matches(Ez)&&(t!=="summary"||e.parentElement!=null&&Fn(e.parentElement)==="details"&&Ax(e.parentElement)===e)&&(t!=="details"||Ax(e)==null)&&(t!=="input"||e.type!=="hidden")}function ZS(e){if(!WS(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=Rz(t)){const a=t!==e,r=Fn(t)==="slot";if(t.hasAttribute("inert")||a&&Fn(t)==="details"&&!t.open&&!Tz(e,t)||t.hasAttribute("hidden")||!r&&!Az(t,a))return!1}return!0}function Az(e,t){const a=Ns(e);return t?a.display!=="none":mp(e,a)}function JS(e){const t=e.tabIndex;if(t<0){const a=Fn(e);if(a==="details"||a==="audio"||a==="video"||Yt(e)&&e.isContentEditable)return 0}return t}function ih(e){if(Fn(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function Mz(e,t){const a=ih(e);if(!a)return!0;const r=t.find(i=>{const l=ih(i);return l?.name===a.name&&l.form===a.form&&l.checked});return r?r===a:t.find(i=>{const l=ih(i);return l?.name===a.name&&l.form===a.form})===a}function eC(e){if(Yt(e)&&Fn(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Yt(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function tC(e,t){eC(e).forEach(a=>{WS(a)&&t.push(a),tC(a,t)})}function nC(e,t,a){eC(e).forEach(r=>{Yt(r)&&r.matches(t)&&a.push(r),nC(r,t,a)})}function l_(e){return ZS(e)&&JS(e)>=0}function sC(e){const t=[];return tC(e,t),t.filter(ZS)}function ru(e){const t=sC(e);return t.filter(a=>JS(a)>=0&&Mz(a,t))}function aC(e,t){const a=ru(e),r=a.length;if(r===0)return;const i=Xn(vt(e)),l=a.indexOf(i),d=l===-1?t===1?0:r-1:l+t;return a[d]}function c_(e){return aC(vt(e).body,1)||e}function rC(e){return aC(vt(e).body,-1)||e}function oC(e,t){if(!e)return null;const a=ru(vt(e).body),r=a.length;if(r===0)return null;const i=a.indexOf(e);if(i===-1)return null;const l=(i+t+r)%r;return a[l]}function zz(e){return oC(e,1)}function Oz(e){return oC(e,-1)}function Xi(e,t){const a=t||e.currentTarget,r=e.relatedTarget;return!r||!Je(a,r)}function Dz(e){ru(e).forEach(a=>{a.dataset.tabindex=a.getAttribute("tabindex")||"",a.setAttribute("tabindex","-1")})}function Yj(e){const t=[];nC(e,"[data-tabindex]",t),t.forEach(a=>{const r=a.dataset.tabindex;delete a.dataset.tabindex,r?a.setAttribute("tabindex",r):a.removeAttribute("tabindex")})}function Zr(e,t,a=!0){return e.filter(i=>i.parentId===t).flatMap(i=>[...!a||i.context?.open?[i]:[],...Zr(e,i.id,a)])}function Kj(e,t){let a=[],r=e.find(i=>i.id===t)?.parentId;for(;r;){const i=e.find(l=>l.id===r);r=i?.parentId,i&&(a=a.concat(i))}return a}function Vc(e){return`data-base-ui-${e}`}let zd=0;function lf(e,t={}){const{preventScroll:a=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(zd);function l(){i&&!i()||e?.focus({preventScroll:a})}if(r)return l(),En;const d=requestAnimationFrame(l);return zd=d,()=>{zd===d&&(cancelAnimationFrame(d),zd=0)}}const lh={inert:new WeakMap,"aria-hidden":new WeakMap},Xj="data-base-ui-inert",Mx={inert:new WeakSet,"aria-hidden":new WeakSet};let hc=new WeakMap,ch=0;function Pz(e){return Mx[e]}function iC(e){return e?nl(e)?e.host:iC(e.parentNode):null}const Qj=(e,t)=>t.map(a=>{if(e.contains(a))return a;const r=iC(a);return e.contains(r)?r:null}).filter(a=>a!=null),Wj=e=>{const t=new Set;return e.forEach(a=>{let r=a;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},Zj=(e,t,a)=>{const r=[],i=l=>{!l||a.has(l)||Array.from(l.children).forEach(d=>{Fn(d)!=="script"&&(t.has(d)?i(d):r.push(d))})};return i(e),r};function Lz(e,t,a,r,{mark:i=!0}){let l=null;r?l="inert":a&&(l="aria-hidden");let d=null,f=null;const p=Qj(t,e),g=i?Zj(t,Wj(p),new Set(p)):[],h=[],b=[];if(l){const _=lh[l],y=Pz(l);f=y,d=_;const S=Qj(t,Array.from(t.querySelectorAll("[aria-live]"))),j=p.concat(S);Zj(t,Wj(j),new Set(j)).forEach(C=>{const w=C.getAttribute(l),E=w!==null&&w!=="false",R=(_.get(C)||0)+1;_.set(C,R),h.push(C),R===1&&E&&y.add(C),E||C.setAttribute(l,l==="inert"?"":"true")})}return i&&g.forEach(_=>{const y=(hc.get(_)||0)+1;hc.set(_,y),b.push(_),y===1&&_.setAttribute(Xj,"")}),ch+=1,()=>{d&&h.forEach(_=>{const S=(d.get(_)||0)-1;d.set(_,S),S||(!f?.has(_)&&l&&_.removeAttribute(l),f?.delete(_))}),i&&b.forEach(_=>{const y=(hc.get(_)||0)-1;hc.set(_,y),y||_.removeAttribute(Xj)}),ch-=1,ch||(lh.inert=new WeakMap,lh["aria-hidden"]=new WeakMap,Mx.inert=new WeakSet,Mx["aria-hidden"]=new WeakSet,hc=new WeakMap)}}function Jj(e,t={}){const{ariaHidden:a=!1,inert:r=!1,mark:i=!0}=t,l=vt(e[0]).body;return Lz(e,l,a,r,{mark:i})}let ek=0;function Iz(e,t="mui"){const[a,r]=x.useState(e),i=e||a;return x.useEffect(()=>{a==null&&(ek+=1,r(`${t}-${ek}`))},[a,t]),i}const tk=s_.useId;function Lo(e,t){if(tk!==void 0){const a=tk();return e??(t?`${t}-${a}`:a)}return Iz(e,t)}const $z=parseInt(x.version,10);function u_(e){return $z>=e}function nk(e){if(!x.isValidElement(e))return null;const t=e,a=t.props;return(u_(19)?a?.ref:t.ref)??null}function zx(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function Bz(e,t){const a={};for(const r in e){const i=e[r];if(t?.hasOwnProperty(r)){const l=t[r](i);l!=null&&Object.assign(a,l);continue}i===!0?a[`data-${r.toLowerCase()}`]="":i&&(a[`data-${r.toLowerCase()}`]=i.toString())}return a}function Uz(e,t){return typeof e=="function"?e(t):e}function qz(e,t){return typeof e=="function"?e(t):e}const d_={};function Ss(e,t,a,r,i){if(!a&&!r&&!i&&!e)return wf(t);let l=wf(e);return t&&(l=Cc(l,t)),a&&(l=Cc(l,a)),r&&(l=Cc(l,r)),i&&(l=Cc(l,i)),l}function Hz(e){if(e.length===0)return d_;if(e.length===1)return wf(e[0]);let t=wf(e[0]);for(let a=1;a<e.length;a+=1)t=Cc(t,e[a]);return t}function wf(e){return f_(e)?{...cC(e,d_)}:Vz(e)}function Cc(e,t){return f_(t)?cC(t,e):Fz(e,t)}function Vz(e){const t={...e};for(const a in t){const r=t[a];lC(a,r)&&(t[a]=uC(r))}return t}function Fz(e,t){if(!t)return e;for(const a in t){const r=t[a];switch(a){case"style":{e[a]=zx(e.style,r);break}case"className":{e[a]=dC(e.className,r);break}default:lC(a,r)?e[a]=Gz(e[a],r):e[a]=r}}return e}function lC(e,t){const a=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return a===111&&r===110&&i>=65&&i<=90&&(typeof t=="function"||typeof t>"u")}function f_(e){return typeof e=="function"}function cC(e,t){return f_(e)?e(t):e??d_}function Gz(e,t){return t?e?(...a)=>{const r=a[0];if(fC(r)){const l=r;Sf(l);const d=t(...a);return l.baseUIHandlerPrevented||e?.(...a),d}const i=t(...a);return e?.(...a),i}:uC(t):e}function uC(e){return e&&((...t)=>{const a=t[0];return fC(a)&&Sf(a),e(...t)})}function Sf(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function dC(e,t){return t?e?t+" "+e:t:e}function fC(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Et(e,t,a={}){const r=t.render,i=Yz(t,a);if(a.enabled===!1)return null;const l=a.state??sn;return Qz(e,r,i,l)}function Yz(e,t={}){const{className:a,style:r,render:i}=e,{state:l=sn,ref:d,props:f,stateAttributesMapping:p,enabled:g=!0}=t,h=g?Uz(a,l):void 0,b=g?qz(r,l):void 0,_=g?Bz(l,p):sn,y=g&&f?Kz(f):void 0,S=g?zx(_,y)??{}:sn;return typeof document<"u"&&(g?Array.isArray(d)?S.ref=dz([S.ref,nk(i),...d]):S.ref=ir(S.ref,nk(i),d):ir(null,null)),g?(h!==void 0&&(S.className=dC(S.className,h)),b!==void 0&&(S.style=zx(S.style,b)),S):sn}function Kz(e){return Array.isArray(e)?Hz(e):Ss(void 0,e)}const Xz=Symbol.for("react.lazy");function Qz(e,t,a,r){if(t){if(typeof t=="function")return t(a,r);const i=Ss(a,t.props);i.ref=a.ref;let l=t;return l?.$$typeof===Xz&&(l=x.Children.toArray(t)[0]),x.cloneElement(l,i)}if(e&&typeof e=="string")return Wz(e,a);throw new Error(gn(8))}function Wz(e,t){return e==="button"?x.createElement("button",{type:"button",...t,key:t.key}):e==="img"?x.createElement("img",{alt:"",...t,key:t.key}):x.createElement(e,t)}const Zz=500,Jz=500,eO={style:{transition:"none"}},tO="data-base-ui-click-trigger",pC={fallbackAxisSide:"none"},mC={fallbackAxisSide:"end"},nO={clipPath:"inset(50%)",position:"fixed",top:0,left:0},gC=x.createContext(null),hC=()=>x.useContext(gC),sO=Vc("portal");function xC(e={}){const{ref:t,container:a,componentProps:r=sn,elementProps:i}=e,l=Lo(),f=hC()?.portalNode,[p,g]=x.useState(null),[h,b]=x.useState(null),_=Ve(k=>{k!==null&&b(k)}),y=x.useRef(null);Pe(()=>{if(a===null){y.current&&(y.current=null,b(null),g(null));return}const k=(a&&(Zb(a)?a:a.current))??f??document.body;if(k==null){y.current&&(y.current=null,b(null),g(null));return}y.current!==k&&(y.current=k,b(null),g(k))},[a,f]);const S=Et("div",r,{ref:[t,_],props:[{id:l,[sO]:""},i]}),j=p&&S?Gs.createPortal(S,p):null;return{node:h,nodeId:x.isValidElement(S)?S.props.id:void 0,subtree:j}}const p_=x.forwardRef(function(t,a){const{render:r,className:i,style:l,children:d,container:f,...p}=t,{node:g,nodeId:h,subtree:b}=xC({container:f,ref:a,componentProps:t,elementProps:p}),_=x.useRef(null),y=x.useRef(null),S=x.useRef(null),j=x.useRef(null),[k,C]=x.useState(null),w=x.useRef(!1),E=k?.modal,R=k?.open,T=!!k&&!k.modal&&k.open&&!!g;x.useEffect(()=>{if(!g||E)return;function z(M){g&&M.relatedTarget&&Xi(M)&&(M.type==="focusin"?w.current&&(Yj(g),w.current=!1):(Dz(g),w.current=!0))}return _a(xt(g,"focusin",z,!0),xt(g,"focusout",z,!0))},[g,E]),Pe(()=>{!g||R!==!0||!w.current||(Yj(g),w.current=!1)},[R,g]);const A=x.useMemo(()=>({beforeOutsideRef:_,afterOutsideRef:y,beforeInsideRef:S,afterInsideRef:j,portalNode:g,setFocusManagerState:C}),[g]);return n.jsxs(x.Fragment,{children:[b,n.jsxs(gC.Provider,{value:A,children:[T&&g&&n.jsx(al,{"data-type":"outside",ref:_,onFocus:z=>{if(Xi(z,g))S.current?.focus();else{const M=k?k.domReference:null;rC(M)?.focus()}}}),T&&g&&n.jsx("span",{"aria-owns":h,style:nO}),g&&Gs.createPortal(d,g),T&&g&&n.jsx(al,{"data-type":"outside",ref:y,onFocus:z=>{if(Xi(z,g))j.current?.focus();else{const M=k?k.domReference:null;c_(M)?.focus(),k?.closeOnFocusOut&&k?.onOpenChange(!1,rt(Po,z.nativeEvent))}}})]})]})});function bC(){const e=new Map;return{emit(t,a){e.get(t)?.forEach(r=>r(a))},on(t,a){e.has(t)||e.set(t,new Set),e.get(t).add(a)},off(t,a){e.get(t)?.delete(a)}}}class m_{nodesRef={current:[]};events=bC();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const a=this.nodesRef.current.findIndex(r=>r===t);a!==-1&&this.nodesRef.current.splice(a,1)}}const _C=x.createContext(null),vC=x.createContext(null),no=()=>x.useContext(_C)?.id||null,so=e=>{const t=x.useContext(vC);return e??t};function yC(e){const t=Lo(),a=so(e),r=no();return Pe(()=>{if(!t)return;const i={id:t,parentId:r};return a?.addNode(i),()=>{a?.removeNode(i)}},[a,t,r]),t}function aO(e){const{children:t,id:a}=e,r=no();return n.jsx(_C.Provider,{value:x.useMemo(()=>({id:a,parentId:r}),[a,r]),children:t})}function rO(e){const{children:t,externalTree:a}=e,r=Vn(()=>a??new m_).current;return n.jsx(vC.Provider,{value:r,children:t})}function Xa(e){return e==null?e:"current"in e?e.current:e}function oO(e,t){const a=Jt(Hn(e));return e instanceof a.KeyboardEvent?"keyboard":e instanceof a.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof a.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const sk=20;let Hr=[];function g_(){Hr=Hr.filter(e=>e.deref()?.isConnected)}function ak(e){g_(),e&&Fn(e)!=="body"&&(Hr.push(new WeakRef(e)),Hr.length>sk&&(Hr=Hr.slice(-sk)))}function rk(){return g_(),Hr[Hr.length-1]?.deref()}function iO(e){return e?l_(e)?e:ru(e)[0]||e:null}function ok(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const a=sC(e).filter(i=>{const l=i.getAttribute("data-tabindex")||"";return l_(i)||i.hasAttribute("data-tabindex")&&!l.startsWith("-")}),r=e.getAttribute("tabindex");a.length===0?r!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(r!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function h_(e){const{context:t,children:a,disabled:r=!1,initialFocus:i=!0,returnFocus:l=!0,restoreFocus:d=!1,modal:f=!0,closeOnFocusOut:p=!0,openInteractionType:g="",nextFocusableElement:h,previousFocusableElement:b,beforeContentFocusGuardRef:_,externalTree:y,getInsideElements:S}=e,j="rootStore"in t?t.rootStore:t,k=j.useState("open"),C=j.useState("domReferenceElement"),w=j.useState("floatingElement"),{events:E,dataRef:R}=j.context,T=Ve(()=>R.current.floatingContext?.nodeId),A=i===!1,z=Nx(C)&&A,M=mn(i),D=mn(l),L=mn(g),I=mn(k),P=so(y),B=hC(),q=x.useRef(!1),Y=x.useRef(!1),U=x.useRef(!1),V=x.useRef(null),X=x.useRef(""),Q=x.useRef(""),W=x.useRef(null),$=x.useRef(null),K=ir(W,_,B?.beforeInsideRef),J=ir($,B?.afterInsideRef),G=Tn(),te=Tn(),se=sl(),pe=B!=null,F=vf(w),oe=Ve((be=F)=>be?ru(be):[]),_e=Ve(()=>S?.().filter(be=>be!=null)??[]);x.useEffect(()=>{if(r||!f)return;function be(Re){Re.key==="Tab"&&Je(F,Xn(vt(F)))&&oe().length===0&&!z&&pa(Re)}const ke=vt(F);return xt(ke,"keydown",be)},[r,F,f,z,oe]),x.useEffect(()=>{if(r||!k)return;const be=vt(F);function ke(){U.current=!1}function Re(Ie){const Oe=Hn(Ie),Te=_e(),Ee=Je(w,Oe)||Je(C,Oe)||Je(B?.portalNode,Oe)||Te.some(Me=>Me===Oe||Je(Me,Oe));U.current=!Ee,Q.current=Ie.pointerType||"keyboard",Oe?.closest(`[${tO}]`)&&(Y.current=!0,te.start(0,()=>{Y.current=!1}))}function Ae(){Q.current="keyboard"}return _a(xt(be,"pointerdown",Re,!0),xt(be,"pointerup",ke,!0),xt(be,"pointercancel",ke,!0),xt(be,"keydown",Ae,!0),ke)},[r,w,C,F,k,B,te,_e]),x.useEffect(()=>{if(r||!p)return;const be=vt(F);function ke(){Y.current=!0,te.start(0,()=>{Y.current=!1})}function Re(Te){const Ee=Hn(Te);l_(Ee)&&(V.current=Ee)}function Ae(Te){const Ee=Te.relatedTarget,Me=Te.currentTarget,De=Hn(Te);f&&Ee==null&&De!=null&&Je(w,De)&&ak(De),queueMicrotask(()=>{const He=T(),Qe=j.context.triggerElements,ge=_e(),de=Ee?.hasAttribute(Vc("focus-guard"))&&[W.current,$.current,B?.beforeInsideRef.current,B?.afterInsideRef.current,B?.beforeOutsideRef.current,B?.afterOutsideRef.current,Xa(b),Xa(h)].includes(Ee),Le=!(Je(C,Ee)||Je(w,Ee)||Je(Ee,w)||Je(B?.portalNode,Ee)||ge.some(ye=>ye===Ee||Je(ye,Ee))||Qe.hasMatchingElement(ye=>Je(ye,Ee))||de||P&&(Zr(P.nodesRef.current,He).find(ye=>Je(ye.context?.elements.floating,Ee)||Je(ye.context?.elements.domReference,Ee))||Kj(P.nodesRef.current,He).find(ye=>[ye.context?.elements.floating,vf(ye.context?.elements.floating)].includes(Ee)||ye.context?.elements.domReference===Ee)));if(Me===C&&F&&ok(F),d&&Me!==C&&!mp(De)&&Xn(be)===be.body){if(Yt(F)&&(F.focus(),d==="popup")){se.request(()=>{F.focus()});return}const ye=oe(),Ne=V.current,We=(Ne&&ye.includes(Ne)?Ne:null)||ye[ye.length-1]||F;Yt(We)&&We.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(z||!f)&&Ee&&Le&&!Y.current&&(z||Ee!==rk())&&(q.current=!0,j.setOpen(!1,rt(Po,Te)))})}function Ie(){U.current||(R.current.insideReactTree=!0,G.start(0,()=>{R.current.insideReactTree=!1}))}const Oe=Yt(C)?C:null;if(!(!w&&!Oe))return _a(Oe&&xt(Oe,"focusout",Ae),Oe&&xt(Oe,"pointerdown",ke),w&&xt(w,"focusin",Re),w&&xt(w,"focusout",Ae),w&&B&&xt(w,"focusout",Ie,!0))},[r,C,w,F,f,P,B,j,p,d,oe,z,T,R,G,te,se,h,b,_e]),x.useEffect(()=>{if(r||!w||!k)return;const be=Array.from(B?.portalNode?.querySelectorAll(`[${Vc("portal")}]`)||[]),Re=(P?Kj(P.nodesRef.current,T()):[]).find(Me=>Nx(Me.context?.elements.domReference||null))?.context?.elements.domReference,Ie=[...[w,...be,W.current,$.current,B?.beforeOutsideRef.current,B?.afterOutsideRef.current,..._e()],Re,Xa(b),Xa(h),z?C:null].filter(Me=>Me!=null),Oe=Jj(Ie,{ariaHidden:f||z,mark:!1}),Te=[w,...be].filter(Me=>Me!=null),Ee=Jj(Te);return()=>{Ee(),Oe()}},[k,r,C,w,f,B,z,P,T,h,b,_e]),Pe(()=>{if(!k||r||!Yt(F))return;X.current="",Q.current="";const be=vt(F),ke=Xn(be);queueMicrotask(()=>{const Re=M.current,Ae=typeof Re=="function"?Re(L.current||""):Re;if(Ae===void 0||Ae===!1||Je(F,ke))return;let Oe=null;const Te=()=>(Oe==null&&(Oe=oe(F)),Oe[0]||F);let Ee;Ae===!0||Ae===null?Ee=Te():Ee=Xa(Ae),Ee=Ee||Te();const Me=Je(F,Xn(be));lf(Ee,{preventScroll:Ee===F,shouldFocus(){if(!I.current)return!1;if(Me)return!0;const De=Xn(be);return!(De!==Ee&&Je(F,De))}})})},[r,k,F,oe,M,L,I]),Pe(()=>{if(r||!F)return;const be=vt(F),ke=Xn(be),Re=L.current==null;ak(ke);function Ae(Oe){if(Oe.open||(X.current=oO(Oe.nativeEvent,Q.current)),Oe.reason===Rn&&Oe.nativeEvent.type==="mouseleave"&&(q.current=!0),Oe.reason===fp)if(Oe.nested)q.current=!1;else if(Qb(Oe.nativeEvent)||Wb(Oe.nativeEvent))q.current=!1;else{let Te=!1;vt(F).createElement("div").focus({get preventScroll(){return Te=!0,!1}}),Te?q.current=!1:q.current=!0}}E.on("openchange",Ae);function Ie(Oe){const Te=D.current;let Ee=typeof Te=="function"?Te(Oe):Te;if(Ee===void 0||Ee===!1)return null;Ee===null&&(Ee=!0);const Me=C?.isConnected?C:null,De=ke?.isConnected&&Fn(ke)!=="body"?ke:null;let He=Re?De||Me:Me||De;return He||(He=rk()||null),typeof Ee=="boolean"?He:Xa(Ee)||He||null}return()=>{E.off("openchange",Ae);const Oe=Xn(be),Te=_e(),Ee=Je(w,Oe)||Te.some(Qe=>Qe===Oe||Je(Qe,Oe))||P&&Zr(P.nodesRef.current,T(),!1).some(Qe=>Je(Qe.context?.elements.floating,Oe)),Me=D.current,De=X.current,He=Ie(De);queueMicrotask(()=>{const Qe=iO(He),ge=typeof Me!="boolean";if(Me&&!q.current&&Yt(Qe)&&(!(!ge&&Qe!==Oe&&Oe!==be.body)||Ee)){const de={preventScroll:!0};De==="keyboard"&&(de.focusVisible=!0),Qe.focus(de)}q.current=!1})}},[r,w,F,D,L,E,P,C,T,_e]),Pe(()=>{if(!ur||k||!w)return;const be=Xn(vt(w));!Yt(be)||!dp(be)||Je(w,be)&&be.blur()},[k,w]),Pe(()=>{if(!(r||!B))return B.setFocusManagerState({modal:f,closeOnFocusOut:p,open:k,onOpenChange:j.setOpen,domReference:C}),()=>{B.setFocusManagerState(null)}},[r,B,f,k,j,p,C]),Pe(()=>{if(!(r||!F))return ok(F),()=>{queueMicrotask(g_)}},[r,F]);const le=!r&&(f?!z:!0)&&(pe||f);return n.jsxs(x.Fragment,{children:[le&&n.jsx(al,{"data-type":"inside",ref:K,onFocus:be=>{if(f){const ke=oe();lf(ke[ke.length-1])}else B?.portalNode&&(q.current=!1,Xi(be,B.portalNode)?c_(C)?.focus():Xa(b??B.beforeOutsideRef)?.focus())}}),a,le&&n.jsx(al,{"data-type":"inside",ref:J,onFocus:be=>{f?lf(oe()[0]):B?.portalNode&&(p&&(q.current=!0),Xi(be,B.portalNode)?rC(C)?.focus():Xa(h??B.afterOutsideRef)?.focus())}})]})}function jC(e,t={}){const{enabled:a=!0,event:r="click",toggle:i=!0,ignoreMouse:l=!1,stickIfOpen:d=!0,touchOpenDelay:f=0,reason:p=_l}=t,g="rootStore"in e?e.rootStore:e,h=g.context.dataRef,b=x.useRef(void 0),_=sl(),y=Tn(),S=x.useMemo(()=>{function j(C,w,E,R){const T=rt(p,w,E);C&&R==="touch"&&f>0?y.start(f,()=>{g.setOpen(!0,T)}):g.setOpen(C,T)}function k(C,w,E){const R=h.current.openEvent,T=g.select("domReferenceElement")!==w;return C&&T||!C||!i?!0:R&&d?!E(R.type):!1}return{onPointerDown(C){b.current=Fr(C.pointerType,!0)&&Wb(C.nativeEvent)?"virtual":C.pointerType},onMouseDown(C){const w=b.current,E=C.nativeEvent,R=g.select("open");if(C.button!==0||r==="click"||Fr(w,!0)&&l)return;const T=k(R,C.currentTarget,M=>M==="click"||M==="mousedown"),A=Hn(E);if(dp(A)){j(T,E,A,w);return}const z=C.currentTarget;_.request(()=>{j(T,E,z,w)})},onClick(C){if(r==="mousedown-only")return;const w=b.current;if(r==="mousedown"&&w){b.current=void 0;return}if(Fr(w,!0)&&l)return;const E=g.select("open"),R=k(E,C.currentTarget,T=>T==="click"||T==="mousedown"||T==="keydown"||T==="keyup");j(R,C.nativeEvent,C.currentTarget,w)},onKeyDown(){b.current=void 0}}},[h,r,l,p,g,d,i,_,y,f]);return x.useMemo(()=>a?{reference:S}:sn,[a,S])}function lO(e,t){let a=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){const l=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},d=t.axis==="x"||t.axis==="both",f=t.axis==="y"||t.axis==="both",p=["mouseenter","mousemove"].includes(t.dataRef.current.openEvent?.type||"")&&t.pointerType!=="touch";let g=l.width,h=l.height,b=l.x,_=l.y;return a==null&&t.x&&d&&(a=l.x-t.x),r==null&&t.y&&f&&(r=l.y-t.y),b-=a||0,_-=r||0,g=0,h=0,!i||p?(g=t.axis==="y"?l.width:0,h=t.axis==="x"?l.height:0,b=d&&t.x!=null?t.x:b,_=f&&t.y!=null?t.y:_):i&&!p&&(h=t.axis==="x"?l.height:h,g=t.axis==="y"?l.width:g),i=!0,{width:g,height:h,x:b,y:_,top:_,right:b+g,bottom:_+h,left:b}}}}function ik(e){return e!=null&&e.clientX!=null}function cO(e,t={}){const{enabled:a=!0,axis:r="both"}=t,i="rootStore"in e?e.rootStore:e,l=i.useState("open"),d=i.useState("floatingElement"),f=i.useState("domReferenceElement"),p=i.context.dataRef,g=x.useRef(!1),h=x.useRef(null),[b,_]=x.useState(),[y,S]=x.useState([]),j=Ve(R=>{i.set("positionReference",R)}),k=Ve((R,T,A)=>{g.current||p.current.openEvent&&!ik(p.current.openEvent)||i.set("positionReference",lO(A??f,{x:R,y:T,axis:r,dataRef:p,pointerType:b}))}),C=Ve(R=>{l?h.current||(k(R.clientX,R.clientY,R.currentTarget),S([])):k(R.clientX,R.clientY,R.currentTarget)}),w=Fr(b)?d:l;x.useEffect(()=>{if(!a){j(f);return}if(!w)return;function R(){h.current?.(),h.current=null}const T=Jt(d);function A(z){const M=Hn(z);Je(d,M)?R():k(z.clientX,z.clientY)}return!p.current.openEvent||ik(p.current.openEvent)?h.current=xt(T,"mousemove",A):j(f),R},[w,a,d,p,f,i,k,j,y]),x.useEffect(()=>()=>{i.set("positionReference",null)},[i]),x.useEffect(()=>{a&&!d&&(g.current=!1)},[a,d]),x.useEffect(()=>{!a&&l&&(g.current=!0)},[a,l]);const E=x.useMemo(()=>{function R(T){_(T.pointerType)}return{onPointerDown:R,onPointerEnter:R,onMouseMove:C,onMouseEnter:C}},[C]);return x.useMemo(()=>a?{reference:E,trigger:E}:{},[a,E])}function uO(){return!1}function dO(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function gp(e,t={}){const{enabled:a=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:l="sloppy",referencePress:d=uO,bubbles:f,externalTree:p}=t,g="rootStore"in e?e.rootStore:e,h=g.useState("open"),b=g.useState("floatingElement"),{dataRef:_}=g.context,y=so(p),S=Ve(typeof i=="function"?i:()=>!1),j=typeof i=="function"?S:i,k=j!==!1,C=Ve(()=>l),{escapeKey:w,outsidePress:E}=dO(f),R=x.useRef(!1),T=x.useRef(!1),A=x.useRef(!1),z=x.useRef(!1),M=x.useRef(""),D=x.useRef(null),L=Tn(),I=Tn(),P=Ve(()=>{I.clear(),_.current.insideReactTree=!1}),B=Ve(K=>{const J=_.current.floatingContext?.nodeId;return(y?Zr(y.nodesRef.current,J):[]).some(te=>te.context?.open&&!te.context.dataRef.current[K])}),q=Ve(K=>rh(K,g.select("floatingElement"))||rh(K,g.select("domReferenceElement"))),Y=Ve(K=>{d()&&g.setOpen(!1,rt(_l,K.nativeEvent))}),U=Ve(K=>{if(!h||!a||!r||K.key!=="Escape"||z.current||!w&&B("__escapeKeyBubbles"))return;const J=X4(K)?K.nativeEvent:K,G=rt(pp,J);g.setOpen(!1,G),G.isCanceled||K.preventDefault(),!w&&!G.isPropagationAllowed&&K.stopPropagation()}),V=Ve(()=>{_.current.insideReactTree=!0,I.start(0,P)}),X=Ve(K=>{if(!h||!a||K.button!==0)return;const J=Hn(K.nativeEvent);Je(g.select("floatingElement"),J)&&(R.current||(R.current=!0,T.current=!1))}),Q=Ve(K=>{!h||!a||(K.defaultPrevented||K.nativeEvent.defaultPrevented)&&R.current&&(T.current=!0)});x.useEffect(()=>{if(!h||!a)return P;_.current.__escapeKeyBubbles=w,_.current.__outsidePressBubbles=E;const K=new ta,J=new ta;function G(){K.clear(),z.current=!0}function te(){K.start(ur?5:0,()=>{z.current=!1})}function se(){A.current=!0,J.start(0,()=>{A.current=!1})}function pe(){R.current=!1,T.current=!1}function F(){const ge=M.current,de=ge==="pen"||!ge?"mouse":ge,Le=C(),ye=typeof Le=="function"?Le():Le;return typeof ye=="string"?ye:ye[de]}function oe(ge){const de=F();return de==="intentional"&&ge.type!=="click"||de==="sloppy"&&ge.type==="click"}function _e(ge){const de=_.current.floatingContext?.nodeId,Le=y&&Zr(y.nodesRef.current,de).some(ye=>rh(ge,ye.context?.elements.floating));return q(ge)||Le}function le(ge){if(oe(ge)){ge.type!=="click"&&!q(ge)&&(J.clear(),A.current=!1),P();return}if(_.current.insideReactTree){P();return}const de=Hn(ge),Le=`[${Vc("inert")}]`,ye=bt(de)?de.getRootNode():null,Ne=Array.from((nl(ye)?ye:vt(g.select("floatingElement"))).querySelectorAll(Le)),We=g.context.triggerElements;if(de&&(We.hasElement(de)||We.hasMatchingElement(it=>Je(it,de))))return;let Ge=bt(de)?de:null;for(;Ge&&!tr(Ge);){const it=or(Ge);if(tr(it)||!bt(it))break;Ge=it}if(!(Ne.length&&bt(de)&&!tz(de)&&!Je(de,g.select("floatingElement"))&&Ne.every(it=>!Je(Ge,it)))){if(Yt(de)&&!("touches"in ge)){const it=tr(de),Tt=Ns(de),_t=/auto|scroll/,Ct=it||_t.test(Tt.overflowX),je=it||_t.test(Tt.overflowY),ze=Ct&&de.clientWidth>0&&de.scrollWidth>de.clientWidth,Ye=je&&de.clientHeight>0&&de.scrollHeight>de.clientHeight,Ze=Tt.direction==="rtl",ft=Ye&&(Ze?ge.offsetX<=de.offsetWidth-de.clientWidth:ge.offsetX>de.clientWidth),Rt=ze&&ge.offsetY>de.clientHeight;if(ft||Rt)return}if(!_e(ge)){if(F()==="intentional"&&A.current){J.clear(),A.current=!1;return}typeof j=="function"&&!j(ge)||B("__outsidePressBubbles")||(g.setOpen(!1,rt(fp,ge)),P())}}}function be(ge){F()!=="sloppy"||ge.pointerType==="touch"||!g.select("open")||!a||q(ge)||le(ge)}function ke(ge){if(F()!=="sloppy"||!g.select("open")||!a||q(ge))return;const de=ge.touches[0];de&&(D.current={startTime:Date.now(),startX:de.clientX,startY:de.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},L.start(1e3,()=>{D.current&&(D.current.dismissOnTouchEnd=!1,D.current.dismissOnMouseDown=!1)}))}function Re(ge,de){const Le=Hn(ge);if(!Le)return;const ye=xt(Le,ge.type,()=>{de(ge),ye()})}function Ae(ge){M.current="touch",Re(ge,ke)}function Ie(ge){L.clear(),ge.type==="pointerdown"&&(M.current=ge.pointerType),!(ge.type==="mousedown"&&D.current&&!D.current.dismissOnMouseDown)&&Re(ge,de=>{de.type==="pointerdown"?be(de):le(de)})}function Oe(ge){if(!R.current)return;const de=T.current;if(pe(),F()==="intentional"){if(ge.type==="pointercancel"){de&&se();return}if(!_e(ge)){if(de){se();return}typeof j=="function"&&!j(ge)||(J.clear(),A.current=!0,P())}}}function Te(ge){if(F()!=="sloppy"||!D.current||q(ge))return;const de=ge.touches[0];if(!de)return;const Le=Math.abs(de.clientX-D.current.startX),ye=Math.abs(de.clientY-D.current.startY),Ne=Math.sqrt(Le*Le+ye*ye);Ne>5&&(D.current.dismissOnTouchEnd=!0),Ne>10&&(le(ge),L.clear(),D.current=null)}function Ee(ge){Re(ge,Te)}function Me(ge){F()!=="sloppy"||!D.current||q(ge)||(D.current.dismissOnTouchEnd&&le(ge),L.clear(),D.current=null)}function De(ge){Re(ge,Me)}const He=vt(b),Qe=_a(r&&_a(xt(He,"keydown",U),xt(He,"compositionstart",G),xt(He,"compositionend",te)),k&&_a(xt(He,"click",Ie,!0),xt(He,"pointerdown",Ie,!0),xt(He,"pointerup",Oe,!0),xt(He,"pointercancel",Oe,!0),xt(He,"mousedown",Ie,!0),xt(He,"mouseup",Oe,!0),xt(He,"touchstart",Ae,!0),xt(He,"touchmove",Ee,!0),xt(He,"touchend",De,!0)));return()=>{Qe(),K.clear(),J.clear(),pe(),A.current=!1,P()}},[_,b,r,k,j,h,a,w,E,U,P,C,B,q,y,g,L]);const W=x.useMemo(()=>({onKeyDown:U,onPointerDown:Y,onClick:Y}),[U,Y]),$=x.useMemo(()=>({onKeyDown:U,onPointerDown:Q,onMouseDown:Q,onClickCapture:V,onMouseDownCapture(K){V(),X(K)},onPointerDownCapture(K){V(),X(K)},onMouseUpCapture:V,onTouchEndCapture:V,onTouchMoveCapture:V}),[U,V,X,Q]);return x.useMemo(()=>a?{reference:W,floating:$,trigger:W}:{},[a,W,$])}function lk(e,t,a){let{reference:r,floating:i}=e;const l=Hs(t),d=i_(t),f=o_(d),p=Vs(t),g=l==="y",h=r.x+r.width/2-i.width/2,b=r.y+r.height/2-i.height/2,_=r[f]/2-i[f]/2;let y;switch(p){case"top":y={x:h,y:r.y-i.height};break;case"bottom":y={x:h,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:b};break;case"left":y={x:r.x-i.width,y:b};break;default:y={x:r.x,y:r.y}}const S=to(t);return S&&(y[d]+=_*(S==="end"?1:-1)*(a&&g?-1:1)),y}async function fO(e,t){var a;t===void 0&&(t={});const{x:r,y:i,platform:l,rects:d,elements:f,strategy:p}=e,{boundary:g="clippingAncestors",rootBoundary:h="viewport",elementContext:b="floating",altBoundary:_=!1,padding:y=0}=Wr(t,e),S=QS(y),k=f[_?b==="floating"?"reference":"floating":b],C=Hc(await l.getClippingRect({element:(a=await(l.isElement==null?void 0:l.isElement(k)))==null||a?k:k.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(f.floating)),boundary:g,rootBoundary:h,strategy:p})),w=b==="floating"?{x:r,y:i,width:d.floating.width,height:d.floating.height}:d.reference,E=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f.floating)),R=await(l.isElement==null?void 0:l.isElement(E))&&await(l.getScale==null?void 0:l.getScale(E))||{x:1,y:1},T=Hc(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:w,offsetParent:E,strategy:p}):w);return{top:(C.top-T.top+S.top)/R.y,bottom:(T.bottom-C.bottom+S.bottom)/R.y,left:(C.left-T.left+S.left)/R.x,right:(T.right-C.right+S.right)/R.x}}const pO=50,mO=async(e,t,a)=>{const{placement:r="bottom",strategy:i="absolute",middleware:l=[],platform:d}=a,f=d.detectOverflow?d:{...d,detectOverflow:fO},p=await(d.isRTL==null?void 0:d.isRTL(t));let g=await d.getElementRects({reference:e,floating:t,strategy:i}),{x:h,y:b}=lk(g,r,p),_=r,y=0;const S={};for(let j=0;j<l.length;j++){const k=l[j];if(!k)continue;const{name:C,fn:w}=k,{x:E,y:R,data:T,reset:A}=await w({x:h,y:b,initialPlacement:r,placement:_,strategy:i,middlewareData:S,rects:g,platform:f,elements:{reference:e,floating:t}});h=E??h,b=R??b,S[C]={...S[C],...T},A&&y<pO&&(y++,typeof A=="object"&&(A.placement&&(_=A.placement),A.rects&&(g=A.rects===!0?await d.getElementRects({reference:e,floating:t,strategy:i}):A.rects),{x:h,y:b}=lk(g,_,p)),j=-1)}return{x:h,y:b,placement:_,strategy:i,middlewareData:S}},gO=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var a,r;const{placement:i,middlewareData:l,rects:d,initialPlacement:f,platform:p,elements:g}=t,{mainAxis:h=!0,crossAxis:b=!0,fallbackPlacements:_,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:j=!0,...k}=Wr(e,t);if((a=l.arrow)!=null&&a.alignmentOffset)return{};const C=Vs(i),w=Hs(f),E=Vs(f)===f,R=await(p.isRTL==null?void 0:p.isRTL(g.floating)),T=_||(E||!j?[jf(f)]:yz(f)),A=S!=="none";!_&&A&&T.push(...Sz(f,j,S,R));const z=[f,...T],M=await p.detectOverflow(t,k),D=[];let L=((r=l.flip)==null?void 0:r.overflows)||[];if(h&&D.push(M[C]),b){const q=vz(i,d,R);D.push(M[q[0]],M[q[1]])}if(L=[...L,{placement:i,overflows:D}],!D.every(q=>q<=0)){var I,P;const q=(((I=l.flip)==null?void 0:I.index)||0)+1,Y=z[q];if(Y&&(!(b==="alignment"?w!==Hs(Y):!1)||L.every(X=>Hs(X.placement)===w?X.overflows[0]>0:!0)))return{data:{index:q,overflows:L},reset:{placement:Y}};let U=(P=L.filter(V=>V.overflows[0]<=0).sort((V,X)=>V.overflows[1]-X.overflows[1])[0])==null?void 0:P.placement;if(!U)switch(y){case"bestFit":{var B;const V=(B=L.filter(X=>{if(A){const Q=Hs(X.placement);return Q===w||Q==="y"}return!0}).map(X=>[X.placement,X.overflows.filter(Q=>Q>0).reduce((Q,W)=>Q+W,0)]).sort((X,Q)=>X[1]-Q[1])[0])==null?void 0:B[0];V&&(U=V);break}case"initialPlacement":U=f;break}if(i!==U)return{reset:{placement:U}}}return{}}}},kC=new Set(["left","top"]);async function hO(e,t){const{placement:a,platform:r,elements:i}=e,l=await(r.isRTL==null?void 0:r.isRTL(i.floating)),d=Vs(a),f=to(a),p=Hs(a)==="y",g=kC.has(d)?-1:1,h=l&&p?-1:1,b=Wr(t,e);let{mainAxis:_,crossAxis:y,alignmentAxis:S}=typeof b=="number"?{mainAxis:b,crossAxis:0,alignmentAxis:null}:{mainAxis:b.mainAxis||0,crossAxis:b.crossAxis||0,alignmentAxis:b.alignmentAxis};return f&&typeof S=="number"&&(y=f==="end"?S*-1:S),p?{x:y*h,y:_*g}:{x:_*g,y:y*h}}const xO=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var a,r;const{x:i,y:l,placement:d,middlewareData:f}=t,p=await hO(t,e);return d===((a=f.offset)==null?void 0:a.placement)&&(r=f.arrow)!=null&&r.alignmentOffset?{}:{x:i+p.x,y:l+p.y,data:{...p,placement:d}}}}},bO=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:a,y:r,placement:i,platform:l}=t,{mainAxis:d=!0,crossAxis:f=!1,limiter:p={fn:w=>{let{x:E,y:R}=w;return{x:E,y:R}}},...g}=Wr(e,t),h={x:a,y:r},b=await l.detectOverflow(t,g),_=Hs(i),y=r_(_);let S=h[y],j=h[_];const k=(w,E)=>XS(E+b[w==="y"?"top":"left"],E,E-b[w==="y"?"bottom":"right"]);d&&(S=k(y,S)),f&&(j=k(_,j));const C=p.fn({...t,[y]:S,[_]:j});return{...C,data:{x:C.x-a,y:C.y-r,enabled:{[y]:d,[_]:f}}}}}},_O=function(e){return e===void 0&&(e={}),{options:e,fn(t){var a,r;const{x:i,y:l,placement:d,rects:f,middlewareData:p}=t,{offset:g=0,mainAxis:h=!0,crossAxis:b=!0}=Wr(e,t),_={x:i,y:l},y=Hs(d),S=r_(y);let j=_[S],k=_[y];const C=Wr(g,t),w=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:(a=C.mainAxis)!=null?a:0,crossAxis:(r=C.crossAxis)!=null?r:0};if(h){const T=S==="y"?"height":"width",A=f.reference[S]-f.floating[T]+w.mainAxis,z=f.reference[S]+f.reference[T]-w.mainAxis;j<A?j=A:j>z&&(j=z)}if(b){var E,R;const T=S==="y"?"width":"height",A=kC.has(Vs(d)),z=f.reference[y]-f.floating[T]+(A&&((E=p.offset)==null?void 0:E[y])||0)+(A?0:w.crossAxis),M=f.reference[y]+f.reference[T]+(A?0:((R=p.offset)==null?void 0:R[y])||0)-(A?w.crossAxis:0);k<z?k=z:k>M&&(k=M)}return{[S]:j,[y]:k}}}},vO=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:a,rects:r,platform:i,elements:l}=t,{apply:d=()=>{},...f}=Wr(e,t),p=await i.detectOverflow(t,f),g=Vs(a),h=to(a),b=Hs(a)==="y",{width:_,height:y}=r.floating;let S,j;g==="top"||g==="bottom"?(S=g,j=h===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(j=g,S=h==="end"?"top":"bottom");const k=y-p.top-p.bottom,C=_-p.left-p.right,w=rl(y-p[S],k),E=rl(_-p[j],C),R=t.middlewareData.shift,T=!R;let A=w,z=E;R!=null&&R.enabled.x&&(z=C),R!=null&&R.enabled.y&&(A=k),T&&!h&&(b?z=_-2*nr(p.left,p.right):A=y-2*nr(p.top,p.bottom)),await d({...t,availableWidth:z,availableHeight:A});const M=await i.getDimensions(l.floating);return _!==M.width||y!==M.height?{reset:{rects:!0}}:{}}}};function wC(e){const t=Ns(e);let a=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Yt(e),l=i?e.offsetWidth:a,d=i?e.offsetHeight:r,f=yf(a)!==l||yf(r)!==d;return f&&(a=l,r=d),{width:a,height:r,$:f}}function x_(e){return bt(e)?e:e.contextElement}function Qi(e){const t=x_(e);if(!Yt(t))return sr(1);const a=t.getBoundingClientRect(),{width:r,height:i,$:l}=wC(t);let d=(l?yf(a.width):a.width)/r,f=(l?yf(a.height):a.height)/i;return(!d||!Number.isFinite(d))&&(d=1),(!f||!Number.isFinite(f))&&(f=1),{x:d,y:f}}const yO=sr(0);function SC(e){const t=Jt(e);return!e_()||!t.visualViewport?yO:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function jO(e,t,a){return t===void 0&&(t=!1),!!a&&t&&a===Jt(e)}function Io(e,t,a,r){t===void 0&&(t=!1),a===void 0&&(a=!1);const i=e.getBoundingClientRect(),l=x_(e);let d=sr(1);t&&(r?bt(r)&&(d=Qi(r)):d=Qi(e));const f=jO(l,a,r)?SC(l):sr(0);let p=(i.left+f.x)/d.x,g=(i.top+f.y)/d.y,h=i.width/d.x,b=i.height/d.y;if(l&&r){const _=Jt(l),y=bt(r)?Jt(r):r;let S=_,j=Sx(S);for(;j&&y!==S;){const k=Qi(j),C=j.getBoundingClientRect(),w=Ns(j),E=C.left+(j.clientLeft+parseFloat(w.paddingLeft))*k.x,R=C.top+(j.clientTop+parseFloat(w.paddingTop))*k.y;p*=k.x,g*=k.y,h*=k.x,b*=k.y,p+=E,g+=R,S=Jt(j),j=Sx(S)}}return Hc({width:h,height:b,x:p,y:g})}function hp(e,t){const a=lp(e).scrollLeft;return t?t.left+a:Io(dr(e)).left+a}function CC(e,t){const a=e.getBoundingClientRect(),r=a.left+t.scrollLeft-hp(e,a),i=a.top+t.scrollTop;return{x:r,y:i}}function kO(e){let{elements:t,rect:a,offsetParent:r,strategy:i}=e;const l=i==="fixed",d=dr(r),f=t?ip(t.floating):!1;if(r===d||f&&l)return a;let p={scrollLeft:0,scrollTop:0},g=sr(1);const h=sr(0),b=Yt(r);if((b||!l)&&((Fn(r)!=="body"||au(d))&&(p=lp(r)),b)){const y=Io(r);g=Qi(r),h.x=y.x+r.clientLeft,h.y=y.y+r.clientTop}const _=d&&!b&&!l?CC(d,p):sr(0);return{width:a.width*g.x,height:a.height*g.y,x:a.x*g.x-p.scrollLeft*g.x+h.x+_.x,y:a.y*g.y-p.scrollTop*g.y+h.y+_.y}}function wO(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function SO(e){const t=lp(e),a=e.ownerDocument.body,r=nr(e.scrollWidth,e.clientWidth,a.scrollWidth,a.clientWidth),i=nr(e.scrollHeight,e.clientHeight,a.scrollHeight,a.clientHeight);let l=-t.scrollLeft+hp(e);const d=-t.scrollTop;return Ns(a).direction==="rtl"&&(l+=nr(e.clientWidth,a.clientWidth)-r),{width:r,height:i,x:l,y:d}}const CO=25;function NO(e,t,a){a===void 0&&(a="viewport");const r=a==="layoutViewport",i=Jt(e),l=dr(e),d=i.visualViewport;let f=l.clientWidth,p=l.clientHeight,g=0,h=0;if(d){const _=!e_()||t==="fixed";r?_||(g=-d.offsetLeft,h=-d.offsetTop):(f=d.width,p=d.height,_&&(g=d.offsetLeft,h=d.offsetTop))}if(hp(l)<=0){const _=l.ownerDocument,y=_.body,S=getComputedStyle(y),j=_.compatMode==="CSS1Compat"&&parseFloat(S.marginLeft)+parseFloat(S.marginRight)||0,k=Math.abs(l.clientWidth-y.clientWidth-j),C=getComputedStyle(l).scrollbarGutter==="stable both-edges"?k/2:k;C<=CO&&(f-=C)}return{width:f,height:p,x:g,y:h}}function EO(e,t){const a=Io(e,!0,t==="fixed"),r=a.top+e.clientTop,i=a.left+e.clientLeft,l=Qi(e),d=e.clientWidth*l.x,f=e.clientHeight*l.y,p=i*l.x,g=r*l.y;return{width:d,height:f,x:p,y:g}}function ck(e,t,a){let r;if(t==="viewport"||t==="layoutViewport")r=NO(e,a,t);else if(t==="document")r=SO(dr(e));else if(bt(t))r=EO(t,a);else{const i=SC(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Hc(r)}function RO(e,t){const a=t.get(e);if(a)return a;let r=qc(e,[],!1).filter(f=>bt(f)&&Fn(f)!=="body"),i=null;const l=Ns(e).position==="fixed";let d=l?or(e):e;for(;bt(d)&&!tr(d);){const f=Ns(d),p=Jb(d),g=i?i.position:l?"fixed":"";!p&&(g==="fixed"||g==="absolute"&&f.position==="static")?r=r.filter(b=>b!==d):i=f,d=or(d)}return t.set(e,r),r}function TO(e){let{element:t,boundary:a,rootBoundary:r,strategy:i}=e;const d=[...a==="clippingAncestors"?ip(t)?[]:RO(t,this._c):[].concat(a),r],f=ck(t,d[0],i);let p=f.top,g=f.right,h=f.bottom,b=f.left;for(let _=1;_<d.length;_++){const y=ck(t,d[_],i);p=nr(y.top,p),g=rl(y.right,g),h=rl(y.bottom,h),b=nr(y.left,b)}return{width:g-b,height:h-p,x:b,y:p}}function AO(e){const{width:t,height:a}=wC(e);return{width:t,height:a}}function MO(e,t,a){const r=Yt(t),i=dr(t),l=a==="fixed",d=Io(e,!0,l,t);let f={scrollLeft:0,scrollTop:0};const p=sr(0);if((r||!l)&&((Fn(t)!=="body"||au(i))&&(f=lp(t)),r)){const _=Io(t,!0,l,t);p.x=_.x+t.clientLeft,p.y=_.y+t.clientTop}!r&&i&&(p.x=hp(i));const g=i&&!r&&!l?CC(i,f):sr(0),h=d.left+f.scrollLeft-p.x-g.x,b=d.top+f.scrollTop-p.y-g.y;return{x:h,y:b,width:d.width,height:d.height}}function uh(e){return Ns(e).position==="static"}function uk(e,t){if(!Yt(e)||Ns(e).position==="fixed")return null;if(t)return t(e);let a=e.offsetParent;return dr(e)===a&&(a=a.ownerDocument.body),a}function NC(e,t){const a=Jt(e);if(ip(e))return a;if(!Yt(e)){let i=or(e);for(;i&&!tr(i);){if(bt(i)&&!uh(i))return i;i=or(i)}return a}let r=uk(e,t);for(;r&&W4(r)&&uh(r);)r=uk(r,t);return r&&tr(r)&&uh(r)&&!Jb(r)?a:r||ez(e)||a}const zO=async function(e){const t=this.getOffsetParent||NC,a=this.getDimensions,r=await a(e.floating);return{reference:MO(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function OO(e){return Ns(e).direction==="rtl"}const EC={convertOffsetParentRelativeRectToViewportRelativeRect:kO,getDocumentElement:dr,getClippingRect:TO,getOffsetParent:NC,getElementRects:zO,getClientRects:wO,getDimensions:AO,getScale:Qi,isElement:bt,isRTL:OO};function RC(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function DO(e,t,a){let r=null,i;const l=dr(e);function d(){var h;clearTimeout(i),(h=r)==null||h.disconnect(),r=null}function f(h,b){h===void 0&&(h=!1),b===void 0&&(b=1),d();const _=e.getBoundingClientRect(),{left:y,top:S,width:j,height:k}=_;if(h||t(),!j||!k)return;const C=Md(S),w=Md(l.clientWidth-(y+j)),E=Md(l.clientHeight-(S+k)),R=Md(y),A={rootMargin:-C+"px "+-w+"px "+-E+"px "+-R+"px",threshold:nr(0,rl(1,b))||1};let z=!0;function M(D){const L=D[0].intersectionRatio;if(!RC(_,e.getBoundingClientRect()))return f();if(L!==b){if(!z)return f();L?f(!1,L):i=setTimeout(()=>{f(!1,1e-7)},1e3)}z=!1}try{r=new IntersectionObserver(M,{...A,root:l.ownerDocument})}catch{r=new IntersectionObserver(M,A)}r.observe(e)}const p=Jt(e),g=()=>f(a);return p.addEventListener("resize",g),f(!0),()=>{p.removeEventListener("resize",g),d()}}function dk(e,t,a,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:l=!0,elementResize:d=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:p=!1}=r,g=x_(e),h=i||l?[...g?qc(g):[],...t?qc(t):[]]:[];h.forEach(C=>{i&&C.addEventListener("scroll",a),l&&C.addEventListener("resize",a)});const b=g&&f?DO(g,a,l):null;let _=-1,y=null;d&&(y=new ResizeObserver(C=>{let[w]=C;w&&w.target===g&&y&&t&&(y.unobserve(t),cancelAnimationFrame(_),_=requestAnimationFrame(()=>{var E;(E=y)==null||E.observe(t)})),a()}),g&&!p&&y.observe(g),t&&y.observe(t));let S,j=p?Io(e):null;p&&k();function k(){const C=Io(e);j&&!RC(j,C)&&a(),j=C,S=requestAnimationFrame(k)}return a(),()=>{var C;h.forEach(w=>{i&&w.removeEventListener("scroll",a),l&&w.removeEventListener("resize",a)}),b?.(),(C=y)==null||C.disconnect(),y=null,p&&cancelAnimationFrame(S)}}const PO=xO,LO=bO,IO=gO,$O=vO,BO=_O,UO=(e,t,a)=>{const r=new Map,i=a??{},l={...EC,...i.platform,_c:r};return mO(e,t,{...i,platform:l})};var qO=typeof document<"u",HO=function(){},cf=qO?x.useLayoutEffect:HO;function Cf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let a,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(a=e.length,a!==t.length)return!1;for(r=a;r--!==0;)if(!Cf(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),a=i.length,a!==Object.keys(t).length)return!1;for(r=a;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=a;r--!==0;){const l=i[r];if(!(l==="_owner"&&e.$$typeof)&&!Cf(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function TC(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function fk(e,t){const a=TC(e);return Math.round(t*a)/a}function dh(e){const t=x.useRef(e);return cf(()=>{t.current=e}),t}function VO(e){e===void 0&&(e={});const{placement:t="bottom",strategy:a="absolute",middleware:r=[],platform:i,elements:{reference:l,floating:d}={},transform:f=!0,whileElementsMounted:p,open:g}=e,[h,b]=x.useState({x:0,y:0,strategy:a,placement:t,middlewareData:{},isPositioned:!1}),[_,y]=x.useState(r);Cf(_,r)||y(r);const[S,j]=x.useState(null),[k,C]=x.useState(null),w=x.useCallback(X=>{X!==A.current&&(A.current=X,j(X))},[]),E=x.useCallback(X=>{X!==z.current&&(z.current=X,C(X))},[]),R=l||S,T=d||k,A=x.useRef(null),z=x.useRef(null),M=x.useRef(h),D=p!=null,L=dh(p),I=dh(i),P=dh(g),B=x.useCallback(()=>{if(!A.current||!z.current)return;const X={placement:t,strategy:a,middleware:_};I.current&&(X.platform=I.current),UO(A.current,z.current,X).then(Q=>{const W={...Q,isPositioned:P.current!==!1};q.current&&!Cf(M.current,W)&&(M.current=W,Gs.flushSync(()=>{b(W)}))})},[_,t,a,I,P]);cf(()=>{g===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,b(X=>({...X,isPositioned:!1})))},[g]);const q=x.useRef(!1);cf(()=>(q.current=!0,()=>{q.current=!1}),[]),cf(()=>{if(R&&(A.current=R),T&&(z.current=T),R&&T){if(L.current)return L.current(R,T,B);B()}},[R,T,B,L,D]);const Y=x.useMemo(()=>({reference:A,floating:z,setReference:w,setFloating:E}),[w,E]),U=x.useMemo(()=>({reference:R,floating:T}),[R,T]),V=x.useMemo(()=>{const X={position:a,left:0,top:0};if(!U.floating)return X;const Q=fk(U.floating,h.x),W=fk(U.floating,h.y);return f?{...X,transform:"translate("+Q+"px, "+W+"px)",...TC(U.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:Q,top:W}},[a,f,U.floating,h.x,h.y]);return x.useMemo(()=>({...h,update:B,refs:Y,elements:U,floatingStyles:V}),[h,B,Y,U,V])}const FO=(e,t)=>{const a=PO(e);return{name:a.name,fn:a.fn,options:[e,t]}},GO=(e,t)=>{const a=LO(e);return{name:a.name,fn:a.fn,options:[e,t]}},YO=(e,t)=>({fn:BO(e).fn,options:[e,t]}),KO=(e,t)=>{const a=IO(e);return{name:a.name,fn:a.fn,options:[e,t]}},XO=(e,t)=>{const a=$O(e);return{name:a.name,fn:a.fn,options:[e,t]}};var fh={exports:{}},ph={};/**
771
+ * @license React
772
+ * use-sync-external-store-shim.production.js
773
+ *
774
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
775
+ *
776
+ * This source code is licensed under the MIT license found in the
777
+ * LICENSE file in the root directory of this source tree.
778
+ */var pk;function QO(){if(pk)return ph;pk=1;var e=Wc();function t(b,_){return b===_&&(b!==0||1/b===1/_)||b!==b&&_!==_}var a=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,l=e.useLayoutEffect,d=e.useDebugValue;function f(b,_){var y=_(),S=r({inst:{value:y,getSnapshot:_}}),j=S[0].inst,k=S[1];return l(function(){j.value=y,j.getSnapshot=_,p(j)&&k({inst:j})},[b,y,_]),i(function(){return p(j)&&k({inst:j}),b(function(){p(j)&&k({inst:j})})},[b]),d(y),y}function p(b){var _=b.getSnapshot;b=b.value;try{var y=_();return!a(b,y)}catch{return!0}}function g(b,_){return _()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:f;return ph.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,ph}var mk;function AC(){return mk||(mk=1,fh.exports=QO()),fh.exports}var Fc=AC(),mh={exports:{}},gh={};/**
779
+ * @license React
780
+ * use-sync-external-store-shim/with-selector.production.js
781
+ *
782
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
783
+ *
784
+ * This source code is licensed under the MIT license found in the
785
+ * LICENSE file in the root directory of this source tree.
786
+ */var gk;function WO(){if(gk)return gh;gk=1;var e=Wc(),t=AC();function a(g,h){return g===h&&(g!==0||1/g===1/h)||g!==g&&h!==h}var r=typeof Object.is=="function"?Object.is:a,i=t.useSyncExternalStore,l=e.useRef,d=e.useEffect,f=e.useMemo,p=e.useDebugValue;return gh.useSyncExternalStoreWithSelector=function(g,h,b,_,y){var S=l(null);if(S.current===null){var j={hasValue:!1,value:null};S.current=j}else j=S.current;S=f(function(){function C(A){if(!w){if(w=!0,E=A,A=_(A),y!==void 0&&j.hasValue){var z=j.value;if(y(z,A))return R=z}return R=A}if(z=R,r(E,A))return z;var M=_(A);return y!==void 0&&y(z,M)?(E=A,z):(E=A,R=M)}var w=!1,E,R,T=b===void 0?null:b;return[function(){return C(h())},T===null?void 0:function(){return C(T())}]},[h,b,_,y]);var k=i(g,S[0],S[1]);return d(function(){j.hasValue=!0,j.value=k},[k]),p(k),k},gh}var hk;function ZO(){return hk||(hk=1,mh.exports=WO()),mh.exports}var JO=ZO();const e6=u_(19),t6=e6?s6:a6;function nt(e,t,a,r,i){return t6(e,t,a,r,i)}function n6(e,t,a,r,i){const l=x.useCallback(()=>t(e.getSnapshot(),a,r,i),[e,t,a,r,i]);return Fc.useSyncExternalStore(e.subscribe,l,l)}$4({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let a=0;a<e.syncHooks.length;a+=1){const r=e.syncHooks[a],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const a=new Set;for(const i of e.syncHooks)a.add(i.store);const r=[];for(const i of a)r.push(i.subscribe(t));return()=>{for(const i of r)i()}}),Fc.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function s6(e,t,a,r,i){const l=I4();if(!l)return n6(e,t,a,r,i);const d=l.syncIndex;l.syncIndex+=1;let f;return l.didInitialize?(f=l.syncHooks[d],(f.store!==e||f.selector!==t||!Object.is(f.a1,a)||!Object.is(f.a2,r)||!Object.is(f.a3,i))&&(f.store!==e&&(l.didChangeStore=!0),f.store=e,f.selector=t,f.a1=a,f.a2=r,f.a3=i,f.value=t(e.getSnapshot(),a,r,i))):(f={store:e,selector:t,a1:a,a2:r,a3:i,value:t(e.getSnapshot(),a,r,i)},l.syncHooks.push(f)),f.value}function a6(e,t,a,r,i){return JO.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,l=>t(l,a,r,i))}class r6{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const a=this.updateTick;for(const r of this.listeners){if(a!==this.updateTick)return;r(t)}}update(t){for(const a in t)if(!Object.is(this.state[a],t[a])){this.setState({...this.state,...t});return}}set(t,a){Object.is(this.state[t],a)||this.setState({...this.state,[t]:a})}notifyAll(){const t={...this.state};this.setState(t)}use(t,a,r,i){return nt(this,t,a,r,i)}}class ou extends r6{constructor(t,a={},r){super(t),this.context=a,this.selectors=r}useSyncedValue(t,a){x.useDebugValue(t);const r=this;Pe(()=>{r.state[t]!==a&&r.set(t,a)},[r,t,a])}useSyncedValueWithCleanup(t,a){const r=this;Pe(()=>(r.state[t]!==a&&r.set(t,a),()=>{r.set(t,void 0)}),[r,t,a])}useSyncedValues(t){const a=this,r=Object.values(t);Pe(()=>{a.update(t)},[a,...r])}useControlledProp(t,a){x.useDebugValue(t);const r=this,i=a!==void 0;Pe(()=>{i&&!Object.is(r.state[t],a)&&r.setState({...r.state,[t]:a})},[r,t,a,i])}select(t,a,r,i){const l=this.selectors[t];return l(this.state,a,r,i)}useState(t,a,r,i){return x.useDebugValue(t),nt(this,this.selectors[t],a,r,i)}useContextCallback(t,a){x.useDebugValue(t);const r=Ve(a??En);this.context[t]=r}useStateSetter(t){const a=x.useRef(void 0);return a.current===void 0&&(a.current=r=>{this.set(t,r)}),a.current}observe(t,a){let r;typeof t=="function"?r=t:r=this.selectors[t];let i=r(this.state);return a(i,i,this),this.subscribe(l=>{const d=r(l);if(!Object.is(i,d)){const f=i;i=d,a(d,f,this)}})}}const o6={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class xp extends ou{constructor(t){const{syncOnly:a,nested:r,onOpenChange:i,triggerElements:l,...d}=t;super({...d,positionReference:d.referenceElement,domReferenceElement:d.referenceElement},{onOpenChange:i,dataRef:{current:{}},events:bC(),nested:r,triggerElements:l},o6),this.syncOnly=a}syncOpenEvent=(t,a)=>{(!t||!this.state.open||a!=null&&Q4(a))&&(this.context.dataRef.current.openEvent=t?a:void 0)};dispatchOpenChange=(t,a)=>{this.syncOpenEvent(t,a.event);const r={open:t,reason:a.reason,nativeEvent:a.event,nested:this.context.nested,triggerElement:a.trigger};this.context.events.emit("openchange",r)};setOpen=(t,a)=>{if(this.syncOnly){this.context.onOpenChange?.(t,a);return}this.dispatchOpenChange(t,a),this.context.onOpenChange?.(t,a)}}function MC(e){const{popupStore:t,treatPopupAsFloatingElement:a=!1,floatingRootContext:r,floatingId:i,nested:l,onOpenChange:d}=e,f=t.useState("open"),p=t.useState("activeTriggerElement"),g=t.useState(a?"popupElement":"positionerElement"),h=t.context.triggerElements,b=d,_=x.useRef(null);r===void 0&&_.current===null&&(_.current=new xp({open:f,transitionStatus:void 0,referenceElement:p,floatingElement:g,triggerElements:h,onOpenChange:b,floatingId:i,syncOnly:!0,nested:l}));const y=r??_.current;return t.useSyncedValue("floatingId",i),Pe(()=>{const S={open:f,floatingId:i,referenceElement:p,floatingElement:g};bt(p)&&(S.domReferenceElement=p),y.state.positionReference===y.state.referenceElement&&(S.positionReference=p),y.update(S)},[f,i,p,g,y]),y.context.onOpenChange=b,y.context.nested=l,y}function vl(e,t=!1,a=!1){const[r,i]=x.useState(e&&t?"idle":void 0),[l,d]=x.useState(e);return e&&!l&&(d(!0),i("starting")),!e&&l&&r!=="ending"&&!a&&i("ending"),!e&&!l&&r==="ending"&&i(void 0),Pe(()=>{if(!e&&l&&r!=="ending"&&a){const f=ga.request(()=>{i("ending")});return()=>{ga.cancel(f)}}},[e,l,r,a]),Pe(()=>{if(!e||t)return;const f=ga.request(()=>{i(void 0)});return()=>{ga.cancel(f)}},[t,e]),Pe(()=>{if(!e||!t)return;e&&l&&r!=="idle"&&i("starting");const f=ga.request(()=>{i("idle")});return()=>{ga.cancel(f)}},[t,e,l,r]),{mounted:l,setMounted:d,transitionStatus:r}}function zC(e,t=!1){const a=sl();return Ve((r,i=null)=>{a.cancel();const l=Xa(e);if(l==null)return;const d=l,f=()=>{Gs.flushSync(r)};if(typeof d.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function p(){Promise.all(d.getAnimations().map(g=>g.finished)).then(()=>{i?.aborted||f()},()=>{if(i?.aborted)return;if(d.getAnimations().some(h=>h.pending||h.playState!=="finished")){p();return}f()})}if(t){const g="data-starting-style";if(!d.hasAttribute(g)){a.request(p);return}const h=new MutationObserver(()=>{d.hasAttribute(g)||(h.disconnect(),p())});h.observe(d,{attributes:!0,attributeFilter:[g]}),i?.addEventListener("abort",()=>h.disconnect(),{once:!0});return}a.request(p)})}function Ca(e){const{enabled:t=!0,open:a,ref:r,onComplete:i}=e,l=Ve(i),d=zC(r,a);x.useEffect(()=>{if(!t)return;const f=new AbortController;return d(l,f.signal),()=>{f.abort()}},[t,a,l,d])}const bp={tabIndex:-1,[Cx]:""};function i6(e){return t=>t==="touch"?e.current:!0}function OC(e,t=!1){const a=Lo(),r=no()!=null,i=Vn(()=>e(a,r)).current;return MC({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:a,nested:r,onOpenChange:i.setOpen}),i}function b_({handle:e,store:t}){return Pe(()=>e.attachStore(t),[e,t]),null}function l6(e,t){const a=x.useRef(null),r=x.useRef(null);return x.useCallback(i=>{if(e===void 0)return;let l=!1;if(a.current!==null){const d=a.current,f=r.current,p=t.context.triggerElements.getById(d);f&&p===f&&(t.context.triggerElements.delete(d),l=!0),a.current=null,r.current=null}if(i!==null&&(a.current=e,r.current=i,t.context.triggerElements.add(e,i),l=!0),l){const d=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==d&&t.set("triggerCount",d)}},[t,e])}function __(e,t,a,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);const i=a?.id??null;(i||t)&&(e.activeTriggerId=i,e.activeTriggerElement=a??null)}function DC(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function c6(e,t,a,r={}){const i=a.reason,l=i===Rn,d=t&&i===Yi,f=!t&&(i===_l||i===pp),p=DC(a);if(e.context.onOpenChange?.(t,a),a.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,a);const g=()=>{const h={...r.extraState,open:t};d?h.instantType="focus":f?h.instantType="dismiss":l&&(h.instantType=void 0),__(h,t,a.trigger,p()),e.update(h)};l?Gs.flushSync(g):g()}function PC(e,t,a,r){const i=a.useState("isMountedByTrigger",e),l=l6(e,a),d=Ve(p=>{const g=a.select("open"),h=a.select("activeTriggerId");if(h===e){a.update({activeTriggerElement:p,...g?r:null});return}h==null&&g&&a.update({activeTriggerId:e,activeTriggerElement:p,...r})}),f=x.useCallback(p=>{l(p),p&&d(p)},[l,d]);return Pe(()=>{i&&a.update({activeTriggerElement:t.current,...r})},[i,a,t,...Object.values(r)]),{registerTrigger:f,isMountedByThisTrigger:i}}function v_(e,t={}){const{closeOnActiveTriggerUnmount:a=!1}=t,r=x.useRef(null),i=e.useState("open"),l=e.useState("triggerCount"),d=e.useState("activeTriggerId"),f=e.useState("activeTriggerElement");Pe(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const p=e.context.triggerElements.size,g={};e.state.triggerCount!==p&&(g.triggerCount=p);const h=e.select("activeTriggerId");let b=null;if(h){const _=e.context.triggerElements.getById(h);if(_)r.current=h,_!==e.state.activeTriggerElement&&(g.activeTriggerElement=_);else{for(const[y,S]of e.context.triggerElements.entries())if(S===e.state.activeTriggerElement){g.activeTriggerId=y,g.activeTriggerElement=S,r.current=y;break}g.activeTriggerId===void 0&&(r.current===h?b=h:r.current=null)}}else r.current=null;if(!b&&!h&&p===1){const _=e.context.triggerElements.entries().next();if(!_.done){const[y,S]=_.value;g.activeTriggerId=y,g.activeTriggerElement=S,r.current=y}}(g.triggerCount!==void 0||g.activeTriggerId!==void 0||g.activeTriggerElement!==void 0)&&e.update(g),b&&a&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===b&&!e.context.triggerElements.getById(b)){const _=rt(ka);e.setOpen(!1,_),_.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,l,d,f,a])}function y_(e,t,a){const{mounted:r,setMounted:i,transitionStatus:l}=vl(e),d=t.useState("preventUnmountingOnClose"),f=e?!1:d;t.useSyncedValues({mounted:r,transitionStatus:l,preventUnmountingOnClose:f});const p=Ve(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),a?.(),t.context.onOpenChangeComplete?.(!1)});return Ca({enabled:r&&!e&&!f,open:e,ref:t.context.popupRef,onComplete(){e||p()}}),{forceUnmount:p,transitionStatus:l}}function j_(e,t){e.useSyncedValues(t),Pe(()=>()=>{e.update({activeTriggerProps:sn,inactiveTriggerProps:sn,popupProps:sn})},[e])}function u6(e,t){Pe(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),Pe(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class iu{constructor(){this.idMap=new Map}add(t,a){this.idMap.set(t,a)}delete(t){this.idMap.delete(t)}hasElement(t){for(const a of this.idMap.values())if(a===t)return!0;return!1}hasMatchingElement(t){for(const a of this.idMap.values())if(t(a))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function d6(){return new xp({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new iu,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function k_(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:d6(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:sn,inactiveTriggerProps:sn,popupProps:sn}}function LC(e,t,a=!1){return new xp({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:a,onOpenChange:void 0})}const Oc=e=>e.triggerIdProp??e.activeTriggerId,w_=e=>e.openProp??e.open,xk=e=>(e.popupElement?.id??e.floatingId)||void 0;function IC(e,t){return t!==void 0&&w_(e)&&Oc(e)===t}function f6(e,t){return IC(e,t)?!0:t!==void 0&&w_(e)&&Oc(e)==null&&e.triggerCount===1}const S_={open:w_,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Oc,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:xk,isTriggerActive:(e,t)=>t!==void 0&&Oc(e)===t,isOpenedByTrigger:(e,t)=>IC(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Oc(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>f6(e,t)?xk(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function $C(e){const t=x.useCallback(r=>e===void 0?En:e.subscribeStore(r),[e]),a=x.useCallback(()=>e===void 0?void 0:e.store,[e]);return Fc.useSyncExternalStore(t,a,()=>e?.serverStore)}function p6(e){const{open:t=!1,onOpenChange:a,elements:r={}}=e,i=Lo(),l=no()!=null,d=Vn(()=>new xp({open:t,transitionStatus:void 0,onOpenChange:a,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new iu,floatingId:i,syncOnly:!1,nested:l})).current;return Pe(()=>{const f={open:t,floatingId:i};r.reference!==void 0&&(f.referenceElement=r.reference,f.domReferenceElement=bt(r.reference)?r.reference:null),r.floating!==void 0&&(f.floatingElement=r.floating),d.update(f)},[t,i,r.reference,r.floating,d]),d.context.onOpenChange=a,d.context.nested=l,d}function m6(e){return g6(e,e.rootContext)}function g6(e,t){const{nodeId:a,externalTree:r}=e,i=t.useState("referenceElement"),l=t.useState("floatingElement"),d=t.useState("domReferenceElement"),f=t.useState("open"),p=t.useState("floatingId"),[g,h]=x.useState(null),[b,_]=x.useState(void 0),[y,S]=x.useState(void 0),j=x.useRef(null),k=so(r),C=x.useMemo(()=>({reference:i,floating:l,domReference:d}),[i,l,d]),w=VO({...e,elements:{...C,...g&&{reference:g}}}),E=bt(b)?b:null,R=y===void 0?t.state.floatingElement:y;t.useSyncedValue("referenceElement",b??null),t.useSyncedValue("domReferenceElement",b===void 0?d:E),t.useSyncedValue("floatingElement",R);const T=x.useCallback(I=>{const P=bt(I)?{getBoundingClientRect:()=>I.getBoundingClientRect(),getClientRects:()=>I.getClientRects(),contextElement:I}:I;h(P),w.refs.setReference(P)},[w.refs]),A=x.useCallback(I=>{(bt(I)||I===null)&&(j.current=I,_(I)),(bt(w.refs.reference.current)||w.refs.reference.current===null||I!==null&&!bt(I))&&w.refs.setReference(I)},[w.refs,_]),z=x.useCallback(I=>{S(I),w.refs.setFloating(I)},[w.refs]),M=x.useMemo(()=>({...w.refs,setReference:A,setFloating:z,setPositionReference:T,domReference:j}),[w.refs,A,z,T]),D=x.useMemo(()=>({...w.elements,domReference:d}),[w.elements,d]),L=x.useMemo(()=>({...w,dataRef:t.context.dataRef,open:f,onOpenChange:t.setOpen,events:t.context.events,floatingId:p,refs:M,elements:D,nodeId:a,rootStore:t}),[w,M,D,a,t,f,p]);return Pe(()=>{d&&(j.current=d)},[d]),Pe(()=>{t.context.dataRef.current.floatingContext=L;const I=k?.nodesRef.current.find(P=>P.id===a);I&&(I.context=L)}),x.useMemo(()=>({...w,context:L,refs:M,elements:D,rootStore:t}),[w,M,D,L,t])}const hh=Kb&&ur;function BC(e,t={}){const{enabled:a=!0,delay:r}=t,i="rootStore"in e?e.rootStore:e,{events:l,dataRef:d}=i.context,f=x.useRef(!1),p=x.useRef(null),g=x.useRef(!0),h=Tn();x.useEffect(()=>{const _=i.select("domReferenceElement");if(!a)return;const y=Jt(_);function S(){const C=i.select("domReferenceElement");!i.select("open")&&Yt(C)&&C===Xn(vt(C))&&(f.current=!0)}function j(){g.current=!0}function k(){g.current=!1}return _a(xt(y,"blur",S),hh&&xt(y,"keydown",j,!0),hh&&xt(y,"pointerdown",k,!0))},[i,a]),x.useEffect(()=>{if(!a)return;function _(y){if(y.reason===_l||y.reason===pp){const S=i.select("domReferenceElement");bt(S)&&(p.current=S,f.current=!0)}}return l.on("openchange",_),()=>{l.off("openchange",_)}},[l,a,i]);const b=x.useMemo(()=>{function _(){f.current=!1,p.current=null}return{onMouseLeave(){_()},onFocus(y){const S=y.currentTarget;if(f.current){if(p.current===S)return;_()}const j=Hn(y.nativeEvent);if(bt(j)){if(hh&&!y.relatedTarget){if(!g.current&&!dp(j))return}else if(!sz(j))return}const k=_f(y.relatedTarget,i.context.triggerElements),{nativeEvent:C,currentTarget:w}=y,E=typeof r=="function"?r():r;if(i.select("open")&&k||E===0||E===void 0){i.setOpen(!0,rt(Yi,C,w));return}h.start(E,()=>{f.current||i.setOpen(!0,rt(Yi,C,w))})},onBlur(y){_();const S=y.relatedTarget,j=y.nativeEvent,k=bt(S)&&S.hasAttribute(Vc("focus-guard"))&&S.getAttribute("data-type")==="outside";h.start(0,()=>{const C=i.select("domReferenceElement"),w=Xn(vt(C));!S&&w===C||Je(d.current.floatingContext?.refs.floating.current,w)||Je(C,w)||k||_f(S??w,i.context.triggerElements)||i.setOpen(!1,rt(Yi,j))})}}},[d,r,i,h]);return x.useMemo(()=>a?{reference:b,trigger:b}:{},[a,b])}class C_{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new ta,this.restTimeout=new ta,this.handleCloseOptions=void 0}static create(){return new C_}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const Nf=new WeakMap;function Ef(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&Nf.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),Nf.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function UC(e,t){const{scopeElement:a,referenceElement:r,floatingElement:i}=t,l=Nf.get(a);l&&l!==e&&Ef(l),Ef(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=a,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,Nf.set(a,e),a.style.pointerEvents="none",r.style.pointerEvents="auto",i.style.pointerEvents="auto"}function N_(e){const t=e.context.dataRef.current,a=Vn(()=>t.hoverInteractionState??C_.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=a),Yb(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function qC(e,t={}){const{enabled:a=!0,closeDelay:r=0,nodeId:i}=t,l="rootStore"in e?e.rootStore:e,d=l.useState("open"),f=l.useState("floatingElement"),p=l.useState("domReferenceElement"),{dataRef:g}=l.context,h=so(),b=no(),_=N_(l),y=Tn(),S=Ve(()=>US(g.current.openEvent?.type,_.interactedInside)),j=Ve(()=>rz(g.current.openEvent?.type)),k=Ve(()=>{Ef(_)});Pe(()=>{d||(_.pointerType=void 0,_.restTimeoutPending=!1,_.interactedInside=!1,k())},[d,_,k]),x.useEffect(()=>k,[k]),Pe(()=>{if(a&&d&&_.handleCloseOptions?.blockPointerEvents&&j()&&bt(p)&&f){const C=p,w=f,E=vt(f),R=h?.nodesRef.current.find(M=>M.id===b)?.context?.elements.floating;R&&(R.style.pointerEvents="");const T=_.pointerEventsScopeElement!==w?_.pointerEventsScopeElement:null,A=R!==w?R:null,z=_.handleCloseOptions?.getScope?.()??T??A??C.closest("[data-rootownerid]")??E.body;return UC(_,{scopeElement:z,referenceElement:C,floatingElement:w}),()=>{k()}}},[a,d,p,f,_,j,h,b,k]),x.useEffect(()=>{if(!a)return;function C(){return!!(h&&b&&Zr(h.nodesRef.current,b).length>0)}function w(M){const D=Qr(r,"close",_.pointerType),L=()=>{l.setOpen(!1,rt(Rn,M)),h?.events.emit("floating.closed",M)};D?_.openChangeTimeout.start(D,L):(_.openChangeTimeout.clear(),L())}function E(M){const D=Hn(M);if(!nz(D)){_.interactedInside=!1;return}_.interactedInside=D?.closest("[aria-haspopup]")!=null}function R(){_.openChangeTimeout.clear(),y.clear(),h?.events.off("floating.closed",A),k()}function T(M){if(C()&&h){h.events.on("floating.closed",A);return}if(_f(M.relatedTarget,l.context.triggerElements))return;const D=g.current.floatingContext?.nodeId??i,L=M.relatedTarget;if(!(h&&D&&bt(L)&&Zr(h.nodesRef.current,D,!1).some(P=>Je(P.context?.elements.floating,L)))){if(_.handler){_.handler(M);return}k(),j()&&!S()&&w(M)}}function A(M){!h||!b||C()||y.start(0,()=>{h.events.off("floating.closed",A),l.setOpen(!1,rt(Rn,M)),h.events.emit("floating.closed",M)})}const z=f;return _a(z&&xt(z,"mouseenter",R),z&&xt(z,"mouseleave",T),z&&xt(z,"pointerdown",E,!0),()=>{h?.events.off("floating.closed",A)})},[a,f,l,g,r,i,j,S,k,_,h,b,y])}const h6={current:null};function HC(e,t={}){const{enabled:a=!0,delay:r=0,handleClose:i=null,mouseOnly:l=!1,restMs:d=0,move:f=!0,triggerElementRef:p=h6,externalTree:g,isActiveTrigger:h=!0,getHandleCloseContext:b,isClosing:_,shouldOpen:y,guardStaleOpen:S=!1}=t,j="rootStore"in e?e.rootStore:e,{dataRef:k,events:C}=j.context,w=so(g),E=N_(j),R=x.useRef(!1),T=mn(i),A=mn(r),z=mn(d),M=mn(a),D=mn(y),L=mn(_),I=Ve(()=>US(k.current.openEvent?.type,E.interactedInside)),P=Ve(()=>D.current?.()!==!1),B=Ve((U,V,X)=>{const Q=j.context.triggerElements;if(Q.hasElement(V))return!U||!Je(U,V);if(!bt(X))return!1;const W=X;return Q.hasMatchingElement($=>Je($,W))&&(!U||!Je(U,W))}),q=Ve(()=>{if(!E.handler)return;vt(j.select("domReferenceElement")).removeEventListener("mousemove",E.handler),E.handler=void 0}),Y=Ve(()=>{Ef(E)});return h&&(E.handleCloseOptions=T.current?.__options),x.useEffect(()=>q,[q]),x.useEffect(()=>{if(!a)return;function U(V){V.open?R.current=!1:(R.current=V.reason===Rn,q(),E.openChangeTimeout.clear(),E.restTimeout.clear(),E.blockMouseMove=!0,E.restTimeoutPending=!1)}return C.on("openchange",U),()=>{C.off("openchange",U)}},[a,C,E,q]),x.useEffect(()=>{if(!a)return;function U(K,J=!0){const G=Qr(A.current,"close",E.pointerType);G?E.openChangeTimeout.start(G,()=>{j.setOpen(!1,rt(Rn,K)),w?.events.emit("floating.closed",K)}):J&&(E.openChangeTimeout.clear(),j.setOpen(!1,rt(Rn,K)),w?.events.emit("floating.closed",K))}const V=p.current??(h?j.select("domReferenceElement"):null);if(!bt(V))return;function X(K){if(E.openChangeTimeout.clear(),E.blockMouseMove=!1,l&&!Fr(E.pointerType))return;const J=qj(z.current),G=Qr(A.current,"open",E.pointerType),te=Hn(K),se=K.currentTarget??null,pe=j.select("domReferenceElement");let F=se;if(bt(te)&&!j.context.triggerElements.hasElement(te)){for(const Oe of j.context.triggerElements.elements())if(Je(Oe,te)){F=Oe;break}}bt(se)&&bt(pe)&&!j.context.triggerElements.hasElement(se)&&Je(se,pe)&&(F=pe);const oe=F==null?!1:B(pe,F,te),_e=j.select("open"),le=L.current?.()??j.select("transitionStatus")==="ending",be=!_e&&le&&R.current,ke=!oe&&bt(F)&&bt(pe)&&Je(pe,F)&&be,Re=J>0&&!G,Ae=oe&&(_e||be)||ke,Ie=!_e||oe;if(Ae){P()&&j.setOpen(!0,rt(Rn,K,F));return}Re||(G?E.openChangeTimeout.start(G,()=>{Ie&&P()&&j.setOpen(!0,rt(Rn,K,F))}):Ie&&P()&&j.setOpen(!0,rt(Rn,K,F)))}function Q(K){if(I()){Y();return}q();const J=j.select("domReferenceElement"),G=vt(J);E.restTimeout.clear(),E.restTimeoutPending=!1;const te=k.current.floatingContext??b?.();if(_f(K.relatedTarget,j.context.triggerElements))return;if(T.current&&te){j.select("open")||E.openChangeTimeout.clear();const pe=p.current;E.handler=T.current({...te,tree:w,x:K.clientX,y:K.clientY,onClose(){Y(),q(),M.current&&!I()&&pe===j.select("domReferenceElement")&&U(K,!0)}}),G.addEventListener("mousemove",E.handler),E.handler(K);return}(E.pointerType==="touch"?!Je(j.select("floatingElement"),K.relatedTarget):!0)&&U(K)}function W(K){Je(V,K.relatedTarget)||(E.openChangeTimeout.clear(),E.restTimeout.clear(),E.restTimeoutPending=!1)}const $=S?xt(V,"mouseout",W):void 0;return f?_a(xt(V,"mousemove",X,{once:!0}),xt(V,"mouseenter",X),xt(V,"mouseleave",Q),$):_a(xt(V,"mouseenter",X),xt(V,"mouseleave",Q),$)},[q,Y,k,A,j,a,T,E,h,B,I,l,f,z,p,w,M,b,L,P,S]),x.useMemo(()=>{if(!a)return;function U(V){E.pointerType=V.pointerType}return{onPointerDown:U,onPointerEnter:U,onMouseMove(V){const{nativeEvent:X}=V,Q=V.currentTarget,W=j.select("domReferenceElement"),$=j.select("open"),K=B(W,Q,V.target);if(l&&!Fr(E.pointerType))return;if($&&K&&E.handleCloseOptions?.blockPointerEvents){const te=j.select("floatingElement");if(te){const se=E.handleCloseOptions?.getScope?.()??Q.ownerDocument.body;UC(E,{scopeElement:se,referenceElement:Q,floatingElement:te})}}const J=qj(z.current);if($&&!K||J===0||!K&&E.restTimeoutPending&&V.movementX**2+V.movementY**2<2)return;E.restTimeout.clear();function G(){if(E.restTimeoutPending=!1,I())return;const te=j.select("open");!E.blockMouseMove&&(!te||K)&&P()&&j.setOpen(!0,rt(Rn,X,Q))}E.pointerType==="touch"?Gs.flushSync(()=>{G()}):K&&$?G():(E.restTimeoutPending=!0,E.restTimeout.start(J,G))}}},[a,E,I,B,l,j,z,P])}const x6="Escape";function bk(e){return ur&&e.movementX===0&&e.movementY===0}function _p(e,t,a){switch(e){case"vertical":return t;case"horizontal":return a;default:return t||a}}function Od(e,t){return _p(t,e===BS||e===t_,e===cp||e===up)}function xh(e,t,a){return _p(t,e===t_,a?e===cp:e===up)||e==="Enter"||e===" "||e===""}function b6(e,t,a){return _p(t,a?e===cp:e===up,e===t_)}function _6(e,t,a,r){const i=a?e===up:e===cp,l=e===BS;return t==="both"||t==="horizontal"&&r?e===x6:_p(t,i,l)}function VC(e,t){const{listRef:a,activeIndex:r,onNavigate:i=()=>{},enabled:l=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:p=!1,nested:g=!1,rtl:h=!1,virtual:b=!1,focusItemOnOpen:_="auto",focusItemOnHover:y=!0,openOnArrowKeyDown:S=!0,disabledIndices:j=void 0,orientation:k="vertical",parentOrientation:C,id:w,resetOnPointerLeave:E=!0,externalTree:R,grid:T}=t,A=T!=null,z="rootStore"in e?e.rootStore:e,M=z.useState("open"),D=z.useState("floatingElement"),L=z.useState("domReferenceElement"),I=z.context.dataRef,P=vf(D),B=Nx(L),q=mn(P),Y=no(),U=so(R),V=x.useRef(_),X=x.useRef(d??-1),Q=x.useRef(null),W=x.useRef(!0),$=Ve(ge=>{i(X.current===-1?null:X.current,ge)}),K=x.useRef(!!D),J=x.useRef(M),G=x.useRef(!1),te=x.useRef(!1),se=x.useRef(null),pe=mn(j),F=mn(M),oe=mn(d),_e=mn(E),le=sl(),be=sl(),ke=Ve(()=>{function ge(Ne){b?U?.events.emit("virtualfocus",Ne):se.current=lf(Ne,{sync:G.current,preventScroll:!0})}const de=a.current[X.current],Le=te.current;de&&ge(de),(G.current?Ne=>Ne():Ne=>le.request(Ne))(()=>{const Ne=a.current[X.current]||de;if(!Ne)return;de||ge(Ne),Ee&&(Le||!W.current)&&Ne.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Pe(()=>{I.current.orientation=k},[I,k]),Pe(()=>{l&&(M&&D?(X.current=d??-1,V.current&&d!=null&&(te.current=!0,$())):K.current&&(X.current=-1,$()))},[l,M,D,d,$]),Pe(()=>{if(l){if(!M){G.current=!1;return}if(D)if(r==null){if(G.current=!1,oe.current!=null)return;if(K.current&&(X.current=-1,ke()),(!J.current||!K.current)&&V.current&&(Q.current!=null||V.current===!0&&Q.current==null)){let ge=0;const de=()=>{a.current[0]==null?(ge<2&&(ge?ye=>be.request(ye):queueMicrotask)(de),ge+=1):(X.current=Q.current==null||xh(Q.current,k,h)||g?of(a):Tx(a),Q.current=null,$())};de()}}else zc(a.current,r)||(X.current=r,ke(),te.current=!1)}},[l,M,D,r,oe,g,a,k,h,$,ke,be]),Pe(()=>{if(!l||D||!U||b||!K.current)return;const ge=U.nodesRef.current,de=ge.find(Ne=>Ne.id===Y)?.context?.elements.floating,Le=Xn(vt(L??de??null)),ye=ge.some(Ne=>Ne.context&&Je(Ne.context.elements.floating,Le));de&&!ye&&W.current&&de.focus({preventScroll:!0})},[l,D,L,U,Y,b]),Pe(()=>{J.current=M,K.current=!!D}),Pe(()=>{M||(Q.current=null,V.current=_)},[M,_]);const Re=r!=null,Ae=Ve(ge=>{if(!F.current)return;const de=a.current.indexOf(ge.currentTarget);de!==-1&&(X.current!==de||r!==de)&&(X.current=de,$(ge))}),Ie=Ve(()=>C??U?.nodesRef.current.find(ge=>ge.id===Y)?.context?.dataRef?.current.orientation),Oe=Ve(()=>of(a,pe.current)),Te=Ve(ge=>{if(W.current=!1,G.current=!0,ge.which===229||!F.current&&ge.currentTarget===q.current)return;if(g&&_6(ge.key,k,h,A)){Od(ge.key,Ie())||pa(ge),z.setOpen(!1,rt(Ex,ge.nativeEvent)),Yt(L)&&(b?U?.events.emit("virtualfocus",L):L.focus());return}const de=X.current,Le=of(a,j),ye=Tx(a,j);if(B||(ge.key==="Home"&&(pa(ge),X.current=Le,$(ge)),ge.key==="End"&&(pa(ge),X.current=ye,$(ge))),T!=null){const Ne=T(ge,X.current,a,k,p,h,j,Le,ye);if(Ne!=null&&(X.current=Ne,$(ge)),k==="both")return}if(Od(ge.key,k)){if(pa(ge),M&&!b&&Xn(ge.currentTarget.ownerDocument)===ge.currentTarget){X.current=xh(ge.key,k,h)?Le:ye,$(ge);return}xh(ge.key,k,h)?p?de>=ye?f&&de!==a.current.length?X.current=-1:(G.current=!1,X.current=Le):X.current=Wa(a.current,{startingIndex:de,disabledIndices:j}):X.current=Math.min(ye,Wa(a.current,{startingIndex:de,disabledIndices:j})):p?de<=Le?f&&de!==-1?X.current=a.current.length:(G.current=!1,X.current=ye):X.current=Wa(a.current,{startingIndex:de,decrement:!0,disabledIndices:j}):X.current=Math.max(Le,Wa(a.current,{startingIndex:de,decrement:!0,disabledIndices:j})),zc(a.current,X.current)&&(X.current=-1),$(ge)}}),Ee=x.useMemo(()=>({onFocus(de){G.current=!0,Ae(de)},onClick:({currentTarget:de})=>de.focus({preventScroll:!0}),onMouseMove(de){bk(de)||(G.current=!0,te.current=!1,y&&Ae(de))},onPointerLeave(de){if(!F.current||!W.current||de.pointerType==="touch")return;G.current=!0;const Le=de.relatedTarget;if(!(!y||a.current.includes(Le))&&_e.current&&(se.current?.(),se.current=null,X.current=-1,$(de),!b)){const ye=q.current,Ne=Xn(vt(ye));ye&&Je(ye,Ne)&&ye.focus({preventScroll:!0})}}}),[Ae,F,q,y,a,$,_e,b]),Me=x.useMemo(()=>b&&M&&Re&&{"aria-activedescendant":`${w}-${r}`},[b,M,Re,w,r]),De=x.useMemo(()=>({"aria-orientation":k==="both"?void 0:k,...B?{}:Me,onKeyDown(ge){if(ge.key==="Tab"&&ge.shiftKey&&M&&!b){const de=Hn(ge.nativeEvent);if(de&&!Je(q.current,de))return;pa(ge),z.setOpen(!1,rt(Po,ge.nativeEvent)),Yt(L)&&L.focus();return}Te(ge)},onPointerMove(ge){bk(ge)||(W.current=!0)}}),[Me,Te,q,k,B,z,M,b,L]),He=x.useMemo(()=>{function ge(ye){z.setOpen(!0,rt(Ex,ye.nativeEvent,ye.currentTarget))}function de(ye){_==="auto"&&Qb(ye.nativeEvent)&&(V.current=!b)}function Le(ye){V.current=_,_==="auto"&&Wb(ye.nativeEvent)&&(V.current=!0)}return{onKeyDown(ye){const Ne=z.select("open");W.current=!1;const We=ye.key.startsWith("Arrow"),Ge=b6(ye.key,Ie(),h),it=Od(ye.key,k),Tt=(g?Ge:it)||ye.key==="Enter"||ye.key.trim()==="";if(b&&Ne)return Te(ye);if(!(!Ne&&!S&&We)){if(Tt){const _t=Od(ye.key,Ie());Q.current=g&&_t?null:ye.key}if(g){Ge&&(pa(ye),Ne?(X.current=Oe(),$(ye)):ge(ye));return}it&&(oe.current!=null&&(X.current=oe.current),pa(ye),!Ne&&S?ge(ye):Te(ye),Ne&&$(ye))}},onFocus(ye){z.select("open")&&!b&&(X.current=-1,$(ye))},onPointerDown:Le,onPointerEnter:Le,onMouseDown:de,onClick:de}},[Te,_,Oe,g,$,z,S,k,Ie,h,oe,b]),Qe=x.useMemo(()=>({...Me,...He}),[Me,He]);return x.useMemo(()=>l?{reference:Qe,floating:De,item:Ee,trigger:He}:{},[l,Qe,De,He,Ee])}function FC(e,t){const{listRef:a,elementsRef:r,activeIndex:i,onMatch:l,disabledIndices:d,onTyping:f,enabled:p=!0,resetMs:g=750,selectedIndex:h=null}=t,b="rootStore"in e?e.rootStore:e,_=b.useState("open"),y=Tn(),S=x.useRef(""),j=x.useRef(h??i??-1),k=x.useRef(null),C=Ve(R=>{function T(q){return r?.current[q]}function A(q){const Y=T(q);return Y&&!mp(Y)||Y?.matches(":disabled")?!1:d==null||!kf(ja,q,d)}function z(q,Y,U=0){if(q.length===0)return-1;const V=(U%q.length+q.length)%q.length,X=Y.toLowerCase();for(let Q=0;Q<q.length;Q+=1){const W=(V+Q)%q.length;if(!(!q[W]?.toLowerCase().startsWith(X)||!A(W)))return W}return-1}const M=a.current;if(S.current.length>0&&R.key===" "&&(pa(R),f?.(!0)),S.current.length>0&&S.current[0]!==" "&&z(M,S.current)===-1&&R.key!==" "&&f?.(!1),M==null||R.key.length!==1||R.ctrlKey||R.metaKey||R.altKey)return;_&&R.key!==" "&&(pa(R),f?.(!0));const D=S.current==="";D&&(j.current=h??i??-1),M.every((q,Y)=>q&&A(Y)?q[0]?.toLowerCase()!==q[1]?.toLowerCase():!0)&&S.current===R.key&&(S.current="",j.current=k.current),S.current+=R.key,y.start(g,()=>{S.current="",j.current=k.current,f?.(!1)});const P=((D?h??i??-1:j.current)??0)+1,B=z(M,S.current,P);B!==-1?(l?.(B),k.current=B):R.key!==" "&&(S.current="",f?.(!1))}),w=Ve(R=>{const T=R.relatedTarget,A=b.select("domReferenceElement"),z=b.select("floatingElement");Je(A,T)||Je(z,T)||(y.clear(),S.current="",j.current=k.current,f?.(!1))});Pe(()=>{!_&&h!==null||(y.clear(),k.current=null,S.current!==""&&(S.current=""))},[_,h,y]);const E=x.useMemo(()=>({onKeyDown:C,onBlur:w}),[C,w]);return x.useMemo(()=>p?{reference:E,floating:E}:{},[p,E])}const _k=.1,v6=_k*_k,Ft=.5;function Dd(e,t,a,r,i,l){return r>=t!=l>=t&&e<=(i-a)*(t-r)/(l-r)+a}function Pd(e,t,a,r,i,l,d,f,p,g){let h=!1;return Dd(e,t,a,r,i,l)&&(h=!h),Dd(e,t,i,l,d,f)&&(h=!h),Dd(e,t,d,f,p,g)&&(h=!h),Dd(e,t,p,g,a,r)&&(h=!h),h}function y6(e,t,a){return e>=a.x&&e<=a.x+a.width&&t>=a.y&&t<=a.y+a.height}function Ld(e,t,a,r,i,l){const d=Math.min(a,i),f=Math.max(a,i),p=Math.min(r,l),g=Math.max(r,l);return e>=d&&e<=f&&t>=p&&t<=g}function GC(e={}){const{blockPointerEvents:t=!1}=e,a=new ta,r=({x:i,y:l,placement:d,elements:f,onClose:p,nodeId:g,tree:h})=>{const b=d?.split("-")[0];let _=!1,y=null,S=null,j=typeof performance<"u"?performance.now():0;function k(w,E){const R=performance.now(),T=R-j;if(y===null||S===null||T===0)return y=w,S=E,j=R,!1;const A=w-y,z=E-S,M=A*A+z*z,D=T*T*v6;return y=w,S=E,j=R,M<D}function C(){a.clear(),p()}return function(E){a.clear();const R=f.domReference,T=f.floating;if(!R||!T||b==null||i==null||l==null)return;const{clientX:A,clientY:z}=E,M=Hn(E),D=E.type==="mouseleave",L=Je(T,M),I=Je(R,M);if(L&&(_=!0,!D))return;if(I&&(_=!1,!D)){_=!0;return}if(D&&bt(E.relatedTarget)&&Je(T,E.relatedTarget))return;function P(){return!!(h&&Zr(h.nodesRef.current,g).length>0)}function B(){P()||C()}if(P())return;const q=R.getBoundingClientRect(),Y=T.getBoundingClientRect(),U=i>Y.right-Y.width/2,V=l>Y.bottom-Y.height/2,X=Y.width>q.width,Q=Y.height>q.height,W=(X?q:Y).left,$=(X?q:Y).right,K=(Q?q:Y).top,J=(Q?q:Y).bottom;if(b==="top"&&l>=q.bottom-1||b==="bottom"&&l<=q.top+1||b==="left"&&i>=q.right-1||b==="right"&&i<=q.left+1){B();return}let G=!1;switch(b){case"top":G=Ld(A,z,W,q.top+1,$,Y.bottom-1);break;case"bottom":G=Ld(A,z,W,Y.top+1,$,q.bottom-1);break;case"left":G=Ld(A,z,Y.right-1,J,q.left+1,K);break;case"right":G=Ld(A,z,q.right-1,J,Y.left+1,K);break}if(G)return;if(_&&!y6(A,z,q)){B();return}if(!D&&k(A,z)){B();return}let te=!1;switch(b){case"top":{const se=X?Ft/2:Ft*4,pe=X||U?i+se:i-se,F=X?i-se:U?i+se:i-se,oe=l+Ft+1,_e=U||X?Y.bottom-Ft:Y.top,le=U?X?Y.bottom-Ft:Y.top:Y.bottom-Ft;te=Pd(A,z,pe,oe,F,oe,Y.left,_e,Y.right,le);break}case"bottom":{const se=X?Ft/2:Ft*4,pe=X||U?i+se:i-se,F=X?i-se:U?i+se:i-se,oe=l-Ft,_e=U||X?Y.top+Ft:Y.bottom,le=U?X?Y.top+Ft:Y.bottom:Y.top+Ft;te=Pd(A,z,pe,oe,F,oe,Y.left,_e,Y.right,le);break}case"left":{const se=Q?Ft/2:Ft*4,pe=Q||V?l+se:l-se,F=Q?l-se:V?l+se:l-se,oe=i+Ft+1,_e=V||Q?Y.right-Ft:Y.left,le=V?Q?Y.right-Ft:Y.left:Y.right-Ft;te=Pd(A,z,_e,Y.top,le,Y.bottom,oe,pe,oe,F);break}case"right":{const se=Q?Ft/2:Ft*4,pe=Q||V?l+se:l-se,F=Q?l-se:V?l+se:l-se,oe=i-Ft,_e=V||Q?Y.left+Ft:Y.right,le=V?Q?Y.left+Ft:Y.right:Y.left+Ft;te=Pd(A,z,oe,pe,oe,F,_e,Y.top,le,Y.bottom);break}}te?_||a.start(40,B):B()}};return r.__options={...e,blockPointerEvents:t},r}const j6={...S_,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class k6 extends ou{constructor(t,a,r){const i=new iu;super(w6(t,i,a,r),S6(i),j6)}setOpen=(t,a)=>{c6(this,t,a,{extraState:{openChangeReason:a.reason}})};cancelPendingOpen(t){this.state.floatingRootContext.dispatchOpenChange(!1,rt(_l,t))}}function w6(e,t,a,r=!1){const i={...k_(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e};return i.floatingRootContext=LC(t,a,r),i}function S6(e){return{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const C6=Gb(function(t){const{disabled:a=!1,defaultOpen:r=!1,open:i,disableHoverablePopup:l=!1,trackCursorAxis:d="none",actionsRef:f,onOpenChange:p,onOpenChangeComplete:g,handle:h,triggerId:b,defaultTriggerId:_=null,children:y}=t,S=OC((I,P)=>new k6({open:r,openProp:i,activeTriggerId:_,triggerIdProp:b},I,P));S.useControlledProp("openProp",i),S.useControlledProp("triggerIdProp",b),S.useContextCallback("onOpenChange",p),S.useContextCallback("onOpenChangeComplete",g);const j=S.useState("open"),k=!a&&j,C=S.useState("activeTriggerId"),w=S.useState("mounted"),E=S.useState("payload");S.useSyncedValues({trackCursorAxis:d,disableHoverablePopup:l,disabled:a}),v_(S,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:R,transitionStatus:T}=y_(k,S),A=S.useState("isInstantPhase"),z=S.useState("instantType"),M=S.useState("lastOpenChangeReason"),D=x.useRef(null);Pe(()=>{j&&a&&S.setOpen(!1,rt(HS))},[j,a,S]),Pe(()=>{T==="ending"&&M===ka||T!=="ending"&&A?(z!=="delay"&&(D.current=z),S.set("instantType","delay")):D.current!==null&&(S.set("instantType",D.current),D.current=null)},[T,A,M,z,S]),Pe(()=>{k&&C==null&&S.set("payload",void 0)},[S,C,k]),x.useImperativeHandle(f,()=>({unmount:R,close:()=>S.setOpen(!1,rt(n_))}),[R,S]);const L=k||w||!a&&d!=="none";return n.jsxs(LS.Provider,{value:S,children:[h&&n.jsx(b_,{handle:h,store:S}),L&&n.jsx(N6,{store:S,disabled:a,trackCursorAxis:d}),typeof y=="function"?y({payload:E}):y]})});function N6({store:e,disabled:t,trackCursorAxis:a}){const r=e.useState("floatingRootContext"),i=gp(r,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),l=cO(r,{enabled:!t&&a!=="none",axis:a==="none"?void 0:a}),d=x.useMemo(()=>Ss(l.reference,i.reference),[l.reference,i.reference]);return j_(e,{activeTriggerProps:d,inactiveTriggerProps:d,popupProps:i.floating??sn}),null}let vk=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const E6={"data-starting-style":""},R6={"data-ending-style":""},Yo={transitionStatus(e){return e==="starting"?E6:e==="ending"?R6:null}};(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=vk.startingStyle]="startingStyle",e[e.endingStyle=vk.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({});const T6={"data-popup-open":""},A6={"data-popup-open":"","data-pressed":""},M6={"data-open":""},z6={"data-closed":""},O6={"data-anchor-hidden":""},YC={open(e){return e?T6:null}},Ox={open(e){return e?A6:null}},lu={open(e){return e?M6:z6},anchorHidden(e){return e?O6:null}},E_={...lu,...Yo};function ra(e){return Lo(e,"base-ui")}const KC=x.createContext(void 0);function D6(){return x.useContext(KC)}const yk=600,XC="data-base-ui-tooltip-trigger";function jk(e){if("composedPath"in e){const a=e.composedPath();for(let r=0;r<a.length;r+=1){const i=a[r];if(bt(i))return i}}const t=e.target;return bt(t)?t:null}function P6(e){let t=e;for(;t;){const a=t.closest(`[${XC}]`);if(a)return a;const r=t.getRootNode();t="host"in r&&bt(r.host)?r.host:null}return null}const L6=PS(function(t,a){const{render:r,className:i,style:l,handle:d,payload:f,disabled:p,delay:g,closeOnClick:h=!0,closeDelay:b,id:_,...y}=t,S=su(!0),k=$C(d)??S;if(!k)throw new Error(gn(82));const C=ra(_),w=k.useState("isTriggerActive",C),E=k.useState("isOpenedByTrigger",C),R=k.useState("floatingRootContext"),T=x.useRef(null),A=g??yk,z=b??0,{registerTrigger:M,isMountedByThisTrigger:D}=PC(C,T,k,{payload:f,closeOnClick:h,closeDelay:z}),L=D6(),{delayRef:I,isInstantPhase:P,hasProvider:B}=uz(R,{open:E}),q=N_(R);k.useSyncedValue("isInstantPhase",P);const Y=k.useState("disabled"),U=p??Y,V=mn(U),X=k.useState("trackCursorAxis"),Q=k.useState("disableHoverablePopup"),W=x.useRef(!1),$=Tn(),K=x.useRef(void 0);function J(){return B?Qr(I.current,"open")===0?0:g??L??yk:A}function G(ke){const Re=T.current;if(!Re||!ke)return!1;const Ae=P6(ke);return Ae!==null&&Ae!==Re&&Je(Re,Ae)}function te(ke){const Re=G(ke);return W.current=Re,Re&&(q.openChangeTimeout.clear(),q.restTimeout.clear(),q.restTimeoutPending=!1,$.clear()),Re}const se=HC(R,{enabled:!U,mouseOnly:!0,move:!1,handleClose:!Q&&X!=="both"?GC():null,restMs:J,delay(){return b==null&&B?{close:Qr(I.current,"close")}:{close:z}},triggerElementRef:T,isActiveTrigger:w,isClosing:()=>k.select("transitionStatus")==="ending",shouldOpen(){return!W.current}}),pe=BC(R,{enabled:!U}).reference,F=ke=>{const Re=W.current,Ae=jk(ke),Ie=te(Ae),Oe=T.current,Te=Oe&&Ae&&Je(Oe,Ae);if(Ie&&k.select("open")&&k.select("lastOpenChangeReason")===Rn){k.setOpen(!1,rt(Rn,ke));return}if(Re&&!Ie&&Te&&!V.current&&!k.select("open")&&Oe&&Fr(K.current)){const Ee=()=>{!W.current&&!V.current&&!k.select("open")&&k.setOpen(!0,rt(Rn,ke,Oe))},Me=J();Me===0?($.clear(),Ee()):$.start(Me,Ee)}},oe=k.useState("triggerProps",D);return Et("button",t,{state:{open:E},ref:[a,M,T],props:[se,pe,D||X!=="none"?oe:void 0,{onMouseOver(ke){F(ke.nativeEvent)},onFocus(ke){G(jk(ke.nativeEvent))&&ke.preventBaseUIHandler()},onMouseLeave(){W.current=!1,$.clear(),K.current=void 0},onPointerEnter(ke){K.current=ke.pointerType},onPointerDown(ke){K.current=ke.pointerType,k.set("closeOnClick",h),h&&!k.select("open")&&k.cancelPendingOpen(ke.nativeEvent)},onClick(ke){h&&!k.select("open")&&k.cancelPendingOpen(ke.nativeEvent)},id:C,"data-trigger-disabled":U?"":void 0,[XC]:U?void 0:""},y],stateAttributesMapping:YC})}),QC=x.createContext(void 0);function I6(){const e=x.useContext(QC);if(e===void 0)throw new Error(gn(70));return e}const $6=x.forwardRef(function(t,a){const{children:r,container:i,className:l,render:d,style:f,...p}=t,{node:g,subtree:h}=xC({container:i,ref:a,componentProps:t,elementProps:p});return!h&&!g?null:n.jsxs(x.Fragment,{children:[h,g&&Gs.createPortal(r,g)]})}),B6=x.forwardRef(function(t,a){const{keepMounted:r=!1,...i}=t;return su().useState("mounted")||r?n.jsx(QC.Provider,{value:r,children:n.jsx($6,{ref:a,...i})}):null}),WC=x.createContext(void 0);function ZC(){const e=x.useContext(WC);if(e===void 0)throw new Error(gn(71));return e}const U6=x.createContext(void 0);function vp(){return x.useContext(U6)?.direction??"ltr"}const q6=e=>({name:"arrow",options:e,async fn(t){const{x:a,y:r,placement:i,rects:l,platform:d,elements:f,middlewareData:p}=t,{element:g,padding:h=0,offsetParent:b="real"}=Wr(e,t)||{};if(g==null)return{};const _=QS(h),y={x:a,y:r},S=i_(i),j=o_(S),k=await d.getDimensions(g),C=S==="y",w=C?"top":"left",E=C?"bottom":"right",R=C?"clientHeight":"clientWidth",T=l.reference[j]+l.reference[S]-y[S]-l.floating[j],A=y[S]-l.reference[S],z=b==="real"?await d.getOffsetParent?.(g):f.floating;let M=f.floating[R]||l.floating[j];(!M||!await d.isElement?.(z))&&(M=f.floating[R]||l.floating[j]);const D=T/2-A/2,L=M/2-k[j]/2-1,I=Math.min(_[w],L),P=Math.min(_[E],L),B=I,q=M-k[j]-P,Y=M/2-k[j]/2+D,U=XS(B,Y,q),V=!p.arrow&&to(i)!=null&&Y!==U&&l.reference[j]/2-(Y<B?I:P)-k[j]/2<0,X=V?Y<B?Y-B:Y-q:0;return{[S]:y[S]+X,data:{[S]:U,centerOffset:Y-U-X,...V&&{alignmentOffset:X}},reset:V}}}),H6=(e,t)=>({...q6(e),options:[e,t]}),V6={name:"hide",async fn(e){const{width:t,height:a,x:r,y:i}=e.rects.reference,l=t===0&&a===0&&r===0&&i===0,d=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:d.top-a>=0||d.right-t>=0||d.bottom-a>=0||d.left-t>=0||l}}}},F6={sideX:"left",sideY:"top"},kk="--available-width",wk="--available-height";function JC(e,t,a){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?a?"inline-start":"inline-end":"right",bottom:"bottom",left:r?a?"inline-end":"inline-start":"left"}[t]}function Sk(e,t,a){const{rects:r,placement:i}=e;return{side:JC(t,Vs(i),a),align:to(i)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function R_(e){return G6(e,m6)}function G6(e,t){const{anchor:a,positionMethod:r="absolute",side:i="bottom",sideOffset:l=0,align:d="center",alignOffset:f=0,collisionBoundary:p,collisionPadding:g=5,sticky:h=!1,arrowPadding:b=5,disableAnchorTracking:_=!1,inline:y,keepMounted:S=!1,floatingRootContext:j,mounted:k,collisionAvoidance:C,shift:w,nodeId:E,adaptiveOrigin:R,lazyFlip:T=!1,externalTree:A}=e,[z,M]=x.useState(null);!k&&z!==null&&M(null);const D=C.side||"flip",L=C.align||"flip",I=C.fallbackAxisSide||"end",P=w?.crossAxis??!1,B=w?.rootBoundary,q=typeof a=="function"?a:void 0,Y=Ve(q),U=q?Y:a,V=mn(a),X=mn(k),W=vp()==="rtl",$=z||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":W?"left":"right","inline-start":W?"right":"left"}[i],K=d==="center"?$:`${$}-${d}`;let J=g;typeof J=="number"?J={top:J,right:J,bottom:J,left:J}:J&&(J={top:J.top||0,right:J.right||0,bottom:J.bottom||0,left:J.left||0});const G=1,te=i==="bottom"?G:0,se=i==="top"?G:0,pe=i==="right"?G:0,F=i==="left"?G:0,oe={boundary:p==="clipping-ancestors"?"clippingAncestors":p,padding:J},_e=x.useRef(null),le=mn(l),be=mn(f),ke=typeof l!="function"?l:0,Re=typeof f!="function"?f:0,Ae=[];y&&Ae.push(y),Ae.push(FO(ot=>{const Lt=Sk(ot,i,W),on=typeof le.current=="function"?le.current(Lt):le.current,Kt=typeof be.current=="function"?be.current(Lt):be.current;return{mainAxis:on,crossAxis:Kt,alignmentAxis:Kt}},[ke,Re,W,i]));const Ie=L==="none"&&D!=="shift",Oe=!Ie&&(h||P||D==="shift"),Te=D==="none"?null:KO({...oe,padding:{top:J.top+G+te,right:J.right+G+F,bottom:J.bottom+G+se,left:J.left+G+pe},mainAxis:!P&&D==="flip",crossAxis:L==="flip"?"alignment":!1,fallbackAxisSideDirection:I}),Ee=Ie?null:GO({...oe,rootBoundary:B,mainAxis:L!=="none",crossAxis:Oe,limiter:h||P?void 0:YO(ot=>{if(!_e.current)return{};const{width:Lt,height:on}=_e.current.getBoundingClientRect(),Kt=Hs(Vs(ot.placement)),Gn=Kt==="y"?Lt:on,An=Kt==="y"?J.left+J.right:J.top+J.bottom;return{offset:Gn/2+An/2}})},[oe,h,P,B,J,L]);D==="shift"||L==="shift"||d==="center"?Ae.push(Ee,Te):Ae.push(Te,Ee),Ae.push(XO({...oe,apply({elements:{floating:ot},availableWidth:Lt,availableHeight:on,rects:Kt}){if(!X.current)return;const Gn=ot.style;Gn.setProperty(kk,`${Lt}px`),Gn.setProperty(wk,`${on}px`);const An=Jt(ot).devicePixelRatio||1,{x:as,y:dn,width:hs,height:Rs}=Kt.reference,oa=(Math.round((as+hs)*An)-Math.round(as*An))/An,ht=(Math.round((dn+Rs)*An)-Math.round(dn*An))/An;Gn.setProperty("--anchor-width",`${oa}px`),Gn.setProperty("--anchor-height",`${ht}px`)}}),H6(ot=>({element:_e.current||vt(ot.elements.floating).createElement("div"),padding:b,offsetParent:"floating"}),[b]),{name:"transformOrigin",fn(ot){const{elements:Lt,middlewareData:on,placement:Kt,rects:Gn,y:An}=ot,as=Vs(Kt),dn=Hs(as),hs=_e.current,Rs=on.arrow?.x||0,oa=on.arrow?.y||0,ht=hs?.clientWidth||0,Ut=hs?.clientHeight||0,Ln=Rs+ht/2,rs=oa+Ut/2,xs=Math.abs(on.shift?.y||0),Mn=Gn.reference.height/2,Wt=typeof l=="function"?l(Sk(ot,i,W)):l,vn=xs>Wt,ia={top:`${Ln}px calc(100% + ${Wt}px)`,bottom:`${Ln}px ${-Wt}px`,left:`calc(100% + ${Wt}px) ${rs}px`,right:`${-Wt}px ${rs}px`}[as],pr=`${Ln}px ${Gn.reference.y+Mn-An}px`;return Lt.floating.style.setProperty("--transform-origin",Oe&&dn==="y"&&vn?pr:ia),{}}},V6,R),Pe(()=>{!k&&j&&j.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[k,j]);const Me=x.useMemo(()=>({elementResize:!_&&typeof ResizeObserver<"u",layoutShift:!_&&typeof IntersectionObserver<"u"}),[_]),{refs:De,elements:He,x:Qe,y:ge,middlewareData:de,update:Le,placement:ye,context:Ne,isPositioned:We,floatingStyles:Ge}=t({rootContext:j,open:S?k:void 0,placement:K,middleware:Ae,strategy:r,whileElementsMounted:S?void 0:(...ot)=>dk(...ot,Me),nodeId:E,externalTree:A}),{sideX:it,sideY:Tt}=de.adaptiveOrigin||F6,_t=We?r:"fixed",Ct=x.useMemo(()=>{let ot;return We?R?ot={position:_t,[it]:Qe,[Tt]:ge}:ot={...Ge,position:_t}:ot={position:_t,top:0,left:0},ot[kk]="100vw",ot[wk]="100vh",We||(ot.opacity=0),ot},[R,_t,it,Qe,Tt,ge,Ge,We]),je=x.useRef(null);Pe(()=>{if(!k)return;const ot=V.current,Lt=typeof ot=="function"?ot():ot,Kt=(Ck(Lt)?Lt.current:Lt)||null||null;Kt!==je.current&&(De.setPositionReference(Kt),je.current=Kt)},[k,De,U,V]),x.useEffect(()=>{if(!k)return;const ot=V.current;typeof ot!="function"&&Ck(ot)&&ot.current!==je.current&&(De.setPositionReference(ot.current),je.current=ot.current)},[k,De,U,V]),x.useEffect(()=>{if(S&&k&&He.reference&&He.floating)return dk(He.reference,He.floating,Le,Me)},[S,k,He,Le,Me]);const ze=Vs(ye),Ye=JC(i,ze,W),Ze=to(ye)||"center",ft=!!de.hide?.referenceHidden;Pe(()=>{T&&k&&We&&ze!==$&&M(ze)},[T,k,We,ze,$]);const Rt=x.useMemo(()=>({position:"absolute",top:de.arrow?.y,left:de.arrow?.x}),[de.arrow]),Qt=de.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:Ct,arrowStyles:Rt,arrowRef:_e,arrowUncentered:Qt,side:Ye,align:Ze,physicalSide:ze,anchorHidden:ft,refs:De,context:Ne,isPositioned:We,update:Le}),[Ct,Rt,_e,Qt,Ye,Ze,ze,ft,De,Ne,We,Le])}function Ck(e){return e!=null&&"current"in e}function yp(e){return e==="starting"?eO:sn}function T_(e,t,{styles:a,transitionStatus:r,props:i,refs:l,hidden:d,inert:f=!1}){const p={...a};return f&&(p.pointerEvents="none"),Et("div",e,{state:t,ref:l,props:[{role:"presentation",hidden:d,style:p},yp(r),i],stateAttributesMapping:lu})}const Y6=x.forwardRef(function(t,a){const{render:r,className:i,anchor:l,positionMethod:d="absolute",side:f="top",align:p="center",sideOffset:g=0,alignOffset:h=0,collisionBoundary:b="clipping-ancestors",collisionPadding:_=5,arrowPadding:y=5,sticky:S=!1,disableAnchorTracking:j=!1,collisionAvoidance:k=mC,style:C,...w}=t,E=su(),R=I6(),T=E.useState("open"),A=E.useState("mounted"),z=E.useState("trackCursorAxis"),M=E.useState("disableHoverablePopup"),D=E.useState("floatingRootContext"),L=E.useState("instantType"),I=E.useState("transitionStatus"),P=E.useState("adaptiveOrigin"),B=R_({anchor:l,positionMethod:d,floatingRootContext:D,mounted:A,side:f,sideOffset:g,align:p,alignOffset:h,collisionBoundary:b,collisionPadding:_,sticky:S,arrowPadding:y,disableAnchorTracking:j,keepMounted:R,collisionAvoidance:k,adaptiveOrigin:P}),q=x.useMemo(()=>({open:T,side:B.side,align:B.align,anchorHidden:B.anchorHidden,instant:z!=="none"?"tracking-cursor":L}),[T,B.side,B.align,B.anchorHidden,z,L]),Y=T_(t,q,{styles:B.positionerStyles,transitionStatus:I,props:w,refs:[a,E.useStateSetter("positionerElement")],hidden:!A,inert:!T||z==="both"||M});return n.jsx(WC.Provider,{value:B,children:Y})}),K6=x.forwardRef(function(t,a){const{render:r,className:i,style:l,...d}=t,f=su(),{side:p,align:g}=ZC(),h=f.useState("open"),b=f.useState("instantType"),_=f.useState("transitionStatus"),y=f.useState("popupProps"),S=f.useState("floatingRootContext"),j=f.useState("disabled"),k=f.useState("closeDelay");Ca({open:h,ref:f.context.popupRef,onComplete(){h&&f.context.onOpenChangeComplete?.(!0)}}),qC(S,{enabled:!j,closeDelay:k});const C=f.useStateSetter("popupElement");return Et("div",t,{state:{open:h,side:p,align:g,instant:b,transitionStatus:_},ref:[a,f.context.popupRef,C],props:[bp,y,yp(_),d],stateAttributesMapping:E_})}),X6=x.forwardRef(function(t,a){const{render:r,className:i,style:l,...d}=t,f=su(),{arrowRef:p,side:g,align:h,arrowUncentered:b,arrowStyles:_}=ZC(),y=f.useState("open"),S=f.useState("instantType");return Et("div",t,{state:{open:y,side:g,align:h,uncentered:b,instant:S},ref:[a,p],props:[{style:_,"aria-hidden":!0},d],stateAttributesMapping:lu})}),Q6=function(t){const{delay:a,closeDelay:r,timeout:i=400}=t,l=x.useMemo(()=>({open:a,close:r}),[a,r]);return n.jsx(KC.Provider,{value:a,children:n.jsx(cz,{delay:l,timeoutMs:i,children:t.children})})};function jp(e){return u_(19)?e:e?"true":void 0}function W6(e){const[t,a]=x.useState({current:e,previous:null});return Object.is(e,t.current)||a({current:e,previous:t.current}),t.previous}function St(...e){return DS(Bc(e))}function Z6({delay:e=0,...t}){return n.jsx(Q6,{"data-slot":"tooltip-provider",delay:e,...t})}function A_({...e}){return n.jsx(C6,{"data-slot":"tooltip",...e})}function M_({...e}){return n.jsx(L6,{"data-slot":"tooltip-trigger",...e})}function z_({className:e,side:t="top",sideOffset:a=4,align:r="center",alignOffset:i=0,children:l,...d}){return n.jsx(B6,{children:n.jsx(Y6,{align:r,alignOffset:i,side:t,sideOffset:a,className:"isolate z-50",children:n.jsxs(K6,{"data-slot":"tooltip-content",className:St("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...d,children:[l,n.jsx(X6,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}function Li({label:e,active:t,onClick:a,isAdd:r,isSettings:i,isDefault:l,icon:d,title:f,testId:p}){const g=e.trim()||"·",{initials:h,subLabel:b}=eN(g),_=r||i?"indigo":tN(g),y=b&&!r&&!i&&!l;return n.jsxs(A_,{children:[n.jsx(M_,{render:n.jsxs("button",{type:"button",onClick:a,"data-testid":p,className:"group relative flex w-full cursor-pointer flex-col items-center gap-1",children:[n.jsx("span",{className:me("flex size-10 items-center justify-center rounded-xl text-sm font-bold transition-all",t&&"ring-2 ring-foreground ring-offset-2 ring-offset-card",r&&"border border-dashed border-muted-fg/50 bg-transparent text-muted-fg hover:bg-accent/60 hover:text-foreground",i&&"bg-muted text-muted-fg hover:bg-accent hover:text-foreground",l&&"overflow-hidden bg-muted",!r&&!i&&!l&&t&&nD(_),!r&&!i&&!l&&!t&&tD(_)),children:d??h}),y&&n.jsx("span",{className:"block max-w-[3.6rem] truncate text-[9px] leading-tight text-muted-fg group-hover:text-foreground",children:b})]})}),n.jsx(z_,{side:"right",children:f||e})]})}function eN(e){const t=e.trim().replace(/[_\-.]+/g," ").replace(/\s+/g," ");if(!t)return{initials:"·",subLabel:null};const a=t.split(" ");if(a.length>=2)return{initials:(a[0][0]+a[1][0]).toUpperCase(),subLabel:J6(t)};const r=a[0];return r.length<=4?{initials:r[0].toUpperCase(),subLabel:r}:{initials:r[0].toUpperCase(),subLabel:r.slice(0,4)+"…"}}function J6(e){return e.length>6?e.slice(0,5)+"…":e}function tN(e){let t=0;for(let a=0;a<e.length;a++)t=t*31+e.charCodeAt(a)|0;return Pj[Math.abs(t)%Pj.length]}const nN={sky:"bg-sky-500/15 text-sky-300 hover:bg-sky-500/25",violet:"bg-violet-500/15 text-violet-300 hover:bg-violet-500/25",emerald:"bg-emerald-500/15 text-emerald-300 hover:bg-emerald-500/25",amber:"bg-amber-500/15 text-amber-300 hover:bg-amber-500/25",rose:"bg-rose-500/15 text-rose-300 hover:bg-rose-500/25",indigo:"bg-indigo-500/15 text-indigo-300 hover:bg-indigo-500/25",teal:"bg-teal-500/15 text-teal-300 hover:bg-teal-500/25",fuchsia:"bg-fuchsia-500/15 text-fuchsia-300 hover:bg-fuchsia-500/25"},eD={sky:"bg-sky-500/30 text-sky-100",violet:"bg-violet-500/30 text-violet-100",emerald:"bg-emerald-500/30 text-emerald-100",amber:"bg-amber-500/30 text-amber-100",rose:"bg-rose-500/30 text-rose-100",indigo:"bg-indigo-500/30 text-indigo-100",teal:"bg-teal-500/30 text-teal-100",fuchsia:"bg-fuchsia-500/30 text-fuchsia-100"};function tD(e){return nN[e]}function nD(e){return eD[e]}function sD(e){const{initials:t}=eN(e);return{initials:t,idleClass:nN[tN(e)]}}function Ue({content:e,side:t="top",children:a}){return e?n.jsxs(A_,{children:[n.jsx(M_,{render:a}),n.jsx(z_,{side:t,children:e})]}):a}const sN=x.createContext(void 0);function O_(e){const t=x.useContext(sN);if(t===void 0&&!e)throw new Error(gn(33));return t}const aN=x.createContext(void 0);function Ko(e){const t=x.useContext(aN);if(t===void 0&&!e)throw new Error(gn(36));return t}const aD=x.createContext(void 0);function D_(e=!0){const t=x.useContext(aD);if(t===void 0&&!e)throw new Error(gn(25));return t}function ol({controlled:e,default:t,name:a,state:r="value"}){const{current:i}=x.useRef(e!==void 0),[l,d]=x.useState(t),f=i?e:l,p=x.useCallback(g=>{i||d(g)},[]);return[f,p]}const rN=x.createContext(void 0);function kp(e=!1){const t=x.useContext(rN);if(t===void 0&&!e)throw new Error(gn(16));return t}function rD(e){const{focusableWhenDisabled:t,disabled:a,composite:r=!1,tabIndex:i=0,isNativeButton:l}=e,d=r&&t!==!1,f=r&&t===!1;return{props:x.useMemo(()=>{const g={onKeyDown(h){a&&t&&h.key!=="Tab"&&h.preventDefault()}};return r||(g.tabIndex=i,!l&&a&&(g.tabIndex=t?i:-1)),(l&&(t||d)||!l&&a)&&(g["aria-disabled"]=a),l&&(!t||f)&&(g.disabled=a),g},[r,a,t,d,f,l,i])}}function Dc(e,t,{detail:a=0}={}){e.dispatchEvent(new(Jt(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:a,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function ao(e={}){const{disabled:t=!1,focusableWhenDisabled:a,tabIndex:r=0,native:i=!0,composite:l}=e,d=x.useRef(null),f=kp(!0),p=l??f!==void 0,{props:g}=rD({focusableWhenDisabled:a,disabled:t,composite:p,tabIndex:r,isNativeButton:i}),h=x.useCallback(()=>{const y=d.current;bh(y)&&p&&t&&g.disabled===void 0&&y.disabled&&(y.disabled=!1)},[t,g.disabled,p]);Pe(h,[h]);const b=x.useCallback((y={})=>{const{onClick:S,onMouseDown:j,onKeyUp:k,onKeyDown:C,onPointerDown:w,...E}=y;return Ss({onClick(R){if(t){R.preventDefault();return}S?.(R)},onMouseDown(R){t||j?.(R)},onKeyDown(R){if(t||(Sf(R),C?.(R),R.baseUIHandlerPrevented))return;const T=R.target===R.currentTarget,A=R.currentTarget,z=bh(A),M=!i&&oD(A),D=T&&(i?z:!M),L=R.key==="Enter",I=R.key===" ",P=A.getAttribute("role"),B=P?.startsWith("menuitem")||P==="option"||P==="gridcell";if(T&&p&&I){if(R.defaultPrevented&&B)return;R.preventDefault(),(!i||z)&&(R.preventBaseUIHandler(),Dc(A,R));return}if(!D||i||!I&&!L){T&&M&&I&&R.preventDefault();return}R.defaultPrevented||(R.preventDefault(),L&&(R.preventBaseUIHandler(),Dc(A,R)))},onKeyUp(R){if(!t){if(Sf(R),k?.(R),R.target===R.currentTarget&&i&&p&&bh(R.currentTarget)&&R.key===" "){R.preventDefault();return}R.baseUIHandlerPrevented||R.target===R.currentTarget&&!i&&!p&&!R.defaultPrevented&&R.key===" "&&(R.preventBaseUIHandler(),Dc(R.currentTarget,R))}},onPointerDown(R){if(t){R.preventDefault();return}w?.(R)}},i?{type:"button"}:{role:"button"},g,E)},[t,g,p,i]),_=Ve(y=>{d.current=y,h()});return{getButtonProps:b,buttonRef:_}}function bh(e){return Yt(e)&&e.tagName==="BUTTON"}function oD(e){return Yt(e)&&e.tagName==="A"&&!!e.href}function iD(e){const{closeOnClick:t,highlighted:a,id:r,nodeId:i,store:l,typingRef:d,itemRef:f,itemMetadata:p}=e,{events:g}=l.useState("floatingTreeRoot"),h=l.useState("open"),b=D_(!0),_=b!==void 0;return x.useMemo(()=>({id:r,role:"menuitem",tabIndex:h&&a?0:-1,onKeyDown(y){y.key===" "&&d?.current&&y.preventDefault()},onMouseMove(y){i&&g.emit("itemhover",{nodeId:i,target:y.currentTarget})},onClick(y){t&&g.emit("close",{domEvent:y,reason:Ki})},onMouseUp(y){if(b){const S=b.initialCursorPointRef.current;if(b.initialCursorPointRef.current=null,_&&S&&Math.abs(y.clientX-S.x)<=1&&Math.abs(y.clientY-S.y)<=1||_&&!Kb&&y.button===2)return}f.current&&l.context.allowMouseUpTriggerRef.current&&(!_||y.button===2)&&p.type==="regular-item"&&Dc(f.current,y,{detail:1})}}),[t,a,r,g,i,h,l,d,f,b,_,p])}const oN={type:"regular-item"};function iN(e){const{closeOnClick:t,disabled:a,highlighted:r,id:i,store:l,typingRef:d=l.context.typingRef,nativeButton:f,itemMetadata:p,nodeId:g}=e,h=x.useRef(null),{getButtonProps:b,buttonRef:_}=ao({disabled:a,focusableWhenDisabled:!0,native:f,composite:!0}),y=iD({closeOnClick:t,highlighted:r,id:i,nodeId:g,store:l,typingRef:d,itemRef:h,itemMetadata:p}),S=x.useCallback(k=>Ss(y,{onMouseEnter(){p.type==="submenu-trigger"&&p.setActive()}},k,b),[y,b,p]),j=ir(h,_);return x.useMemo(()=>({getItemProps:S,itemRef:j}),[S,j])}const lN=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function lD(){return x.useContext(lN)}function cu(e={}){const{guess:t,label:a,metadata:r,textRef:i,index:l}=e,{register:d,unregister:f,subscribeMapChange:p,nextIndexRef:g}=lD(),h=x.useRef(-1),[b,_]=x.useState(l==null&&t?()=>{if(h.current===-1){const k=g.current;g.current+=1,h.current=k}return h.current}:-1),y=l??b,S=x.useRef(null),j=x.useCallback(k=>{const C=S.current;C&&f(C),S.current=k,k&&d(k,{metadata:r??null,index:l??null,label:a,textRef:i})},[l,d,f,r,a,i]);return Pe(()=>{if(l==null)return p(k=>{const C=S.current?k.get(S.current)?.index:null;C!=null&&_(C)})},[l,p]),{ref:j,index:y}}let Nk=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.highlighted="data-highlighted",e})({});const cN={checked(e){return e?{[Nk.checked]:""}:{[Nk.unchecked]:""}},...Yo},cD=x.createContext(void 0),uD=x.forwardRef(function(t,a){const{render:r,className:i,id:l,label:d,nativeButton:f=!1,disabled:p=!1,closeOnClick:g=!0,style:h,...b}=t,_=cu({guess:!0,label:d}),y=O_(!0),S=ra(l),{store:j}=Ko(),k=j.useState("disabled"),C=p||k,w=j.useState("isActive",_.index),E=j.useState("itemProps"),{getItemProps:R,itemRef:T}=iN({closeOnClick:g,disabled:C,highlighted:w,id:S,store:j,nativeButton:f,nodeId:y?.context.nodeId,itemMetadata:oN});return Et("div",t,{state:{disabled:C,highlighted:w},props:[E,b,R],ref:[T,a,_.ref]})}),dD=x.createContext(void 0);function uN(e){return x.useContext(dD)}const Dx="ArrowUp",Px="ArrowDown",Lx="ArrowLeft",Ix="ArrowRight",$x="Home",Bx="End",wp=new Set([Dx,Px,Lx,Ix,$x,Bx]),fD="Shift",pD=[fD,"Control","Alt","Meta"];function mD(e){return Yt(e)&&e.tagName==="INPUT"}function Ek(e){return!!(mD(e)&&e.selectionStart!=null||Yt(e)&&e.tagName==="TEXTAREA")}function Rk(e,t,a,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,l=e.scrollTop;const d=e.clientWidth<e.scrollWidth,f=e.clientHeight<e.scrollHeight;if(d&&r!=="vertical"){const p=Tk(e,t,"left"),g=Id(e),h=Id(t);a==="ltr"&&(p+t.offsetWidth+h.scrollMarginRight>e.scrollLeft+e.clientWidth-g.scrollPaddingRight?i=p+t.offsetWidth+h.scrollMarginRight-e.clientWidth+g.scrollPaddingRight:p-h.scrollMarginLeft<e.scrollLeft+g.scrollPaddingLeft&&(i=p-h.scrollMarginLeft-g.scrollPaddingLeft)),a==="rtl"&&(p-h.scrollMarginLeft<e.scrollLeft+g.scrollPaddingLeft?i=p-h.scrollMarginLeft-g.scrollPaddingLeft:p+t.offsetWidth+h.scrollMarginRight>e.scrollLeft+e.clientWidth-g.scrollPaddingRight&&(i=p+t.offsetWidth+h.scrollMarginRight-e.clientWidth+g.scrollPaddingRight))}if(f&&r!=="horizontal"){const p=Tk(e,t,"top"),g=Id(e),h=Id(t);p-h.scrollMarginTop<e.scrollTop+g.scrollPaddingTop?l=p-h.scrollMarginTop-g.scrollPaddingTop:p+t.offsetHeight+h.scrollMarginBottom>e.scrollTop+e.clientHeight-g.scrollPaddingBottom&&(l=p+t.offsetHeight+h.scrollMarginBottom-e.clientHeight+g.scrollPaddingBottom)}e.scrollTo({left:i,top:l,behavior:"auto"})}function Tk(e,t,a){const r=a==="left"?"offsetLeft":"offsetTop";let i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function Id(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const gD=x.forwardRef(function(t,a){const{render:r,className:i,style:l,finalFocus:d,...f}=t,{store:p}=Ko(),{side:g,align:h}=O_(),b=uN()!=null,_=p.useState("open"),y=p.useState("transitionStatus"),S=p.useState("popupProps"),j=p.useState("mounted"),k=p.useState("instantType"),C=p.useState("activeTriggerElement"),w=p.useState("parent"),E=p.useState("lastOpenChangeReason"),R=p.useState("rootId"),T=p.useState("floatingRootContext"),A=p.useState("floatingTreeRoot"),z=p.useState("closeDelay"),M=p.useState("hoverEnabled"),D=p.useState("disabled"),L=p.useState("openMethod"),I=w.type==="context-menu";Ca({open:_,ref:p.context.popupRef,onComplete(){_&&p.context.onOpenChangeComplete?.(!0)}}),x.useEffect(()=>{function U(V){p.setOpen(!1,rt(V.reason,V.domEvent))}return A.events.on("close",U),()=>{A.events.off("close",U)}},[A.events,p]),qC(T,{enabled:M&&!D&&!I&&w.type!=="menubar",closeDelay:z});const P=p.useStateSetter("popupElement"),B={transitionStatus:y,side:g,align:h,open:_,nested:w.type==="menu",instant:k},q=Et("div",t,{state:B,ref:[a,p.context.popupRef,P],stateAttributesMapping:E_,props:[S,{onKeyDown(U){b&&wp.has(U.key)&&U.stopPropagation()}},yp(y),f,{"data-rootownerid":R}]});let Y=w.type===void 0||I;return(C||w.type==="menubar"&&E!==fp)&&(Y=!0),n.jsx(h_,{context:T,openInteractionType:L,modal:I,disabled:!j,returnFocus:d===void 0?Y:d,initialFocus:w.type!=="menu",restoreFocus:!0,externalTree:w.type!=="menubar"?A:void 0,previousFocusableElement:C,nextFocusableElement:w.type===void 0?p.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:w.type===void 0?p.context.beforeContentFocusGuardRef:void 0,children:q})}),dN=x.createContext(void 0);function hD(){const e=x.useContext(dN);if(e===void 0)throw new Error(gn(32));return e}const xD=x.forwardRef(function(t,a){const{keepMounted:r=!1,...i}=t,{store:l}=Ko();return l.useState("mounted")||r?n.jsx(dN.Provider,{value:r,children:n.jsx(p_,{ref:a,...i})}):null});function Sp(e){const{children:t,elementsRef:a,labelsRef:r,onMapChange:i}=e,l=Ve(i),[,d]=x.useState(!1),f=Vn(_D).current,p=Vn(bD).current,g=x.useRef(0),h=x.useRef(!0),b=x.useRef([]),_=x.useRef(null),y=Ve(()=>{h.current||(h.current=!0,d(T=>!T))}),S=Ve((T,A)=>{p.set(T,A),y()}),j=Ve(T=>{p.delete(T),y()}),k=Ve(T=>{const A=new Map;return a.current.length=0,r&&(r.current.length=0),T.forEach(z=>{A.set(z.element,{...z.registration.metadata??{},index:z.index}),a.current[z.index]=z.element,r&&(r.current[z.index]=z.registration.label!==void 0?z.registration.label:z.registration.textRef?.current?.textContent??z.element.textContent)}),g.current=a.current.length,A});function C(T){if(_.current?.disconnect(),_.current=null,typeof MutationObserver!="function"||T.length<2)return;const A=new MutationObserver(M=>{if(!jD(M))return;let D=null;for(const L of T)if(L.isConnected){if(D&&fN(D,L)>0){A.disconnect(),y();return}D=L}});_.current=A;const z=new Set;for(let M=1;M<T.length;M+=1){const D=yD(T[M-1],T[M]);D&&z.add(D)}z.forEach(M=>A.observe(M,{childList:!0}))}const w=Ve(()=>{const[T,A]=vD(p),z=k(T);C(A),b.current=T,h.current=!1,f.forEach(M=>M(z)),l(z)});Pe(()=>(h.current||k(b.current),()=>{a.current=[],r&&(r.current=[])}),[a,r,k]),Pe(()=>{h.current&&w()}),Pe(()=>()=>{_.current?.disconnect(),h.current=!0},[]);const E=Ve(T=>(f.add(T),()=>{f.delete(T)})),R=x.useMemo(()=>({register:S,unregister:j,subscribeMapChange:E,nextIndexRef:g}),[S,j,E,g]);return n.jsx(lN.Provider,{value:R,children:t})}function bD(){return new Map}function _D(){return new Set}function vD(e){const t=new Set,a=[],r=[];e.forEach((l,d)=>{if(!d.isConnected)return;const f=l.index,p={index:f??-1,element:d,registration:l};f===null?r.push(p):f>=0&&(t.add(f),a.push(p))});let i=0;return r.sort((l,d)=>fN(l.element,d.element)),r.forEach(l=>{for(;t.has(i);)i+=1;l.index=i,a.push(l),i+=1}),t.size>0&&a.sort((l,d)=>l.index-d.index),[a,r.map(l=>l.element)]}function yD(e,t){let a=e.parentElement;for(;a&&!a.contains(t);)a=a.parentElement;return a}function jD(e){for(const t of e)for(let a=0;a<t.removedNodes.length;a+=1)if(t.removedNodes[a].isConnected)return!0;return!1}function fN(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const P_=x.forwardRef(function(t,a){const{cutout:r,...i}=t;let l;if(r){const d=r.getBoundingClientRect();l=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${d.left}px ${d.top}px,${d.left}px ${d.bottom}px,${d.right}px ${d.bottom}px,${d.right}px ${d.top}px,${d.left}px ${d.top}px)`}return n.jsx("div",{ref:a,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:l}})});let Ak={},Mk={},zk="";function Cp(e,t){return au(e)?e:t}function Ok(e,t,a){return/hidden|clip/.test(e.getComputedStyle(Cp(t,a)).overflowY)}function kD(e){if(typeof document>"u")return!1;const t=vt(e);return Jt(t).innerWidth-t.documentElement.clientWidth>0}function wD(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const a=vt(e),r=a.documentElement,i=a.body,l=Cp(r,i),d=l.style.overflowY,f=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",l.style.overflowY="scroll";const p=l.offsetWidth;l.style.overflowY="hidden";const g=l.offsetWidth;return l.style.overflowY=d,r.style.scrollbarGutter=f,p===g}function SD(e){const t=vt(e),a=t.documentElement,r=t.body,i=Cp(a,r),l={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(i.style,l)}}function CD(e){const t=vt(e),a=t.documentElement,r=t.body,i=Jt(a);let l=0,d=0,f=!1;const p=ga.create();if(ur&&(i.visualViewport?.scale??1)!==1)return()=>{};function g(){const y=i.getComputedStyle(a),S=i.getComputedStyle(r),C=(y.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";l=a.scrollTop,d=a.scrollLeft,Ak={scrollbarGutter:a.style.scrollbarGutter,overflowY:a.style.overflowY,overflowX:a.style.overflowX},zk=a.style.scrollBehavior,Mk={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const w=a.scrollHeight>a.clientHeight,E=a.scrollWidth>a.clientWidth,R=y.overflowY==="scroll"||S.overflowY==="scroll",T=y.overflowX==="scroll"||S.overflowX==="scroll",A=Math.max(0,i.innerWidth-r.clientWidth),z=Math.max(0,i.innerHeight-r.clientHeight),M=parseFloat(S.marginTop)+parseFloat(S.marginBottom),D=parseFloat(S.marginLeft)+parseFloat(S.marginRight),L=Cp(a,r);if(f=wD(e),f){a.style.scrollbarGutter=C,L.style.overflowY="hidden",L.style.overflowX="hidden";return}Object.assign(a.style,{scrollbarGutter:C,overflowY:"hidden",overflowX:"hidden"}),(w||R)&&(a.style.overflowY="scroll"),(E||T)&&(a.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:M||z?`calc(100dvh - ${M+z}px)`:"100dvh",width:D||A?`calc(100vw - ${D+A}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),r.scrollTop=l,r.scrollLeft=d,a.setAttribute("data-base-ui-scroll-locked",""),a.style.scrollBehavior="unset"}function h(){Object.assign(a.style,Ak),Object.assign(r.style,Mk),f||(a.scrollTop=l,a.scrollLeft=d,a.removeAttribute("data-base-ui-scroll-locked"),a.style.scrollBehavior=zk)}function b(){h(),p.request(g)}g();const _=xt(i,"resize",b);return()=>{p.cancel(),h(),typeof i.removeEventListener=="function"&&_()}}class ND{lockCount=0;restore=null;timeoutLock=ta.create();timeoutUnlock=ta.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const a=vt(t),r=a.documentElement,i=a.body,l=Jt(r);if(Ok(l,r,i)){const f=new l.MutationObserver(()=>{Ok(l,r,i)||(f.disconnect(),this.restore=null,this.lock(t))}),p={attributes:!0};f.observe(r,p),f.observe(i,p),this.restore=()=>f.disconnect();return}const d=rp||!kD(t);this.restore=d?SD(t):CD(t)}}const ED=new ND;function pN(e=!0,t=null){Pe(()=>{if(e)return ED.acquire(t)},[e,t])}const RD=20;function mN(e,t,a,r){const[i,l]=x.useState(!1);Pe(()=>{if(!e||!t||a==null){l(!1);return}const d=vt(a).documentElement.clientWidth,f=a.offsetWidth;l(d>0&&f>0&&f>=d-RD)},[e,t,a]),pN(e&&(!t||i),r)}const TD=x.forwardRef(function(t,a){const{anchor:r,positionMethod:i="absolute",className:l,render:d,side:f,align:p,sideOffset:g=0,alignOffset:h=0,collisionBoundary:b="clipping-ancestors",collisionPadding:_=5,arrowPadding:y=5,sticky:S=!1,disableAnchorTracking:j=!1,collisionAvoidance:k=pC,style:C,...w}=t,{store:E}=Ko(),R=hD(),T=D_(!0),A=E.useState("parent"),z=E.useState("floatingRootContext"),M=E.useState("floatingTreeRoot"),D=E.useState("mounted"),L=E.useState("open"),I=E.useState("modal"),P=E.useState("openMethod"),B=E.useState("activeTriggerElement"),q=E.useState("transitionStatus"),Y=E.useState("positionerElement"),U=E.useState("instantType"),V=E.useState("adaptiveOrigin"),X=E.useState("lastOpenChangeReason"),Q=E.useState("floatingNodeId"),W=E.useState("floatingParentNodeId"),$=z.useState("domReferenceElement"),K=x.useRef(null),J=zC(Y);let G=r,te=g,se=h,pe=p,F=k;A.type==="context-menu"&&(G=r??A.context?.anchor,pe=pe??"start",!f&&pe!=="center"&&(se=t.alignOffset??2,te=t.sideOffset??-5));let oe=f,_e=pe;A.type==="menu"?(oe=oe??"inline-end",_e=_e??"start",F=t.collisionAvoidance??mC):A.type==="menubar"&&(oe=oe??(A.context.orientation==="vertical"?"inline-end":"bottom"),_e=_e??"start");const le=A.type==="context-menu",be=R_({anchor:G,floatingRootContext:z,positionMethod:T?"fixed":i,mounted:D,side:oe,sideOffset:te,align:_e,alignOffset:se,arrowPadding:le?0:y,collisionBoundary:b,collisionPadding:_,sticky:S,nodeId:Q,keepMounted:R,disableAnchorTracking:j,collisionAvoidance:F,shift:le?{crossAxis:!("side"in F&&F.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:M,adaptiveOrigin:V});x.useEffect(()=>{function Me(De){De.open&&(De.parentNodeId===Q&&E.set("hoverEnabled",!1),De.nodeId!==Q&&De.parentNodeId===E.select("floatingParentNodeId")&&E.setOpen(!1,rt(Sc)))}return M.events.on("menuopenchange",Me),()=>{M.events.off("menuopenchange",Me)}},[E,M.events,Q]),x.useEffect(()=>{if(E.select("floatingParentNodeId")==null)return;function Me(De){if(De.open||De.nodeId!==E.select("floatingParentNodeId"))return;const He=De.reason??Sc;E.setOpen(!1,rt(He))}return M.events.on("menuopenchange",Me),()=>{M.events.off("menuopenchange",Me)}},[M.events,E]);const ke=Tn();x.useEffect(()=>{L||ke.clear()},[L,ke]),x.useEffect(()=>{function Me(De){if(!(!L||De.nodeId!==E.select("floatingParentNodeId")))if(De.target&&B&&B!==De.target){const He=E.select("closeDelay");He>0?ke.isStarted()||ke.start(He,()=>{E.setOpen(!1,rt(Sc))}):E.setOpen(!1,rt(Sc))}else ke.clear()}return M.events.on("itemhover",Me),()=>{M.events.off("itemhover",Me)}},[M.events,L,B,E,ke]),x.useEffect(()=>{const Me={open:L,nodeId:Q,parentNodeId:W,reason:E.select("lastOpenChangeReason")};M.events.emit("menuopenchange",Me)},[M.events,L,E,Q,W]),Pe(()=>{const Me=$,De=K.current;if(Me&&(K.current=Me),De&&Me&&Me!==De){E.set("instantType",void 0);const He=new AbortController;return J(()=>{E.set("instantType","trigger-change")},He.signal),()=>{He.abort()}}},[$,J,E]);const Re={open:L,side:be.side,align:be.align,anchorHidden:be.anchorHidden,nested:A.type==="menu",instant:U},Ae=A.type==="menubar"&&A.context.modal;mN(L&&(Ae||I&&X!==Rn),P==="touch",Y,B);const Oe=T_(t,Re,{styles:be.positionerStyles,transitionStatus:q,props:w,refs:[a,E.useStateSetter("positionerElement")],hidden:!D,inert:!L}),Te=D&&A.type!=="menu"&&(A.type!=="menubar"&&I&&X!==Rn||A.type==="menubar"&&A.context.modal);let Ee=null;return A.type==="menubar"?Ee=A.context.contentElement:A.type===void 0&&(Ee=B),n.jsxs(sN.Provider,{value:be,children:[Te&&n.jsx(P_,{ref:A.type==="context-menu"||A.type==="nested-context-menu"?A.context.internalBackdropRef:null,inert:jp(!L),cutout:Ee}),n.jsx(aO,{id:Q,children:n.jsx(Sp,{elementsRef:E.context.itemDomElements,labelsRef:E.context.itemLabels,children:Oe})})]})}),gN=x.createContext(void 0);function AD(){const e=x.useContext(gN);if(e===void 0)throw new Error(gn(34));return e}const MD=x.memo(x.forwardRef(function(t,a){const{render:r,className:i,value:l,defaultValue:d,onValueChange:f,disabled:p=!1,style:g,"aria-labelledby":h,...b}=t,[_,y]=x.useState(void 0),[S,j]=ol({controlled:l,default:d,name:"MenuRadioGroup"}),k=Ve((R,T)=>{f?.(R,T),!T.isCanceled&&j(R)}),w=Et("div",t,{state:{disabled:p},ref:a,props:{role:"group","aria-labelledby":h??_,"aria-disabled":p||void 0,...b}}),E=x.useMemo(()=>({value:S,setValue:k,disabled:p}),[S,k,p]);return n.jsx(cD.Provider,{value:y,children:n.jsx(gN.Provider,{value:E,children:w})})})),hN=x.createContext(void 0);function zD(){const e=x.useContext(hN);if(e===void 0)throw new Error(gn(35));return e}const OD=x.forwardRef(function(t,a){const{render:r,className:i,id:l,label:d,nativeButton:f=!1,disabled:p=!1,closeOnClick:g=!1,value:h,style:b,..._}=t,y=cu({guess:!0,label:d}),S=O_(!0),j=ra(l),{store:k}=Ko(),C=k.useState("isActive",y.index),w=k.useState("itemProps"),{value:E,setValue:R,disabled:T}=AD(),A=k.useState("disabled"),z=p||T||A,M=E===h,{getItemProps:D,itemRef:L}=iN({closeOnClick:g,disabled:z,highlighted:C,id:j,store:k,nativeButton:f,nodeId:S?.context.nodeId,itemMetadata:oN}),I=x.useMemo(()=>({disabled:z,highlighted:C,checked:M}),[z,C,M]);function P(q){const Y=rt(Ki,q.nativeEvent,void 0,{preventUnmountOnClose:En});R(h,Y)}const B=Et("div",t,{state:I,stateAttributesMapping:cN,props:[w,{role:"menuitemradio","aria-checked":M,onClick:P},_,D],ref:[L,a,y.ref]});return n.jsx(hN.Provider,{value:I,children:B})}),DD=x.forwardRef(function(t,a){const{render:r,className:i,style:l,keepMounted:d=!1,...f}=t,p=zD(),g=x.useRef(null),{transitionStatus:h,mounted:b,setMounted:_}=vl(p.checked);Ca({open:p.checked,ref:g,onComplete(){p.checked||_(!1)}});const y={checked:p.checked,disabled:p.disabled,highlighted:p.highlighted,transitionStatus:h};return Et("span",t,{state:y,stateAttributesMapping:cN,ref:[a,g],props:{"aria-hidden":!0,...f},enabled:d||b})}),PD=x.createContext(null);function xN(e){return x.useContext(PD)}function LD(e){const t=x.useRef(""),a=x.useCallback(i=>{i.defaultPrevented||(t.current=i.pointerType,e(i,i.pointerType))},[e]);return{onClick:x.useCallback(i=>{if(i.detail===0){e(i,"keyboard");return}"pointerType"in i?e(i,i.pointerType):e(i,t.current),t.current=""},[e]),onPointerDown:a}}function L_(e,t){const a=x.useRef(e),r=Ve(t);Pe(()=>{a.current!==e&&r(a.current),a.current=e},[e,r])}function ID(e,t){const a=Ve((l,d)=>{(typeof e=="function"?e():e)||t(d||(rp?"touch":""))}),{onClick:r,onPointerDown:i}=LD(a);return x.useMemo(()=>({onClick:r,onPointerDown:i}),[r,i])}function bN(e){const[t,a]=x.useState(null),r=ID(e,a);return L_(e,i=>{i&&!e&&a(null)}),x.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}const $D={...S_,disabled:e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")}};class BD extends ou{constructor(t){super({...qD(),...t},UD(),$D),this.unsubscribeParentListener=this.observe("parent",a=>{if(this.unsubscribeParentListener?.(),a.type==="menu"){let r=a.store.select("rootId"),i=a.store.select("floatingTreeRoot"),l=a.store.select("keyboardEventRelay");this.unsubscribeParentListener=a.store.subscribe(()=>{const d=a.store.select("rootId"),f=a.store.select("floatingTreeRoot"),p=a.store.select("keyboardEventRelay");r===d&&i===f&&l===p||(r=d,i=f,l=p,this.notifyAll())}),this.context.allowMouseUpTriggerRef=a.store.context.allowMouseUpTriggerRef;return}a.type!==void 0&&(this.context.allowMouseUpTriggerRef=a.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,a){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:a})}unsubscribeParentListener=null}function UD(){return{positionerRef:x.createRef(),popupRef:x.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),onOpenChangeComplete:void 0,triggerElements:new iu}}function qD(){return{...k_(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new m_,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:sn,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}const HD=x.createContext(void 0);function VD(){return x.useContext(HD)}const FD=Gb(function(t){const{children:a,open:r,onOpenChange:i,onOpenChangeComplete:l,defaultOpen:d=!1,disabled:f=!1,modal:p,loopFocus:g=!0,orientation:h="vertical",actionsRef:b,closeParentOnEsc:_=!1,handle:y,triggerId:S,defaultTriggerId:j=null,highlightItemOnHover:k=!0}=t,C=D_(!0),w=Ko(!0),E=xN(!0),R=VD(),T=x.useMemo(()=>R&&w?{type:"menu",store:w.store}:E?{type:"menubar",context:E}:C&&!w?{type:"context-menu",context:C}:{type:void 0},[C,w,E,R]),A=GD({open:d,openProp:r,activeTriggerId:j,triggerIdProp:S,parent:T});A.useControlledProp("openProp",r),A.useControlledProp("triggerIdProp",S),A.useContextCallback("onOpenChangeComplete",l);const z=Lo(),M=Lo(),D=A.useState("floatingTreeRoot"),L=yC(D),I=no(),P=A.useState("open"),B=A.useState("activeTriggerElement"),q=A.useState("positionerElement"),Y=A.useState("hoverEnabled"),U=A.useState("disabled"),V=A.useState("lastOpenChangeReason"),X=A.useState("parent"),Q=A.useState("activeIndex"),W=A.useState("payload"),$=A.useState("floatingParentNodeId"),K=x.useRef(null),J=x.useRef(X.type!=="context-menu"),G=Tn(),te=x.useRef(!0),se=Tn(),pe=$!=null,{openMethod:F,triggerProps:oe}=bN(P);A.useSyncedValues({disabled:f,highlightItemOnHover:k,modal:X.type===void 0?p:void 0,openMethod:F,rootId:z}),v_(A);const{forceUnmount:_e}=y_(P,A,()=>{A.set("allowMouseEnter",!1)});Pe(()=>{C&&!w?A.update({parent:{type:"context-menu",context:C},floatingNodeId:L,floatingParentNodeId:I}):w&&A.update({floatingNodeId:L,floatingParentNodeId:I})},[C,w,L,I,A]),x.useEffect(()=>{if(P||(K.current=null),X.type==="context-menu"){if(!P){G.clear(),J.current=!1;return}G.start(500,()=>{J.current=!0})}},[G,P,X.type]),Pe(()=>{!P&&!Y&&A.set("hoverEnabled",!0)},[P,Y,A]);const le=Ve((Ne,We)=>{const Ge=We.reason;if(!Ne&&!A.select("open")||P===Ne&&We.trigger===B&&V===Ge)return;const it=DC(We);if(!Ne&&We.trigger==null&&(We.trigger=B??void 0),i?.(Ne,We),We.isCanceled)return;A.state.floatingRootContext.dispatchOpenChange(Ne,We);const Tt=We.event;if(Ne===!1&&Tt?.type==="click"&&Tt.pointerType==="touch"&&!te.current)return;Ne&&Ge===Yi?(te.current=!1,se.start(300,()=>{te.current=!0})):(te.current=!0,se.clear());const _t=(Ge===_l||Ge===Ki)&&Tt.detail===0,Ct=!Ne&&(Ge===pp||Ge==null),je={open:Ne,openChangeReason:Ge};K.current=We.event,__(je,Ne,We.trigger,it()),A.update(je),X.type==="menubar"&&(Ge===Yi||Ge===Po||Ge===Rn||Ge===Ex||Ge===Sc)?A.set("instantType","group"):_t||Ct?A.set("instantType",_t?"click":"dismiss"):A.set("instantType",void 0)}),be=MC({popupStore:A,floatingId:M,nested:I!=null,onOpenChange:le}),ke=be.context.events;Pe(()=>{const Ne=({open:We,eventDetails:Ge})=>le(We,Ge);return ke.on("setOpen",Ne),()=>{ke?.off("setOpen",Ne)}},[ke,le]);const Re=x.useCallback(()=>{A.setOpen(!1,rt(n_))},[A]);x.useImperativeHandle(b,()=>({unmount:_e,close:Re}),[_e,Re]);let Ae;X.type==="context-menu"&&(Ae=X.context),x.useImperativeHandle(Ae?.positionerRef,()=>q,[q]),x.useImperativeHandle(Ae?.actionsRef,()=>({setOpen:le}),[le]);const Ie=gp(be,{enabled:!U,bubbles:{escapeKey:_&&X.type==="menu"},outsidePress(){return X.type!=="context-menu"||K.current?.type==="contextmenu"?!0:J.current},externalTree:pe?D:void 0}),Oe=vp(),Te=x.useCallback(Ne=>{A.select("activeIndex")!==Ne&&A.set("activeIndex",Ne)},[A]),Ee=VC(be,{enabled:!U,listRef:A.context.itemDomElements,activeIndex:Q,nested:X.type!==void 0,loopFocus:g,orientation:h,parentOrientation:X.type==="menubar"?X.context.orientation:void 0,rtl:Oe==="rtl",disabledIndices:ja,onNavigate:Te,openOnArrowKeyDown:X.type!=="context-menu",externalTree:pe?D:void 0,focusItemOnHover:k}),Me=x.useCallback(Ne=>{A.context.typingRef.current=Ne},[A]),De=FC(be,{enabled:!U,listRef:A.context.itemLabels,elementsRef:A.context.itemDomElements,activeIndex:Q,resetMs:Zz,onMatch:Ne=>{P&&Ne!==Q&&A.set("activeIndex",Ne)},onTyping:Me}),He=x.useMemo(()=>{const Ne=Ss(De.reference,Ee.reference,Ie.reference,{onMouseMove(){A.set("allowMouseEnter",!0)}},oe);return Ne["aria-haspopup"]="menu",Ne["aria-expanded"]=P,Ne},[A,De.reference,Ee.reference,Ie.reference,oe,P]),Qe=x.useMemo(()=>{const Ne=Ss(Ee.trigger,Ie.trigger,oe);return Ne["aria-haspopup"]="menu",Ne["aria-expanded"]=!1,Ne},[Ee.trigger,Ie.trigger,oe]),ge=x.useMemo(()=>Ss(bp,{id:M,role:"menu","aria-labelledby":B?.id,onMouseMove(){A.set("allowMouseEnter",!0),X.type==="menu"&&A.set("hoverEnabled",!1)},onClick(){A.select("hoverEnabled")&&A.set("hoverEnabled",!1)},onKeyDown(Ne){const We=A.select("keyboardEventRelay");We&&!Ne.isPropagationStopped()&&We(Ne)}},De.floating,Ee.floating,Ie.floating),[B,M,X.type,A,De.floating,Ee.floating,Ie.floating]),de=Ee.item??sn;j_(A,{floatingRootContext:be,activeTriggerProps:He,inactiveTriggerProps:Qe,popupProps:ge,itemProps:de});const Le=x.useMemo(()=>({store:A,parent:T}),[A,T]),ye=n.jsxs(aN.Provider,{value:Le,children:[y&&n.jsx(b_,{handle:y,store:A}),typeof a=="function"?a({payload:W}):a]});return X.type===void 0||X.type==="context-menu"?n.jsx(rO,{externalTree:D,children:ye}):ye});function GD(e){return Vn(()=>new BD(e)).current}const $d=5;function _N(e,t){const a=YD(t);return e.clientX>=a.left-$d&&e.clientX<=a.right+$d&&e.clientY>=a.top-$d&&e.clientY<=a.bottom+$d}function YD(e){const t=e.getBoundingClientRect(),a=Jt(e);if(Xb)return t;const r=a.getComputedStyle(e,"::before"),i=a.getComputedStyle(e,"::after");if(!(r.content!=="none"||i.content!=="none"))return t;const d=parseFloat(r.width)||0,f=parseFloat(r.height)||0,p=parseFloat(i.width)||0,g=parseFloat(i.height)||0,h=Math.max(t.width,d,p),b=Math.max(t.height,f,g),_=h-t.width,y=b-t.height;return{left:t.left-_/2,right:t.right+_/2,top:t.top-y/2,bottom:t.bottom+y/2}}function vN(e={}){const{highlightItemOnHover:t,highlightedIndex:a,onHighlightedIndexChange:r}=kp(),{ref:i,index:l}=cu(e),d=a===l,f=x.useRef(null),p=ir(i,f);return{compositeProps:{tabIndex:d?0:-1,onFocus(){r(l)},onMouseMove(){const h=f.current;if(!t||!h)return;const b=h.hasAttribute("disabled")||h.ariaDisabled==="true";!d&&!b&&h.focus()}},compositeRef:p,index:l}}function KD(e){const{render:t,className:a,style:r,state:i=sn,props:l=ja,refs:d=ja,metadata:f,stateAttributesMapping:p,tag:g="div",...h}=e,{compositeProps:b,compositeRef:_}=vN({metadata:f});return Et(g,e,{state:i,ref:[_,...d],props:[b,...l,h],stateAttributesMapping:p})}function yN(e){if(Yt(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid");if(!tr(e))return yN(or(e))}function XD(e,t){const a=x.useRef(null);function r(l){Gs.flushSync(()=>{e.setOpen(!1,rt(Po,l.nativeEvent,l.currentTarget))}),Oz(a.current)?.focus()}function i(l){const d=e.select("positionerElement");if(d&&Xi(l,d))e.context.beforeContentFocusGuardRef.current?.focus();else{Gs.flushSync(()=>{e.setOpen(!1,rt(Po,l.nativeEvent,l.currentTarget))});let f=zz(e.context.triggerFocusTargetRef.current||t.current);for(;f!==null&&Je(d,f);){const p=f;if(f=c_(f),f===p)break}f?.focus()}}return{preFocusGuardRef:a,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function QD(e){const{enabled:t=!0,mouseDownAction:a,open:r}=e,i=x.useRef(!1);return x.useMemo(()=>t?{onMouseDown:l=>{(a==="open"&&!r||a==="close"&&r)&&(i.current=!0,vt(l.currentTarget).addEventListener("click",()=>{i.current=!1},{once:!0}))},onClick:l=>{i.current&&(i.current=!1,l.preventBaseUIHandler())}}:sn,[t,a,r])}const WD=PS(function(t,a){const{render:r,className:i,style:l,disabled:d=!1,nativeButton:f=!0,id:p,openOnHover:g,delay:h=100,closeDelay:b=0,handle:_,payload:y,...S}=t,j=Ko(!0),C=$C(_)??j?.store;if(!C)throw new Error(gn(85));const w=ra(p),E=C.useState("isTriggerActive",w),R=C.useState("floatingRootContext"),T=C.useState("isOpenedByTrigger",w),A=C.useState("triggerPopupId",w),z=x.useRef(null),M=JD(),D=kp(!0),L=so(),I=x.useMemo(()=>L??new m_,[L]),P=yC(I),B=no(),{registerTrigger:q,isMountedByThisTrigger:Y}=PC(w,z,C,{payload:y,closeDelay:b,parent:M,floatingTreeRoot:I,floatingNodeId:P,floatingParentNodeId:B,keyboardEventRelay:D?.relayKeyboardEvent}),U=M.type==="menubar",V=C.useState("disabled"),X=d||V||U&&M.context.disabled,{getButtonProps:Q,buttonRef:W}=ao({disabled:X,native:f});x.useEffect(()=>{!T&&M.type===void 0&&(C.context.allowMouseUpTriggerRef.current=!1)},[C,T,M.type]);const $=x.useRef(null),K=Tn(),J=Ve(Me=>{if(!$.current)return;K.clear(),C.context.allowMouseUpTriggerRef.current=!1;const De=Me.target;Je($.current,De)||Je(C.select("positionerElement"),De)||De===$.current||De!=null&&yN(De)===C.select("rootId")||_N(Me,$.current)||I.events.emit("close",{domEvent:Me,reason:qS})});x.useEffect(()=>{T&&C.select("lastOpenChangeReason")===Rn&&vt($.current).addEventListener("mouseup",J,{once:!0})},[T,J,C]);const G=U&&M.context.hasSubmenuOpen,se=HC(R,{enabled:(g??G)&&!X&&(!U||G&&!Y),handleClose:GC({blockPointerEvents:!U}),mouseOnly:!0,move:!1,restMs:M.type===void 0?h:void 0,delay:{close:b},triggerElementRef:z,externalTree:I,isActiveTrigger:E,isClosing:()=>C.select("transitionStatus")==="ending"}),pe=ZD(T,C.select("lastOpenChangeReason")),F=jC(R,{enabled:!X,event:T&&U?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:M.type===void 0?pe:!1}),oe=BC(R,{enabled:!X&&G}),_e=QD({open:T,enabled:U,mouseDownAction:"open"}),le=x.useMemo(()=>Ss(oe.reference,F.reference),[oe.reference,F.reference]),be=C.useState("triggerProps",Y),{preFocusGuardRef:ke,handlePreFocusGuardFocus:Re,handleFocusTargetFocus:Ae}=XD(C,z),Ie={disabled:X,open:T},Oe=[$,a,W,q,z],Te=[le,se??sn,be,{"aria-haspopup":"menu","aria-controls":A,id:w,onMouseDown:Me=>{if(C.select("open"))return;K.start(200,()=>{C.context.allowMouseUpTriggerRef.current=!0}),vt(Me.currentTarget).addEventListener("mouseup",J,{once:!0})}},U?{role:"menuitem"}:{},_e,S,Q],Ee=Et("button",t,{enabled:!U,stateAttributesMapping:Ox,state:Ie,ref:Oe,props:Te});return U?n.jsx(KD,{tag:"button",render:r,className:i,style:l,state:Ie,refs:Oe,props:Te,stateAttributesMapping:Ox}):T?n.jsxs(x.Fragment,{children:[n.jsx(al,{ref:ke,onFocus:Re},`${w}-pre-focus-guard`),n.jsx(x.Fragment,{children:Ee},w),n.jsx(al,{ref:C.context.triggerFocusTargetRef,onFocus:Ae},`${w}-post-focus-guard`)]}):n.jsx(x.Fragment,{children:Ee},w)});function ZD(e,t){const a=Tn(),[r,i]=x.useState(!1);return Pe(()=>{e&&t===Rn?(i(!0),a.start(Jz,()=>{i(!1)})):e||(a.clear(),i(!1))},[e,t,a]),r}function JD(){const e=xN();return x.useMemo(()=>e?{type:"menubar",context:e}:{type:void 0},[e])}function jN(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function I_({...e}){return n.jsx(FD,{"data-slot":"dropdown-menu",...e})}function $_({...e}){return n.jsx(WD,{"data-slot":"dropdown-menu-trigger",...e})}function B_({align:e="start",alignOffset:t=0,side:a="bottom",sideOffset:r=4,className:i,...l}){return n.jsx(xD,{children:n.jsx(TD,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:a,sideOffset:r,children:n.jsx(gD,{"data-slot":"dropdown-menu-content",className:St("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",i),...l})})})}function uf({className:e,inset:t,variant:a="default",...r}){return n.jsx(uD,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":a,className:St("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...r})}function eP({...e}){return n.jsx(MD,{"data-slot":"dropdown-menu-radio-group",...e})}function tP({className:e,children:t,inset:a,...r}){return n.jsxs(OD,{"data-slot":"dropdown-menu-radio-item","data-inset":a,className:St("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:n.jsx(DD,{children:n.jsx(Xr,{})})}),t]})}const nP={cron:{daily:"todos los días a las {at}",weekdays:"de lunes a viernes a las {at}",weekends:"fines de semana a las {at}",on_days:"{days} a las {at}",monthly:"el día {day} de cada mes a las {at}",every_hour:"cada hora, al minuto {minute}",every_n_hours:"cada {n} horas, al minuto {minute}",every_n_minutes:"cada {n} minutos",every_minute:"cada minuto",every_label:"cada N horas en vez de una hora fija",use_cron:"editar como cron",use_picker:"usar el selector",preset_every_day:"todos los días",preset_weekdays:"días de semana",preset_weekends:"fin de semana",day_short:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mié",thu:"Jue",fri:"Vie",sat:"Sáb"}},when:{now:"ahora",in:"en {amount}",ago:"hace {amount}",minutes:"{n} min",hours:"{n} h",days:"{n} d"},common:{loading:"Cargando…",saving:"Guardando…",cancel:"Cancelar",save:"Guardar",delete:"Borrar",edit:"Editar",create:"Crear",add:"Agregar",remove:"Quitar",reload:"Recargar",shutdown:"Apagar",enabled:"Habilitado",disabled:"Deshabilitado",enable:"Habilitar",disable:"Deshabilitar",open:"Abrir",close:"Cerrar",confirm:"Confirmar",optional:"(opcional)",none:"—",none_yet:"Todavía no hay nada.",error_generic:"Algo salió mal.",search:"Buscar",new:"Nuevo",restore:"Restaurar",show:"Mostrar",hide:"Ocultar",copy:"Copiar",run:"Ejecutar",refresh:"Refrescar",view_all:"Ver todo",saved:"Guardado.",deleted:"Eliminado.",pager_prev:"Anterior",pager_next:"Siguiente",pager_page:"Página {page} de {total}",pager_range:"{from}–{to} de {total}",pager_per_page:"Por página"},daemon:{connecting:"Conectando con el daemon…",unreachable:"No pude llegar al daemon en localhost:7430.",unreachable_hint:"Arrancá APX con `apx daemon start` y refrescá.",version:"Versión",uptime:"Uptime",status:"Status",running:"running",down:"down",reload_hint:"POST /admin/reload — relee ~/.apx/config.json sin reiniciar.",shutdown_confirm:"¿Apagar el daemon? Las próximas requests fallarán hasta levantarlo de nuevo.",shutdown_done:"Daemon detenido."},pairing:{title:"Vincular este equipo",subtitle:"Estás entrando desde fuera de esta máquina. Por seguridad, vinculá este navegador con un código de pairing.",steps_title:"Cómo obtener el código",step_1:"En la PC donde corre APX, abrí una terminal.",step_2:"Ejecutá `apx pair` (o escaneá el QR con APX Deck).",step_3:"Copiá el código que aparece debajo del QR y pegalo acá.",code_label:"Código de pairing",code_ph:"p. ej. 7f3a1c9e-…",label_label:"Nombre de este equipo",label_ph:"p. ej. Notebook del living",submit:"Vincular",linking:"Vinculando…",success:"Equipo vinculado ✓",err_required:"Pegá el código de pairing.",err_expired:"El código expiró. Volvé a correr `apx pair` y probá de nuevo.",err_unknown:"Código desconocido o ya usado. Generá uno nuevo con `apx pair`.",err_generic:"No se pudo vincular. Revisá el código e intentá otra vez.",revoke_hint:"Podés revocar este equipo cuando quieras desde Settings o con `apx pair revoke`."},nav:{apx_admin:"APX",settings:"Settings",project:"Proyecto",add_project:"Agregar proyecto",all_projects:"Todos los proyectos",more_projects:"{count} más",collapse_projects:"Ocultar proyectos",expand_projects:"Mostrar proyectos",modules:{voice:"Voces",desktop:"Escritorio",deck:"Deck",code:"Code",web:"Web"}},topbar:{breadcrumb_root:"APX",breadcrumb_settings:"APX › Settings",breadcrumb_project:"APX › Proyecto",breadcrumb_base:"Base",breadcrumb_projects:"Proyectos",light:"Cambiar a claro",dark:"Cambiar a oscuro",lang_toggle:"Idioma"},admin:{title:"APX",subtitle:"Panel general. Configuración global, canales y proyectos.",engines_title:"Engines",engines_subtitle:"Adaptadores LLM disponibles. Las API keys viven en ~/.apx/config.json.",telegram_title:"Telegram",telegram_subtitle:"Canales configurados. Cada uno puede estar pineado a un proyecto.",telegram_polling_on:"Polling activo",telegram_polling_off:"Deshabilitado",telegram_add_channel:"Canal",telegram_send_test:"Probar",telegram_send_test_title:"Enviar a",telegram_default_message:"Mensaje de prueba desde el panel de APX ✅",projects_title:"Proyectos registrados",projects_subtitle:"Click en un proyecto para abrir su panel.",unregister:"Desregistrar",unregister_confirm:"¿Quitar {label} de APX? La carpeta no se borra; sólo se desregistra.",reload_success:"Config recargada.",telegram_polling_started:"Polling iniciado.",telegram_polling_stopped:"Polling detenido.",telegram_channel_removed:"Canal eliminado.",agents_badge:"agents",engine_badge:"sí",engine_badge_no:"no",base_label:"Base"},add_project:{title:"Agregar proyecto",subtitle:"APX indexará .apc/, agents y AGENTS.md en esa carpeta.",path_label:"Ruta absoluta",path_hint:"Equivalente a apx project add /ruta/al/proyecto",path_placeholder:"/Volumes/SSDT7Shield/proyectos_varios/mi-proyecto",register:"Registrar",path_required:"Ruta requerida.",registered:"Proyecto #{id} registrado.",search_btn:"Buscar",picker_prompt:"Elegí la carpeta del proyecto",browser_unavailable:"Explorador no disponible hasta reiniciar daemon. Pegá ruta manual.",no_folders:"Sin carpetas."},inbox:{search:"Buscar",no_match:"No coincide nada",hide_quiet:"Ocultar agentes callados",open_in_project:"Abrir en el proyecto",super_agent_scope:"Todos los proyectos",title:"Bandeja de agentes",subtitle:"Cada agente como una conversación, lo más reciente primero.",empty:"Todavía no hablaste con ningún agente.",pinned:"principal",show_quiet:"Ver los que no hablaron",no_reply_yet:"(sin respuestas todavía)"},settings:{title:"Settings",subtitle:"Preferencias del panel + diagnóstico del daemon local.",appearance:"Apariencia",light_mode:"Claro",dark_mode:"Oscuro",system_mode:"Sistema",language:"Idioma",daemon:"Daemon",daemon_sub:"Estado del proceso local que sirve esta web y orquesta los agentes.",engines:"Engines disponibles",engines_sub:"Adaptadores LLM compilados con el daemon.",token:"Token para esta sesión",token_sub:"Si esta web no logró auto-cargar el token, pegalo acá.",token_active:"(ya hay token activo)",token_paste:"Pegá el bearer del daemon",token_saved:"Token guardado.",devices:"Dispositivos pareados",devices_sub:"GET /pair/list. Revocar invalida ese bearer en el daemon.",devices_empty:"No hay clientes pareados todavía.",devices_revoke_confirm:"Revocar cliente {id}?",devices_revoke_success:"Cliente revocado.",devices_pair_btn:"Vincular dispositivo",devices_pair_title:"Vincular dispositivo",devices_pair_desc:"Escaneá el QR con la cámara del celu para entrar directo, o pegá el código en la otra PC.",devices_pair_scan:"Escaneá con la cámara del teléfono — te abre la web ya vinculada.",devices_pair_code:"O pegá este código en la pantalla de pairing:",devices_pair_url:"URL de acceso",devices_pair_link:"O copiá este link y abrilo en el otro dispositivo (entra solo):",devices_pair_copy:"Copiar",devices_pair_copied:"Link copiado al portapapeles.",devices_pair_copied_code:"Código copiado.",devices_pair_expires:"Expira en {s}s",devices_pair_expired:"El código expiró.",devices_pair_regen:"Generar otro",devices_pair_waiting:"Esperando que el dispositivo confirme…",devices_pair_done:"Dispositivo vinculado ✓",devices_pair_localhost_only:"Solo se pueden generar códigos desde la PC del daemon (localhost).",devices_last_seen:"visto:",devices_never:"nunca",devices_revoke:"Revocar",account_section:"Cuenta",agents_section:"Agentes & modelos",super_agent_section:"Super-agente",knowledge_section:"Modelos y conocimiento",channels_section:"Canales & dispositivos",modules_section:"Módulos",advanced_section:"Avanzado",tabs:{identity:"Identidad",super_agent:"Super-agente",profile:"Perfil del agente",engines:"Engines & modelos",telegram:"Telegram",devices:"Dispositivos",nudge:"Interrupciones",advanced:"Avanzado"},profile:{title:"Perfil del agente",subtitle:"Un oficio instalable para el super-agente: qué hace con su día y cuándo te habla. Distinto del nombre del agente (eso está en Identidad).",active_hint:"Hay un perfil activo: su bloque viaja en cada turno de cada canal. Desactivalo para volver a vanilla.",vanilla_hint:"No hay ningún perfil activo. APX se comporta exactamente como siempre — el prompt del super-agente es idéntico al de una instalación limpia.",none_available:"No hay perfiles disponibles todavía.",active:"activo",activate:"Activar",replace_active:"Reemplazar el activo",deactivate:"Desactivar",on:"Activo",off:"Inactivo",replaces_active:"Activarlo reemplaza al perfil activo",deactivate_title:"¿Desactivar el perfil?",deactivate_confirm:"APX vuelve a vanilla. Las rutinas del perfil se deshabilitan pero no se borran, y tu configuración, tareas y memoria quedan intactas: volver a activarlo restaura todo.",activated:"Perfil activo",deactivated:"Perfil desactivado — APX está en vanilla",token_cost:"Costo de prompt",over_budget:"excede su presupuesto declarado",settings_title:"Configuración del perfil",settings_subtitle:"Los valores en blanco toman el default del paquete. Cambiar un horario reprograma la rutina de verdad.",saved:"Configuración guardada",saved_with_routines:"Configuración guardada y rutinas reprogramadas",doctor_title:"Diagnóstico",doctor_clean:"Todo en orden.",preview_title:"Bloque de prompt",preview_subtitle:"Exactamente lo que recibe el modelo, con tus valores ya sustituidos.",preview_empty:"(vacío)",preview_inactive:"Esto es lo que recibiría el modelo si activaras este perfil.",no_settings:"Este perfil no tiene nada configurable.",settings_locked:"Activá el perfil para poder cambiar su configuración.",doctor_vanilla:"Sin perfil activo. APX se comporta como siempre."},nudge:{title:"Presupuesto de interrupciones",subtitle:"Cada cuánto puede escribirte APX sin que se lo pidas. Las respuestas a tus propios mensajes nunca se retienen.",off_hint:"El presupuesto está apagado: sale todo mensaje no solicitado. Igual queda registrado acá abajo.",on_hint:"{{sent}} enviados hoy, quedan {{left}}.",source:"Definido por",enabled:"Aplicar el presupuesto",daily_max:"Mensajes por día",daily_max_hint:"0 significa sin techo.",quiet_hours:"Horas de silencio",quiet_hours_hint:"HH:MM-HH:MM. Cruza la medianoche sin problema. Vacío = ninguna.",cooldown:"Espacio mínimo (minutos)",project_cooldown:"Espacio mínimo por proyecto (minutos)",kind_cooldown:"Espacio mínimo por tipo (minutos)",critical_bypass:"Lo crítico puede saltarse el presupuesto",critical_bypass_hint:"Los saltos quedan siempre registrados y marcados.",log_title:"Lo que mandó",log_subtitle:"Sólo mensajes no solicitados, del más nuevo al más viejo. Lo que marques alimenta lo que manda después.",log_empty:"Todavía no mandó nada sin que se lo pidieras.",useful:"Me sirvió",noise:"No me servía",bypass:"se salteó el presupuesto",saved:"Presupuesto actualizado",unrated:"sin calificar"},identity:{title:"Identidad",subtitle:"Datos del usuario. Configuración del agente va en Super-agente.",agent_name:"Nombre del agente",owner_name:"Tu nombre",personality:"Personalidad",owner_context:"Contexto del dueño",owner_context_hint:"Quién sos, en qué trabajás, qué le interesa al agente saber de vos.",language:"Idioma preferido",timezone:"Timezone (IANA)",timezone_hint:"Detectado automáticamente — buscá para cambiar.",saved:"Identidad guardada."},super_agent:{title:"Super-agente",subtitle:"Personalidad, modelo, prompt y modos del super-agente.",personality:"Personalidad",model:"Modelo activo",model_hint:"Ej: anthropic:claude-sonnet-4.5, ollama:gemma2:9b",permission_mode:"Permission mode",system:"Prompt extra (system)",system_hint:"Texto que se prepende al system prompt base.",system_ph:"(Vacío = se usa el prompt base de core/agent/prompts/super-agent-base.md)",fallback_title:"Fallback chain",fallback_hint:"Si el modelo activo falla, prueba estos en orden.",fallback_add:"Agregar modelo a la cadena",saved:"Super-agente guardado.",enabled_label:"Super-agente habilitado",model_active:"Modelo activo (router)",model_configure:"Configurar en Modelos",behavior_subtitle:"Comportamiento del super-agente. El modelo y la cadena de fallback se configuran en el Router de modelos."},engines_keys:{title:"API keys de modelos",subtitle:"Cada engine guarda su key en ~/.apx/config.json. Los valores ya seteados muestran sufijo seguro.",ollama_url:"Ollama URL",ollama_hint:"Por defecto: http://127.0.0.1:11434",key_label:"API key",key_placeholder:"(no seteada)",clear:"Borrar key",saved:"Key guardada.",cleared:"Key borrada."},telegram_global:{title:"Telegram (default)",subtitle:"Canal default — los proyectos pueden overridear con su propio canal.",bot_token:"Bot token",chat_id:"Chat ID por defecto",poll_interval:"Poll interval (ms)",respond_with_engine:"Respond with engine",enabled:"Polling habilitado",saved:"Telegram guardado."},advanced:{title:"Avanzado",subtitle:"Editor raw del ~/.apx/config.json. Los secretos se ven *** set *** pero podés escribir uno nuevo.",write:"Aplicar cambios",written:"Config aplicada y daemon recargado.",reload_success:"Config recargada."}},project:{not_found:"Roby no encontró el proyecto {pid}: quizás se desregistró o el ID es incorrecto.",rebuild:"Rebuild context",rebuild_done:"Rebuild OK.",unregister_confirm:"¿Desregistrar {label}? La carpeta no se borra.",unregistered:"Desregistrado.",base_subtitle:"Espacio general · super-agente",danger:{title:"Zona peligrosa",subtitle:"Acciones que afectan el registro del proyecto en APX. No tocan archivos del repo.",rebuild_desc:"Re-escanea .apc/, MCPs y agents y regenera el contexto del super-agente para este proyecto.",unregister_desc:"Quita el proyecto del registry de APX. La carpeta del disco se mantiene intacta.",rebuild_confirm_title:"Rebuild context",rebuild_confirm_desc:"Regenerar contexto de {label}.",rebuild_long:"Vuelve a leer la config APC, lista MCPs y agents disponibles, y reconstruye el system prompt del super-agente. Es seguro de correr — no borra nada. Usalo después de tocar .apc/ a mano o si los cambios no se reflejan.",unregister_confirm_title:"Desregistrar proyecto",unregister_long:"El proyecto deja de aparecer en `apx`. Los archivos del disco (.apc/, código, todo) se mantienen. Podés volver a registrarlo con `apx project register <path>`."},nav:{overview:"Overview",chat:"Chat",config:"Config",telegram:"Telegram",agents:"Agents",routines:"Rutinas",tasks:"Tasks",commitments:"Compromisos",mcps:"MCPs",artifacts:"Artifacts",vars:"Variables",logs:"Logs",memories:"Memorias",structure:"Estructura",docs:"Docs",files:"Archivos"},sections:{workspace:"Workspace",content:"Contenido",automation:"Automatización",knowledge:"Conversaciones",config:"Config"},overview:{tasks_open:"Tasks abiertas",routines:"Rutinas",routines_active:"Rutinas activas",agents:"Agents",mcps:"MCPs",artifacts:"Artifacts",chat:"Chat (super-agent)",chat_value:"abrir",roster:"Equipo",no_agents:"Todavía no hay agentes.",orchestrators:"Orquestadores",specialists:"Especialistas",recent_tasks:"Tasks recientes",no_activity:"No hay tasks abiertas.",brain_title:"Cerebro del equipo",brain_desc:"El mapa completo de agentes — los orquestadores en el núcleo y sus especialistas en racimo alrededor. Clic en un nodo para abrirlo.",brain_core:"Equipo"},artifacts:{title:"Artifacts",subtitle:"Scripts y archivos reutilizables guardados en el proyecto. Los crean los agentes; podés verlos, ejecutarlos, renombrarlos o eliminarlos."},chat:{title:"Chat con agente",subtitle:"Chat directo con el agente del proyecto.",live_title:"Chat con {agent}",superagent_title:"Chat con {persona}",superagent_subtitle:"Chat con {persona} — el super-agente APX. Puede usar tools (proyectos, tasks, mcps, agentes).",loaded_subtitle:"Conversación cargada con {slug}. Lo que mandes se agrega a este chat.",thread_subtitle:"Historial con {persona} en {channel}. Si respondés acá, la conversación sigue desde la web.",empty:"Mandá un mensaje para arrancar la conversación.",placeholder:"Escribí algo y enter para enviar (shift+enter = nueva línea)",send:"Enviar",stop:"Stop",new_session:"Nueva sesión",delete:"Borrar",delete_confirm_title:"Borrar chat",delete_confirm_desc:"Esta acción no se puede deshacer. Se elimina para siempre el historial de este chat.",deleted:"Chat borrado.",meta_created:"Creado {date} · {channel}",meta_new:"Chat nuevo · {channel}",copy:"copiar",copied:"Copiado.",stopped_marker:" [detenido]",create_agent:"Crear agente",create_agent_title:"Crear agente",create_agent_desc:"Necesario para iniciar chat en proyecto.",role_label:"rol",model_label:"modelo",model_hint:"ej. openai:gpt-5, groq:llama-3.3-70b-versatile",master_label:"Agente master",list:{title:"Chats",new:"Nuevo",search:"Buscar chats…",all_agents:"Todos los agentes",empty:"No hay conversaciones todavía. Arrancá una desde la derecha.",count:"{n} en total",pick_agent:"Elegí un agente"}},tasks:{title:"Tasks (TODOs)",subtitle:"Append-only JSONL en ~/.apx/projects/<id>/tasks/.",add:"agregar",add_label:"Nueva task",add_placeholder:"ej. revisar bug del scroll",empty:"No hay tasks {state}.",empty_open:"No hay tasks abiertas.",created:"Task creada.",create_error:"no pude crear la task",done:"✓ done",drop:"✗ drop",reopen:"↻ reopen",due:"vence",via:"via",aria_done:"marcar done",aria_drop:"descartar task",aria_reopen:"reabrir task"},global_tasks:{add:"Agregar",add_title:"Nueva tarea",field_title:"Tarea",field_project:"Proyecto",field_due:"Vence",any_status:"cualquier estado",title:"Tasks (todos los proyectos)",subtitle:"Tareas agregadas de todos los proyectos registrados.",empty:"Sin tasks.",due:"vence",go_project:"Ir al proyecto"},commitments:{add:"Agregar",add_title:"Registrar una promesa",add_hint:"Algo que le dijiste a una persona concreta que ibas a hacer. Las tareas están al lado.",field_who:"Quién está esperando",field_who_hint:"El nombre como lo dirías vos — texto libre, no un contacto.",field_what:"Qué prometiste",field_what_ph:"mandar el presupuesto corregido",field_due:"Para cuándo",field_due_hint:"Opcional, pero es la parte que lo hace útil.",field_project:"Proyecto",title:"Compromisos",subtitle:"Qué prometiste, a quién y para cuándo. Aparte de las tareas: acá hay alguien esperando.",empty:"Nada prometido.",overdue:"vencía",overdue_only:"Pasados de fecha",no_date:"sin fecha acordada",moved:"movido",mark_kept:"Cumplido",mark_missed:"Incumplido",state:{open:"abiertos",kept:"cumplidos",missed:"incumplidos",all:"todos"}},routines:{title:"Heartbeats / Routines",subtitle:"Cron, every:Nm, once:ISO. Cada rutina dispara un agente o un shell.",empty:"Sin rutinas. Creá una arriba.",new:"nueva",new_btn:"Nueva",delete_confirm:"Borrar rutina {name}?",delete_confirm_body:"Esta acción no se puede deshacer.",saved:"Rutina guardada.",paused:"pausada",next_run:"próxima:",last_run:"última:",enabled_hint:"Activa · corre según el intervalo",disabled_hint:"Pausada · solo con el botón Run",enabled_label:"Habilitada",new_title:"Nueva rutina",edit_title:"Editar {name}",dialog_desc:"Se guarda en .apc/routines.json. La rutina corre mientras el daemon está activo.",name_field:"Nombre (name)",name_no_edit:"No se puede cambiar al editar.",kind_field:"Acción (kind)",schedule_field:"Intervalo (schedule)",schedule_hint:"Elegí un preset o escribilo a mano. Manual = solo corre con el botón Run.",vars_title:"Variables disponibles",what_happens:"Qué va a pasar",list_title:"Rutinas",detail_empty:"Elegí una rutina de la lista.",edit_btn:"Editar",edit_hint:"Abrir el editor: tipo, intervalo, prompt, pre/post y variables.",block_pre:"Pre-commands",block_post:"Post-commands",block_prompt:"Prompt",block_text:"Texto",block_command:"Comando",block_empty:"(vacío)",runs_title:"Ejecuciones",runs_empty:"Sin ejecuciones todavía.",runs_close:"Cerrar",runs_no_detail:"Sin más detalle.",runs_output:"Salida",status_ok:"ok",status_error:"error",status_skipped:"salteada",agent_field:"Agente (spec.agent)",agent_hint:"Quién ejecuta la rutina.",agent_loading:"cargando…",agent_pick:"— elegí un agente —",prompt_exec:"Prompt (spec.prompt)",prompt_exec_ph:"qué pendiente hay para hoy?",prompt_super:"Prompt (spec.prompt)",prompt_super_ph:"resumí el estado del proyecto",pre_field:"Pre-commands (pre_commands)",pre_hint:"Shell ANTES del prompt. Uno por línea.",post_field:"Post-commands (post_commands)",post_hint:"Shell DESPUÉS del prompt. Uno por línea.",tg_channel:"Canal (spec.channel)",tg_chat_id:"Chat ID (spec.chat_id)",tg_text:"Mensaje de Telegram (spec.text)",tg_text_hint:"Mensaje fijo a enviar. No usa modelo.",shell_field:"Comando (spec.command)",shell_hint:"Corre tal cual en el shell. Sin prompt ni pre/post.",hb_channel:"Canal (spec.channel)",hb_message:"Mensaje (spec.message)",name_required:"name requerido",save_error:"save falló",run_error:"run falló",toggle_error:"toggle falló",delete_error:"delete falló",run_success:"{name} disparada.",run_confirm:"¿Ejecutar la rutina {name} ahora?",run_confirm_body:"Corre la acción una vez, sin esperar al horario.",running:"Ejecutando…",delete_success:"borrada."},agents:{title:"Agents",subtitle:"Definidos en .apc/agents/<slug>.md.",subtitle_full:"Definidos en .apc/agents/<slug>.md. La memoria runtime vive en ~/.apx/projects/<id>/agents/<slug>/.",empty:"Sin agents. Agregá uno con <code>apx agent add</code> o el botón.",empty_text:"Sin agents. Agregá uno con `apx agent add` o el botón de arriba.",new:"Agente",created:"Agent {slug} creado.",slug_invalid:"slug debe matchear /^[a-z][a-z0-9_-]*$/",hierarchy:"Jerarquía",list_view:"Lista",import:"Importar",chat:"Chat",view:"Ver",orchestrator:"Orquestador",new_title:"Nuevo agent",new_desc:"POST /projects/:pid/agents — escribe .apc/agents/<slug>.md.",slug_label:"slug",slug_ph:"cody",role_label:"role (opcional)",role_ph:"code refactor",model_label:"model (opcional)",model_hint:"ej. ollama:gemma2:9b, openai:gpt-4o-mini",lang_label:"language (opcional)",desc_label:"description (opcional)",desc_ph:"Qué hace este agente…",skills_label:"skills (coma)",skills_ph:"skill-a, skill-b",tools_label:"tools (coma)",tools_ph:"tool-a, tool-b",parent_label:"reporta a (parent, opcional)",parent_hint:"Subagente de un orquestador.",none_parent:"— ninguno —",master_label:"Orquestador (master)",create_success:"Agent {slug} creado.",create_error:"create falló",import_title:"Importar del vault",import_desc:"Plantillas en ~/.apx/agents. Se registran en este proyecto (.apc/agents/<slug>.md).",import_empty:"Sin plantillas en el vault.",import_success:"Importado: {slug}",import_already:"ya está",import_btn:"Importar"},agent_detail:{not_found:"Agente no encontrado.",chat_btn:"Chat con {slug}",reports_to:"↳ reporta a",no_threads:"Sin threads.",no_activity:"Sin actividad registrada.",threads_recent:"Threads recientes",subagents:"Subagentes",subagents_desc:"Agentes que reportan a este orquestador.",config_title:"Configuración del agente",type_label:"Tipología (type)",area_label:"Área",area_hint:"ej. operaciones, marketing",area_ph:"operaciones",role_label:"Role",parent_label:"Reporta a (parent)",none_parent:"— ninguno —",model_label:"Modelo base",model_hint:"Vacío = usa el modelo del Router (default). Setealo solo para forzar un modelo a este agente.",model_ph:"(vacío = router default)",skills_label:"Skills (coma)",bio_label:"Bio / descripción",system_label:"System prompt",system_hint:"Define personalidad y comportamiento (cuerpo del AGENT.md).",master_label:"Orquestador (master)",delete_btn:"Borrar agente",save_btn:"Guardar cambios",delete_confirm:'Borrar el agente "{slug}"? Se elimina .apc/agents/{slug}.md y sus datos runtime locales.',update_success:"Agente actualizado.",delete_success:"Agente borrado.",tools_hint:"Qué tools puede usar el agente. Tocá para activar/desactivar; o editá la lista abajo.",tools_custom_ph:"lista (coma): echo, http_fetch",memory_title:"Memoria del agente",memory_empty:"(memoria vacía)",memory_saved:"Memoria guardada.",records_title:"Records",records_desc:"Log de actividad del agente (mensajes/acciones). Lo más nuevo primero.",sleep_title:"Sleep / Heartbeat",sleep_desc:"Estado de ejecución del agente, derivado de sus rutinas.",sleep_deep:"Deep sleep · sin heartbeat",sleep_deep_desc:"Este agente no tiene ninguna rutina que lo dispare. No se ejecuta de forma autónoma; solo responde cuando lo invocás (chat / tarea).",brain_title:"Brain",brain_desc:"Grafo de relaciones reales del agente: memoria, threads, tasks, heartbeats y jerarquía. (primera versión — lo refinamos)",brain_empty:"Aún no hay relaciones para graficar (sin memoria, threads, tasks ni rutinas).",msgs_count:"msgs"},mcps:{title:"MCP servers",subtitle:"3 scopes: Runtime > Shared > Global. Conflictos arriba si los hay.",empty:"Sin MCPs configurados.",new:"MCP",delete_confirm:"Borrar MCP {name} de scope {scope}?",conflicts:"⚠ Conflictos: {names}",conflict_detail:"{name} está definido en {winner} y {loser}. Se usa {winner}; {loser} queda ignorado.",new_title:"Nuevo MCP",edit_title:"Editar MCP",new_desc:"Se guarda según el scope elegido. Los valores con ${var.X} se resuelven al arrancar el MCP.",scope_label:"Scope",scope_runtime:"Runtime",scope_shared:"Shared",scope_global:"Global",source_runtime:"Runtime",source_apc:"APC / Shared",source_claude:"Claude",source_codex:"Codex",source_cursor:"Cursor",source_vscode:"VS Code",source_roo:"Roo",source_gemini:"Gemini",scope_runtime_desc:"Solo este proyecto · con secrets · no se commitea (~/.apx/projects/<id>/mcps.json)",scope_shared_desc:"Solo este proyecto · committeable · sin secrets (.apc/mcps.json)",scope_global_desc:"Todos los proyectos de esta máquina (~/.apx/mcps.json)",transport_stdio:"stdio",transport_http:"HTTP",transport_stdio_desc:"Proceso local — `command` + args",transport_http_desc:"Endpoint remoto — URL + headers",transport_label:"Transport",name_label:"Nombre",name_ph:"my-mcp",cmd_label:"Comando",cmd_ph:"npx",args_label:"Args",args_hint_tokens:"Una entrada por argumento. Usá el botón + para insertar variables.",env_label:"Env",env_hint_tokens:"Pares clave/valor. Los valores aceptan ${var.NOMBRE} (botón + a la derecha).",env_empty:"Sin variables de entorno.",url_label:"URL",url_ph:"https://example.com/v2/mcp",headers_label:"Headers",headers_hint:"Pares clave/valor — típicamente Authorization: Bearer ${var.TOKEN}.",headers_empty:"Sin headers.",enabled_label:"Habilitado",add_btn:"Agregar",save_btn:"Guardar",add_arg:"Agregar arg",edit_btn:"Editar",test_btn:"Probar",logs_btn:"Logs",testing:"Probando…",test_ok:"OK · {n} tools disponibles",tools_count:"{n} tools",logs_title:"Logs · {name}",logs_empty:"Sin logs todavía. Arrancá el MCP llamando un tool o probando.",logs_events:"Eventos recientes",logs_stderr:"stderr (últimos 4KB)",logs_panel_title:"Live logs",logs_panel_pick:"elegí un MCP",logs_panel_hint:"Click un MCP de la lista para ver lo que está pasando en vivo.",logs_panel_idle:"Sin actividad. Apretá Probar para arrancarlo.",name_required:"Nombre requerido",removed:"eliminado",added:"MCP agregado.",updated:"MCP actualizado."},vars:{title:"Variables",subtitle_project:"Reemplazan ${var.NOMBRE} al cargar MCPs y plantillas. Las del proyecto ganan sobre las globales. Se guardan fuera del repo (~/.apx/, chmod 0600).",subtitle_base:"Variables globales — disponibles para todos los proyectos. Se guardan en ~/.apx/vars.json (chmod 0600).",empty:"Sin variables todavía.",new:"Variable",new_title:"Nueva variable",edit_title:"Editar variable",new_desc:"Se referencia como ${var.NOMBRE} en cualquier campo que soporte interpolación.",reveal_all:"Mostrar valores",reveal:"Mostrar",hide:"Ocultar",filter_label:"Mostrar:",filter_all:"Todas",filter_project:"Sólo proyecto",filter_global:"Sólo globales",scope_label:"Scope",scope_project:"proyecto",scope_project_desc:"Sólo este proyecto. Pisa la global con mismo nombre.",scope_global:"global",scope_global_desc:"Disponible en todos los proyectos.",name_label:"Nombre",name_hint:"Mayúsculas, dígitos y _. P. ej.: MY_API_KEY, GITHUB_TOKEN.",value_label:"Valor",value_hint:"Se guarda en disco con permisos 0600. Nunca se commitea.",value_edit_ph:"(dejá vacío para no cambiarlo… aún no soportado, pegá el valor de nuevo)",add_btn:"Agregar",save_btn:"Guardar",edit_btn:"Editar",delete_btn:"Borrar",delete_confirm:"¿Borrar {name} ({scope})?",removed:"Variable eliminada.",added:"Variable agregada.",updated:"Variable actualizada.",name_required:"Nombre requerido.",value_required:"Valor requerido."},threads:{title:"Chats",subtitle:"Conversaciones por agent (vacío = ningún log persistido todavía).",no_agents:"No hay agents. Las conversaciones requieren un agent configurado.",pick:"Elegí un agent para ver sus conversaciones.",empty:"No hay conversaciones para {slug}.",conversation_title:"Conversación {id}",messages:"mensajes",via:"via"},config:{title:"Config rápida",subtitle:"Override del proyecto. Se escribe en {path}.",model:"super_agent.model",model_hint:"ej. anthropic:claude-sonnet-4.5, ollama:gemma2:9b",perm:"super_agent.permission_mode",route:"route_to_agent",route_hint:"Slug del agent que atiende por defecto en este proyecto.",use_global:"(usa global)",saved:"Guardado.",nothing:"Nada para guardar.",raw_title:"Config (JSON crudo)",raw_subtitle:"Pegá el objeto entero — equivale a PUT del archivo.",raw_save:"Reemplazar config",raw_done:"Config sobrescrita.",effective:"Effective config (read-only)",effective_sub:"Lo que ve realmente el daemon (global ⊕ override).",section_title:"Config proyecto",section_desc:"APC metadata y overrides separados. General APX vive en Settings > Config.",effective_read:"Lectura: global APX + override proyecto.",save_project:".apc/project.json guardado.",save_override:".apc/config.json guardado.",save_fields_success:"Overrides guardados.",save_meta_success:"Project metadata guardado.",no_data:"Sin datos.",tab_settings:"Settings",tab_project:"Project"},telegram:{title:"Canal de Telegram (override)",subtitle:"Si seteás un canal acá, los mensajes generados por este proyecto se mandan ahí en lugar del default.",use_default:"Usar el canal default",bot_token:"Bot token (override)",chat_id:"Chat ID (override)",saved:"Override guardado.",cleared:"Override eliminado — vuelve al default.",override_active:"override activo",channel_badge:"Canal {name}",no_override:"Sin override. Los mensajes de este proyecto van al canal default.",respond_engine:"Responder con engine",route_agent:"route_to_agent",route_hint:"Slug del agent que atiende (vacío = super-agent).",bot_hint_none:"Si vacío, hereda del default."},memories:{super_agent_group:"Super-agente",notebook_item:"Libreta de {persona}",tokens:"~{n} tok",sidebar_title:"Memorias",general_group:"General",general_item:"Memoria del proyecto",project_title:"Memoria del proyecto",project_desc:"Hechos durables a nivel proyecto. .apc/memory.md — la leen los agentes y el super-agente.",project_ph:`# Memoria del proyecto
787
+
788
+ Hechos estables que cualquier agente debería saber…`,agents_title:"Memorias de agentes",agents_desc:"Memoria individual por agente. ~/.apx/projects/<id>/agents/<slug>/memory.md",no_agents:"Sin agentes en este proyecto.",saved:"Memoria guardada.",empty:"(memoria vacía)",chars:"chars · Markdown",save_btn:"Guardar"}},base:{title:"Base",subtitle:"Espacio general · super-agente",nav_general:"General",nav_activity:"Actividad",nav_system:"Sistema",workspaces_title:"Workspaces",workspaces_desc:"Todos los proyectos registrados en APX.",workspaces_new:"Nuevo proyecto",workspaces_empty:"Sin proyectos. Agregá uno con el botón de arriba.",sessions_title:"Sessions",sessions_desc:"Sesiones de todos los engines (apx · claude · codex), más nuevas primero.",sessions_desc_scoped:"Sesiones en la carpeta de este proyecto ({path}), todos los engines, más nuevas primero.",sessions_all:"Todos los engines",sessions_empty:"Sin sesiones.",sessions_error:"No pude leer las sesiones: {msg}",sessions_search_ph:"Buscar sesiones…",sessions_deep:"Profundo",sessions_deep_tip:"También busca dentro de los transcripts (más lento)",sessions_clear:"Limpiar filtros",sessions_refresh:"Refrescar lista",sessions_no_match:"Ninguna sesión coincide con «{q}».",sessions_act_cmd:"Copiar comando apx",sessions_act_ask:"Pedir a {name} que continúe",sessions_act_folder:"Abrir carpeta",sessions_act_path:"Copiar ruta",sessions_cmd_copied:"Comando copiado — pegalo en tu terminal",sessions_path_copied:"Ruta copiada",sessions_copy_failed:"No se pudo copiar",sessions_no_folder:"Esta sesión no tiene carpeta",sessions_no_path:"Esta sesión no tiene ruta",sessions_folder_failed:"No se pudo abrir la carpeta: {msg}",defaults_title:"Agent defaults",defaults_desc:"Plantillas globales del vault. Las bundled vienen con APX y siempre están; las que crees o edites quedan en ~/.apx/agents y se superponen. Importalas a un proyecto desde Agents › Importar.",defaults_show_removed:"Mostrar removidos",defaults_new:"Nuevo",defaults_empty:"Sin plantillas en el vault.",defaults_hide:"Ocultar",defaults_restore:"Restaurar",defaults_edit:"Editar",defaults_remove:"Ocultar",defaults_delete:"Borrar",defaults_tombstone_msg:'Ocultar el default "{slug}"? Es bundled — quedá tombstoneado y lo recuperás con Restaurar.',defaults_delete_msg:'Borrar el template "{slug}"?',defaults_hidden:"Ocultado.",defaults_deleted:"Borrado.",defaults_restored:"Restaurado.",defaults_new_title:"Nuevo template",defaults_new_desc:"POST /agents/vault — se guarda en ~/.apx/agents/<slug>.md",defaults_edit_title:'Editar "{slug}"',defaults_bundled_desc:"Es un default bundled. Al guardar se hace copy-on-write a ~/.apx/agents/<slug>.md (queda como override).",defaults_user_desc:"PATCH /agents/vault/:slug — edita el archivo en ~/.apx/agents.",defaults_master_label:"Agente master",defaults_slug_invalid:"slug inválido (debe matchear /^[a-z][a-z0-9_-]*$/)",defaults_created:'Template "{slug}" creado.',defaults_saved:'Template "{slug}" guardado.'},logs:{title:"Logs",desc_global:"Actividad del daemon (canales globales: telegram, direct…). ~/.apx/messages/<channel>/.",desc_project:"Actividad del proyecto. ~/.apx/projects/<id>/messages/.",filter_channel:"filtrar canal (ej. telegram)",filter_dir:"dirección",all_directions:"Todas las direcciones",in:"Entrada (in)",out:"Salida (out)",filter_type:"tipo",all_types:"Todos los tipos",search_text:"buscar en el texto…",count_of:"de",no_activity:"Sin actividad.",no_activity_ch:'Sin actividad en el canal "{ch}".',error:"No pude leer los mensajes: {msg}",show_more:"ver más",event_routine_created:"rutina creada",event_routine_updated:"rutina actualizada",show_less:"ver menos",daemon_errors:"Errores del daemon (~/.apx/logs/errors.jsonl)",no_errors:"Sin errores registrados. 🎉"},telegram_contacts:{title:"Contactos de Telegram",desc:"Quién le escribe a los bots. El rol define qué herramientas puede usar; un invitado no tiene permisos hasta que le asignes un rol.",empty:"Todavía no hay contactos — se registran solos cuando alguien escribe a un bot.",owner_badge:"dueño",assign_role:"Asignar rol",owner_hint:"Es dueño de un canal — cambialo desde el canal",removed:"Contacto eliminado.",delete_confirm:"¿Borrar el contacto {name}?",last_seen:"visto:",tools_all:"tools: todas",tools_none:"tools: ninguna",tools_label:"tools:"},telegram_channels:{title:"Canales",desc:"Cada canal es un bot que el daemon polea. Acá podés añadir/quitar canales, cambiar el agente que contesta, el proyecto al que pertenece y su dueño.",new_btn:"Nuevo canal",empty:"Todavía no hay canales — agregá el primero.",removed:"Canal eliminado.",delete_confirm:"¿Borrar el canal {name}?",no_owner:"sin dueño (se reclama al primer DM)",owner_label:"dueño:"},telegram_channel_dialog:{new_title:"Nuevo canal de Telegram",edit_title:"Editar canal: {name}",name_label:"name (slug interno)",token_label:"bot_token",chat_id:"chat_id",project_label:"project",project_hint:"Slug o id del proyecto al que pinear este canal (opcional).",route_label:"route_to_agent",route_hint:"Agente que contesta; vacío = super-agent APX.",owner_label:"owner_user_id",owner_hint:"user_id de Telegram del dueño de este canal. Override del rol global a 'owner' acá. Si lo dejás vacío, el primer mensaje privado lo reclama.",owner_ph:"889721252",respond_label:"Responder con engine (no echo)",name_required:"name requerido",saved:"Canal guardado."},telegram_send_dialog:{title:"Enviar a {name}",default_msg:"Mensaje de prueba desde el panel de APX ✅"},telegram_roles:{title:"Roles",desc:"Cada rol define qué herramientas del super-agent puede usar quien lo tenga asignado. 'owner' siempre = todas; 'guest' siempre = ninguna (solo chat).",empty:"No hay roles definidos.",tools_all:"todas las herramientas",tools_none:"ninguna herramienta",builtin:"built-in",delete_confirm:'¿Borrar el rol "{name}"?',removed:"Rol eliminado.",saved:'Rol "{name}" guardado.',name_required:"Nombre requerido.",builtin_error:'"{name}" es un rol built-in.',new_title:"Nuevo rol o reemplazar uno custom",name_label:"Nombre",name_ph:"editor",tools_label:"Tools (separadas por coma)",tools_hint:"Vacío = ninguna. Ejemplos: call_agent, list_tasks, create_task.",tools_ph:"call_agent, list_tasks",full_access:"Acceso total (todas las tools)",save_btn:"Guardar rol",delete_btn:"Borrar"},superagent:{title:"{persona}",badge:"super-agent · APX",desc:"Conversación rápida con tu super-agente. Tiene acceso a tools (proyectos, tasks, mcps, agentes); para un hilo más largo y persistente, abrí Chats.",empty:"Mandale un mensaje a {persona} para arrancar.",thinking:"{persona} está pensando…",talk:"Hablar con {persona}",new_chat:"Nuevo chat",placeholder:"Escribí y enter para enviar (shift+enter = nueva línea)…"},not_found:{title:"404",message:"Roby se perdió: esta página no existe o se movió.",home:"Volver al inicio"},ask_panel:{answers_header:"Respuestas",other:"Otro",other_placeholder:"Escribí tu propia respuesta acá",text_placeholder:"Escribí tu respuesta…",back:"Atrás",skip:"Omitir",next:"Siguiente",submit:"Enviar",status_waiting:"Esperando respuesta…",status_received:"Respuestas recibidas"},code_module:{title:"Code",badge:"super-agent",desc:"Sesiones de código estilo OpenCode. Elegí un proyecto, abrí una sesión y pedile que lea, planifique, edite o ejecute.",no_projects:"No hay proyectos registrados. Registrá uno con `apx project add` para usar Code.",sessions:"Sesiones",new_session:"Nueva sesión",untitled:"Nueva sesión",no_sessions:"Todavía no hay sesiones — creá una para empezar a codear.",pick_project:"Elegí un proyecto para ver sus sesiones.",rename:"Renombrar",delete:"Eliminar",delete_confirm:"¿Eliminar esta sesión? Se borra la transcripción; tus archivos quedan intactos.",empty_chat:"Mandá una instrucción de código para arrancar.",placeholder:"Pedí un cambio… (enter envía, shift+enter = nueva línea)",mode_build:"Build",mode_plan:"Plan",mode_build_hint:"Build — edita archivos y ejecuta comandos",mode_plan_hint:"Plan — solo lectura, propone cambios sin tocar archivos",tab_context:"Contexto",tab_changes:"Cambios",tab_artifacts:"Artifacts",artifacts_none:"Todavía no hay artifacts. Pedile al agente que cree un script en `artifacts/<nombre>`.",artifacts_count:"{n} artifact(s)",artifacts_copy_path:"Copiar path",artifacts_run:"Run",artifacts_run_hint:"Para ejecutarlo desde la terminal:",artifacts_delete:"Eliminar",artifacts_delete_confirm:"¿Eliminar este artifact? El archivo se borra del disco.",ctx_model:"Modelo",ctx_tokens:"Tokens",ctx_input:"Entrada",ctx_output:"Salida",ctx_messages:"Mensajes",ctx_breakdown:"Desglose de contexto",ctx_none:"Sin uso todavía — mandá un turno para ver tokens.",seg_system:"Sistema",seg_user:"Usuario",seg_assistant:"Asistente",seg_tool:"Tools",seg_other:"Otro",changes_none:"Todavía no hay cambios en esta sesión.",changes_no_git:"Los cambios necesitan un repo git. Este proyecto no lo es.",changes_files:"{n} archivo(s) cambiados",stopped:"[detenido]",close:"Cerrar",reload:"Recargar",discard_changes:"Descartar cambios",save_shortcut_hint:"Guardar (Cmd/Ctrl+S)",artifacts_rename:"Renombrar",artifacts_view:"Ver contenido",artifacts_edit:"Editar contenido",artifacts_preview:"Previsualizar",artifacts_preview_hint:"Abrir una previsualización en vivo en una pestaña local",artifacts_share:"Compartir",artifacts_share_hint:"Crear una URL pública por túnel para compartir esta preview",artifacts_stop_preview:"Detener preview",artifacts_preview_local:"Preview local",artifacts_preview_public:"URL pública",artifacts_copy_url:"Copiar URL",artifacts_preview_started:"Preview activa en {url}",tree_collapse_all:"Colapsar todo",terminal_clear:"Limpiar",terminal_close:"Cerrar terminal"},desktop_screen:{status_title:"Estado",autostart_title:"Arranque automático",shortcut_title:"Atajo de teclado",appearance_title:"Apariencia",activation_title:"Activación + transcripción",last_conv_title:"Última conversación",open_config:"Configuración"},voice_screen:{providers_title:"Proveedores de voz (TTS)",test_title:"Probar voz",stt_title:"Transcripción (STT)",configure_provider:"Configurar {name}"},deck_screen:{widgets_title:"Widgets",context_title:"Contexto APX",reload_manifest:"Recargar manifest",widget_native:"Widget nativo APX",widget_external:"Widget externo",preview_badge:"Vista previa",preview_title:"Deck — Próximamente",preview_body:"El módulo Deck todavía está en desarrollo y no fue lanzado aún. Lo volveremos a activar cuando Deck salga en una versión estable. Por ahora todo acá es de solo lectura y no se guardará ningún cambio."},memory_panel:{embeddings_title:"Embeddings (RAG)",embeddings_desc:"Modelo que vectoriza el historial de todos los canales para la memoria relevante. Igual que TTS/STT: elegí un proveedor y un modelo. 'Automático' prueba local primero y cae a offline si no hay nada disponible.",provider_label:"Proveedor",provider_hint:"Ollama es local y gratis. Gemini/OpenAI usan la API key de su sección en Modelos (o la de abajo).",mode_label:"Modo de selección",mode_hint:"Cadena cae al siguiente si uno falla; Único usa exactamente el proveedor elegido.",available:"disponible",unavailable:"no disp.",test_btn:"Probar embedding",reindex_btn:"Reindexar memoria",test_ok:"Embedding OK con {embedder}",test_failed:"Test falló: {msg}",reindexed:"Reindexado: {indexed} chunks (limpiados {cleared}).",reindex_failed:"Reindex falló: {msg}",save_failed:"No se pudo guardar: {msg}",provider_auto:"Automático (cadena: Ollama → Gemini → OpenAI → offline)",provider_ollama:"Ollama — local, sin API key (nomic-embed-text)",provider_gemini:"Gemini — free tier con key (text-embedding-004)",provider_openai:"OpenAI — text-embedding-3-small (cloud)",provider_tf:"Offline (term-frequency, sin modelo — degradado)",mode_chain:"Cadena (fallback automático)",mode_single:"Único (usa solo el elegido)",ollama_title:"Ollama (local)",ollama_desc:"Sin API key. Corre nomic-embed-text en tu Ollama local o cloud.",model_label:"Modelo",base_url_label:"Base URL",ollama_base_url_hint:"Vacío usa engines.ollama.base_url (default http://localhost:11434).",openai_title:"OpenAI",openai_desc:"text-embedding-3-small (1536 dims) u otro modelo compatible.",api_key_label:"API key",openai_key_hint:"Vacío reusa engines.openai.api_key. Dejalo en blanco para mantener la guardada.",gemini_title:"Gemini",gemini_desc:"text-embedding-004 (768 dims). Free tier con API key de Google.",gemini_key_hint:"Vacío reusa engines.gemini.api_key.",compaction_title:"Compactación de historial",compaction_desc:"Cuando un chat supera el umbral de turnos, los más viejos se resumen con un LLM liviano (local) y se guardan como [RESUMEN COMPACTADO], manteniendo el contexto acotado. Corre fuera del hot-path: el turno actual usa el resumen que ya exista.",threshold_label:"Umbral de compactación",threshold_hint:"Compactar una vez que el chat supera estos turnos (por defecto 60).",keep_recent_label:"Turnos recientes a preservar",keep_recent_hint:"Turnos verbatim que NUNCA se compactan (por defecto 40). Debe ser menor al umbral.",compact_model_label:"Modelo de compactación",compact_model_hint:"LLM liviano para resumir. Ideal uno local (Ollama) para no gastar. Formato proveedor:modelo.",compact_fallback_label:"Modelo de fallback",compact_fallback_hint:"Se usa si el de compactación falla. Vacío cae al modelo del super-agente.",compact_fallback_ph:"(vacío → modelo del super-agente)"},router_panel:{title:"Router de modelos",description:"Un único router general (sin casos por tarea). Elegí un proveedor y un modelo; si el activo falla, prueba la cadena de fallback en orden.",badge_default:"default",no_providers:"Agregá un proveedor abajo para poder elegir modelos.",active_model_label:"Modelo activo (default)",active_model_hint:"Proveedor + modelo. Se guarda como proveedor:modelo.",fallback_title:"Cadena de fallback",fallback_desc:"Si el modelo activo falla, prueba estos en orden. Click en uno para editarlo.",fallback_empty:"Sin fallback configurado.",add_to_chain:"Agregar a la cadena",done:"listo",save:"Guardar router",saved:"Guardado",saved_toast:"Router guardado.",provider_ph:"— proveedor —",provider_not_found:"⚠ {name} (no encontrado)",provider_not_configured:'El proveedor "{name}" no está configurado.'},routing_panel:{title:"Ruteo por contenido",description:"Elegí un modelo distinto por mensaje según su contenido (imagen, tamaño, canal, keywords). Aparte de la cadena de fallback de arriba.",signal_on:"Ruteo por contenido: ON ({n} reglas)",signal_on_empty:"Ruteo por contenido: ON (todavía sin reglas)",signal_off:"Ruteo por contenido: OFF",how_it_works:"¿Cómo funciona?",enable_label:"Activar ruteo por contenido",rules_title:"Reglas de ruteo",rules_desc:"Se evalúan de arriba hacia abajo; gana la primera regla que cumpla todas sus condiciones.",rules_empty:"Todavía sin reglas. Agregá algunas en el editor.",edit_rules:"Editar reglas (JSON)",hide_editor:"Ocultar editor",editor_label:"Reglas (array JSON)",json_hint:"Array de { model, when }. Claves de when: has_image, min_prompt_chars, max_prompt_chars, min_context_chars, channels[], keywords[]. when vacío = matchea todos los mensajes.",json_error:"JSON inválido: {msg}",json_not_array:"Las reglas tienen que ser un array JSON.",insert_example:"Insertar un ejemplo",when_any:"cualquier mensaje",when_image:"tiene imagen",when_no_image:"sin imagen",when_min_prompt:"prompt ≥ {n} chars",when_max_prompt:"prompt ≤ {n} chars",when_min_context:"contexto ≥ {n} chars",when_channels:"canales: {list}",when_keywords:"keywords: {list}",helper:"El ruteo elige un modelo por mensaje (imagen, tamaño, canal, keywords). Se compone con el failover: un modelo ruteado que esté caído cae por la cadena. Un override de modelo explícito por request siempre gana.",save:"Guardar ruteo",saved:"Guardado",saved_toast:"Ruteo por contenido guardado.",confirm_title:"¿Aplicar los cambios de ruteo?",confirm_body:"Esto cambia qué modelo atiende cada mensaje. El failover sigue aplicando si un modelo ruteado está caído.",confirm_on:"El ruteo por contenido va a quedar ON con {n} reglas.",confirm_off:"El ruteo por contenido va a quedar OFF (cada mensaje usa el router default).",confirm_apply:"Aplicar",cancel:"Cancelar"},engines_panel:{title:"Proveedores",new_btn:"Nuevo proveedor",description:"Proveedores LLM (API). Cada provider usa un engine/adapter (openai, ollama, …) con su key y URL.",empty:"Sin providers. Agregá uno con el botón de arriba.",add_card:"Agregar provider",saved:"Provider guardado.",saved_json:"Provider guardado (JSON).",deleted:"Provider borrado.",delete_confirm:"¿Borrar provider {name}?"},providers_modal:{new_title:"Nuevo proveedor",edit_title:"Editar {name}",description:"Proveedor LLM. El motor (engine) define qué adapter usa (openai, ollama, …).",list_models_hint:"Listar los modelos reales del proveedor",toggle_active:"Activo · click para desactivar",toggle_inactive:"Inactivo · click para activar",delete:"Borrar",custom:"Custom",json_mode:"JSON",form_mode:"Volver al formulario",json_label:"Config del provider (JSON)",json_hint:"Se guarda como engines.{slug} en config.json",json_help:"Debe ser un objeto JSON válido con al menos engine. El slug se toma del formulario.",name_label:"Nombre",name_ph:"Mi provider",engine_label:"Motor (engine)",base_url_label:"URL base (base_url)",base_url_hint:"Se completa sola al elegir un proveedor.",base_url_ph:"https://api.openai.com/v1",api_key_label:"API key",api_key_hint_existing:"Dejá en blanco para mantener la actual.",api_key_hint_env:"Se guarda como secreto. Env sugerida: {env}",api_key_hint:"Se guarda como secreto.",api_key_set:"…{suffix} (ya seteada)",model_label:"Modelo por defecto",load_models:"Cargar modelos",max_tokens_label:"Máx. tokens (max_tokens)",temperature_label:"Temperatura: {value}",pricing_summary:"Análisis de tokens / pricing (opcional)",context_limit_label:"Límite de contexto (tokens)",price_input:"$ entrada / 1M",price_output:"$ salida / 1M",price_cache_read:"$ cache read / 1M",price_cache_write:"$ cache write / 1M",model_limits_label:"Límites de contexto por modelo (JSON)",active_label:"Activo (los agentes pueden usarlo)",err_slug_required:"Slug requerido.",err_slug_required_form:"Slug requerido (en el formulario).",err_slug_exists:'Ya existe un provider "{slug}".',err_model_limits_json:"Límites de contexto por modelo: JSON inválido.",err_json_invalid:"JSON inválido: revisá la sintaxis.",err_json_object:"El JSON debe ser un objeto con la config del provider.",err_engine_missing:'Falta "engine" (ej. "anthropic", "ollama").',err_save:"Error al guardar.",err_no_models:"Sin modelos. ¿Key/URL correctas?",err_list_models:"No se pudo listar modelos."},providers_card:{active:"Activo",off:"Off",model:"Modelo",base_url:"Base URL",api_key:"API key",key_set:"✓ seteada",temp:"Temp",price_io:"$ in/out (1M)"},chat_ui:{copy:"Copiar",stop:"Detener",send:"Enviar",pick_model:"Elegir modelo (o Auto)",insert_variable:"Insertar variable",ctx_files:"archivos",ctx_actors:"{n} agentes/modelos",ctx_turns:"{n} turnos"},sidebar_ui:{toggle:"Mostrar/ocultar sidebar"},models_ui:{invalid_hint:"Modelo/proveedor no disponible"},global_config:{title:"Config APX"},agent_detail_extra:{skills_title:"Skills & tools"},voice_ui:{api_key_label:"API key",api_key_set:"…{suffix} (ya seteada)",api_key_keep_hint:"Dejá en blanco para mantener la actual.",api_key_secret_hint:"Se guarda como secreto. Env: {env}",api_key_reuse_hint:"Si lo dejás vacío, reusa {engine}. Env: {env}",err_save:"Error al guardar.",model_label:"Modelo",voice_label:"Voz",format_label:"Formato",output_format_label:"Formato de salida",voice_id_label:"Voice ID",voice_id_hint:"Voice id de ElevenLabs (vacío = default).",gemini_model_hint:"El TTS de Gemini todavía está en preview.",base_url_label:"Base URL (opcional)",base_url_hint:"Endpoint compatible con OpenAI. Vacío = OpenAI. Apuntalo a un servidor local (ej. un daemon QVox / Qwen3-TTS) para usar ese en su lugar.",openai_model_hint:"tts-1 / tts-1-hd para OpenAI. Dejalo vacío para que un servidor custom elija.",openai_voice_hint:"Preset de OpenAI (alloy…) o preset de tu servidor custom (ej. custom). Vacío = default del servidor.",openai_style_hint:"Voz base / instruct, usada por endpoints custom (la persona que se mantiene en todo el audio). El tts-1 de OpenAI la ignora.",style_label:"Estilo (cómo debería hablar)",style_hint:"Instrucción en lenguaje natural. Vacío = sin estilo. Ej.: 'hablá en un tono alegre y pausado'.",style_ph:"hablá en un tono alegre y enérgico",temperature_label:"Temperatura (opcional)",temperature_hint:"Temperatura de sampleo para endpoints custom. Vacío = default del servidor.",emotions_short:"Emociones",emotions_label:"Tags de emoción inline",emotions_hint:"Cuando hable este motor, deja que el agente meta tags tipo [happy]/[whisper] en las respuestas de voz para darles color. Activalo solo si este motor entiende los tags (ej. un endpoint QVox/Qwen3-TTS) — si no, se quitan antes de sintetizar.",emotions_tags_label:"Tags permitidos",emotions_tags_hint:"Separados por coma. Vacío = el set por defecto.",piper_bin_label:"Binario (bin)",piper_bin_hint:"Ruta o nombre del CLI de piper (PATH).",piper_model_label:"Modelo (.onnx)",piper_model_hint:"Ruta absoluta al modelo de voz de piper.",piper_speaker_label:"Speaker (opcional)",piper_speaker_hint:"Speaker id para modelos multi-voz.",mock_desc:"El engine mock genera un WAV de prueba en silencio. No tiene parámetros: sirve como fallback garantizado cuando no hay ningún otro engine configurado.",selection_mode:"Modo de selección",mode_chain_desc:"Cadena con fallback: usa el primer engine disponible siguiendo el orden de abajo.",mode_single_desc:"Solo engine default: siempre usa el elegido; el resto queda configurado para otros usos.",mode_chain_btn:"Cadena (router)",mode_single_btn:"Solo engine default",move_up:"Subir",move_down:"Bajar",badge_local:"local",badge_available:"disponible",badge_unavailable:"configurado, no disponible",badge_not_configured:"sin configurar",badge_default:"default",badge_custom:"custom",set_as_default:"Usar como default",configure:"Configurar",remove:"Quitar",remove_confirm:"¿Quitar este proveedor custom?",add_provider:"Agregar proveedor",new_provider:"Nuevo proveedor",custom_note:"Endpoint custom compatible con OpenAI.",custom_desc:"Cualquier endpoint de voz compatible con OpenAI (ej. un servidor local QVox / Qwen3-TTS).",label_label:"Nombre",label_hint:"Nombre para mostrar de este proveedor.",base_url_req_label:"Base URL",base_url_req_hint:"Requerido. El endpoint compatible con OpenAI, ej. http://127.0.0.1:5111/v1",api_key_optional_hint:"Opcional — solo si tu servidor pide key.",advanced:"Avanzado",custom_model_hint:"Opcional. La mayoría de los servidores locales lo ignoran (ej. QVox).",custom_voice_hint:"Opcional. Un preset que entienda tu servidor (ej. custom). Vacío = default del servidor.",custom_optional_ph:"(opcional)",stt_engine_label:"Engine de transcripción",stt_engine_hint:"Local usa faster-whisper (requiere python3 + faster-whisper). OpenAI usa la key de engines.openai.",stt_model_label:"Modelo local (whisper)",stt_model_hint:"Más grande = más preciso y más lento.",stt_language_label:"Idioma",stt_language_hint:'Para español, elegir "Español" mejora la precisión.',stt_provider_auto:"Automático (local, después remoto)",stt_provider_local:"Local — faster-whisper (offline)",stt_provider_openai:"OpenAI — Whisper-1 (cloud)",stt_provider_custom:"Custom — server OpenAI-compatible",stt_openai_model_label:"Modelo OpenAI",stt_openai_model_hint:"Por defecto whisper-1.",stt_custom_baseurl_label:"URL base (OpenAI-compatible)",stt_custom_baseurl_hint:"Ej: http://localhost:8000/v1 (mlx-audio en Metal) o http://192.168.1.50:9000/v1 (Radeon/NVIDIA en la red).",stt_custom_model_label:"Modelo",stt_custom_model_hint:"Ej: mlx-community/whisper-large-v3-turbo o large-v3.",stt_custom_key_hint:"Opcional — la mayoría de los servers locales no requieren key.",stt_hw_label:"Hardware detectado",stt_hw_recommended:"Recomendado",stt_hw_limited:"aceleración GPU limitada, se usa CPU",stt_backend_label:"Aceleración / Motor",stt_backend_hint:"Auto elige según tu hardware. Metal corre en la GPU (mlx); CPU usa faster-whisper.",stt_backend_auto:"Automático (recomendado)",stt_model_needs_download:"Falta descargar (~{size}). Hay que bajar el modelo para usar este motor.",lang_auto:"Detección automática",lang_es:"Español",lang_en:"Inglés",lang_pt:"Portugués",lang_fr:"Francés",lang_it:"Italiano",lang_de:"Alemán",test_default_text:"Hola, soy APX. Esto es una prueba de voz.",test_default_engine:"Default ({name})",test_default_chain:"Default (cadena)",test_unavailable_suffix:" · no disponible",test_empty_error:"Escribí algo para decir.",test_synth_error:"No se pudo sintetizar.",test_engine_label:"Engine",test_engine_hint:"Override del default para probar.",test_style_label:"Estilo (solo Gemini)",test_style_hint:"Cómo debería hablar. Vacío = sin estilo.",test_text_label:"Texto a decir",test_text_ph:"Escribí lo que querés que diga…",say_this:"Decir esto",stop:"Detener",replay:"Repetir",engine_result:"Engine",providers_desc:"Engines de síntesis, en orden de fallback. El estado lo reporta el daemon en vivo. Agregá tus propios endpoints compatibles con OpenAI.",providers_load_error:"No pude cargar los proveedores: {msg}",test_desc:"Elegí con qué engine sintetizar y, si aplica, cómo debería hablar.",stt_desc:"Engine de speech-to-text que usan el deck, Telegram y la CLI al escuchar.",toast_default_engine:"Engine default: {id}.",toast_mode_chain:"Modo: cadena con fallback.",toast_mode_single:"Modo: solo engine default.",toast_config_saved:"Configuración de voz guardada.",toast_provider_removed:"Proveedor eliminado.",err_label_required:"Falta el nombre.",err_base_url_required:"Falta la base URL.",toast_transcription_updated:"Transcripción actualizada."},telegram_ui:{channel_dialog_desc:"POST /telegram/channels (upsert) — PATCH /telegram/channels/:name (parcial).",bot_token_hint:"Token de BotFather. Se guarda en ~/.apx/config.json.",bot_token_hint_short:"Token de BotFather.",secret_set_replace:"(seteado — escribí para reemplazar)",secret_already_set:"(ya seteado)",empty_keep:"— vacío = mantener",message_sent:"Mensaje enviado.",message_label:"Texto",send_chat_id:"chat_id: {id}",default_apx:"APX por defecto",yes:"sí",no:"no",user_id_fallback:"user_id {id}",role_assigned:"{name} → {role}"},agents_form:{emoji:"Emoji",area:"Área",role:"Rol",no_role:"— sin rol —",autonomy:"Autonomía",autonomy_hint:"Cuánto puede hacer el agente sin pedir confirmación.",auto_total:"Total",auto_automatico:"Auto",auto_permiso:"Permiso"},structure:{title:"Estructura",subtitle:"Áreas y roles de la empresa. Las áreas agrupan agentes; los roles definen su función.",info:"Las áreas son agrupaciones opcionales. Los roles definen la función de un agente y pueden pertenecer a un área.",empty:"Todavía no hay áreas ni roles. Creá el primero arriba.",new_area:"Nueva área",new_role:"Nuevo rol",edit_area:"Editar área",edit_role:"Editar rol",create_area:"Crear área",create_role:"Crear rol",name:"Nombre",slug:"Slug",goal:"Objetivo",goal_hint:"Para qué existe esta área (opcional).",area:"Área",description:"Descripción",no_area:"— sin área —",roles:"Roles",add_role:"rol",no_roles:"sin roles",general_roles:"Roles generales",delete_area:"Borrar área",delete_role:"Borrar rol",delete_area_desc:'¿Borrar el área "{name}"? Sus roles quedan sin área, no se eliminan.',delete_role_desc:'¿Borrar el rol "{name}"?'},files:{docs_label:"Docs",files_label:"Archivos",new_doc:"Nuevo documento",new_doc_hint:"Podés usar carpetas: cases/onboarding/spec.md",empty:"No hay archivos.",docs_empty:"Todavía no hay documentación. Creá el primer documento.",truncated:"Listado recortado (demasiados archivos).",select_prompt:"Elegí un archivo para verlo.",save:"Guardar",saved:"Guardado.",deleted:"Eliminado.",created:"Documento creado.",edit:"Editar",preview:"Preview",discard:"Descartar",no_preview:"No hay preview para este archivo.",too_large:"Archivo demasiado grande para mostrar.",path_label:"Ruta del archivo",path_example:"ej. cases/onboarding/spec.md",create:"Crear"},tasks:{state_open:"abiertas",state_done:"hechas",state_dropped:"descartadas",status_pending:"pendiente",status_running:"corriendo",status_in_review:"en revisión",status_blocked:"bloqueada",done_label:"hecha",dropped_label:"descartada",detail_title:"Detalle de task",field_title:"Título",field_prompt:"Prompt",field_status:"Estado",field_agent:"Agente",field_creator:"Creada por",field_source:"Origen",field_created:"Creada",field_updated:"Actualizada",field_done:"Completada",prompt_ph:"Descripción / prompt de la task…",toggle_prompt:"Prompt",view_thread:"Ver conversación",mark_done:"Completar"},agents_ui:{model_router_default:"modelo: default del router",slug_kebab_hint:"kebab-case, ej. reviewer, my-agent, content-writer",comma_separated:"separadas por coma",body_hint:"markdown — extiende el system prompt del agente",source_user:"user",source_override:"override",source_bundled:"bundled",tab_explorer:"Explorador",type_none:"— sin tipo —",type_orchestrator:"Orquestador",type_orchestrator_desc:"Coordina el equipo y delega.",type_specialist:"Especialista",type_specialist_desc:"Experto en el dominio; corre tareas.",type_assistant:"Asistente",type_assistant_desc:"Ayudante conversacional.",type_worker:"Worker",type_worker_desc:"Corre tareas autónomas.",type_monitor:"Monitor",type_monitor_desc:"Vigila el estado y reporta.",stat_threads:"Threads",stat_records:"Records",stat_tasks:"Tasks",stat_heartbeats:"Heartbeats",uncategorized:"Sin categoría",brain_zoom_in:"Acercar",brain_zoom_out:"Alejar",brain_fit:"Ajustar a la vista",brain_fullscreen:"Pantalla completa",brain_exit_fs:"Salir de pantalla completa",brain_pan_hint:"scroll para zoom · arrastrá el fondo para mover",brain_expand:"Expandir cerebros",brain_collapse:"Colapsar",brain_open:"Abrir",brain_part_of:"Parte de",brain_branches:"Ramas",config_def_desc:"definición (frontmatter + system prompt).",memory_durable_desc:"hechos durables que el agente recuerda.",running:"running",paused:"pausada",last_error:"última: error",field_tick:"Tick",field_next_tick:"Próximo tick",field_last_tick:"Último tick",field_last_run:"Última corrida",tools_label:"Tools",kind_agent:"agente",kind_memory:"memoria",kind_thread:"thread",kind_task:"task",kind_routine:"rutina",kind_hierarchy:"jerarquía",nodes_drag_hint:"{n} nodos · arrastrá para reordenar",kind_watch:"Vigía",kind_watch_desc:"Barre buscando cosas que valga la pena notar — vencidos, promesas por caer, proyectos en silencio. No cuesta nada cuando no hay nada que reportar.",action_watch:"Vigila señales, y sólo juzga cuando encuentra alguna",kind_exec_agent:"Agente del proyecto",kind_exec_agent_desc:"Corre un agente del proyecto con un prompt. Vos elegís cuál.",kind_super_agent:"Super-agente",kind_super_agent_desc:"Llama al super-agente APX con un prompt.",kind_telegram:"Telegram",kind_telegram_desc:"Manda un mensaje fijo a un canal de Telegram. Sin modelo ni agente.",kind_shell:"Shell",kind_shell_desc:"Corre un comando shell. Sin prompt ni pre/post — el comando es la acción.",kind_heartbeat:"Heartbeat",kind_heartbeat_desc:"No hace nada salvo escribir una línea en los logs cada vez que corre. Sirve para confirmar que el scheduler está vivo. Si no sabés si lo necesitás, no lo uses.",unit_seconds:"segundos",unit_minutes:"minutos",unit_hours:"horas",unit_days:"días",every_n_unit:"cada {n} {unit}",every_v:"cada {v}",preset_every_10m:"cada 10 min",preset_hourly:"cada hora",preset_daily_9am:"diario 9am",sched_manual:"solo cuando lo corrés vos",preset_weekdays_9am:"días hábiles 9am",preset_manual:"Manual",var_pre_output_prompt:"Salida de texto de los pre-commands. Se reemplaza dentro del prompt/texto antes de enviarlo. Útil para inyectar datos frescos (clima, una API) en la instrucción.",var_llm_output:"Respuesta final del agente o super-agente. Disponible en los post-commands como variable de entorno. Ej: reenviarla por Telegram.",var_status:"Resultado de la acción: ok o error. Disponible en los post-commands para decidir qué hacer después.",var_skipped:"Vale 1 si la acción se salteó (por skip_prompt_on), 0 si corrió. Disponible en los post-commands.",var_pre_output:"Salida completa de los pre-commands, como variable de entorno en los post-commands (hasta 32k).",var_pre_output_file:"Ruta a un archivo temporal con la salida de los pre-commands. Para salidas grandes que no convienen como variable.",var_pre_exit:"Código de salida del último pre-command (0 = ok). Disponible en los post-commands.",var_routine:"Nombre de esta rutina. Disponible como variable de entorno en los comandos.",summary_runs_agent:'Corre el agente "{agent}"',summary_runs_agent_none:"Corre un agente (todavía no elegiste cuál)",summary_super_agent:"Llama al super-agente",summary_telegram:'Manda Telegram a "{channel}"',summary_runs_cmd:"Corre: {cmd}",summary_shell:"Corre un comando shell",summary_heartbeat:"Deja un heartbeat en los logs",action_agent_answers:'El agente "{agent}" responde el prompt',action_agent_pick_answers:"El agente (elegí uno) responde el prompt",action_super_answers:"El super-agente responde el prompt",action_telegram_channel:'Manda Telegram al canal "{channel}"',action_runs_shell:"Corre el comando shell",step_pre:"Pre",step_post:"Post",last_label:"última:",tg_chat_id_ph:"(usa el del canal)",tg_text_ph:"mensaje a enviar",hb_message_ph:"sigo vivo",arg_placeholder:"--flag o valor",remove_arg:"quitar arg",super_agent_label:"{persona} (super-agente)",super_agent_badge:"super-agente"},modules_ui:{desktop_pos_left:"Izquierda",desktop_pos_center:"Centro",desktop_pos_right:"Derecha",desktop_theme_system:"Sistema",desktop_theme_light:"Claro",desktop_theme_dark:"Oscuro",desktop_status_desc:"La ventana se abre desde la terminal o por arranque automático.",desktop_running:"Corriendo",desktop_stopped:"Detenida",desktop_refresh:"refrescar",desktop_start:"Iniciar",desktop_stop:"Detener",desktop_restart:"Reiniciar",desktop_restart_hint:"Recarga la ventana abierta para aplicar ya los cambios de config (tema, posición).",desktop_restart_done:"Reiniciando la ventana — aplicando la última config.",desktop_restart_none:"No hay ninguna ventana de desktop conectada.",desktop_start_done:"Ventana de desktop iniciada.",desktop_start_already:"La ventana de desktop ya estaba corriendo.",desktop_stop_done:"Ventana de desktop detenida.",desktop_stop_none:"No había ninguna ventana de desktop corriendo.",desktop_from_terminal:"Desde la terminal:",desktop_autostart_desc:"Abre la ventana al iniciar sesión. Equivale a `apx desktop install` (no requiere sudo).",desktop_platform:"plataforma: {platform}",desktop_shortcut_desc:"Atajo global que muestra/oculta la ventana y empieza a escuchar.",desktop_accelerator:"Acelerador",desktop_accelerator_hint:"Hacé clic en el campo y apretá tu combinación de teclas. Reiniciá la ventana para aplicar.",desktop_shortcut_record:"Hacé clic para definir un atajo",desktop_shortcut_recording:"Apretá tu combinación…",desktop_shortcut_change:"clic para cambiar",desktop_shortcut_esc:"Esc para cancelar",desktop_shortcut_saved:"Atajo guardado. Reiniciá la ventana (apx desktop stop && start) para aplicarlo.",desktop_autostart_on:"Arranque automático habilitado para el próximo inicio de sesión.",desktop_autostart_off:"Arranque automático deshabilitado.",desktop_appearance_desc:"Tema de la ventana y posición en la pantalla.",desktop_theme:"Tema",desktop_restart_apply:"Reiniciá la ventana para aplicar.",desktop_theme_set:"Tema: {value}.",desktop_position:"Posición",desktop_position_hint:'"izquierda" / "centro" / "derecha" del borde superior.',desktop_position_set:"Posición: {value}.",desktop_activation_desc:"El plugin del daemon procesa los mensajes. El STT se configura en Voces.",desktop_enabled_toast:"Escritorio habilitado.",desktop_disabled_toast:"Escritorio deshabilitado.",desktop_plugin_on:"Plugin habilitado (responde mensajes)",desktop_plugin_off:"Plugin deshabilitado",desktop_stt_engine:"Motor de speech-to-text:",desktop_stt_engine_suffix:"(whisper local, idioma, modelo).",desktop_last_conv_desc:"El último intercambio con el agente desde la ventana flotante.",desktop_no_messages:"Todavía no hay mensajes. Mandá algo a la ventana de escritorio para que aparezca acá.",desktop_you:"Vos",desktop_roby:"Roby",desktop_empty_msg:"(vacío)",deck_widget_enabled:"Widget {id} habilitado.",deck_widget_disabled:"Widget {id} deshabilitado.",deck_save_error:"Error al guardar",deck_loading_manifest:"Cargando manifest…",deck_manifest_error:"Error al cargar el manifest.",deck_widgets_summary:"{count} widgets · {enabled} externos habilitados",deck_loading_manifest_full:"Cargando el manifest del Deck…",deck_manifest_load_failed:"No se pudo cargar el manifest del Deck.",deck_retry:"Reintentar",deck_no_widgets:"No hay widgets en el manifest.",deck_context_desc:"Información que el Deck ve desde el daemon.",deck_active_project:"Proyecto activo:",deck_none:"ninguno",deck_registered_projects:"Proyectos registrados:",deck_active_plugins:"Plugins activos:",deck_daemon_active:"activo · {uptime}",deck_daemon_started:"iniciado",deck_safety_no_shell:"sin shell directo",deck_safety_no_arbitrary:"comandos arbitrarios bloqueados",deck_safety_confirm:"las acciones peligrosas requieren confirmación",code_copied:"Copiado.",code_saved:"Guardado.",code_file_empty:"(vacío)",code_file_error:"Error: {msg}",code_stream_error:"error",code_super_agent:"super-agent",code_super_agent_desc:"Agente principal con todas las tools",code_chat_tab:"Chat",code_panel_sessions:"Lista de sesiones",code_panel_tree:"Árbol de archivos",code_panel_terminal:"Terminal",code_panel_context:"Panel de contexto",code_ctx_auto:"auto",code_ctx_mode:"Modo",code_ctx_agent:"Agente",code_ctx_msgs_value:"{user} usuario · {assistant} asistente",code_ctx_tokens_total:"Tokens Total",code_ctx_created:"Creado",code_ctx_activity:"Actividad",code_project_fallback:"proyecto {id}",code_pick_project_ph:"Elegí un proyecto…",code_artifact_exit_ok:"exit 0 — {ms}ms",code_artifact_exit_fail:"exit {code}{timeout}",code_artifact_timeout_suffix:" (timeout)",code_artifact_view_short:"Ver",code_artifact_edit_short:"Editar",code_artifact_exit_badge:"exit {code}",code_artifact_timeout:"timeout",code_artifact_truncated:"truncado"},settings_ui:{bearer_label:"Bearer",global_config_desc:"Config general en ~/.apx/config.json. Editable por tabs; el JSON queda separado.",global_json_desc:"Los secretos redacted no se sobrescriben.",save_json:"Guardar JSON",expand_menu:"Expandir menú",collapse_menu:"Colapsar menú",documentation:"Documentación",kind_personal:"Personal",kind_company:"Empresa",kind_app:"App",kind_software:"Software",kind_default:"Default",kind_other:"Otro",base_menu_view:"Vista del menú Base (workspace general).",coming_soon:"Próximamente",inspector_title:"Skill Inspector (RAG por turno)",inspector_desc:"Función experimental. Cuando está activa, el agente NO recibe la lista completa de skills en su prompt; en cada mensaje un RAG local decide qué skill(s) cargar — el cuerpo completo si hay match fuerte, una sugerencia si es medio, nada si no aplica. Se reevalúa en cada turno: una skill que dejó de ser relevante desaparece del contexto.",enable_inspector:"Habilitar inspector",enable_inspector_hint:"Off = comportamiento clásico (lista de slugs + sugerencia pasiva). On = el RAG decide por turno.",on:"On",off:"Off",index_count:"Índice: {n} skills",not_indexed:"sin indexar",dim:"dim {dim}",updated_at:"actualizado {date}",reindex:"Reindexar",reindex_forced:"Reindexar (forzado)",embedder_source:"El embedder viene de Memoria (RAG). Local con Ollama, u offline si no hay proveedor configurado.",thresholds_title:"Umbrales y límites",thresholds_desc:"Ajustá qué tan agresivo es el inspector. Subir los umbrales = menos falsos positivos pero más riesgo de perderte una skill; bajarlos = al revés.",test_title:"Probar (dry-run)",test_desc:"Escribí un mensaje como lo haría un usuario y mirá qué skills cargaría/sugeriría el inspector — sin llamar al modelo. Fuerza el inspector aunque esté apagado arriba.",test_placeholder:"ej.: necesito crear un video promocional con voz en off",test_btn:"Probar",jit_empty_index:"JIT (índice vacío)",loaded_label:"Cargadas:",suggested_label:"Sugeridas:",could_not_save:"No se pudo guardar: {msg}",indexed_with:"Indexado con {embedder} (dim {dim}): +{added} ~{refreshed} -{removed}.",index_failed:"Falló el indexado: {msg}",dry_run_failed:"Falló el dry-run: {msg}",knob_load_threshold:"Umbral de carga",knob_load_threshold_hint:"Similaridad mínima para inyectar el CUERPO de la skill (alto = más estricto).",knob_hint_threshold:"Umbral de sugerencia",knob_hint_threshold_hint:"Similaridad mínima para solo SUGERIR la skill (así el agente la carga si quiere).",knob_margin:"Margen sobre la 2da",knob_margin_hint:"La primera tiene que superar a la segunda por este margen para cargar su cuerpo (evita empates flojos).",knob_max_loaded:"Máx. cuerpos cargados",knob_max_loaded_hint:"Cuántas skills se inyectan completas por turno.",knob_max_hints:"Máx. sugerencias",knob_max_hints_hint:"Cuántas skills extra se nombran como sugerencia.",knob_prompt_floor:"Largo mínimo del prompt",knob_prompt_floor_hint:"Los mensajes más cortos que esto se ignoran (evita 'ok', 'hola').",knob_body_char_cap:"Tope de chars del cuerpo",knob_body_char_cap_hint:"Recorta los cuerpos largos para que no inflen el contexto.",cfg_overrides_label:"Overrides",cfg_overrides_desc:".apc/config.json. Solo valores específicos del proyecto; vacío hereda del global/effective.",cfg_route_to_agent:"Route to agent",cfg_super_agent_model:"Modelo del super-agente",cfg_permission_mode:"Permission mode",cfg_extra_prompt:"Prompt extra",cfg_telegram_label:"Telegram",cfg_chat_id:"Chat ID",cfg_bot_token:"Bot token",cfg_respond_with_engine:"Responder con engine",cfg_engines_label:"Engines",cfg_ollama_url:"Ollama URL",cfg_anthropic_key:"Anthropic API key",cfg_openai_key:"OpenAI API key",cfg_groq_key:"Groq API key",cfg_openrouter_key:"OpenRouter API key",cfg_gemini_key:"Gemini API key",cfg_project_label:"Proyecto",cfg_project_desc:".apc/project.json. Metadata APC portable; sin secretos, sin runtime.",cfg_name:"Nombre",cfg_version:"Versión",cfg_apc_spec:"APC spec",cfg_apx_install:"Estado de instalación APX",cfg_apx_storage_id:"ID de storage APX"},skills_page:{title:"Skills",desc:"Activá o desactivá qué skills carga cada agente. Elegí el scope: el super-agent (global) o un proyecto puntual.",list_title:"Skills instaladas",list_desc:"Las privadas de APX están siempre activas y no se pueden tocar.",scope_label:"Scope",scope_super_agent:"Super-agent (global)",scope_hint:"El super-agent usa el scope global. Cada proyecto puede sobrescribir skills de forma independiente.",count_label:"{n} skills · {on} activas",empty:"No hay skills. Creá una abajo o instalá con la CLI.",source_builtin:"APX",source_global:"Global",source_project:"Proyecto",private_badge:"Privada",private_hint:"Skill interna de APX — siempre activa, no se puede desactivar ni borrar.",overridden_badge:"Override",inherited_hint:"Heredada del global",reset_to_global:"Volver al global",on:"activa",off:"inactiva",toggle_failed:"No se pudo cambiar el estado: {msg}",add_title:"Agregar skill",add_desc:"Crea una skill de usuario en ~/.apx/skills/<slug>/SKILL.md. Queda disponible para todos los scopes.",add_slug_label:"Slug",add_slug_ph:"mi-skill",add_desc_label:"Descripción",add_desc_ph:"Una línea que explique cuándo usarla",add_body_label:"Cuerpo (Markdown)",add_body_ph:`# Mi skill
789
+
790
+ Instrucciones para el agente…`,add_btn:"Crear skill",created_ok:'Skill "{slug}" creada.',create_failed:"No se pudo crear: {msg}",delete_btn:"Borrar",delete_confirm:'¿Borrar la skill "{slug}"? No se puede deshacer.',deleted_ok:'Skill "{slug}" borrada.',delete_failed:"No se pudo borrar: {msg}",inspector_section_title:"Skill Inspector (RAG por turno)",inspector_section_desc:"Config avanzada: RAG local que inyecta solo las skills que el mensaje necesita.",scope_ph:"— elegir scope —",select_a_skill:"Elegí una skill de la lista para ver su contenido.",added_by:"Agregado por",activator:"Activador",by_apx:"APX (built-in)",by_you:"Vos",activator_value:"Coincidencia semántica (RAG)",tab_preview:"Vista",tab_source:"Fuente",add_menu:"Agregar",add_online:"Crear con el editor",add_online_hint:"Escribí slug + descripción + contenido",add_zip:"Subir .zip",add_zip_hint:"Importar una skill empaquetada",add_repo:"Desde repo git",add_repo_hint:"Clonar desde una URL",create_dialog_title:"Crear skill",repo_dialog_title:"Importar desde repo git",repo_url_label:"URL del repo",repo_url_ph:"https://github.com/usuario/mi-skill.git",repo_url_hint:"El repo (o su subcarpeta) debe tener un SKILL.md.",import_btn:"Importar",imported_ok:'Skill "{slug}" importada.',import_failed:"No se pudo importar: {msg}",cancel:"Cancelar",manager_tab:"Skills",rag_tab:"Config (RAG)"},shared_ui:{skill_inspector_title:"Skill Inspector ({embedder}) eligió estas skills para este turno",tools_count:"{n} tools",tools_failed:"{n} fallaron",tool_read_file:"Leer archivo",tool_write_file:"Escribir archivo",tool_edit_file:"Editar archivo",tool_list_files:"Listar archivos",tool_search_files:"Buscar en archivos",tool_search_messages:"Buscar mensajes",tool_tail_messages:"Últimos mensajes",tool_run_shell:"Correr shell",tool_send_telegram:"Enviar Telegram",tool_call_agent:"Llamar agente",tool_call_mcp:"Llamar MCP",tool_call_runtime:"Llamar runtime",tool_create_task:"Crear task",dedup:"dedup",args:"args",result:"result",auto:"Auto",auto_router:"Auto (decide el router)",model_filter_ph:"filtrar o escribir modelo…",loading_models:"cargando modelos…",use_value:"usar “{value}”",model_combobox_ph:"elegí o escribí un modelo…",search_variable_ph:"buscar variable…",no_matches:"sin coincidencias",create_variable:"Crear nueva variable…",kv_key_ph:"CLAVE",kv_value_ph:"valor",remove_row:"quitar fila",add_row:"Agregar fila",err_chat_failed:"Falló el chat.",err_stream_failed:"Falló el stream.",err_load_conversation:"No se pudo cargar la conversación.",err_stream:"Error de stream."},integrations:{title:"Integrations",description:"Plugins y tools disponibles para este proyecto",tab_plugins:"Plugins",tab_tools:"Tools",scope_label:"Ámbito:",scope_project:"Este proyecto",scope_global:"Global (default)",plugins_hint:"Plugins de canal y servicio instalables por proyecto. Se guardan en el ámbito seleccionado arriba.",more_soon:"Más plugins próximamente…",tools_hint:"Tools que los plugins conectados exponen a los agentes de este proyecto.",tools_empty:"No hay tools de integraciones. Conectá un plugin para habilitarlas.",tool_active:"activo",tool_inactive:"inactivo",status_active:"Activo",status_error:"Error",status_unconfigured:"No configurado",connected:"Conectado",connect:"Conectar",deactivate:"Desactivar",saving:"Guardando...",validating:"Validando...",verifying:"Verificando token...",confirm:"Confirmar",select_placeholder:"Seleccionar...",reveal:"Ver",hide:"Ocultar",credentials:"Credenciales {name}",coming_soon:"Próximamente",coming_soon_body:"Este plugin está declarado en el catálogo pero todavía no está conectable en APX. Se va a portar de forma nativa en una próxima iteración.",tools_for_agents:"Tools para agentes",tools_available_note:"Disponibles para los agentes que las tengan permitidas, o vía discover_tools.",err_connect:"Error al conectar",err_generic:"Ocurrió un error",action_done:"Listo",asana:{select_label:"Seleccioná el workspace a usar",connected:{user_name:"Conectado como",user_email:"Email",workspace_name:"Workspace"},fields:{personal_access_token:{label:"Personal Access Token",help_label:"¿Cómo obtener el token?",help_steps:`Abrí app.asana.com/0/my-apps en el navegador.
791
+ Bajá hasta la sección "Personal access tokens" (no tus apps OAuth).
792
+ Hacé clic en "+ New access token".
793
+ Dale un nombre y confirmá.
794
+ Copiá el token completo — empieza con "1/..." y tiene un ":" en el medio.
795
+ Pegalo en el campo de abajo.`}}},github:{connected:{user_login:"Conectado como",user_name:"Nombre"},fields:{token:{label:"Personal Access Token",help_label:"¿Cómo obtener el token?",help_steps:`Abrí github.com/settings/tokens.
796
+ Generá un token (classic o fine-grained) con scope "repo".
797
+ Copiá el token — empieza con ghp_ o github_pat_.
798
+ Pegalo en el campo de abajo.`}}},obsidian:{connected:{vault_path:"Vault",vault_name:"Nombre",note_count:"Notas"},fields:{vault_path:{label:"Ruta del Vault"},auto_mcp:{label:"Registrar MCP de Obsidian",hint:"Agrega un MCP 'obsidian' apuntando a este vault, en este scope."},memory_sync:{label:"Sincronizar memoria de APX",hint:"Habilita el respaldo de la memoria de APX en el vault; luego usá el botón de abajo."}},actions:{sync_memory:"Sincronizar memoria",sync_memory_done:"Sincronizados {count} archivo(s) · {changed} cambiados"}}}},sP={cron:{daily:"every day at {at}",weekdays:"Monday to Friday at {at}",weekends:"weekends at {at}",on_days:"{days} at {at}",monthly:"day {day} of each month at {at}",every_hour:"every hour, at :{minute}",every_n_hours:"every {n} hours, at :{minute}",every_n_minutes:"every {n} minutes",every_minute:"every minute",every_label:"every N hours instead",use_cron:"edit as cron",use_picker:"use the picker",preset_every_day:"every day",preset_weekdays:"weekdays",preset_weekends:"weekends",day_short:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"}},when:{now:"now",in:"in {amount}",ago:"{amount} ago",minutes:"{n} min",hours:"{n} h",days:"{n} d"},common:{loading:"Loading…",saving:"Saving…",cancel:"Cancel",save:"Save",delete:"Delete",edit:"Edit",create:"Create",add:"Add",remove:"Remove",reload:"Reload",shutdown:"Shut down",enabled:"Enabled",disabled:"Disabled",enable:"Enable",disable:"Disable",open:"Open",close:"Close",confirm:"Confirm",optional:"(optional)",none:"—",none_yet:"Nothing here yet.",error_generic:"Something went wrong.",search:"Search",new:"New",restore:"Restore",show:"Show",hide:"Hide",copy:"Copy",run:"Run",refresh:"Refresh",view_all:"View all",saved:"Saved.",deleted:"Deleted.",pager_prev:"Previous",pager_next:"Next",pager_page:"Page {page} of {total}",pager_range:"{from}–{to} of {total}",pager_per_page:"Per page"},daemon:{connecting:"Connecting to the daemon…",unreachable:"Could not reach the daemon at localhost:7430.",unreachable_hint:"Start APX with `apx daemon start` and refresh.",version:"Version",uptime:"Uptime",status:"Status",running:"running",down:"down",reload_hint:"POST /admin/reload — reloads ~/.apx/config.json without restarting.",shutdown_confirm:"Shut down the daemon? Upcoming requests will fail until it restarts.",shutdown_done:"Daemon stopped."},pairing:{title:"Pair this device",subtitle:"You are connecting from outside this machine. For security, pair this browser with a pairing code.",steps_title:"How to get the code",step_1:"On the PC where APX is running, open a terminal.",step_2:"Run `apx pair` (or scan the QR with APX Deck).",step_3:"Copy the code shown below the QR and paste it here.",code_label:"Pairing code",code_ph:"e.g. 7f3a1c9e-…",label_label:"Device name",label_ph:"e.g. Living room laptop",submit:"Pair",linking:"Pairing…",success:"Device paired ✓",err_required:"Paste the pairing code.",err_expired:"The code expired. Run `apx pair` again and try again.",err_unknown:"Unknown or already-used code. Generate a new one with `apx pair`.",err_generic:"Could not pair. Check the code and try again.",revoke_hint:"You can revoke this device at any time from Settings or with `apx pair revoke`."},nav:{apx_admin:"APX",settings:"Settings",project:"Project",add_project:"Add project",all_projects:"All projects",more_projects:"{count} more",collapse_projects:"Hide projects",expand_projects:"Show projects",modules:{voice:"Voices",desktop:"Desktop",deck:"Deck",code:"Code",web:"Web"}},topbar:{breadcrumb_root:"APX",breadcrumb_settings:"APX › Settings",breadcrumb_project:"APX › Project",breadcrumb_base:"Base",breadcrumb_projects:"Projects",light:"Switch to light",dark:"Switch to dark",lang_toggle:"Language"},admin:{title:"APX",subtitle:"Admin panel. Global config, channels and projects.",engines_title:"Engines",engines_subtitle:"Available LLM adapters. API keys live in ~/.apx/config.json.",telegram_title:"Telegram",telegram_subtitle:"Configured channels. Each one can be pinned to a project.",telegram_polling_on:"Polling active",telegram_polling_off:"Disabled",telegram_add_channel:"Channel",telegram_send_test:"Test",telegram_send_test_title:"Send to",telegram_default_message:"Test message from APX panel ✅",projects_title:"Registered projects",projects_subtitle:"Click a project to open its panel.",unregister:"Unregister",unregister_confirm:"Remove {label} from APX? The folder is not deleted; only unregistered.",reload_success:"Config reloaded.",telegram_polling_started:"Polling started.",telegram_polling_stopped:"Polling stopped.",telegram_channel_removed:"Channel deleted.",agents_badge:"agents",engine_badge:"yes",engine_badge_no:"no",base_label:"Base"},add_project:{title:"Add project",subtitle:"APX will index .apc/, agents and AGENTS.md in that folder.",path_label:"Absolute path",path_hint:"Equivalent to apx project add /path/to/project",path_placeholder:"/path/to/my-project",register:"Register",path_required:"Path required.",registered:"Project #{id} registered.",search_btn:"Browse",picker_prompt:"Pick the project folder",browser_unavailable:"Browser unavailable until daemon restarts. Paste path manually.",no_folders:"No folders."},inbox:{search:"Search",no_match:"Nothing matches",hide_quiet:"Hide quiet agents",open_in_project:"Open in project",super_agent_scope:"All projects",title:"Agent inbox",subtitle:"Every agent as a conversation, most recent first.",empty:"You have not talked to any agent yet.",pinned:"lead",show_quiet:"Show quiet agents",no_reply_yet:"(no replies yet)"},settings:{title:"Settings",subtitle:"Panel preferences + local daemon diagnostics.",appearance:"Appearance",light_mode:"Light",dark_mode:"Dark",system_mode:"System",language:"Language",daemon:"Daemon",daemon_sub:"Status of the local process that serves this web and orchestrates agents.",engines:"Available engines",engines_sub:"LLM adapters compiled with the daemon.",token:"Session token",token_sub:"If this web could not auto-load the token, paste it here.",token_active:"(token already active)",token_paste:"Paste daemon bearer",token_saved:"Token saved.",devices:"Paired devices",devices_sub:"GET /pair/list. Revoking invalidates that bearer on the daemon.",devices_empty:"No paired clients yet.",devices_revoke_confirm:"Revoke client {id}?",devices_revoke_success:"Client revoked.",devices_pair_btn:"Pair device",devices_pair_title:"Pair device",devices_pair_desc:"Scan the QR with your phone camera to open the web already paired, or paste the code on another PC.",devices_pair_scan:"Scan with your phone camera — opens the web already paired.",devices_pair_code:"Or paste this code on the pairing screen:",devices_pair_url:"Access URL",devices_pair_link:"Or copy this link and open it on the other device (enters automatically):",devices_pair_copy:"Copy",devices_pair_copied:"Link copied to clipboard.",devices_pair_copied_code:"Code copied.",devices_pair_expires:"Expires in {s}s",devices_pair_expired:"The code expired.",devices_pair_regen:"Generate another",devices_pair_waiting:"Waiting for device to confirm…",devices_pair_done:"Device paired ✓",devices_pair_localhost_only:"Codes can only be generated from the daemon's PC (localhost).",devices_last_seen:"seen:",devices_never:"never",devices_revoke:"Revoke",account_section:"Account",agents_section:"Agents & models",super_agent_section:"Super-agent",knowledge_section:"Models & knowledge",channels_section:"Channels & devices",modules_section:"Modules",advanced_section:"Advanced",tabs:{identity:"Identity",super_agent:"Super-agent",profile:"Agent profile",engines:"Engines & models",telegram:"Telegram",devices:"Devices",nudge:"Interruptions",advanced:"Advanced"},profile:{title:"Agent profile",subtitle:"An installable line of work for the super-agent: what it does with its day and when it speaks to you. Distinct from the agent's name (that lives under Identity).",active_hint:"A profile is active: its block ships on every turn of every channel. Deactivate to go back to vanilla.",vanilla_hint:"No profile is active. APX behaves exactly as it always has — the super-agent prompt is identical to a clean install.",none_available:"No profiles available yet.",active:"active",activate:"Activate",replace_active:"Replace the active one",deactivate:"Deactivate",on:"Active",off:"Inactive",replaces_active:"Turning this on replaces the active profile",deactivate_title:"Deactivate the profile?",deactivate_confirm:"APX goes back to vanilla. The profile's routines are disabled but not deleted, and your settings, tasks and memory are untouched — activating it again restores everything.",activated:"Profile active",deactivated:"Profile off — APX is back to vanilla",token_cost:"Prompt cost",over_budget:"over its declared budget",settings_title:"Profile settings",settings_subtitle:"Blank fields fall back to the package default. Changing a time really reschedules the routine.",saved:"Settings saved",saved_with_routines:"Settings saved and routines rescheduled",doctor_title:"Doctor",doctor_clean:"All good.",preview_title:"Prompt block",preview_subtitle:"Exactly what reaches the model, with your values substituted.",preview_empty:"(empty)",preview_inactive:"This is what the model would receive if you activated this profile.",no_settings:"This profile has nothing to configure.",settings_locked:"Activate the profile to change its settings.",doctor_vanilla:"No profile active. APX behaves as it always has."},nudge:{title:"Interruption budget",subtitle:"How often APX may write to you without being asked. Replies to your own messages are never held back.",off_hint:"The budget is off: every unrequested message goes out. Everything is still recorded below.",on_hint:"{{sent}} sent today, {{left}} left.",source:"Set by",enabled:"Enforce the budget",daily_max:"Messages per day",daily_max_hint:"0 means no ceiling.",quiet_hours:"Quiet hours",quiet_hours_hint:"HH:MM-HH:MM. Crosses midnight fine. Leave empty for none.",cooldown:"Minimum gap (minutes)",project_cooldown:"Minimum gap per project (minutes)",kind_cooldown:"Minimum gap per kind (minutes)",critical_bypass:"Critical messages may bypass the budget",critical_bypass_hint:"Bypasses are always recorded and flagged.",log_title:"What it has sent",log_subtitle:"Unrequested messages only, newest first. Your rating feeds back into what it sends next.",log_empty:"Nothing sent unprompted yet.",useful:"Useful",noise:"Not useful",bypass:"bypassed the budget",saved:"Budget updated",unrated:"not rated"},identity:{title:"Identity",subtitle:"User data. Agent configuration goes in Super-agent.",agent_name:"Agent name",owner_name:"Your name",personality:"Personality",owner_context:"Owner context",owner_context_hint:"Who you are, what you work on, what the agent should know about you.",language:"Preferred language",timezone:"Timezone (IANA)",timezone_hint:"Auto-detected — search to change.",saved:"Identity saved."},super_agent:{title:"Super-agent",subtitle:"Personality, model, prompt and modes of the super-agent.",personality:"Personality",model:"Active model",model_hint:"E.g.: anthropic:claude-sonnet-4.5, ollama:gemma2:9b",permission_mode:"Permission mode",system:"Extra prompt (system)",system_hint:"Text prepended to the base system prompt.",system_ph:"(Empty = the base prompt from core/agent/prompts/super-agent-base.md is used)",fallback_title:"Fallback chain",fallback_hint:"If the active model fails, these are tried in order.",fallback_add:"Add model to chain",saved:"Super-agent saved.",enabled_label:"Super-agent enabled",model_active:"Active model (router)",model_configure:"Configure in Models",behavior_subtitle:"Super-agent behavior. Model and fallback chain are configured in the Model Router."},engines_keys:{title:"Model API keys",subtitle:"Each engine stores its key in ~/.apx/config.json. Already-set values show a safe suffix.",ollama_url:"Ollama URL",ollama_hint:"Default: http://127.0.0.1:11434",key_label:"API key",key_placeholder:"(not set)",clear:"Clear key",saved:"Key saved.",cleared:"Key cleared."},telegram_global:{title:"Telegram (default)",subtitle:"Default channel — projects can override with their own channel.",bot_token:"Bot token",chat_id:"Default chat ID",poll_interval:"Poll interval (ms)",respond_with_engine:"Respond with engine",enabled:"Polling enabled",saved:"Telegram saved."},advanced:{title:"Advanced",subtitle:"Raw editor for ~/.apx/config.json. Secrets show as *** set *** but you can write a new one.",write:"Apply changes",written:"Config applied and daemon reloaded.",reload_success:"Config reloaded."}},project:{not_found:"Roby couldn't find project {pid}: it may have been unregistered, or the ID is wrong.",rebuild:"Rebuild context",rebuild_done:"Rebuild OK.",unregister_confirm:"Unregister {label}? The folder is not deleted.",unregistered:"Unregistered.",base_subtitle:"General workspace · super-agent",danger:{title:"Danger zone",subtitle:"Actions that affect APX's project registry. They do not touch repo files.",rebuild_desc:"Re-scans .apc/, MCPs and agents and regenerates the super-agent context for this project.",unregister_desc:"Removes the project from APX's registry. The folder on disk stays intact.",rebuild_confirm_title:"Rebuild context",rebuild_confirm_desc:"Regenerate context for {label}.",rebuild_long:"Re-reads APC config, lists available MCPs and agents, and rebuilds the super-agent system prompt. Safe to run — nothing is deleted. Use it after editing .apc/ by hand or if changes are not being picked up.",unregister_confirm_title:"Unregister project",unregister_long:"The project disappears from `apx`. Files on disk (.apc/, code, everything) stay. You can re-register it with `apx project register <path>`."},nav:{overview:"Overview",chat:"Chat",config:"Config",telegram:"Telegram",agents:"Agents",routines:"Routines",tasks:"Tasks",commitments:"Commitments",mcps:"MCPs",artifacts:"Artifacts",vars:"Variables",logs:"Logs",memories:"Memories",structure:"Structure",docs:"Docs",files:"Files"},sections:{workspace:"Workspace",content:"Content",automation:"Automation",knowledge:"Conversations",config:"Config"},overview:{tasks_open:"Open tasks",routines:"Routines",routines_active:"Active routines",agents:"Agents",mcps:"MCPs",artifacts:"Artifacts",chat:"Chat (super-agent)",chat_value:"open",roster:"Team",no_agents:"No agents yet.",orchestrators:"Orchestrators",specialists:"Specialists",recent_tasks:"Recent tasks",no_activity:"No open tasks.",brain_title:"Team brain",brain_desc:"The whole agent map — orchestrators at the core, their specialists clustered around them. Click a node to open it.",brain_core:"Team"},artifacts:{title:"Artifacts",subtitle:"Reusable scripts and files stored under the project. Agents create them; you can view, run, rename or delete them."},chat:{title:"Chat with agent",subtitle:"Direct conversations with project agents. The super-agent does not intervene.",live_title:"Chat with {agent}",superagent_title:"Chat with {persona}",superagent_subtitle:"Chat with {persona} — the APX super-agent. Can use tools (projects, tasks, mcps, agents).",loaded_subtitle:"Loaded conversation with {slug}. Sending will append to this thread.",thread_subtitle:"History with {persona} on {channel}. Replying here continues the conversation from the web.",empty:"Send a message to start the conversation.",placeholder:"Type something and press enter to send (shift+enter = new line)",send:"Send",stop:"Stop",new_session:"New session",delete:"Delete",delete_confirm_title:"Delete chat",delete_confirm_desc:"This can't be undone. This chat's history will be permanently deleted.",deleted:"Chat deleted.",meta_created:"Created {date} · {channel}",meta_new:"New chat · {channel}",copy:"copy",copied:"Copied.",stopped_marker:" [stopped]",create_agent:"Create agent",create_agent_title:"Create agent",create_agent_desc:"Required to start a chat in this project.",role_label:"role",model_label:"model",model_hint:"e.g. openai:gpt-5, groq:llama-3.3-70b-versatile",master_label:"Master agent",list:{title:"Chats",new:"New",search:"Search chats…",all_agents:"All agents",empty:"No conversations yet. Start one from the right.",count:"{n} total",pick_agent:"Pick an agent"}},tasks:{title:"Tasks (TODOs)",subtitle:"Append-only JSONL in ~/.apx/projects/<id>/tasks/.",add:"add",add_label:"New task",add_placeholder:"e.g. fix scroll bug",empty:"No {state} tasks.",empty_open:"No open tasks.",created:"Task created.",create_error:"could not create task",done:"✓ done",drop:"✗ drop",reopen:"↻ reopen",due:"due",via:"via",aria_done:"mark done",aria_drop:"discard task",aria_reopen:"reopen task"},global_tasks:{add:"Add",add_title:"New task",field_title:"Task",field_project:"Project",field_due:"Due",any_status:"any status",title:"Tasks (all projects)",subtitle:"Aggregated tasks from all registered projects.",empty:"No tasks.",due:"due",go_project:"Go to project"},commitments:{add:"Add",add_title:"Record a promise",add_hint:"Something you told a specific person you would do. Tasks live next door.",field_who:"Who is waiting",field_who_hint:"A name as you would say it — free text, not a contact.",field_what:"What you promised",field_what_ph:"send the revised quote",field_due:"By when",field_due_hint:"Optional, but it is the part that makes this useful.",field_project:"Project",title:"Commitments",subtitle:"What was promised, to whom, and by when. Separate from tasks: someone is waiting on these.",empty:"Nothing promised.",overdue:"was due",overdue_only:"Past their date",no_date:"no date agreed",moved:"moved",mark_kept:"Kept",mark_missed:"Missed",state:{open:"open",kept:"kept",missed:"missed",all:"all"}},routines:{title:"Heartbeats / Routines",subtitle:"Cron, every:Nm, once:ISO. Each routine fires an agent or a shell.",empty:"No routines. Create one above.",new:"new",new_btn:"New",delete_confirm:"Delete routine {name}?",delete_confirm_body:"This can't be undone.",saved:"Routine saved.",paused:"paused",next_run:"next:",last_run:"last:",enabled_hint:"Active · runs on schedule",disabled_hint:"Paused · only via Run button",enabled_label:"Enabled",new_title:"New routine",edit_title:"Edit {name}",dialog_desc:"Saved in .apc/routines.json. The routine runs while the daemon is active.",name_field:"Name",name_no_edit:"Cannot be changed when editing.",kind_field:"Action (kind)",schedule_field:"Interval (schedule)",schedule_hint:"Choose a preset or type manually. Manual = only runs via Run button.",vars_title:"Available variables",what_happens:"What will happen",list_title:"Routines",detail_empty:"Pick a routine from the list.",edit_btn:"Edit",edit_hint:"Open the editor: kind, schedule, prompt, pre/post and variables.",block_pre:"Pre-commands",block_post:"Post-commands",block_prompt:"Prompt",block_text:"Text",block_command:"Command",block_empty:"(empty)",runs_title:"Executions",runs_empty:"No executions yet.",runs_close:"Close",runs_no_detail:"No further detail.",runs_output:"Output",status_ok:"ok",status_error:"error",status_skipped:"skipped",agent_field:"Agent (spec.agent)",agent_hint:"Who executes the routine.",agent_loading:"loading…",agent_pick:"— pick an agent —",prompt_exec:"Prompt (spec.prompt)",prompt_exec_ph:"what is pending for today?",prompt_super:"Prompt (spec.prompt)",prompt_super_ph:"summarize the project status",pre_field:"Pre-commands (pre_commands)",pre_hint:"Shell BEFORE the prompt. One per line.",post_field:"Post-commands (post_commands)",post_hint:"Shell AFTER the prompt. One per line.",tg_channel:"Channel (spec.channel)",tg_chat_id:"Chat ID (spec.chat_id)",tg_text:"Telegram Message (spec.text)",tg_text_hint:"Fixed message to send. Does not use a model.",shell_field:"Command (spec.command)",shell_hint:"Runs as-is in the shell. No prompt, no pre/post.",hb_channel:"Channel (spec.channel)",hb_message:"Message (spec.message)",name_required:"name required",save_error:"save failed",run_error:"run failed",toggle_error:"toggle failed",delete_error:"delete failed",run_success:"{name} fired.",run_confirm:"Run routine {name} now?",run_confirm_body:"Runs the action once, regardless of the schedule.",running:"Running…",delete_success:"deleted."},agents:{title:"Agents",subtitle:"Defined in .apc/agents/<slug>.md.",subtitle_full:"Defined in .apc/agents/<slug>.md. Runtime memory lives under ~/.apx/projects/<id>/agents/<slug>/.",empty:"No agents. Add one with <code>apx agent add</code> or the button.",empty_text:"No agents. Add one with `apx agent add` or the button above.",new:"Agent",created:"Agent {slug} created.",slug_invalid:"slug must match /^[a-z][a-z0-9_-]*$/",hierarchy:"Hierarchy",list_view:"List",import:"Import",chat:"Chat",view:"View",orchestrator:"Orchestrator",new_title:"New agent",new_desc:"POST /projects/:pid/agents — writes .apc/agents/<slug>.md.",slug_label:"slug",slug_ph:"cody",role_label:"role (optional)",role_ph:"code refactor",model_label:"model (optional)",model_hint:"e.g. ollama:gemma2:9b, openai:gpt-4o-mini",lang_label:"language (optional)",desc_label:"description (optional)",desc_ph:"What does this agent do…",skills_label:"skills (comma)",skills_ph:"skill-a, skill-b",tools_label:"tools (comma)",tools_ph:"tool-a, tool-b",parent_label:"reports to (parent, optional)",parent_hint:"Sub-agent of an orchestrator.",none_parent:"— none —",master_label:"Orchestrator (master)",create_success:"Agent {slug} created.",create_error:"create failed",import_title:"Import from vault",import_desc:"Templates in ~/.apx/agents. Registered in this project (.apc/agents/<slug>.md).",import_empty:"No templates in the vault.",import_success:"Imported: {slug}",import_already:"already here",import_btn:"Import"},agent_detail:{not_found:"Agent not found.",chat_btn:"Chat with {slug}",reports_to:"↳ reports to",no_threads:"No threads.",no_activity:"No recorded activity.",threads_recent:"Recent threads",subagents:"Sub-agents",subagents_desc:"Agents that report to this orchestrator.",config_title:"Agent configuration",type_label:"Type",area_label:"Area",area_hint:"e.g. operations, marketing",area_ph:"operations",role_label:"Role",parent_label:"Reports to (parent)",none_parent:"— none —",model_label:"Base model",model_hint:"Empty = uses the Router model (default). Set only to force a model for this agent.",model_ph:"(empty = router default)",skills_label:"Skills (comma)",bio_label:"Bio / description",system_label:"System prompt",system_hint:"Defines personality and behavior (body of AGENT.md).",master_label:"Orchestrator (master)",delete_btn:"Delete agent",save_btn:"Save changes",delete_confirm:'Delete agent "{slug}"? Removes .apc/agents/{slug}.md and local runtime data.',update_success:"Agent updated.",delete_success:"Agent deleted.",tools_hint:"Which tools this agent can use. Tap to toggle; or edit the list below.",tools_custom_ph:"list (comma): echo, http_fetch",memory_title:"Agent memory",memory_empty:"(empty memory)",memory_saved:"Memory saved.",records_title:"Records",records_desc:"Agent activity log (messages/actions). Newest first.",sleep_title:"Sleep / Heartbeat",sleep_desc:"Agent execution status, derived from its routines.",sleep_deep:"Deep sleep · no heartbeat",sleep_deep_desc:"This agent has no routine that triggers it. It does not run autonomously; it only responds when invoked (chat / task).",brain_title:"Brain",brain_desc:"Real relationship graph of the agent: memory, threads, tasks, heartbeats and hierarchy. (first version — will be refined)",brain_empty:"No relationships to graph yet (no memory, threads, tasks or routines).",msgs_count:"msgs"},mcps:{title:"MCP servers",subtitle:"3 scopes: runtime > shared > global. Conflicts shown above if any.",empty:"No MCPs configured.",new:"MCP",delete_confirm:"Delete MCP {name} from scope {scope}?",conflicts:"⚠ Conflicts: {names}",conflict_detail:"{name} is defined in {winner} and {loser}. APX uses {winner}; {loser} is ignored.",new_title:"New MCP",new_desc:"POST /projects/:pid/mcps?scope=…",scope_label:"Scope",transport_label:"Transport",name_label:"Name",name_ph:"filesystem",cmd_label:"Command",cmd_ph:"npx",args_label:"Args",args_hint:"space-separated",args_ph:"-y @modelcontextprotocol/server-filesystem /tmp",env_label:"Env (JSON, optional)",url_label:"URL",url_ph:"https://example.com/mcp",enabled_label:"Enabled",add_btn:"Add",name_required:"name required",env_invalid:"env must be valid JSON",removed:"removed",added:"MCP added.",updated:"MCP updated.",edit_title:"Edit MCP",save_btn:"Save",add_arg:"Add arg",edit_btn:"Edit",test_btn:"Test",logs_btn:"Logs",testing:"Testing…",test_ok:"OK · {n} tools available",tools_count:"{n} tools",logs_title:"Logs · {name}",logs_empty:"No logs yet. Start the MCP by calling a tool or running Test.",logs_events:"Recent events",logs_stderr:"stderr (last 4KB)",logs_panel_title:"Live logs",logs_panel_pick:"pick an MCP",logs_panel_hint:"Click an MCP in the list to see what's happening live.",logs_panel_idle:"No activity. Hit Test to spin it up.",scope_runtime:"Runtime",scope_shared:"Shared",scope_global:"Global",source_runtime:"Runtime",source_apc:"APC / Shared",source_claude:"Claude",source_codex:"Codex",source_cursor:"Cursor",source_vscode:"VS Code",source_roo:"Roo",source_gemini:"Gemini",scope_runtime_desc:"This project only · with secrets · not committed (~/.apx/projects/<id>/mcps.json)",scope_shared_desc:"This project only · committeable · no secrets (.apc/mcps.json)",scope_global_desc:"All projects on this machine (~/.apx/mcps.json)",transport_stdio:"stdio",transport_http:"HTTP",transport_stdio_desc:"Local process — `command` + args",transport_http_desc:"Remote endpoint — URL + headers",args_hint_tokens:"One entry per arg. Use the + button to insert a variable.",env_hint_tokens:"Key/value pairs. Values accept ${var.NAME} (+ button on the right).",env_empty:"No env vars.",headers_label:"Headers",headers_hint:"Key/value pairs — typically Authorization: Bearer ${var.TOKEN}.",headers_empty:"No headers."},vars:{title:"Variables",subtitle_project:"Replace ${var.NAME} when loading MCPs and templates. Project vars beat globals. Stored outside the repo (~/.apx/, chmod 0600).",subtitle_base:"Global variables — available to every project. Stored in ~/.apx/vars.json (chmod 0600).",empty:"No variables yet.",new:"Variable",new_title:"New variable",edit_title:"Edit variable",new_desc:"Referenced as ${var.NAME} in any field that supports interpolation.",reveal_all:"Show values",reveal:"Show",hide:"Hide",filter_label:"Show:",filter_all:"All",filter_project:"Project only",filter_global:"Globals only",scope_label:"Scope",scope_project:"project",scope_project_desc:"This project only. Beats the global with the same name.",scope_global:"global",scope_global_desc:"Available to every project.",name_label:"Name",name_hint:"Uppercase, digits and _. E.g. MY_API_KEY, GITHUB_TOKEN.",value_label:"Value",value_hint:"Stored on disk with 0600 perms. Never committed.",value_edit_ph:"(leave empty to keep current… not yet supported, paste the value again)",add_btn:"Add",save_btn:"Save",edit_btn:"Edit",delete_btn:"Delete",delete_confirm:"Delete {name} ({scope})?",removed:"Variable removed.",added:"Variable added.",updated:"Variable updated.",name_required:"Name required.",value_required:"Value required."},threads:{title:"Chats",subtitle:"Conversations per agent (empty = no logs persisted yet).",no_agents:"No agents. Conversations require a configured agent.",pick:"Pick an agent to view its conversations.",empty:"No conversations for {slug}.",conversation_title:"Conversation {id}",messages:"messages",via:"via"},config:{title:"Quick config",subtitle:"Project override. Written to {path}.",model:"super_agent.model",model_hint:"e.g. anthropic:claude-sonnet-4.5, ollama:gemma2:9b",perm:"super_agent.permission_mode",route:"route_to_agent",route_hint:"Slug of the agent that handles this project by default.",use_global:"(uses global)",saved:"Saved.",nothing:"Nothing to save.",raw_title:"Config (raw JSON)",raw_subtitle:"Paste the entire object — equivalent to PUT the file.",raw_save:"Replace config",raw_done:"Config overwritten.",effective:"Effective config (read-only)",effective_sub:"What the daemon actually sees (global ⊕ override).",section_title:"Project config",section_desc:"APC metadata and overrides separated. General APX lives in Settings > Config.",effective_read:"Read: global APX + project override.",save_project:".apc/project.json saved.",save_override:".apc/config.json saved.",save_fields_success:"Overrides saved.",save_meta_success:"Project metadata saved.",no_data:"No data.",tab_settings:"Settings",tab_project:"Project"},telegram:{title:"Telegram channel (override)",subtitle:"If you set a channel here, messages from this project go there instead of the default.",use_default:"Use default channel",bot_token:"Bot token (override)",chat_id:"Chat ID (override)",saved:"Override saved.",cleared:"Override removed — falls back to default.",override_active:"override active",channel_badge:"Channel {name}",no_override:"No override. Messages from this project go to the default channel.",respond_engine:"Respond with engine",route_agent:"route_to_agent",route_hint:"Slug of the agent that handles messages (empty = super-agent).",bot_hint_none:"If empty, inherits from default."},memories:{super_agent_group:"Super-agent",notebook_item:"{persona}'s notebook",tokens:"~{n} tok",sidebar_title:"Memories",general_group:"General",general_item:"Project memory",project_title:"Project memory",project_desc:"Durable facts at the project level. .apc/memory.md — read by agents and the super-agent.",project_ph:`# Project Memory
799
+
800
+ Stable facts that any agent should know…`,agents_title:"Agent memories",agents_desc:"Individual memory per agent. ~/.apx/projects/<id>/agents/<slug>/memory.md",no_agents:"No agents in this project.",saved:"Memory saved.",empty:"(empty memory)",chars:"chars · Markdown",save_btn:"Save"}},base:{title:"Base",subtitle:"General workspace · super-agent",nav_general:"General",nav_activity:"Activity",nav_system:"System",workspaces_title:"Workspaces",workspaces_desc:"All projects registered in APX.",workspaces_new:"New project",workspaces_empty:"No projects. Add one with the button above.",sessions_title:"Sessions",sessions_desc:"Sessions from all engines (apx · claude · codex), newest first.",sessions_desc_scoped:"Sessions in this project's folder ({path}), all engines, newest first.",sessions_all:"All engines",sessions_empty:"No sessions.",sessions_error:"Could not read sessions: {msg}",sessions_search_ph:"Search sessions…",sessions_deep:"Deep",sessions_deep_tip:"Also search inside transcripts (slower)",sessions_clear:"Clear filters",sessions_refresh:"Refresh list",sessions_no_match:"No sessions match “{q}”.",sessions_act_cmd:"Copy apx command",sessions_act_ask:"Ask {name} to continue",sessions_act_folder:"Open folder",sessions_act_path:"Copy path",sessions_cmd_copied:"Command copied — paste it in your terminal",sessions_path_copied:"Path copied",sessions_copy_failed:"Could not copy",sessions_no_folder:"This session has no folder",sessions_no_path:"This session has no path",sessions_folder_failed:"Could not open folder: {msg}",defaults_title:"Agent defaults",defaults_desc:"Global vault templates. Bundled ones come with APX and are always present; ones you create or edit go in ~/.apx/agents and override. Import them into a project from Agents › Import.",defaults_show_removed:"Show removed",defaults_new:"New",defaults_empty:"No templates in the vault.",defaults_hide:"Hide",defaults_restore:"Restore",defaults_edit:"Edit",defaults_remove:"Hide",defaults_delete:"Delete",defaults_tombstone_msg:`Hide the default "{slug}"? It's bundled — tombstoned and recoverable with Restore.`,defaults_delete_msg:'Delete the template "{slug}"?',defaults_hidden:"Hidden.",defaults_deleted:"Deleted.",defaults_restored:"Restored.",defaults_new_title:"New template",defaults_new_desc:"POST /agents/vault — saved to ~/.apx/agents/<slug>.md",defaults_edit_title:'Edit "{slug}"',defaults_bundled_desc:"This is a bundled default. Saving does a copy-on-write to ~/.apx/agents/<slug>.md (becomes an override).",defaults_user_desc:"PATCH /agents/vault/:slug — edits the file in ~/.apx/agents.",defaults_master_label:"Master agent",defaults_slug_invalid:"invalid slug (must match /^[a-z][a-z0-9_-]*$/)",defaults_created:'Template "{slug}" created.',defaults_saved:'Template "{slug}" saved.'},logs:{title:"Logs",desc_global:"Daemon activity (global channels: telegram, direct…). ~/.apx/messages/<channel>/.",desc_project:"Project activity. ~/.apx/projects/<id>/messages/.",filter_channel:"filter channel (e.g. telegram)",filter_dir:"direction",all_directions:"All directions",in:"Incoming (in)",out:"Outgoing (out)",filter_type:"type",all_types:"All types",search_text:"search text…",count_of:"of",no_activity:"No activity.",no_activity_ch:'No activity in channel "{ch}".',error:"Could not read messages: {msg}",show_more:"show more",event_routine_created:"routine created",event_routine_updated:"routine updated",show_less:"show less",daemon_errors:"Daemon errors (~/.apx/logs/errors.jsonl)",no_errors:"No errors recorded. 🎉"},telegram_contacts:{title:"Telegram contacts",desc:"Who writes to the bots. The role defines which tools they can use; a guest has no permissions until you assign a role.",empty:"No contacts yet — they register automatically when someone writes to a bot.",owner_badge:"owner",assign_role:"Assign role",owner_hint:"Channel owner — change it from the channel",removed:"Contact deleted.",delete_confirm:"Delete contact {name}?",last_seen:"seen:",tools_all:"tools: all",tools_none:"tools: none",tools_label:"tools:"},telegram_channels:{title:"Channels",desc:"Each channel is a bot the daemon polls. Here you can add/remove channels, change the answering agent, the project it belongs to and its owner.",new_btn:"New channel",empty:"No channels yet — add the first one.",removed:"Channel deleted.",delete_confirm:"Delete channel {name}?",no_owner:"no owner (claimed on first DM)",owner_label:"owner:"},telegram_channel_dialog:{new_title:"New Telegram channel",edit_title:"Edit channel: {name}",name_label:"name (internal slug)",token_label:"bot_token",chat_id:"chat_id",project_label:"project",project_hint:"Slug or id of the project to pin this channel to (optional).",route_label:"route_to_agent",route_hint:"Answering agent; empty = APX super-agent.",owner_label:"owner_user_id",owner_hint:"Telegram user_id of the channel owner. Overrides global role to 'owner' here. Leave empty — first private message claims it.",owner_ph:"889721252",respond_label:"Respond with engine (not echo)",name_required:"name required",saved:"Channel saved."},telegram_send_dialog:{title:"Send to {name}",default_msg:"Test message from APX panel ✅"},telegram_roles:{title:"Roles",desc:"Each role defines which super-agent tools the assigned user can invoke. 'owner' always = all; 'guest' always = none (chat only).",empty:"No roles defined.",tools_all:"all tools",tools_none:"no tools",builtin:"built-in",delete_confirm:'Delete role "{name}"?',removed:"Role deleted.",saved:'Role "{name}" saved.',name_required:"Name required.",builtin_error:'"{name}" is a built-in role.',new_title:"New role or replace a custom one",name_label:"Name",name_ph:"editor",tools_label:"Tools (comma-separated)",tools_hint:"Empty = none. Examples: call_agent, list_tasks, create_task.",tools_ph:"call_agent, list_tasks",full_access:"Full access (all tools)",save_btn:"Save role",delete_btn:"Delete"},superagent:{title:"{persona}",badge:"super-agent · APX",desc:"Quick chat with your super-agent. Has access to tools (projects, tasks, mcps, agents); for a longer persistent thread, open Chats.",empty:"Send {persona} a message to get started.",thinking:"{persona} is thinking…",talk:"Talk to {persona}",new_chat:"New chat",placeholder:"Type and press enter to send (shift+enter = new line)…"},not_found:{title:"404",message:"Roby got lost: this page doesn't exist or has moved.",home:"Back to home"},ask_panel:{answers_header:"Answers",other:"Other",other_placeholder:"Write your own answer here",text_placeholder:"Type your answer…",back:"Back",skip:"Skip",next:"Next",submit:"Send",status_waiting:"Waiting for your answer…",status_received:"Answers received"},code_module:{title:"Code",badge:"super-agent",desc:"OpenCode-style coding sessions. Pick a project, open a session, and ask it to read, plan, edit or run.",no_projects:"No registered projects. Register one with `apx project add` to use Code.",sessions:"Sessions",new_session:"New session",untitled:"New session",no_sessions:"No sessions yet — create one to start coding.",pick_project:"Pick a project to see its sessions.",rename:"Rename",delete:"Delete",delete_confirm:"Delete this session? The transcript is removed; your files are untouched.",empty_chat:"Send a coding instruction to get started.",placeholder:"Ask for a change… (enter sends, shift+enter = new line)",mode_build:"Build",mode_plan:"Plan",mode_build_hint:"Build — edits files and runs commands",mode_plan_hint:"Plan — read-only, proposes changes without touching files",tab_context:"Context",tab_changes:"Changes",tab_artifacts:"Artifacts",artifacts_none:"No artifacts yet. Ask the agent to create a script under `artifacts/<name>`.",artifacts_count:"{n} artifact(s)",artifacts_copy_path:"Copy path",artifacts_run:"Run",artifacts_run_hint:"Run it from your terminal:",artifacts_delete:"Delete",artifacts_delete_confirm:"Delete this artifact? The file will be removed from disk.",ctx_model:"Model",ctx_tokens:"Tokens",ctx_input:"Input",ctx_output:"Output",ctx_messages:"Messages",ctx_breakdown:"Context breakdown",ctx_none:"No usage yet — send a turn to see tokens.",seg_system:"System",seg_user:"User",seg_assistant:"Assistant",seg_tool:"Tools",seg_other:"Other",changes_none:"No changes in this session yet.",changes_no_git:"Changes need a git repository. This project isn't one.",changes_files:"{n} file(s) changed",stopped:"[stopped]",close:"Close",reload:"Reload",discard_changes:"Discard changes",save_shortcut_hint:"Save (Cmd/Ctrl+S)",artifacts_rename:"Rename",artifacts_view:"View contents",artifacts_edit:"Edit contents",artifacts_preview:"Preview",artifacts_preview_hint:"Open a live preview in a local browser tab",artifacts_share:"Share",artifacts_share_hint:"Create a public tunnel URL to share this preview",artifacts_stop_preview:"Stop preview",artifacts_preview_local:"Local preview",artifacts_preview_public:"Public URL",artifacts_copy_url:"Copy URL",artifacts_preview_started:"Preview running at {url}",tree_collapse_all:"Collapse all",terminal_clear:"Clear",terminal_close:"Close terminal"},desktop_screen:{status_title:"Status",autostart_title:"Auto-start",shortcut_title:"Keyboard shortcut",appearance_title:"Appearance",activation_title:"Activation + transcription",last_conv_title:"Last conversation",open_config:"Configuration"},voice_screen:{providers_title:"Voice providers (TTS)",test_title:"Test voice",stt_title:"Transcription (STT)",configure_provider:"Configure {name}"},deck_screen:{widgets_title:"Widgets",context_title:"APX context",reload_manifest:"Reload manifest",widget_native:"Native APX widget",widget_external:"External widget",preview_badge:"Preview",preview_title:"Deck — Coming soon",preview_body:"The Deck module is still in development and not released yet. We'll re-enable it once Deck ships in a stable release. For now everything here is read-only and no changes will be saved."},memory_panel:{embeddings_title:"Embeddings (RAG)",embeddings_desc:"Model that vectorizes the history of all channels for relevant memory. Just like TTS/STT: pick a provider and model. 'Automatic' tries local first and falls back to offline if nothing is available.",provider_label:"Provider",provider_hint:"Ollama is local and free. Gemini/OpenAI use the API key from their section in Models (or the one below).",mode_label:"Selection mode",mode_hint:"Chain falls back to the next if one fails; Single uses exactly the chosen provider.",available:"available",unavailable:"unavail.",test_btn:"Test embedding",reindex_btn:"Reindex memory",test_ok:"Embedding OK with {embedder}",test_failed:"Test failed: {msg}",reindexed:"Reindexed: {indexed} chunks (cleared {cleared}).",reindex_failed:"Reindex failed: {msg}",save_failed:"Could not save: {msg}",provider_auto:"Automatic (chain: Ollama → Gemini → OpenAI → offline)",provider_ollama:"Ollama — local, no API key (nomic-embed-text)",provider_gemini:"Gemini — free tier with key (text-embedding-004)",provider_openai:"OpenAI — text-embedding-3-small (cloud)",provider_tf:"Offline (term-frequency, no model — degraded)",mode_chain:"Chain (automatic fallback)",mode_single:"Single (uses only the chosen one)",ollama_title:"Ollama (local)",ollama_desc:"No API key. Runs nomic-embed-text on your local or cloud Ollama.",model_label:"Model",base_url_label:"Base URL",ollama_base_url_hint:"Empty uses engines.ollama.base_url (default http://localhost:11434).",openai_title:"OpenAI",openai_desc:"text-embedding-3-small (1536 dims) or another compatible model.",api_key_label:"API key",openai_key_hint:"Empty reuses engines.openai.api_key. Leave it blank to keep the saved one.",gemini_title:"Gemini",gemini_desc:"text-embedding-004 (768 dims). Free tier with a Google API key.",gemini_key_hint:"Empty reuses engines.gemini.api_key.",compaction_title:"History compaction",compaction_desc:"When a chat exceeds the turn threshold, the oldest turns are summarized with a lightweight (local) LLM and saved as [COMPACTED SUMMARY], keeping context bounded. Runs off the hot-path: the current turn uses whatever summary already exists.",threshold_label:"Compaction threshold",threshold_hint:"Compact once the chat exceeds these turns (default 60).",keep_recent_label:"Recent turns to preserve",keep_recent_hint:"Verbatim turns that are NEVER compacted (default 40). Must be lower than the threshold.",compact_model_label:"Compaction model",compact_model_hint:"Lightweight LLM for summarizing. Ideally a local one (Ollama) to avoid cost. Format provider:model.",compact_fallback_label:"Fallback model",compact_fallback_hint:"Used if the compaction one fails. Empty falls back to the super-agent model.",compact_fallback_ph:"(empty → super-agent model)"},router_panel:{title:"Model router",description:"A single general router (no per-task cases). Pick a provider and model; if the active one fails, it tries the fallback chain in order.",badge_default:"default",no_providers:"Add a provider below to be able to pick models.",active_model_label:"Active model (default)",active_model_hint:"Provider + model. Saved as provider:model.",fallback_title:"Fallback chain",fallback_desc:"If the active model fails, it tries these in order. Click one to edit it.",fallback_empty:"No fallback configured.",add_to_chain:"Add to the chain",done:"done",save:"Save router",saved:"Saved",saved_toast:"Router saved.",provider_ph:"— provider —",provider_not_found:"⚠ {name} (not found)",provider_not_configured:'The provider "{name}" is not configured.'},routing_panel:{title:"Content routing",description:"Prefer a different model per message based on its content (image, size, channel, keywords). Separate from the fallback chain above.",signal_on:"Content routing: ON ({n} rules)",signal_on_empty:"Content routing: ON (no rules yet)",signal_off:"Content routing: OFF",how_it_works:"How does it work?",enable_label:"Enable content routing",rules_title:"Routing rules",rules_desc:"Evaluated top to bottom; the first rule whose conditions all match wins.",rules_empty:"No rules yet. Add some in the editor.",edit_rules:"Edit rules (JSON)",hide_editor:"Hide editor",editor_label:"Rules (JSON array)",json_hint:"Array of { model, when }. when keys: has_image, min_prompt_chars, max_prompt_chars, min_context_chars, channels[], keywords[]. Empty when = matches every message.",json_error:"Invalid JSON: {msg}",json_not_array:"The rules must be a JSON array.",insert_example:"Insert an example",when_any:"any message",when_image:"has image",when_no_image:"no image",when_min_prompt:"prompt ≥ {n} chars",when_max_prompt:"prompt ≤ {n} chars",when_min_context:"context ≥ {n} chars",when_channels:"channels: {list}",when_keywords:"keywords: {list}",helper:"Routing picks a model per message (image, size, channel, keywords). It composes with failover: a routed model that is down falls back down the chain. An explicit per-request model override always wins.",save:"Save routing",saved:"Saved",saved_toast:"Content routing saved.",confirm_title:"Apply routing changes?",confirm_body:"This changes which model handles each message. Failover still applies if a routed model is down.",confirm_on:"Content routing will be ON with {n} rules.",confirm_off:"Content routing will be OFF (every message uses the default router).",confirm_apply:"Apply",cancel:"Cancel"},engines_panel:{title:"Providers",new_btn:"New provider",description:"LLM providers (API). Each provider uses an engine/adapter (openai, ollama, …) with its key and URL.",empty:"No providers. Add one with the button above.",add_card:"Add provider",saved:"Provider saved.",saved_json:"Provider saved (JSON).",deleted:"Provider deleted.",delete_confirm:"Delete provider {name}?"},providers_modal:{new_title:"New provider",edit_title:"Edit {name}",description:"LLM provider. The engine defines which adapter it uses (openai, ollama, …).",list_models_hint:"List the provider's actual models",toggle_active:"Active · click to deactivate",toggle_inactive:"Inactive · click to activate",delete:"Delete",custom:"Custom",json_mode:"JSON",form_mode:"Back to form",json_label:"Provider config (JSON)",json_hint:"Saved as engines.{slug} in config.json",json_help:"Must be a valid JSON object with at least engine. The slug is taken from the form.",name_label:"Name",name_ph:"My provider",engine_label:"Engine",base_url_label:"Base URL (base_url)",base_url_hint:"Auto-filled when you pick a provider.",base_url_ph:"https://api.openai.com/v1",api_key_label:"API key",api_key_hint_existing:"Leave blank to keep the current one.",api_key_hint_env:"Stored as a secret. Suggested env: {env}",api_key_hint:"Stored as a secret.",api_key_set:"…{suffix} (already set)",model_label:"Default model",load_models:"Load models",max_tokens_label:"Max tokens (max_tokens)",temperature_label:"Temperature: {value}",pricing_summary:"Token analysis / pricing (optional)",context_limit_label:"Context limit (tokens)",price_input:"$ input / 1M",price_output:"$ output / 1M",price_cache_read:"$ cache read / 1M",price_cache_write:"$ cache write / 1M",model_limits_label:"Per-model context limits (JSON)",active_label:"Active (agents can use it)",err_slug_required:"Slug required.",err_slug_required_form:"Slug required (in the form).",err_slug_exists:'A provider "{slug}" already exists.',err_model_limits_json:"Per-model context limits: invalid JSON.",err_json_invalid:"Invalid JSON: check the syntax.",err_json_object:"The JSON must be an object with the provider config.",err_engine_missing:'Missing "engine" (e.g. "anthropic", "ollama").',err_save:"Error saving.",err_no_models:"No models. Correct key/URL?",err_list_models:"Could not list models."},providers_card:{active:"Active",off:"Off",model:"Model",base_url:"Base URL",api_key:"API key",key_set:"✓ set",temp:"Temp",price_io:"$ in/out (1M)"},chat_ui:{copy:"Copy",stop:"Stop",send:"Send",pick_model:"Pick model (or Auto)",insert_variable:"Insert variable",ctx_files:"files",ctx_actors:"{n} agents/models",ctx_turns:"{n} turns"},sidebar_ui:{toggle:"Toggle sidebar"},models_ui:{invalid_hint:"Model/provider unavailable"},global_config:{title:"APX config"},agent_detail_extra:{skills_title:"Skills & tools"},voice_ui:{api_key_label:"API key",api_key_set:"…{suffix} (already set)",api_key_keep_hint:"Leave blank to keep the current one.",api_key_secret_hint:"Stored as a secret. Env: {env}",api_key_reuse_hint:"Reuses {engine} if left blank. Env: {env}",err_save:"Error while saving.",model_label:"Model",voice_label:"Voice",format_label:"Format",output_format_label:"Output format",voice_id_label:"Voice ID",voice_id_hint:"ElevenLabs voice id (empty = default).",gemini_model_hint:"Gemini TTS is still in preview.",base_url_label:"Base URL (optional)",base_url_hint:"OpenAI-compatible endpoint. Empty = OpenAI. Point it at a local server (e.g. a QVox / Qwen3-TTS daemon) to use that instead.",openai_model_hint:"tts-1 / tts-1-hd for OpenAI. Leave blank to let a custom server pick.",openai_voice_hint:"OpenAI preset (alloy…) or a custom server's preset (e.g. custom). Empty = server default.",openai_style_hint:"Base voice / instruct, used by custom endpoints (the persona kept across the audio). Ignored by stock OpenAI tts-1.",style_label:"Style (how it should speak)",style_hint:"Natural-language instruction. Empty = no style. E.g.: 'speak in a cheerful, unhurried tone'.",style_ph:"speak in a cheerful, energetic tone",temperature_label:"Temperature (optional)",temperature_hint:"Sampling temperature for custom endpoints. Empty = server default.",emotions_short:"Emotions",emotions_label:"Inline emotion tags",emotions_hint:"When this engine speaks, let the agent drop [happy]/[whisper]-style tags into voice replies to color the delivery. Only enable it if this engine understands the tags (e.g. a QVox/Qwen3-TTS endpoint) — otherwise they're stripped before synthesis.",emotions_tags_label:"Allowed tags",emotions_tags_hint:"Comma-separated. Empty = the default set.",piper_bin_label:"Binary (bin)",piper_bin_hint:"Path or name of the piper CLI (PATH).",piper_model_label:"Model (.onnx)",piper_model_hint:"Absolute path to the piper voice model.",piper_speaker_label:"Speaker (optional)",piper_speaker_hint:"Speaker id for multi-voice models.",mock_desc:"The mock engine generates a silent test WAV. It has no parameters: it serves as a guaranteed fallback when no other engine is configured.",selection_mode:"Selection mode",mode_chain_desc:"Chain with fallback: uses the first available engine following the order below.",mode_single_desc:"Default engine only: always uses the chosen one; the rest stay configured for other purposes.",mode_chain_btn:"Chain (router)",mode_single_btn:"Default engine only",move_up:"Move up",move_down:"Move down",badge_local:"local",badge_available:"available",badge_unavailable:"configured, unavailable",badge_not_configured:"not configured",badge_default:"default",badge_custom:"custom",set_as_default:"Set as default",configure:"Configure",remove:"Remove",remove_confirm:"Remove this custom provider?",add_provider:"Add provider",new_provider:"New provider",custom_note:"Custom OpenAI-compatible endpoint.",custom_desc:"Any OpenAI-compatible speech endpoint (e.g. a local QVox / Qwen3-TTS server).",label_label:"Name",label_hint:"Display name for this provider.",base_url_req_label:"Base URL",base_url_req_hint:"Required. The OpenAI-compatible endpoint, e.g. http://127.0.0.1:5111/v1",api_key_optional_hint:"Optional — only if your server requires a key.",advanced:"Advanced",custom_model_hint:"Optional. Most local servers ignore it (e.g. QVox).",custom_voice_hint:"Optional. A preset your server understands (e.g. custom). Empty = server default.",custom_optional_ph:"(optional)",stt_engine_label:"Transcription engine",stt_engine_hint:"Local uses faster-whisper (requires python3 + faster-whisper). OpenAI uses the engines.openai key.",stt_model_label:"Local model (whisper)",stt_model_hint:"Bigger = more accurate and slower.",stt_language_label:"Language",stt_language_hint:'For Spanish, setting "Spanish" improves accuracy.',stt_provider_auto:"Automatic (local, then remote)",stt_provider_local:"Local — faster-whisper (offline)",stt_provider_openai:"OpenAI — Whisper-1 (cloud)",stt_provider_custom:"Custom — OpenAI-compatible server",stt_openai_model_label:"OpenAI model",stt_openai_model_hint:"Defaults to whisper-1.",stt_custom_baseurl_label:"Base URL (OpenAI-compatible)",stt_custom_baseurl_hint:"e.g. http://localhost:8000/v1 (mlx-audio on Metal) or http://192.168.1.50:9000/v1 (Radeon/NVIDIA on the LAN).",stt_custom_model_label:"Model",stt_custom_model_hint:"e.g. mlx-community/whisper-large-v3-turbo or large-v3.",stt_custom_key_hint:"Optional — most local servers need no key.",stt_hw_label:"Detected hardware",stt_hw_recommended:"Recommended",stt_hw_limited:"limited GPU acceleration, using CPU",stt_backend_label:"Acceleration / Engine",stt_backend_hint:"Auto adapts to your hardware. Metal runs on the GPU (mlx); CPU uses faster-whisper.",stt_backend_auto:"Automatic (recommended)",stt_model_needs_download:"Not downloaded (~{size}). The model must be downloaded to use this engine.",lang_auto:"Auto-detect",lang_es:"Spanish",lang_en:"English",lang_pt:"Portuguese",lang_fr:"French",lang_it:"Italian",lang_de:"German",test_default_text:"Hi, I'm APX. This is a voice test.",test_default_engine:"Default ({name})",test_default_chain:"Default (chain)",test_unavailable_suffix:" · unavailable",test_empty_error:"Type something to say.",test_synth_error:"Could not synthesize.",test_engine_label:"Engine",test_engine_hint:"Override the default for testing.",test_style_label:"Style (Gemini only)",test_style_hint:"How it should speak. Empty = no style.",test_text_label:"Text to say",test_text_ph:"Type what you want it to say…",say_this:"Say this",stop:"Stop",replay:"Replay",engine_result:"Engine",providers_desc:"Synthesis engines, in fallback order. Status is reported live by the daemon. Add your own OpenAI-compatible endpoints.",providers_load_error:"Could not load providers: {msg}",test_desc:"Pick which engine to synthesize with and, if applicable, how it should speak.",stt_desc:"Speech-to-text engine used by the deck, Telegram, and the CLI when listening.",toast_default_engine:"Default engine: {id}.",toast_mode_chain:"Mode: chain with fallback.",toast_mode_single:"Mode: default engine only.",toast_config_saved:"Voice configuration saved.",toast_provider_removed:"Provider removed.",err_label_required:"A name is required.",err_base_url_required:"A base URL is required.",toast_transcription_updated:"Transcription updated."},telegram_ui:{channel_dialog_desc:"POST /telegram/channels (upsert) — PATCH /telegram/channels/:name (partial).",bot_token_hint:"BotFather token. Stored in ~/.apx/config.json.",bot_token_hint_short:"BotFather token.",secret_set_replace:"(set — type to replace)",secret_already_set:"(already set)",empty_keep:"— empty = keep",message_sent:"Message sent.",message_label:"Text",send_chat_id:"chat_id: {id}",default_apx:"default APX",yes:"yes",no:"no",user_id_fallback:"user_id {id}",role_assigned:"{name} → {role}"},agents_form:{emoji:"Emoji",area:"Area",role:"Role",no_role:"— no role —",autonomy:"Autonomy",autonomy_hint:"How much the agent can do without asking for confirmation.",auto_total:"Total",auto_automatico:"Auto",auto_permiso:"Permission"},structure:{title:"Structure",subtitle:"Company areas and roles. Areas group agents; roles define their function.",info:"Areas are optional groupings. Roles define an agent's function and may belong to an area.",empty:"No areas or roles yet. Create the first one above.",new_area:"New area",new_role:"New role",edit_area:"Edit area",edit_role:"Edit role",create_area:"Create area",create_role:"Create role",name:"Name",slug:"Slug",goal:"Goal",goal_hint:"What this area exists for (optional).",area:"Area",description:"Description",no_area:"— no area —",roles:"Roles",add_role:"role",no_roles:"no roles",general_roles:"General roles",delete_area:"Delete area",delete_role:"Delete role",delete_area_desc:'Delete area "{name}"? Its roles are detached, not deleted.',delete_role_desc:'Delete role "{name}"?'},files:{docs_label:"Docs",files_label:"Files",new_doc:"New document",new_doc_hint:"Folders allowed: cases/onboarding/spec.md",empty:"No files.",docs_empty:"No documentation yet. Create the first document.",truncated:"Listing truncated (too many files).",select_prompt:"Pick a file to view it.",save:"Save",saved:"Saved.",deleted:"Deleted.",created:"Document created.",edit:"Edit",preview:"Preview",discard:"Discard",no_preview:"No preview for this file.",too_large:"File too large to display.",path_label:"File path",path_example:"e.g. cases/onboarding/spec.md",create:"Create"},tasks:{state_open:"open",state_done:"done",state_dropped:"dropped",status_pending:"pending",status_running:"running",status_in_review:"in review",status_blocked:"blocked",done_label:"done",dropped_label:"dropped",detail_title:"Task detail",field_title:"Title",field_prompt:"Prompt",field_status:"Status",field_agent:"Agent",field_creator:"Created by",field_source:"Source",field_created:"Created",field_updated:"Updated",field_done:"Completed",prompt_ph:"Task description / prompt…",toggle_prompt:"Prompt",view_thread:"View thread",mark_done:"Complete"},agents_ui:{model_router_default:"model: router default",slug_kebab_hint:"kebab-case, e.g. reviewer, my-agent, content-writer",comma_separated:"comma-separated",body_hint:"markdown — extends the agent's system prompt",source_user:"user",source_override:"override",source_bundled:"bundled",tab_explorer:"Explorer",type_none:"— no type —",type_orchestrator:"Orchestrator",type_orchestrator_desc:"Coordinates the team and delegates.",type_specialist:"Specialist",type_specialist_desc:"Domain expert; runs tasks.",type_assistant:"Assistant",type_assistant_desc:"Conversational helper.",type_worker:"Worker",type_worker_desc:"Runs autonomous tasks.",type_monitor:"Monitor",type_monitor_desc:"Watches state and reports.",stat_threads:"Threads",stat_records:"Records",stat_tasks:"Tasks",stat_heartbeats:"Heartbeats",uncategorized:"Uncategorized",brain_zoom_in:"Zoom in",brain_zoom_out:"Zoom out",brain_fit:"Fit to view",brain_fullscreen:"Fullscreen",brain_exit_fs:"Exit fullscreen",brain_pan_hint:"scroll to zoom · drag background to pan",brain_expand:"Expand brains",brain_collapse:"Collapse",brain_open:"Open",brain_part_of:"Part of",brain_branches:"Branches",config_def_desc:"definition (frontmatter + system prompt).",memory_durable_desc:"durable facts the agent remembers.",running:"running",paused:"paused",last_error:"last: error",field_tick:"Tick",field_next_tick:"Next tick",field_last_tick:"Last tick",field_last_run:"Last run",tools_label:"Tools",kind_agent:"agent",kind_memory:"memory",kind_thread:"thread",kind_task:"task",kind_routine:"routine",kind_hierarchy:"hierarchy",nodes_drag_hint:"{n} nodes · drag to rearrange",kind_watch:"Watcher",kind_watch_desc:"Sweeps for things worth noticing — overdue work, promises coming due, projects gone quiet. Costs nothing when there is nothing to report.",action_watch:"Watches for signals, and judges only when it finds some",kind_exec_agent:"Project agent",kind_exec_agent_desc:"Runs a project agent with a prompt. You pick which one.",kind_super_agent:"Super-agent",kind_super_agent_desc:"Calls the APX super-agent with a prompt.",kind_telegram:"Telegram",kind_telegram_desc:"Sends a fixed message to a Telegram channel. No model or agent.",kind_shell:"Shell",kind_shell_desc:"Runs a shell command. No prompt or pre/post — the command is the action.",kind_heartbeat:"Heartbeat",kind_heartbeat_desc:"Does nothing except write a line to the logs each time it runs. Useful to confirm the scheduler is alive. If you don't know whether you need it, don't use it.",unit_seconds:"seconds",unit_minutes:"minutes",unit_hours:"hours",unit_days:"days",every_n_unit:"every {n} {unit}",every_v:"every {v}",preset_every_10m:"every 10 min",preset_hourly:"hourly",preset_daily_9am:"daily 9am",sched_manual:"only when you run it",preset_weekdays_9am:"weekdays 9am",preset_manual:"Manual",var_pre_output_prompt:"Text output of the pre-commands. Replaced inside the prompt/text before it is sent. Use it to inject fresh data (weather, an API) into the instruction.",var_llm_output:"Final answer from the agent or super-agent. Available in the post-commands as an env var — e.g. forward it via Telegram.",var_status:"Action result: ok or error. Available in the post-commands to branch on what happened.",var_skipped:"1 if the action was skipped (via skip_prompt_on), 0 if it ran. Available in the post-commands.",var_pre_output:"Full pre-commands output, as an env var in the post-commands (up to 32k).",var_pre_output_file:"Path to a temp file with the pre-commands output. For large outputs not suited to an env var.",var_pre_exit:"Exit code of the last pre-command (0 = ok). Available in the post-commands.",var_routine:"Name of this routine. Available as an env var in the commands.",summary_runs_agent:'Runs the agent "{agent}"',summary_runs_agent_none:"Runs an agent (none chosen yet)",summary_super_agent:"Calls the super-agent",summary_telegram:'Sends Telegram to "{channel}"',summary_runs_cmd:"Runs: {cmd}",summary_shell:"Runs a shell command",summary_heartbeat:"Leaves a heartbeat in the logs",action_agent_answers:'Agent "{agent}" answers the prompt',action_agent_pick_answers:"Agent (pick one) answers the prompt",action_super_answers:"The super-agent answers the prompt",action_telegram_channel:'Sends Telegram to channel "{channel}"',action_runs_shell:"Runs the shell command",step_pre:"Pre",step_post:"Post",last_label:"last:",tg_chat_id_ph:"(uses the channel's)",tg_text_ph:"message to send",hb_message_ph:"still alive",arg_placeholder:"--flag or value",remove_arg:"remove arg",super_agent_label:"{persona} (super-agent)",super_agent_badge:"super-agent"},modules_ui:{desktop_pos_left:"Left",desktop_pos_center:"Center",desktop_pos_right:"Right",desktop_theme_system:"System",desktop_theme_light:"Light",desktop_theme_dark:"Dark",desktop_status_desc:"The window launches from the terminal or via autostart.",desktop_running:"Running",desktop_stopped:"Stopped",desktop_refresh:"refresh",desktop_start:"Start",desktop_stop:"Stop",desktop_restart:"Restart",desktop_restart_hint:"Reload the open window so config changes (theme, position) apply now.",desktop_restart_done:"Restarting the window — applying the latest config.",desktop_restart_none:"No desktop window is connected.",desktop_start_done:"Desktop window launched.",desktop_start_already:"Desktop window is already running.",desktop_stop_done:"Desktop window stopped.",desktop_stop_none:"No desktop window was running.",desktop_from_terminal:"From terminal:",desktop_autostart_desc:"Launches the window at user login. Equivalent to `apx desktop install` (no sudo required).",desktop_platform:"platform: {platform}",desktop_shortcut_desc:"Global hotkey that shows/hides the window and starts listening.",desktop_accelerator:"Accelerator",desktop_accelerator_hint:"Click the field and press your key combo. Restart the window to apply.",desktop_shortcut_record:"Click to set a shortcut",desktop_shortcut_recording:"Press your combo…",desktop_shortcut_change:"click to change",desktop_shortcut_esc:"Esc to cancel",desktop_shortcut_saved:"Shortcut saved. Restart the window (apx desktop stop && start) to apply it.",desktop_autostart_on:"Autostart enabled for the next login.",desktop_autostart_off:"Autostart disabled.",desktop_appearance_desc:"Window theme and position on the screen.",desktop_theme:"Theme",desktop_restart_apply:"Restart the window to apply.",desktop_theme_set:"Theme: {value}.",desktop_position:"Position",desktop_position_hint:'"left" / "center" / "right" of the top edge.',desktop_position_set:"Position: {value}.",desktop_activation_desc:"The daemon plugin processes the messages. STT is configured in Voices.",desktop_enabled_toast:"Desktop enabled.",desktop_disabled_toast:"Desktop disabled.",desktop_plugin_on:"Plugin enabled (replies to messages)",desktop_plugin_off:"Plugin disabled",desktop_stt_engine:"Speech-to-text engine:",desktop_stt_engine_suffix:"(local whisper, language, model).",desktop_last_conv_desc:"The latest exchange with the agent from the floating window.",desktop_no_messages:"No messages yet. Send something to the desktop window for it to appear here.",desktop_you:"You",desktop_roby:"Roby",desktop_empty_msg:"(empty)",deck_widget_enabled:"Widget {id} enabled.",deck_widget_disabled:"Widget {id} disabled.",deck_save_error:"Error while saving",deck_loading_manifest:"Loading manifest…",deck_manifest_error:"Error loading the manifest.",deck_widgets_summary:"{count} widgets · {enabled} external enabled",deck_loading_manifest_full:"Loading the Deck manifest…",deck_manifest_load_failed:"Could not load the Deck manifest.",deck_retry:"Retry",deck_no_widgets:"No widgets in the manifest.",deck_context_desc:"Information the Deck sees from the daemon.",deck_active_project:"Active project:",deck_none:"none",deck_registered_projects:"Registered projects:",deck_active_plugins:"Active plugins:",deck_daemon_active:"active · {uptime}",deck_daemon_started:"started",deck_safety_no_shell:"no direct shell",deck_safety_no_arbitrary:"arbitrary commands blocked",deck_safety_confirm:"dangerous actions require confirmation",code_copied:"Copied.",code_saved:"Saved.",code_file_empty:"(empty)",code_file_error:"Error: {msg}",code_stream_error:"error",code_super_agent:"super-agent",code_super_agent_desc:"Main agent with all tools",code_chat_tab:"Chat",code_panel_sessions:"Session list",code_panel_tree:"File tree",code_panel_terminal:"Terminal",code_panel_context:"Context panel",code_ctx_auto:"auto",code_ctx_mode:"Mode",code_ctx_agent:"Agent",code_ctx_msgs_value:"{user} user · {assistant} assistant",code_ctx_tokens_total:"Total Tokens",code_ctx_created:"Created",code_ctx_activity:"Activity",code_project_fallback:"project {id}",code_pick_project_ph:"Pick a project…",code_artifact_exit_ok:"exit 0 — {ms}ms",code_artifact_exit_fail:"exit {code}{timeout}",code_artifact_timeout_suffix:" (timeout)",code_artifact_view_short:"View",code_artifact_edit_short:"Edit",code_artifact_exit_badge:"exit {code}",code_artifact_timeout:"timeout",code_artifact_truncated:"truncated"},settings_ui:{bearer_label:"Bearer",global_config_desc:"General config in ~/.apx/config.json. Editable by tabs; JSON stays separate.",global_json_desc:"Redacted secrets are not overwritten.",save_json:"Save JSON",expand_menu:"Expand menu",collapse_menu:"Collapse menu",documentation:"Documentation",kind_personal:"Personal",kind_company:"Company",kind_app:"App",kind_software:"Software",kind_default:"Default",kind_other:"Other",base_menu_view:"Base menu view (general workspace).",coming_soon:"Coming soon",inspector_title:"Skill Inspector (per-turn RAG)",inspector_desc:"Experimental feature. When active, the agent does NOT receive the full skill list in its prompt; on each message a local RAG decides which skill(s) to load — the full body on a strong match, a suggestion on a medium match, nothing if it doesn't apply. It is re-evaluated every turn: a skill that stopped being relevant disappears from the context.",enable_inspector:"Enable inspector",enable_inspector_hint:"Off = classic behavior (slug list + passive suggestion). On = the RAG decides per turn.",on:"On",off:"Off",index_count:"Index: {n} skills",not_indexed:"not indexed",dim:"dim {dim}",updated_at:"updated {date}",reindex:"Reindex",reindex_forced:"Reindex (forced)",embedder_source:"The embedder comes from Memory (RAG). Local with Ollama, or offline if no provider is set.",thresholds_title:"Thresholds and limits",thresholds_desc:"Tune how aggressive the inspector is. Raising the thresholds = fewer false positives but more risk of missing a skill; lowering them = the opposite.",test_title:"Test (dry-run)",test_desc:"Type a message the way a user would and see which skills the inspector would load/suggest — without calling the model. Forces the inspector on even if it's off above.",test_placeholder:"e.g.: I need to create a promo video with voiceover",test_btn:"Test",jit_empty_index:"JIT (empty index)",loaded_label:"Loaded:",suggested_label:"Suggested:",could_not_save:"Could not save: {msg}",indexed_with:"Indexed with {embedder} (dim {dim}): +{added} ~{refreshed} -{removed}.",index_failed:"Index failed: {msg}",dry_run_failed:"Dry-run failed: {msg}",knob_load_threshold:"Load threshold",knob_load_threshold_hint:"Minimum similarity to inject the skill's BODY (high = stricter).",knob_hint_threshold:"Hint threshold",knob_hint_threshold_hint:"Minimum similarity to only SUGGEST the skill (so the agent loads it if it wants).",knob_margin:"Margin over the 2nd",knob_margin_hint:"The top must beat the second by this margin to load its body (avoids weak ties).",knob_max_loaded:"Max. loaded bodies",knob_max_loaded_hint:"How many skills are injected in full per turn.",knob_max_hints:"Max. hints",knob_max_hints_hint:"How many extra skills are named as a suggestion.",knob_prompt_floor:"Minimum prompt length",knob_prompt_floor_hint:"Messages shorter than this are ignored (avoids 'ok', 'hi').",knob_body_char_cap:"Body char cap",knob_body_char_cap_hint:"Trims long skill bodies so they don't bloat the context.",cfg_overrides_label:"Overrides",cfg_overrides_desc:".apc/config.json. Only project-specific values; empty inherits global/effective.",cfg_route_to_agent:"Route to agent",cfg_super_agent_model:"Super-agent model",cfg_permission_mode:"Permission mode",cfg_extra_prompt:"Extra prompt",cfg_telegram_label:"Telegram",cfg_chat_id:"Chat ID",cfg_bot_token:"Bot token",cfg_respond_with_engine:"Respond with engine",cfg_engines_label:"Engines",cfg_ollama_url:"Ollama URL",cfg_anthropic_key:"Anthropic API key",cfg_openai_key:"OpenAI API key",cfg_groq_key:"Groq API key",cfg_openrouter_key:"OpenRouter API key",cfg_gemini_key:"Gemini API key",cfg_project_label:"Project",cfg_project_desc:".apc/project.json. Portable APC metadata; no secrets, no runtime.",cfg_name:"Name",cfg_version:"Version",cfg_apc_spec:"APC spec",cfg_apx_install:"APX install state",cfg_apx_storage_id:"APX storage id"},skills_page:{title:"Skills",desc:"Turn skills on or off per agent. Pick a scope: the super-agent (global) or a specific project.",list_title:"Installed skills",list_desc:"APX's private skills are always active and can't be changed.",scope_label:"Scope",scope_super_agent:"Super-agent (global)",scope_hint:"The super-agent uses the global scope. Each project can override skills independently.",count_label:"{n} skills · {on} on",empty:"No skills yet. Create one below or install via the CLI.",source_builtin:"APX",source_global:"Global",source_project:"Project",private_badge:"Private",private_hint:"Built-in APX skill — always active, can't be disabled or deleted.",overridden_badge:"Override",inherited_hint:"Inherited from global",reset_to_global:"Reset to global",on:"on",off:"off",toggle_failed:"Could not change state: {msg}",add_title:"Add a skill",add_desc:"Creates a user skill at ~/.apx/skills/<slug>/SKILL.md. Available across all scopes.",add_slug_label:"Slug",add_slug_ph:"my-skill",add_desc_label:"Description",add_desc_ph:"One line describing when to use it",add_body_label:"Body (Markdown)",add_body_ph:`# My skill
801
+
802
+ Instructions for the agent…`,add_btn:"Create skill",created_ok:'Skill "{slug}" created.',create_failed:"Could not create: {msg}",delete_btn:"Delete",delete_confirm:`Delete skill "{slug}"? This can't be undone.`,deleted_ok:'Skill "{slug}" deleted.',delete_failed:"Could not delete: {msg}",inspector_section_title:"Skill Inspector (per-turn RAG)",inspector_section_desc:"Advanced: local RAG that injects only the skills a message needs.",scope_ph:"— choose scope —",select_a_skill:"Pick a skill from the list to see its content.",added_by:"Added by",activator:"Activator",by_apx:"APX (built-in)",by_you:"You",activator_value:"Semantic match (RAG)",tab_preview:"Preview",tab_source:"Source",add_menu:"Add",add_online:"Create with editor",add_online_hint:"Write slug + description + content",add_zip:"Upload .zip",add_zip_hint:"Import a packaged skill",add_repo:"From git repo",add_repo_hint:"Clone from a URL",create_dialog_title:"Create skill",repo_dialog_title:"Import from git repo",repo_url_label:"Repo URL",repo_url_ph:"https://github.com/user/my-skill.git",repo_url_hint:"The repo (or its subfolder) must contain a SKILL.md.",import_btn:"Import",imported_ok:'Skill "{slug}" imported.',import_failed:"Could not import: {msg}",cancel:"Cancel",manager_tab:"Skills",rag_tab:"Config (RAG)"},shared_ui:{skill_inspector_title:"Skill Inspector ({embedder}) chose these skills for this turn",tools_count:"{n} tools",tools_failed:"{n} failed",tool_read_file:"Read file",tool_write_file:"Write file",tool_edit_file:"Edit file",tool_list_files:"List files",tool_search_files:"Search in files",tool_search_messages:"Search messages",tool_tail_messages:"Latest messages",tool_run_shell:"Run shell",tool_send_telegram:"Send Telegram",tool_call_agent:"Call agent",tool_call_mcp:"Call MCP",tool_call_runtime:"Call runtime",tool_create_task:"Create task",dedup:"dedup",args:"args",result:"result",auto:"Auto",auto_router:"Auto (router decides)",model_filter_ph:"filter or type a model…",loading_models:"loading models…",use_value:"use “{value}”",model_combobox_ph:"pick or type a model…",search_variable_ph:"search variable…",no_matches:"no matches",create_variable:"Create new variable…",kv_key_ph:"KEY",kv_value_ph:"value",remove_row:"remove row",add_row:"Add row",err_chat_failed:"Chat failed.",err_stream_failed:"Stream failed.",err_load_conversation:"Could not load conversation.",err_stream:"Stream error."},integrations:{title:"Integrations",description:"Plugins and tools available for this project",tab_plugins:"Plugins",tab_tools:"Tools",scope_label:"Scope:",scope_project:"This project",scope_global:"Global (default)",plugins_hint:"Channel & service plugins installable per project. Saved in the scope selected above.",more_soon:"More plugins coming soon…",tools_hint:"Tools that connected plugins expose to this project's agents.",tools_empty:"No integration tools yet. Connect a plugin to enable them.",tool_active:"active",tool_inactive:"inactive",status_active:"Active",status_error:"Error",status_unconfigured:"Not configured",connected:"Connected",connect:"Connect",deactivate:"Deactivate",saving:"Saving...",validating:"Validating...",verifying:"Verifying token...",confirm:"Confirm",select_placeholder:"Select...",reveal:"Show",hide:"Hide",credentials:"{name} credentials",coming_soon:"Coming soon",coming_soon_body:"This plugin is declared in the catalog but isn't connectable in APX yet. It will be ported natively in a future iteration.",tools_for_agents:"Agent tools",tools_available_note:"Available to agents that allow them, or via discover_tools.",err_connect:"Failed to connect",err_generic:"Something went wrong",action_done:"Done",asana:{select_label:"Select the workspace to use",connected:{user_name:"Connected as",user_email:"Email",workspace_name:"Workspace"},fields:{personal_access_token:{label:"Personal Access Token",help_label:"How to get the token?",help_steps:`Open app.asana.com/0/my-apps in your browser.
803
+ Scroll to the "Personal access tokens" section (not your OAuth apps).
804
+ Click "+ New access token".
805
+ Give it a name and confirm.
806
+ Copy the full token — it starts with "1/..." and has a ":" in the middle.
807
+ Paste it in the field below.`}}},github:{connected:{user_login:"Connected as",user_name:"Name"},fields:{token:{label:"Personal Access Token",help_label:"How to get the token?",help_steps:`Open github.com/settings/tokens.
808
+ Generate a token (classic or fine-grained) with the "repo" scope.
809
+ Copy the token — it starts with ghp_ or github_pat_.
810
+ Paste it in the field below.`}}},obsidian:{connected:{vault_path:"Vault",vault_name:"Name",note_count:"Notes"},fields:{vault_path:{label:"Vault path"},auto_mcp:{label:"Auto-register Obsidian MCP",hint:"Adds an 'obsidian' MCP server pointing at this vault, in this scope."},memory_sync:{label:"Sync APX memory",hint:"Enable mirroring APX memory into the vault, then use the button below."}},actions:{sync_memory:"Sync memory now",sync_memory_done:"Synced {count} file(s) · {changed} changed"}}}},U_={es:nP,en:sP};function aP(){try{const e=localStorage.getItem(Dn.language);if(e&&e in U_)return e}catch{}return"en"}let Np=aP();function kN(e){Np=e;try{localStorage.setItem(Dn.language,e)}catch{}}const wN=[{value:"es",label:"Español"},{value:"en",label:"English"}];function q_(){return Np}function rP(e){const t=U_[Np],a=e.split(".");let r=t;for(const i of a)if(r&&typeof r=="object"&&i in r)r=r[i];else return;return typeof r=="string"?r:void 0}function oP(e,t){return t?e.replace(/\{(\w+)\}/g,(a,r)=>r in t?String(t[r]):`{${r}}`):e}function iP(e){const t=rP(e);if(t!==void 0)return t;if(Np!=="es"){const a=U_.es,r=e.split(".");let i=a;for(const l of r)if(i&&typeof i=="object"&&l in i)i=i[l];else return;return typeof i=="string"?i:void 0}}function u(e,t){const a=iP(e);return a===void 0?e:oP(a,t)}function H_(e){const[t,a]=x.useState(!1);x.useEffect(()=>{try{a(localStorage.getItem(e)==="true")}catch{}},[e]);const r=x.useCallback(()=>a(i=>{const l=!i;try{localStorage.setItem(e,String(l))}catch{}return l}),[e]);return{collapsed:t,toggle:r}}function lP({collapsed:e,onToggle:t}){return n.jsx(Ue,{content:u(e?"settings_ui.expand_menu":"settings_ui.collapse_menu"),side:"bottom",children:n.jsx("button",{type:"button",onClick:t,"aria-label":u(e?"settings_ui.expand_menu":"settings_ui.collapse_menu"),className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:n.jsx(SS,{className:me("size-4 transition-transform",e&&"rotate-180")})})})}function cP({sections:e,active:t,onChange:a,collapsed:r=!1}){return n.jsx("nav",{className:me("hidden md:flex shrink-0 flex-col gap-1 py-3 transition-all",r?"w-12 items-center px-1":"w-44 px-2"),children:e.map((i,l)=>n.jsxs("div",{className:me("w-full",l>0&&"mt-2"),children:[!r&&i.title&&n.jsx("p",{className:"mb-1 px-2 text-[9px] font-semibold uppercase tracking-wider text-muted-fg/70",children:i.title}),n.jsx("div",{className:"space-y-0.5",children:i.items.map(({key:d,label:f,icon:p,badge:g,mark:h})=>{const b=t===d,_=n.jsxs("button",{type:"button",onClick:()=>a(d),"data-testid":`tabnav-${d||"index"}`,className:me("relative flex cursor-pointer items-center rounded-lg transition-colors",r?"size-9 justify-center":"w-full gap-2 px-2.5 py-1.5",b?"bg-accent text-accent-fg":"text-muted-fg hover:bg-accent/60 hover:text-foreground"),children:[n.jsx(p,{className:"size-4 shrink-0"}),r&&h&&n.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 flex items-center justify-center rounded-full bg-card",children:h}),!r&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"flex-1 truncate text-left text-xs",children:f}),h&&n.jsx("span",{className:"flex shrink-0 items-center",children:h}),g!==void 0&&n.jsx("span",{className:"rounded-full bg-muted px-1.5 text-[9px] text-muted-fg",children:g})]})]});return r?n.jsx(Ue,{content:f,side:"right",children:_},d):n.jsx(x.Fragment,{children:_},d)})})]},l))})}var Dk=Object.prototype.hasOwnProperty;function Ux(e,t){var a,r;if(e===t)return!0;if(e&&t&&(a=e.constructor)===t.constructor){if(a===Date)return e.getTime()===t.getTime();if(a===RegExp)return e.toString()===t.toString();if(a===Array){if((r=e.length)===t.length)for(;r--&&Ux(e[r],t[r]););return r===-1}if(!a||typeof e=="object"){r=0;for(a in e)if(Dk.call(e,a)&&++r&&!Dk.call(t,a)||!(a in t)||!Ux(e[a],t[a]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}const SN=0,CN=1,NN=2,Pk=3,EN=4,ha=new WeakMap,Za=()=>{},Zt=Za(),qx=Object,lt=e=>e===Zt,xa=e=>typeof e=="function",ar=(e,t)=>({...e,...t}),Hx=e=>xa(e.then),_h={},Bd={},V_="undefined",uu=typeof window!=V_,Vx=typeof document!=V_,uP=uu&&"Deno"in window,dP=()=>uu&&typeof window.requestAnimationFrame!=V_,RN=(e,t)=>{const a=ha.get(e);return[()=>!lt(t)&&e.get(t)||_h,r=>{if(!lt(t)){const i=e.get(t);t in Bd||(Bd[t]=i),a[5](t,ar(i,r),i||_h)}},a[6],()=>!lt(t)&&t in Bd?Bd[t]:!lt(t)&&e.get(t)||_h]};let Fx=!0;const fP=()=>Fx,[Gx,Yx]=uu&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Za,Za],pP=()=>{const e=Vx&&document.visibilityState;return lt(e)||e!=="hidden"},mP=e=>(Vx&&document.addEventListener("visibilitychange",e),Gx("focus",e),()=>{Vx&&document.removeEventListener("visibilitychange",e),Yx("focus",e)}),gP=e=>{const t=()=>{Fx=!0,e()},a=()=>{Fx=!1};return Gx("online",t),Gx("offline",a),()=>{Yx("online",t),Yx("offline",a)}},hP={isOnline:fP,isVisible:pP},xP={initFocus:mP,initReconnect:gP},Lk=!Zc.useId,Mo=!uu||uP,bP=e=>dP()?window.requestAnimationFrame(e):setTimeout(e,1),xc=Mo?x.useEffect:x.useLayoutEffect,vh=typeof navigator<"u"&&navigator.connection,Ik=!Mo&&vh&&(["slow-2g","2g"].includes(vh.effectiveType)||vh.saveData),Ud=new WeakMap,_P=e=>qx.prototype.toString.call(e),yh=(e,t)=>e===`[object ${t}]`;let vP=0;const Kx=e=>{const t=typeof e,a=_P(e),r=yh(a,"Date"),i=yh(a,"RegExp"),l=yh(a,"Object");let d,f;if(qx(e)===e&&!r&&!i){if(d=Ud.get(e),d)return d;if(d=++vP+"~",Ud.set(e,d),Array.isArray(e)){for(d="@",f=0;f<e.length;f++)d+=Kx(e[f])+",";Ud.set(e,d)}if(l){d="#";const p=qx.keys(e).sort();for(;!lt(f=p.pop());)lt(e[f])||(d+=f+":"+Kx(e[f])+",");Ud.set(e,d)}}else d=r?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return d},F_=e=>{if(xa(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Kx(e):"",[e,t]};let yP=0;const Rf=()=>++yP;async function TN(...e){const[t,a,r,i]=e,l=ar({populateCache:!0,throwOnError:!0},typeof i=="boolean"?{revalidate:i}:i||{});let d=l.populateCache;const f=l.rollbackOnError;let p=l.optimisticData;const g=_=>typeof f=="function"?f(_):f!==!1,h=l.throwOnError;if(xa(a)){const _=a,y=[],S=t.keys();for(const j of S)!/^\$(inf|sub)\$/.test(j)&&_(t.get(j)._k)&&y.push(j);return Promise.all(y.map(b))}return b(a);async function b(_){const[y]=F_(_);if(!y)return;const[S,j]=RN(t,y),[k,C,w,E]=ha.get(t),R=()=>{const q=k[y];return(xa(l.revalidate)?l.revalidate(S().data,_):l.revalidate!==!1)&&(delete w[y],delete E[y],q&&q[0])?q[0](NN).then(()=>S().data):S().data};if(e.length<3)return R();let T=r,A,z=!1;const M=Rf();C[y]=[M,0];const D=!lt(p),L=S(),I=L.data,P=L._c,B=lt(P)?I:P;if(D&&(p=xa(p)?p(B,I):p,j({data:p,_c:B})),xa(T))try{T=T(B)}catch(q){A=q,z=!0}if(T&&Hx(T))if(T=await T.catch(q=>{A=q,z=!0}),M!==C[y][0]){if(z)throw A;return T}else z&&D&&g(A)&&(d=!0,j({data:B,_c:Zt}));if(d&&!z)if(xa(d)){const q=d(T,B);j({data:q,error:Zt,_c:Zt})}else j({data:T,error:Zt,_c:Zt});if(C[y][1]=Rf(),Promise.resolve(R()).then(()=>{j({_c:Zt})}),z){if(h)throw A;return}return T}}const $k=(e,t)=>{for(const a in e)e[a][0]&&e[a][0](t)},jP=(e,t)=>{if(!ha.has(e)){const r=ar(xP,t),i=Object.create(null),l=TN.bind(Zt,e);let d=Za;const f=Object.create(null),p=(_,y)=>{const S=f[_]||[];return f[_]=S,S.push(y),()=>{const j=S.indexOf(y);j>=0&&(S[j]=S[S.length-1],S.pop())}},g=(_,y,S)=>{e.set(_,y);const j=f[_];if(j)for(const k of j)k(y,S)},h=_=>{const y=ha.get(e),[,S,j,k]=y,C=Rf();y[8]++;for(const R in j)delete j[R];for(const R in k)delete k[R];for(const R in S)S[R]=[C,C];const w={};for(const R of[...e.keys()]){const T=e.get(R);e.delete(R);const A=f[R];if(A)for(const z of A)z(w,T)}const E=!_||_.revalidate!==!1;for(const R in i){const T=i[R];for(let A=0;A<T.length;A++)T[A](EN,{revalidate:E&&!A})}},b=()=>{if(!ha.has(e)&&(ha.set(e,[i,Object.create(null),Object.create(null),Object.create(null),l,g,p,h,0]),!Mo)){const _=r.initFocus(setTimeout.bind(Zt,$k.bind(Zt,i,SN))),y=r.initReconnect(setTimeout.bind(Zt,$k.bind(Zt,i,CN)));d=()=>{_&&_(),y&&y(),ha.delete(e)}}};return b(),[e,l,b,d,h]}const a=ha.get(e);return[e,a[4],Zt,Zt,a[7]]},kP=(e,t,a,r,i)=>{const l=a.errorRetryCount,d=i.retryCount,f=~~((Math.random()+.5)*(1<<(d<8?d:8)))*a.errorRetryInterval;!lt(l)&&d>l||setTimeout(r,f,i)},wP=Ux,[AN,Tf,,,SP]=jP(new Map),CP=ar({onLoadingSlow:Za,onSuccess:Za,onError:Za,onErrorRetry:kP,onDiscarded:Za,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Ik?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Ik?5e3:3e3,compare:wP,isPaused:()=>!1,cache:AN,mutate:Tf,unload:SP,fallback:{}},hP),NP=(e,t)=>{const a=ar(e,t);if(t){const{use:r,fallback:i,cacheData:l}=e,{use:d,fallback:f,cacheData:p}=t;r&&d&&(a.use=r.concat(d)),i&&f&&(a.fallback=ar(i,f)),l&&p&&(a.cacheData=ar(l,p))}return a},EP=x.createContext({}),RP="$inf$",MN=uu&&window.__SWR_DEVTOOLS_USE__,TP=MN?window.__SWR_DEVTOOLS_USE__:[],AP=()=>{MN&&(window.__SWR_DEVTOOLS_REACT__=Zc)},MP=e=>xa(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],zN=()=>{const e=x.useContext(EP);return x.useMemo(()=>ar(CP,e),[e])},zP=e=>(t,a,r)=>e(t,a&&((...l)=>{const[d]=F_(t),[,,,f]=ha.get(AN);if(d.startsWith(RP))return a(...l);const p=f[d];return lt(p)?a(...l):(delete f[d],p)}),r),OP=TP.concat(zP),DP=e=>function(...a){const r=zN(),[i,l,d]=MP(a),f=NP(r,d);let p=e;const{use:g}=f,h=(g||[]).concat(OP);for(let b=h.length;b--;)p=h[b](p);return p(i,l||f.fetcher||null,f)},PP=(e,t,a)=>{const r=t[e]||(t[e]=[]);return r.push(a),()=>{const i=r.indexOf(a);i>=0&&(r[i]=r[r.length-1],r.pop())}};AP();const qd=Zc.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}}),jh={dedupe:!0},Bk=(e,t,a)=>{var r;return t?((r=e.get(t))==null?void 0:r.has(a))===!0:!1},kh=(e,t,a)=>{if(!t)return;let r=e.get(t);r||(r=new Set,e.set(t,r)),r.add(a)},LP=({value:e,getCacheData:t,canCommit:a,setCache:r})=>{const i=l=>{a()&&lt(t())&&r(l)};Promise.resolve(e).then(l=>{i({data:l,error:Zt})},l=>{i({error:l})})},Af=Promise.resolve(Zt);Af.status="fulfilled";Af.value=Zt;const IP=()=>Za,$P=(e,t,a)=>{const{cache:r,compare:i,suspense:l,fallbackData:d,revalidateOnMount:f,revalidateIfStale:p,refreshInterval:g,refreshWhenHidden:h,refreshWhenOffline:b,keepPreviousData:_,strictServerPrefetchWarning:y}=a,[S,j,k,C]=ha.get(r),[w,E]=F_(e),R=x.useRef(!1),T=x.useRef(!1),A=x.useRef(w),z=x.useRef(t),M=x.useRef(a),D=()=>M.current,L=()=>D().isVisible()&&D().isOnline(),[I,P,B,q]=RN(r,w),Y=x.useRef({}).current,U=lt(d)?lt(a.fallback)?Zt:a.fallback[w]:d,V=a.cacheData,X=w?V?.[w]:Zt,Q=w?C[w]:Zt,W=lt(Q)&&!lt(X),$=W?X:Q,K=(de,Le)=>{for(const ye in Y){const Ne=ye;if(Ne==="data"){if(!i(de[Ne],Le[Ne])&&(!lt(de[Ne])||!i(Re,Le[Ne])))return!1}else if(Le[Ne]!==de[Ne])return!1}return!0},J=!R.current,G=x.useMemo(()=>{const de=I(),Le=q(),ye=it=>{const Tt=ar(it);return delete Tt._k,(()=>{if(!w||!t||D().isPaused())return!1;if(J&&!lt(f))return f;const Ct=lt(U)?Tt.data:U;return l&&W&&lt(Ct)?!1:lt(Ct)||p})()?{isValidating:!0,isLoading:!0,...Tt}:Tt},Ne=ye(de),We=de===Le?Ne:ye(Le);let Ge=Ne;return[()=>{const it=ye(I());return K(it,Ge)?(Ge.data=it.data,Ge.isLoading=it.isLoading,Ge.isValidating=it.isValidating,Ge.error=it.error,Ge):(Ge=it,it)},()=>We]},[r,w]),te=Fc.useSyncExternalStore(x.useCallback(de=>B(w,(Le,ye)=>{K(ye,Le)||de()}),[r,w]),G[0],G[1]),se=S[w]&&S[w].length>0,pe=te.data;let F=lt(pe)?U&&Hx(U)?qd(U):U:pe;const oe=te.error,_e=x.useRef(F),le=x.useRef(Zt);let be=le.current;be||(be=new WeakMap,le.current=be);const ke=x.useRef(null);let Re=_?lt(pe)?lt(_e.current)?F:_e.current:pe:F;const Ae=w&&lt(F),Ie=x.useRef(null);!Mo&&Fc.useSyncExternalStore(IP,()=>(Ie.current=!1,Ie),()=>(Ie.current=!0,Ie));const Oe=Ie.current;y&&Oe&&!l&&Ae&&console.warn(`Missing pre-initiated data for serialized key "${w}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);const Te=!w||!t||D().isPaused()||se&&!lt(oe)?!1:J&&!lt(f)?f:l&&W&&Ae?!1:l?lt(F)?!1:p:lt(F)||p,Ee=J&&Te,Me=lt(te.isValidating)?Ee:te.isValidating,De=lt(te.isLoading)?Ee:te.isLoading,He=x.useCallback(async de=>{const Le=z.current;if(!w||!Le||T.current||D().isPaused())return!1;let ye,Ne,We=!0;const Ge=de||{},it=!k[w]||!Ge.dedupe,Tt=W&&!Bk(be,V,w)&&!lt($)&&lt(I().data),_t=()=>Lk?!T.current&&w===A.current&&R.current:w===A.current,Ct={isValidating:!1,isLoading:!1},je=()=>{P(Ct)},ze=()=>{const Ze=k[w];Ze&&Ze[1]===Ne&&delete k[w]},Ye={isValidating:!0};lt(I().data)&&(Ye.isLoading=!0);try{if(it&&(P(Ye),a.loadingTimeout&&lt(I().data)&&setTimeout(()=>{We&&_t()&&D().onLoadingSlow(w,a)},a.loadingTimeout),Tt&&kh(be,V,w),k[w]=[Tt?$:Le(E),Rf()],Tt&&C[w]&&delete C[w]),[ye,Ne]=k[w],ye=await ye,it&&setTimeout(ze,a.dedupingInterval),!k[w]||k[w][1]!==Ne)return it&&_t()&&D().onDiscarded(w),!1;Ct.error=Zt;const Ze=j[w];if(!lt(Ze)&&(Ne<=Ze[0]||Ne<=Ze[1]||Ze[1]===0))return je(),it&&_t()&&D().onDiscarded(w),!1;const ft=I().data;Ct.data=i(ft,ye)?ft:ye,it&&_t()&&D().onSuccess(ye,w,a)}catch(Ze){ze();const ft=D(),{shouldRetryOnError:Rt}=ft;ft.isPaused()||(Ct.error=Ze,it&&_t()&&(ft.onError(Ze,w,ft),(Rt===!0||xa(Rt)&&Rt(Ze))&&(!D().revalidateOnFocus||!D().revalidateOnReconnect||L())&&ft.onErrorRetry(Ze,w,ft,Qt=>{const ot=S[w];ot&&ot[0]&&ot[0](Pk,Qt)},{retryCount:(Ge.retryCount||0)+1,dedupe:!0})))}return We=!1,je(),!0},[w,r]),Qe=x.useCallback((...de)=>TN(r,A.current,...de),[]);if(xc(()=>{const de=ke.current;de&&(ke.current=null,kh(be,de.cacheData,de.key),lt(I().data)&&P({data:de.data,error:Zt,_k:de._k}),C[de.key]&&delete C[de.key])}),xc(()=>{z.current=t,M.current=a,lt(pe)||(_e.current=pe)}),xc(()=>{if(t||!W||lt($)||Bk(be,V,w)||!lt(I().data))return;kh(be,V,w);const de=j[w];LP({value:$,getCacheData:()=>I().data,canCommit:()=>!T.current&&w===A.current&&j[w]===de,setCache:Le=>P({...Le,_k:E})})}),xc(()=>{if(!w)return;const de=He.bind(Zt,jh);let Le=0;D().revalidateOnFocus&&(Le=Date.now()+D().focusThrottleInterval);const Ne=PP(w,S,(We,Ge={})=>{if(We==SN){const it=Date.now();D().revalidateOnFocus&&it>Le&&L()&&(Le=it+D().focusThrottleInterval,de())}else if(We==CN)D().revalidateOnReconnect&&L()&&de();else{if(We==NN)return He();if(We==Pk)return He(Ge);if(We==EN&&(_e.current=Zt,Ge.revalidate))return He()}});return T.current=!1,A.current=w,R.current=!0,P({_k:E}),Te&&(k[w]||(lt(F)||Mo?de():bP(de))),()=>{T.current=!0,Ne()}},[w]),xc(()=>{let de;function Le(){const Ne=xa(g)?g(I().data):g;Ne&&de!==-1&&(de=setTimeout(ye,Ne))}function ye(){!I().error&&(h||D().isVisible())&&(b||D().isOnline())?He(jh).then(Le):Le()}return Le(),()=>{de&&(clearTimeout(de),de=-1)}},[g,h,b,w]),x.useDebugValue(Re),l){if(!Lk&&Mo&&Ae&&lt($))throw new Error("Fallback data is required when using Suspense in SSR.");Ae&&(z.current=t,M.current=a,T.current=!1);const de=!lt($)&&Ae;let Le=Zt;if(de&&W)Le=$&&Hx($)?qd($):$,F=Le,Re=Le,Mo||(ke.current={data:Le,_k:E,key:w,cacheData:V});else{const Ne=de?Qe($):Af;qd(Ne)}if(!lt(oe)&&Ae)throw oe;const ye=Ae&&lt(Le)?He(jh):Af;!lt(Re)&&Ae&&(ye.status="fulfilled",ye.value=!0),qd(ye)}return{mutate:Qe,get data(){return Y.data=!0,Re},get error(){return Y.error=!0,oe},get isValidating(){return Y.isValidating=!0,Me},get isLoading(){return Y.isLoading=!0,De}}},$e=DP($P);let il=null;function Ao(e){il=e}function G_(){return il}class du extends Error{status;body;constructor(t,a,r){super(a),this.status=t,this.body=r}}async function bc(e,t,a,r={}){const i={"content-type":"application/json",...il?{authorization:`Bearer ${il}`}:{},...r.headers||{}},l=await fetch(t,{...r,method:e,headers:i,body:a!==void 0?JSON.stringify(a):void 0});if(!l.ok){let d="",f=null;try{f=await l.json(),d=f?.error||JSON.stringify(f)}catch{d=await l.text()}throw new du(l.status,`${e} ${t} → ${l.status}: ${d}`,f)}if(l.status!==204)return await l.json()}function Ja(e){const t=e;if(Array.isArray(e))return{items:e,total:e.length};if(t&&Array.isArray(t.data)){const a=t.data;return{items:a,total:typeof t.meta?.total=="number"?t.meta.total:a.length}}if(t&&Array.isArray(t.sessions)){const a=t.sessions;return{items:a,total:a.length}}return{items:[],total:0}}const ne={get:e=>bc("GET",e),post:(e,t)=>bc("POST",e,t),put:(e,t)=>bc("PUT",e,t),patch:(e,t)=>bc("PATCH",e,t),del:e=>bc("DELETE",e)};async function ON(e,t,a,r){const i=await fetch(e,{method:"POST",signal:r,headers:{"content-type":"application/json",...il?{authorization:`Bearer ${il}`}:{}},body:JSON.stringify(t)});if(!i.ok||!i.body){const p=await i.text().catch(()=>"");throw new du(i.status,`POST ${e} → ${i.status}: ${p||"stream failed"}`)}const l=i.body.getReader(),d=new TextDecoder("utf-8");let f="";for(;;){const{value:p,done:g}=await l.read();if(g)break;f+=d.decode(p,{stream:!0});let h=f.indexOf(`
811
+ `);for(;h>=0;){const b=f.slice(0,h).trim();if(f=f.slice(h+1),b)try{a(JSON.parse(b))}catch{}h=f.indexOf(`
812
+ `)}}if(f.trim())try{a(JSON.parse(f.trim()))}catch{}}const BP={get:()=>ne.get("/api/health")},Zn={list:()=>ne.get("/api/projects"),register:e=>ne.post("/api/projects",{path:e}),remove:e=>ne.del(`/api/projects/${encodeURIComponent(e)}`),rebuild:e=>ne.post(`/api/projects/${encodeURIComponent(e)}/rebuild`),config:{show:e=>ne.get(`/api/projects/${e}/config`),set:(e,t)=>ne.patch(`/api/projects/${e}/config`,{set:t}),unset:(e,t)=>ne.patch(`/api/projects/${e}/config`,{unset:t}),put:(e,t)=>ne.put(`/api/projects/${e}/config`,t)},apcProject:{set:(e,t,a)=>ne.patch(`/api/projects/${e}/apc-project`,{set:t,unset:a}),put:(e,t)=>ne.put(`/api/projects/${e}/apc-project`,t)},memory:{get:e=>ne.get(`/api/projects/${e}/memory`),put:(e,t)=>ne.put(`/api/projects/${e}/memory`,{body:t})}},an={list:(e,t)=>ne.get(`/api/projects/${e}/agents${t?.stats?"?stats=1":""}`),get:(e,t)=>ne.get(`/api/projects/${e}/agents/${t}`),create:(e,t)=>ne.post(`/api/projects/${e}/agents`,t),update:(e,t,a)=>ne.patch(`/api/projects/${e}/agents/${encodeURIComponent(t)}`,a),remove:(e,t)=>ne.del(`/api/projects/${e}/agents/${encodeURIComponent(t)}`),chat:(e,t,a)=>ne.post(`/api/projects/${e}/agents/${encodeURIComponent(t)}/chat`,a),memory:{get:(e,t)=>ne.get(`/api/projects/${e}/agents/${t}/memory`),put:(e,t,a)=>ne.put(`/api/projects/${e}/agents/${t}/memory`,{body:a})},vault:e=>ne.get(e?.includeRemoved?"/api/agents/vault?include_removed=1":"/api/agents/vault"),vaultCreate:(e,t={},a="")=>ne.post("/api/agents/vault",{slug:e,fields:t,body:a}),vaultPatch:(e,t)=>ne.patch(`/api/agents/vault/${encodeURIComponent(e)}`,t),vaultRemove:e=>ne.del(`/api/agents/vault/${encodeURIComponent(e)}`),vaultRestore:e=>ne.post(`/api/agents/vault/${encodeURIComponent(e)}/restore`),import:(e,t)=>ne.post(`/api/projects/${e}/agents/import`,{slug:t})},Jr={list:(e,t)=>ne.get(`/api/projects/${e}/agents/${t}/conversations`),get:(e,t,a)=>ne.get(`/api/projects/${e}/agents/${t}/conversations/${a}`),threads:e=>ne.get(`/api/projects/${e}/super-agent/threads`),thread:(e,t,a)=>ne.get(`/api/projects/${e}/super-agent/threads/${t}/${a}`),remove:(e,t,a)=>ne.del(`/api/projects/${e}/agents/${t}/conversations/${a}`),removeThread:(e,t,a)=>ne.del(`/api/projects/${e}/super-agent/threads/${t}/${a}`),compact:(e,t,a)=>ne.post(a?`/api/projects/${e}/agents/${t}/conversations/${a}/compact`:`/api/projects/${e}/agents/${t}/compact`,{})},Ur={list:e=>ne.get(`/api/projects/${e}/routines`),get:(e,t)=>ne.get(`/api/projects/${e}/routines/${t}`),run:(e,t)=>ne.post(`/api/projects/${e}/routines/${t}/run`),enable:(e,t)=>ne.post(`/api/projects/${e}/routines/${t}/enable`),disable:(e,t)=>ne.post(`/api/projects/${e}/routines/${t}/disable`),upsert:(e,t)=>ne.post(`/api/projects/${e}/routines`,t),remove:(e,t)=>ne.del(`/api/projects/${e}/routines/${encodeURIComponent(t)}`)},qn={list:(e,t="open")=>ne.get(`/api/projects/${e}/tasks?state=${t}`).then(a=>Ja(a).items),global:(e="open")=>ne.get(`/api/tasks?state=${e}`).then(t=>Ja(t).items),listPage:(e,{state:t,limit:a,offset:r})=>ne.get(`/api/projects/${e}/tasks?state=${t}&limit=${a}&offset=${r}`).then(i=>Ja(i)),globalPage:({state:e,limit:t,offset:a,status:r})=>ne.get(`/api/tasks?state=${e}&limit=${t}&offset=${a}`+(r?`&status=${r}`:"")).then(i=>Ja(i)),get:(e,t)=>ne.get(`/api/projects/${e}/tasks/${t}`),add:(e,t)=>ne.post(`/api/projects/${e}/tasks`,t),patch:(e,t,a)=>ne.patch(`/api/projects/${e}/tasks/${t}`,{patch:a}),status:(e,t,a)=>ne.post(`/api/projects/${e}/tasks/${t}/status`,{status:a}),done:(e,t)=>ne.post(`/api/projects/${e}/tasks/${t}/done`),drop:(e,t)=>ne.post(`/api/projects/${e}/tasks/${t}/drop`),reopen:(e,t)=>ne.post(`/api/projects/${e}/tasks/${t}/reopen`),summary:e=>ne.get(`/api/projects/${e}/tasks-summary`)},qr={list:e=>ne.get(`/api/projects/${e}/mcps`),check:e=>ne.get(`/api/projects/${e}/mcps/check`),add:(e,t,a)=>ne.post(`/api/projects/${e}/mcps?scope=${t}`,a),remove:(e,t,a="shared")=>ne.del(`/api/projects/${e}/mcps/${encodeURIComponent(t)}?scope=${a}`),test:(e,t)=>ne.post(`/api/projects/${e}/mcps/${encodeURIComponent(t)}/test`,{}),logs:(e,t)=>ne.get(`/api/projects/${e}/mcps/${encodeURIComponent(t)}/logs`)},So=e=>`?scope=${e}`,Kn={catalog:e=>ne.get(`/api/projects/${e}/integrations/catalog`),list:(e,t="project")=>ne.get(`/api/projects/${e}/integrations${So(t)}`),status:(e,t,a="project")=>ne.get(`/api/projects/${e}/integrations/${t}${So(a)}`),configure:(e,t,a,r)=>ne.post(`/api/projects/${e}/integrations/${t}/configure${So(a)}`,r),validate:(e,t,a="project")=>ne.post(`/api/projects/${e}/integrations/${t}/validate${So(a)}`,{}),deactivate:(e,t,a="project")=>ne.post(`/api/projects/${e}/integrations/${t}/deactivate${So(a)}`,{}),action:(e,t,a,r="project")=>ne.post(`/api/projects/${e}/integrations/${t}/action/${a}${So(r)}`,{}),remove:(e,t,a="project")=>ne.del(`/api/projects/${e}/integrations/${t}${So(a)}`),asanaConfigure:(e,t,a)=>Kn.configure(e,"asana",t,{personal_access_token:a.personalAccessToken,workspace_gid:a.workspaceGid}),asanaValidate:(e,t)=>Kn.validate(e,"asana",t),asanaWorkspaces:(e,t)=>Kn.action(e,"asana","workspaces",t)},Gc={list:(e,t={})=>ne.get(`/api/projects/${e}/vars${t.reveal?"?reveal=1":""}`),get:(e,t,a={})=>ne.get(`/api/projects/${e}/vars/${encodeURIComponent(t)}${a.reveal?"?reveal=1":""}`),upsert:(e,t)=>ne.post(`/api/projects/${e}/vars`,t),remove:(e,t,a="project")=>ne.del(`/api/projects/${e}/vars/${encodeURIComponent(t)}?scope=${a}`)},wh=e=>{const t=new URLSearchParams;for(const[r,i]of Object.entries(e))i!==void 0&&i!==""&&t.set(r,String(i));const a=t.toString();return a?`?${a}`:""},Mf={global:(e={})=>ne.get(`/api/messages/global${wh(e)}`),project:(e,t={})=>ne.get(`/api/projects/${e}/messages${wh(t)}`),search:(e,t,a=50)=>ne.get(`/api/projects/${e}/messages/search${wh({q:t,limit:a})}`)},UP={global:e=>ne.get(`/api/sessions${e?`?engine=${encodeURIComponent(e)}`:""}`).then(t=>({sessions:Ja(t).items})),page:({engine:e,q:t,deep:a,cwd:r,limit:i,offset:l})=>{const d=new URLSearchParams({limit:String(i),offset:String(l)});return e&&d.set("engine",e),t?.trim()&&d.set("q",t.trim()),a&&d.set("deep","1"),r?.trim()&&d.set("cwd",r.trim()),ne.get(`/api/sessions?${d.toString()}`).then(f=>Ja(f))}},qP={list:()=>ne.get("/api/tools")},Pn={channels:{list:()=>ne.get("/api/telegram/channels"),upsert:e=>ne.post("/api/telegram/channels",e),patch:(e,t)=>ne.patch(`/api/telegram/channels/${e}`,t),remove:e=>ne.del(`/api/telegram/channels/${encodeURIComponent(e)}`)},contacts:{list:()=>ne.get("/api/telegram/contacts"),patch:(e,t)=>ne.patch(`/api/telegram/contacts/${encodeURIComponent(String(e))}`,t),remove:e=>ne.del(`/api/telegram/contacts/${encodeURIComponent(String(e))}`)},roles:{list:()=>ne.get("/api/telegram/roles"),set:(e,t)=>ne.put(`/api/telegram/roles/${encodeURIComponent(e)}`,{tools:t}),remove:e=>ne.del(`/api/telegram/roles/${encodeURIComponent(e)}`)},status:()=>ne.get("/api/telegram/status"),start:()=>ne.post("/api/telegram/start"),stop:()=>ne.post("/api/telegram/stop"),send:e=>ne.post("/api/telegram/send",e)},Yc={list:()=>ne.get("/api/engines"),presets:()=>ne.get("/api/engines/presets"),models:e=>ne.post("/api/engines/models",e)},HP=Object.freeze(Object.defineProperty({__proto__:null,Engines:Yc},Symbol.toStringTag,{value:"Module"})),ll={reload:()=>ne.post("/api/admin/reload"),shutdown:()=>ne.post("/api/admin/shutdown"),config:{get:()=>ne.get("/api/admin/config"),patch:e=>ne.patch("/api/admin/config",e)},superAgent:()=>ne.get("/api/admin/super-agent"),logs:(e="errors",t=200)=>ne.get(`/api/admin/logs?file=${e}&limit=${t}`)},cl={list:()=>ne.get("/api/pair/list"),revoke:e=>ne.del(`/api/pair/revoke/${encodeURIComponent(e)}`),init:()=>ne.post("/api/pair/init",{}),status:e=>ne.get(`/api/pair/status/${encodeURIComponent(e)}`),confirm:e=>ne.post("/api/pair/confirm",e)},Uk={get:()=>ne.get("/api/identity"),patch:e=>ne.patch("/api/identity",e)},DN={send:(e,t)=>ne.post(`/api/projects/${e}/super-agent/chat`,t),stream:(e,t,a,r)=>ON(`/api/projects/${e}/super-agent/chat/stream`,t,a,r),summarize:e=>ne.post("/api/super-agent/summarize",e)},zf={dirs:e=>ne.get(`/api/admin/fs/dirs?path=${encodeURIComponent(e)}`),pickDir:e=>ne.get(`/api/admin/fs/pick-dir${e?`?prompt=${encodeURIComponent(e)}`:""}`)},VP=["alloy","echo","fable","onyx","nova","shimmer"],FP=["Kore","Puck","Charon","Fenrir","Aoede"],GP=["eleven_multilingual_v2","eleven_turbo_v2_5","eleven_flash_v2_5"],YP=["tts-1","tts-1-hd"],KP=["happy","sad","excited","angry","calm","whisper","shout","laugh","cry","narrator","neutral"],XP=["tiny","base","small","medium","large-v2","large-v3","large-v3-turbo"],Of={piper:{name:"Piper",note:"Local, offline (CLI + .onnx model). No API key.",local:!0},elevenlabs:{name:"ElevenLabs",note:"Cloud, multilingual. Requires an API key."},openai:{name:"OpenAI",note:"Cloud (tts-1 / tts-1-hd) or any OpenAI-compatible endpoint (set a base URL for a local server, e.g. QVox)."},gemini:{name:"Gemini",note:"Cloud (preview). Uses your Gemini key."},mock:{name:"Mock",note:"Silent test engine. Always available as a fallback.",local:!0}};async function QP(e){const t=G_(),a=await fetch(`/api/voice/tts?path=${encodeURIComponent(e)}`,{headers:t?{authorization:`Bearer ${t}`}:{}});if(!a.ok){const i=await a.text().catch(()=>"");throw new Error(`No se pudo leer el audio (${a.status}): ${i.slice(0,160)}`)}const r=await a.blob();return URL.createObjectURL(r)}const Df={providers:()=>ne.get("/api/tts/providers"),sttHardware:()=>ne.get("/api/transcribe/hardware"),sttModels:e=>ne.get(`/api/transcribe/models?backend=${e}`),say:e=>ne.post("/api/tts/say",e),turn:e=>ne.post("/api/voice/turn",e)},PN={manifest:()=>ne.get("/api/deck/manifest"),setWidget:(e,t)=>ne.patch(`/api/deck/widgets/${encodeURIComponent(e)}`,t),exec:e=>ne.post("/api/deck/exec",e)},Co=e=>`/api/projects/${e}/code/sessions`,Ya={sessions:{list:e=>ne.get(Co(e)).then(t=>t.sessions),get:(e,t)=>ne.get(`${Co(e)}/${t}`),create:(e,t={})=>ne.post(Co(e),t),update:(e,t,a)=>ne.patch(`${Co(e)}/${t}`,a),remove:(e,t)=>ne.del(`${Co(e)}/${t}`)},changes:(e,t)=>ne.get(`${Co(e)}/${t}/changes`),stream:(e,t,a,r,i)=>ON(`${Co(e)}/${t}/chat/stream`,a,r,i)},Ws={list:e=>ne.get(`/api/projects/${encodeURIComponent(e)}/artifacts`),read:(e,t)=>ne.get(`/api/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`),run:(e,t,a=[])=>ne.post(`/api/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/run`,{args:a}),remove:(e,t)=>ne.del(`/api/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`),write:(e,t,a)=>ne.patch(`/api/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,{content:a}),rename:(e,t,a)=>ne.patch(`/api/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,{newName:a}),preview:(e,t,a=!0)=>ne.post(`/api/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/preview`,{watch:a}),previews:e=>ne.get(`/api/projects/${encodeURIComponent(e)}/previews`),stopPreview:e=>ne.del(`/api/previews/${encodeURIComponent(e)}`),openTunnel:(e,t)=>ne.post(`/api/previews/${encodeURIComponent(e)}/tunnel`,{provider:t}),closeTunnel:e=>ne.del(`/api/previews/${encodeURIComponent(e)}/tunnel`)},Us={list:e=>{const t=new URLSearchParams;e&&(t.set("project_path",e),t.set("scope",e));const a=t.toString();return ne.get(a?`/api/skills?${a}`:"/api/skills")},detail:(e,t)=>{const a=t?`?project_path=${encodeURIComponent(t)}`:"";return ne.get(`/api/skills/${encodeURIComponent(e)}/detail${a}`)},setEnabled:e=>ne.put("/api/skills/enabled",e),create:e=>ne.post("/api/skills",e),importZip:e=>ne.post("/api/skills/import/zip",e),importRepo:e=>ne.post("/api/skills/import/repo",e),remove:(e,t)=>{const a=t?`?project_path=${encodeURIComponent(t)}`:"";return ne.del(`/api/skills/${encodeURIComponent(e)}${a}`)},inspector:()=>ne.get("/api/skills/inspector"),updateInspector:e=>ne.put("/api/skills/inspector",e),index:(e={})=>ne.post("/api/skills/index",e),inspect:(e,t)=>ne.post("/api/skills/inspect",{prompt:e,project_path:t})},Gr={get:e=>ne.get(`/api/projects/${e}/organization`),createArea:(e,t)=>ne.post(`/api/projects/${e}/organization/areas`,t),updateArea:(e,t,a)=>ne.patch(`/api/projects/${e}/organization/areas/${encodeURIComponent(t)}`,a),removeArea:(e,t)=>ne.del(`/api/projects/${e}/organization/areas/${encodeURIComponent(t)}`),createRole:(e,t)=>ne.post(`/api/projects/${e}/organization/roles`,t),updateRole:(e,t,a)=>ne.patch(`/api/projects/${e}/organization/roles/${encodeURIComponent(t)}`,a),removeRole:(e,t)=>ne.del(`/api/projects/${e}/organization/roles/${encodeURIComponent(t)}`)},Nc={tree:(e,t="project")=>ne.get(`/api/projects/${e}/fs/tree?scope=${t}`),read:(e,t,a="project")=>ne.get(`/api/projects/${e}/fs/file?scope=${a}&path=${encodeURIComponent(t)}`),write:(e,t,a,r="project")=>ne.put(`/api/projects/${e}/fs/file`,{scope:r,path:t,content:a}),mkdir:(e,t,a="project")=>ne.post(`/api/projects/${e}/fs/dir`,{scope:a,path:t}),remove:(e,t,a="project")=>ne.del(`/api/projects/${e}/fs/entry?scope=${a}&path=${encodeURIComponent(t)}`)};function Xo(){const{data:e,error:t,isLoading:a,mutate:r}=$e("/api/projects",()=>Zn.list(),{refreshInterval:sp.projects});return{projects:(e||[]).slice().sort((l,d)=>{const f=Number(l.id),p=Number(d.id);return f===0&&p!==0?-1:p===0&&f!==0?1:f-p}),error:t,isLoading:a,mutate:r}}function fu(e){const{projects:t,isLoading:a,mutate:r}=Xo();return{project:t.find(l=>String(l.id)===e)??null,isLoading:a,mutate:r}}function Y_(){const{data:e,error:t,isLoading:a,mutate:r}=$e("/api/identity",()=>Uk.get());return{identity:e||{},error:t,isLoading:a,mutate:r,save:async l=>{const d=await Uk.patch(l);return await r(d,{revalidate:!1}),d}}}function pu(){const{identity:e}=Y_();return e?.agent_name?.trim()||"APX"}function WP(){return[{id:"desktop",label:u("nav.modules.desktop"),href:"/m/desktop",icon:Lb},{id:"code",label:u("nav.modules.code"),href:"/m/code",icon:ya}]}function ZP(e,t,a){const[r,i]=x.useState(t);return x.useLayoutEffect(()=>{const l=e.current;if(!l||!a)return;const d=()=>{const p=getComputedStyle(l),g=(parseFloat(p.paddingTop)||0)+(parseFloat(p.paddingBottom)||0),h=l.clientHeight-g;if(h<=0)return;const b=parseFloat(p.rowGap)||12,y=(l.querySelector("[data-rail-probe]")?.offsetHeight??56)+b,j=Math.max(0,Math.floor((h+b)/y))-1;i(j>=t?t:Math.max(0,j-1))};d();const f=new ResizeObserver(d);return f.observe(l),()=>f.disconnect()},[e,t,a]),a?Math.min(r,t):t}function qk({projects:e,label:t,sublabel:a,icon:r,tooltip:i,header:l,active:d,testId:f,onSelect:p,isActive:g}){return n.jsxs(I_,{children:[n.jsxs($_,{"data-testid":f,title:i,"aria-label":i,className:"group flex w-full cursor-pointer flex-col items-center gap-1",children:[n.jsx("span",{className:me("flex size-10 items-center justify-center rounded-xl text-xs font-bold transition-all","bg-muted/40 text-muted-fg hover:bg-accent hover:text-foreground",d&&"ring-2 ring-foreground ring-offset-2 ring-offset-card"),children:r??t}),a&&n.jsx("span",{className:"block max-w-[3.6rem] truncate text-[9px] leading-tight text-muted-fg group-hover:text-foreground",children:a})]}),n.jsxs(B_,{side:"right",align:"start",sideOffset:8,className:"max-h-[70vh] w-64",children:[n.jsx("div",{className:"px-1.5 py-1 text-xs font-medium text-muted-foreground",children:l}),e.map(h=>{const b=h.name||h.path.split("/").pop()||String(h.id),_=`/p/${h.id}`,{initials:y,idleClass:S}=sD(b);return n.jsxs(uf,{"data-testid":`project-menu-item-${h.id}`,onClick:()=>p(_),className:me(g(_)&&"bg-accent/60 text-foreground"),children:[n.jsx("span",{className:me("flex size-6 shrink-0 items-center justify-center rounded-md text-[10px] font-bold",S),children:y}),n.jsx("span",{className:"truncate",children:b})]},h.id)})]})]})}function JP({onSelect:e,onOpenRoby:t,onOpenAddProject:a}){const{projects:r,isLoading:i}=Xo(),l=ns(),d=WP(),f=pu(),p=x.useRef(null),{collapsed:g,toggle:h}=H_(Dn.sidebarCollapsed+".projects"),b=w=>l.pathname===w||l.pathname.startsWith(`${w}/`),_=r.find(w=>String(w.id)==="0"),y=r.filter(w=>String(w.id)!=="0").sort((w,E)=>Number(E.id)-Number(w.id)),S=ZP(p,y.length,!g&&y.length>0),j=y.slice(0,S),k=y.slice(S),C=k.some(w=>b(`/p/${w.id}`));return n.jsxs("aside",{className:"flex h-full w-20 flex-col items-center gap-3 overflow-hidden bg-transparent py-3",children:[n.jsx(Ue,{content:u("nav.apx_admin"),side:"right",children:n.jsx("button",{type:"button",onClick:()=>e("/"),"data-testid":"nav-home",className:"mb-2 cursor-pointer",children:n.jsx(o4,{size:36})})}),n.jsx(Ue,{content:u("inbox.title"),side:"right",children:n.jsx("button",{type:"button",onClick:()=>e("/m/inbox"),"data-testid":"nav-inbox",className:`flex size-10 cursor-pointer items-center justify-center rounded-xl border transition ${b("/m/inbox")?"border-primary bg-primary/10":"border-border bg-muted/40 hover:bg-muted"}`,"aria-label":u("inbox.title"),children:n.jsx(nu,{size:18})})}),i&&n.jsx("div",{className:"size-10 animate-pulse rounded-xl bg-muted"}),_&&n.jsx(Li,{label:u("base.title"),testId:"project-avatar-0",title:u("base.subtitle"),active:b("/p/0"),isDefault:!0,icon:n.jsx("img",{src:"/modules/superagent.png",alt:u("base.title"),className:"size-7 object-contain",draggable:!1}),onClick:()=>e("/p/0")}),d.map(w=>n.jsx(Li,{label:w.label,testId:`module-avatar-${w.id}`,title:w.label,active:b(w.href),icon:n.jsx(w.icon,{size:18}),onClick:()=>e(w.href)},w.id)),n.jsxs("div",{className:"flex min-h-0 w-full flex-1 flex-col items-center gap-3",children:[y.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"my-0.5 h-px w-8 rounded-full bg-border"}),n.jsx(Ue,{content:u(g?"nav.expand_projects":"nav.collapse_projects"),side:"right",children:n.jsx("button",{type:"button",onClick:h,"data-testid":"nav-toggle-projects","aria-label":u(g?"nav.expand_projects":"nav.collapse_projects"),"aria-expanded":!g,className:"flex h-5 w-8 cursor-pointer items-center justify-center rounded-md text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:n.jsx(ms,{className:me("size-3.5 transition-transform",g&&"-rotate-90")})})})]}),n.jsxs("div",{ref:p,className:"flex min-h-0 w-full flex-1 flex-col items-center gap-3 overflow-hidden py-1.5",children:[y.length>0&&g&&n.jsx(qk,{projects:y,icon:n.jsx(xM,{size:18}),sublabel:String(y.length),tooltip:u("nav.all_projects"),header:u("nav.all_projects"),active:y.some(w=>b(`/p/${w.id}`)),testId:"nav-projects-folder",onSelect:e,isActive:b}),y.length>0&&!g&&n.jsxs(n.Fragment,{children:[n.jsx("div",{"data-rail-probe":!0,"aria-hidden":!0,className:"invisible absolute w-full",children:n.jsx(Li,{label:"Ag",active:!1,onClick:()=>{}})}),j.map(w=>{const E=w.name||w.path.split("/").pop()||String(w.id),R=`/p/${w.id}`;return n.jsx("div",{"data-rail-item":!0,className:"w-full",children:n.jsx(Li,{label:E,testId:`project-avatar-${w.id}`,title:`${E} — ${w.path}`,active:b(R),onClick:()=>e(R)})},w.id)}),k.length>0&&n.jsx(qk,{projects:k,label:`+${k.length}`,tooltip:u("nav.more_projects",{count:k.length}),header:u("nav.more_projects",{count:k.length}),active:C,testId:"nav-projects-overflow",onSelect:e,isActive:b})]}),n.jsx(Li,{label:u("nav.add_project"),isAdd:!0,testId:"nav-add-project",icon:n.jsx(Ot,{size:18}),active:!1,onClick:()=>a?a():e("/?action=add-project"),title:u("nav.add_project")})]})]}),n.jsx(Li,{label:u("nav.settings"),isSettings:!0,testId:"nav-settings",icon:n.jsx(np,{size:16}),active:l.pathname==="/settings"||l.pathname.startsWith("/settings/"),onClick:()=>e("/settings"),title:u("nav.settings")}),n.jsx(Ue,{content:u("settings_ui.documentation"),side:"right",children:n.jsx("a",{href:"https://agentprojectcontext.github.io/apx/docs/",target:"_blank",rel:"noopener noreferrer","data-testid":"nav-docs","aria-label":u("settings_ui.documentation"),className:"flex size-10 items-center justify-center rounded-xl border border-border/60 bg-muted/30 text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:n.jsx(KA,{size:18})})}),n.jsx(Ue,{content:u("superagent.talk",{persona:f}),side:"right",children:n.jsx("button",{type:"button",onClick:t,"data-testid":"nav-roby","aria-label":u("superagent.talk",{persona:f}),className:"flex size-10 items-center justify-center rounded-xl border border-border/60 bg-muted/30 text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:n.jsx(rn,{size:18})})})]})}function LN(e){switch(e){case"personal":return u("settings_ui.kind_personal");case"company":return u("settings_ui.kind_company");case"app":return u("settings_ui.kind_app");case"software":return u("settings_ui.kind_software");case"default":return u("settings_ui.kind_default");case"other":return u("settings_ui.kind_other");default:return u("nav.project")}}function qe({title:e,description:t,action:a,filters:r,className:i,children:l,fullHeight:d}){return n.jsxs("section",{className:me("rounded-xl border border-border bg-card p-5",d&&"flex h-full min-h-0 flex-col",i),children:[n.jsxs("header",{className:me("flex items-start justify-between gap-4",d&&"shrink-0"),children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:e}),t&&n.jsx("p",{className:"mt-0.5 text-sm text-muted-fg",children:t})]}),a]}),r?n.jsx("div",{className:me("mt-3 flex flex-wrap items-center gap-1.5",d&&"shrink-0"),children:r}):null,n.jsx("div",{className:me("mt-4",d&&"flex min-h-0 flex-1 flex-col"),children:l})]})}function Hk({children:e}){return n.jsx("kbd",{className:"rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wide text-muted-fg",children:e})}function mu({ok:e}){return n.jsx("span",{className:me("inline-block size-2 rounded-full",e===null?"bg-muted-fg":e?"bg-emerald-500":"bg-red-500")})}const eL=x.forwardRef(function(t,a){const{render:r,className:i,disabled:l=!1,focusableWhenDisabled:d=!1,nativeButton:f=!0,style:p,...g}=t,{getButtonProps:h,buttonRef:b}=ao({disabled:l,focusableWhenDisabled:d,native:f});return Et("button",t,{state:{disabled:l},ref:[a,b],props:[g,h]})}),Vk=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Fk=Bc,K_=(e,t)=>a=>{var r;if(t?.variants==null)return Fk(e,a?.class,a?.className);const{variants:i,defaultVariants:l}=t,d=Object.keys(i).map(g=>{const h=a?.[g],b=l?.[g];if(h===null)return null;const _=Vk(h)||Vk(b);return i[g][_]}),f=a&&Object.entries(a).reduce((g,h)=>{let[b,_]=h;return _===void 0||(g[b]=_),g},{}),p=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((g,h)=>{let{class:b,className:_,...y}=h;return Object.entries(y).every(S=>{let[j,k]=S;return Array.isArray(k)?k.includes({...l,...f}[j]):{...l,...f}[j]===k})?[...g,b,_]:g},[]);return Fk(e,d,p,a?.class,a?.className)},tL=K_("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function lr({className:e,variant:t="default",size:a="default",...r}){return n.jsx(eL,{"data-slot":"button",className:St(tL({variant:t,size:a,className:e})),...r})}const nL={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},sL={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},aL={disabled:!1,...sL},X_={valid(e){return e===null?null:e?{"data-valid":""}:{"data-invalid":""}}},rL={invalid:void 0,name:void 0,validityData:{state:nL,errors:[],error:"",value:"",initialValue:null},setValidityData:En,disabled:void 0,setTouched:En,setDirty:En,setFilled:En,setFocused:En,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:aL,registerFieldControl:En,validation:{getValidationProps:(e,t=sn)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:En,getInputControl:()=>null,commit:async()=>{},change:En}},oL=x.createContext(rL);function gu(e=!0){const t=x.useContext(oL);if(t.setValidityData===En&&!e)throw new Error(gn(28));return t}const iL=x.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:En,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Q_(){return x.useContext(iL)}const lL=x.createContext({controlId:void 0,registerControlId:En,labelId:void 0,setLabelId:En,messageIds:[],setMessageIds:En,getDescriptionProps:e=>e});function Ep(){return x.useContext(lL)}function cL(e,t,a,r=!0,i){const[l,d]=x.useState(),f=ra(i?`${i}-label`:void 0),p=e??t??l;return Pe(()=>{const g=e||t||!r?void 0:uL(a.current,f);l!==g&&d(g)}),p}function uL(e,t){const a=dL(e);if(a)return!a.id&&t&&(a.id=t),a.id||void 0}function dL(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const a=e.id;if(a){const i=e.nextElementSibling;if(i&&i.htmlFor===a)return i}const r=e.labels;return r&&r[0]}function Rp(e={}){const{id:t,implicit:a=!1,controlRef:r}=e,{controlId:i,registerControlId:l}=Ep(),d=ra(t),f=a?i:void 0,p=Vn(()=>Symbol()),g=x.useRef(!1),h=x.useRef(t!=null),b=Ve(()=>{!g.current||l===En||(g.current=!1,l(p.current,void 0))});return Pe(()=>{if(l===En)return;let _;if(a){const y=r?.current;bt(y)&&y.closest("label")!=null?_=t??null:_=f??d}else if(t!=null)h.current=!0,_=t;else if(h.current)_=d;else{b();return}if(_===void 0){b();return}g.current=!0,l(p.current,_)},[t,r,f,l,a,d,p,b]),x.useEffect(()=>b,[b]),i??d}function W_(e,t,a,r,i=!0,l){const{registerFieldControl:d}=gu(),f=Vn(()=>Symbol());Pe(()=>{const p=f.current;if(!i){d(p,void 0);return}d(p,{controlRef:e,getValue:r,id:t,name:l,value:a})},[e,i,r,t,l,d,f,a]),Pe(()=>{const p=f.current;return()=>{d(p,void 0)}},[d,f])}const fL=x.forwardRef(function(t,a){const{render:r,className:i,id:l,name:d,value:f,disabled:p=!1,onValueChange:g,defaultValue:h,autoFocus:b=!1,style:_,...y}=t,{state:S,name:j,disabled:k,setTouched:C,setDirty:w,validityData:E,setFocused:R,setFilled:T,validationMode:A,validation:z}=gu(),{clearErrors:M}=Q_(),D=k||p,L=j??d,I={...S,disabled:D},{labelId:P}=Ep(),B=Rp({id:l});Pe(()=>{const W=f!=null;z.inputRef.current?.value||W&&f!==""?T(!0):W&&f===""&&T(!1)},[z.inputRef,T,f]);const q=x.useRef(null);Pe(()=>{b&&q.current===Xn(vt(q.current))&&R(!0)},[b,R]);const[Y]=ol({controlled:f,default:h,name:"FieldControl",state:"value"}),U=f!==void 0,V=U?Y:void 0,X=Ve(()=>z.inputRef.current?.value);return W_(z.inputRef,B,V,X,!D,d),Et("input",t,{ref:[a,q],state:I,props:[{id:B,disabled:D,name:L,ref:z.inputRef,"aria-labelledby":P,autoFocus:b,...U?{value:V}:{defaultValue:h},onChange(W){const $=W.currentTarget.value;g?.($,rt(ka,W.nativeEvent)),w($!==(E.initialValue??"")),T($!==""),W.nativeEvent.defaultPrevented||(M(L),z.change($))},onFocus(){R(!0)},onBlur(W){C(!0),R(!1),A==="onBlur"&&z.commit(W.currentTarget.value)},onKeyDown(W){W.currentTarget.tagName==="INPUT"&&W.key==="Enter"&&(C(!0),z.commit(W.currentTarget.value))}},y,W=>z.getValidationProps(D,W)],stateAttributesMapping:X_})}),pL=x.forwardRef(function(t,a){return n.jsx(fL,{ref:a,...t})});function mL({className:e,type:t,...a}){return n.jsx(pL,{type:t,"data-slot":"input",className:St("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...a})}function gL({className:e,...t}){return n.jsx("textarea",{"data-slot":"textarea",className:St("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}function hL(e){return Et(e.defaultTagName??"div",e,e)}const xL=K_("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function bL({className:e,variant:t="default",render:a,...r}){return hL({defaultTagName:"span",props:Ss({className:St(xL({variant:t}),e)},r),render:a,state:{slot:"badge",variant:t}})}const IN=x.createContext(void 0);function _L(){const e=x.useContext(IN);if(e===void 0)throw new Error(gn(63));return e}const $N={...X_,checked(e){return e?{"data-checked":""}:{"data-unchecked":""}}},vL=x.forwardRef(function(t,a){const{checked:r,className:i,defaultChecked:l,"aria-labelledby":d,form:f,id:p,inputRef:g,name:h,nativeButton:b=!1,onCheckedChange:_,readOnly:y=!1,required:S=!1,disabled:j=!1,render:k,uncheckedValue:C,value:w,style:E,...R}=t,{clearErrors:T}=Q_(),{state:A,setTouched:z,setDirty:M,validityData:D,setFilled:L,setFocused:I,validationMode:P,disabled:B,name:q,validation:Y}=gu(),{labelId:U}=Ep(),V=B||j,X=q??h,Q=x.useRef(null),W=ir(Q,g,Y.inputRef),$=x.useRef(null),K=ra(),J=Rp({id:p,implicit:!1,controlRef:$}),G=b?void 0:J,[te,se]=ol({controlled:r,default:!!l,name:"Switch",state:"checked"});W_($,K,te,void 0,!V,h),Pe(()=>{Q.current&&L(Q.current.checked)},[L]),L_(te,()=>{T(X),M(te!==D.initialValue),L(te),Y.change(te)});const{getButtonProps:pe,buttonRef:F}=ao({disabled:V,native:b}),oe=cL(d,U,Q,!b,G),_e={id:b?J:K,role:"switch","aria-checked":te,"aria-readonly":y||void 0,"aria-required":S||void 0,"aria-labelledby":oe,onFocus(){V||I(!0)},onBlur(){const Re=Q.current;!Re||V||(z(!0),I(!1),P==="onBlur"&&Y.commit(Re.checked))},onClick(Re){if(y||V)return;Re.preventDefault();const Ae=Q.current;Ae&&Dc(Ae,Re)}},le={...Y.getValidationProps(V),checked:te,disabled:V,form:f,id:G,name:X,required:S,style:X?KS:a_,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:W,onChange(Re){if(Re.nativeEvent.defaultPrevented)return;if(y){Re.preventDefault();return}const Ae=Re.currentTarget.checked,Ie=rt(ka,Re.nativeEvent);_?.(Ae,Ie),!Ie.isCanceled&&se(Ae)},onClick(Re){Re.stopPropagation()},onFocus(){$.current?.focus()},...w!==void 0?{value:w}:sn},be=x.useMemo(()=>({...A,checked:te,disabled:V,readOnly:y,required:S}),[A,te,V,y,S]),ke=Et("span",t,{state:be,ref:[a,$,F],props:[_e,R,pe,Re=>Y.getValidationProps(V,Re)],stateAttributesMapping:$N});return n.jsxs(IN.Provider,{value:be,children:[ke,!te&&X&&C!==void 0&&n.jsx("input",{type:"hidden",form:f,name:X,value:C,disabled:V}),n.jsx("input",{...le,suppressHydrationWarning:!0})]})}),yL=x.forwardRef(function(t,a){const{render:r,className:i,style:l,...d}=t,f=_L();return Et("span",t,{state:f,ref:a,stateAttributesMapping:$N,props:d})});function jL({className:e,size:t="default",...a}){return n.jsx(vL,{"data-slot":"switch","data-size":t,className:St("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...a,children:n.jsx(yL,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}function kL({className:e,...t}){return n.jsx(Js,{role:"status","aria-label":"Loading",className:St("size-4 animate-spin",e),...t})}const BN=x.createContext(void 0);function Qo(e){const t=x.useContext(BN);if(!e&&t===void 0)throw new Error(gn(27));return t}const UN=x.forwardRef(function(t,a){const{render:r,className:i,style:l,forceRender:d=!1,...f}=t,p=Qo(),g=p.useState("open"),h=p.useState("nested"),b=p.useState("mounted"),_=p.useState("transitionStatus");return Et("div",t,{state:{open:g,transitionStatus:_},ref:[p.context.backdropRef,a],stateAttributesMapping:E_,props:[{role:"presentation",hidden:!b,style:{userSelect:"none",WebkitUserSelect:"none"}},f],enabled:d||!h})}),Tp=x.forwardRef(function(t,a){const{render:r,className:i,style:l,disabled:d=!1,nativeButton:f=!0,...p}=t,g=Qo(),h=g.useState("open"),{getButtonProps:b,buttonRef:_}=ao({disabled:d,native:f}),y={disabled:d};function S(j){h&&g.setOpen(!1,rt(oz,j.nativeEvent))}return Et("button",t,{state:y,ref:[a,_],props:[{onClick:S},p,b]})}),qN=x.forwardRef(function(t,a){const{render:r,className:i,style:l,id:d,...f}=t,p=Qo(),g=ra(d);return p.useSyncedValueWithCleanup("descriptionElementId",g),Et("p",t,{ref:a,props:[{id:g},f]})}),HN=x.createContext(void 0);function wL(){const e=x.useContext(HN);if(e===void 0)throw new Error(gn(26));return e}const SL={...lu,...Yo,nestedDialogOpen(e){return e?{"data-nested-dialog-open":""}:null}},VN=x.forwardRef(function(t,a){const{render:r,className:i,style:l,finalFocus:d,initialFocus:f,...p}=t,g=Qo(),h=g.useState("descriptionElementId"),b=g.useState("disablePointerDismissal"),_=g.useState("floatingRootContext"),y=g.useState("popupProps"),S=g.useState("modal"),j=g.useState("mounted"),k=g.useState("nested"),C=g.useState("nestedOpenDialogCount"),w=g.useState("open"),E=g.useState("openMethod"),R=g.useState("titleElementId"),T=g.useState("transitionStatus"),A=g.useState("role"),z=_.useState("floatingId");wL(),Ca({open:w,ref:g.context.popupRef,onComplete(){w&&g.context.onOpenChangeComplete?.(!0)}});const M=f===void 0?i6(g.context.popupRef):f,D=C>0,L=g.useStateSetter("popupElement"),P=Et("div",t,{state:{open:w,nested:k,transitionStatus:T,nestedDialogOpen:D},props:[y,{id:z,"aria-labelledby":R,"aria-describedby":h,role:A,...bp,hidden:!j,onKeyDown(B){wp.has(B.key)&&B.stopPropagation()},style:{"--nested-dialogs":C}},p],ref:[a,g.context.popupRef,L],stateAttributesMapping:SL});return n.jsx(h_,{context:_,openInteractionType:E,disabled:!j,closeOnFocusOut:!b,initialFocus:M,returnFocus:d,modal:S!==!1,restoreFocus:"popup",children:P})}),FN=x.forwardRef(function(t,a){const{keepMounted:r=!1,...i}=t,l=Qo(),d=l.useState("mounted"),f=l.useState("modal"),p=l.useState("open");return d||r?n.jsx(HN.Provider,{value:r,children:n.jsxs(p_,{ref:a,...i,children:[d&&f===!0&&n.jsx(P_,{ref:l.context.internalBackdropRef,inert:jp(!p)}),t.children]})}):null});function CL({store:e,parentContext:t,isDrawer:a}){const r=e.useState("open"),i=e.useState("disablePointerDismissal"),l=e.useState("modal"),d=e.useState("popupElement"),f=e.useState("floatingRootContext"),[p,g]=x.useState(0),[h,b]=x.useState(0),_=p===0,y=gp(f,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:l==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(S){if(!e.context.outsidePressEnabledRef.current||"button"in S&&S.button!==0)return!1;if("touches"in S){if(S.type==="touchend"){if(S.changedTouches.length!==1||S.touches.length!==0)return!1}else if(S.touches.length!==1)return!1}const j=Hn(S);if(_&&!i){if(l){const k=e.context.internalBackdropRef.current,C=e.context.backdropRef.current;return k||C?k===j||C===j||Je(j,d)&&!j?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:_});return pN(r&&l===!0,d),e.useContextCallback("onNestedDialogOpen",(S,j)=>{g(S),b(j)}),Pe(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(p+1,h+(a?1:0)):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[a,r,p,h,t]),j_(e,{activeTriggerProps:y.reference,inactiveTriggerProps:y.trigger,popupProps:y.floating,nestedOpenDialogCount:p,nestedOpenDrawerCount:h}),null}const NL={...S_,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class EL extends ou{constructor(t,a,r){const i=new iu,l=RL(t,i,a,r);super(l,TL(i),NL)}setOpen=(t,a)=>{if(a.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&a.trigger==null&&this.state.activeTriggerId!=null&&(a.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,a),a.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,a);const r={open:t};__(r,t,a.trigger),this.update(r)}}function RL(e,t,a,r=!1){const i={...k_(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e};return i.floatingRootContext=LC(t,a,r),i}function TL(e){return{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function AL(e,t){const{children:a,open:r,defaultOpen:i=!1,onOpenChange:l,onOpenChangeComplete:d,disablePointerDismissal:f=!1,modal:p=!0,actionsRef:g,handle:h,triggerId:b,defaultTriggerId:_=null}=t,y=e==="drawer",S=p,j=f,k="dialog",C=Qo(!0),w=C!=null,E={modal:S,disablePointerDismissal:j,nested:w,role:k},R=OC((L,I)=>new EL({open:i,openProp:r,activeTriggerId:_,triggerIdProp:b,...E},L,I),!0);R.useControlledProp("openProp",r),R.useControlledProp("triggerIdProp",b),R.useSyncedValues(E),R.useContextCallback("onOpenChange",l),R.useContextCallback("onOpenChangeComplete",d);const T=R.useState("open"),A=R.useState("mounted"),z=R.useState("payload");u6(R,T),v_(R);const{forceUnmount:M}=y_(T,R);x.useImperativeHandle(g,()=>({unmount:M,close:()=>R.setOpen(!1,rt(n_))}),[M,R]);const D=T||A;return n.jsxs(BN.Provider,{value:R,children:[h&&n.jsx(b_,{handle:h,store:R}),D&&n.jsx(CL,{store:R,parentContext:C?.context,isDrawer:y}),typeof a=="function"?a({payload:z}):a]})}function GN(e){return AL("dialog",e)}const YN=x.forwardRef(function(t,a){const{render:r,className:i,style:l,id:d,...f}=t,p=Qo(),g=ra(d);return p.useSyncedValueWithCleanup("titleElementId",g),Et("h2",t,{ref:a,props:[{id:g},f]})});function Xx({...e}){return n.jsx(GN,{"data-slot":"dialog",...e})}function ML({...e}){return n.jsx(FN,{"data-slot":"dialog-portal",...e})}function zL({...e}){return n.jsx(Tp,{"data-slot":"dialog-close",...e})}function OL({className:e,...t}){return n.jsx(UN,{"data-slot":"dialog-overlay",className:St("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function Qx({className:e,children:t,showCloseButton:a=!0,...r}){return n.jsxs(ML,{children:[n.jsx(OL,{}),n.jsxs(VN,{"data-slot":"dialog-content",className:St("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...r,children:[t,a&&n.jsxs(Tp,{"data-slot":"dialog-close",render:n.jsx(lr,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[n.jsx(gs,{}),n.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Wx({className:e,...t}){return n.jsx("div",{"data-slot":"dialog-header",className:St("flex flex-col gap-2",e),...t})}function Gk({className:e,showCloseButton:t=!1,children:a,...r}){return n.jsxs("div",{"data-slot":"dialog-footer",className:St("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...r,children:[a,t&&n.jsx(Tp,{render:n.jsx(lr,{variant:"outline"}),children:"Close"})]})}function Zx({className:e,...t}){return n.jsx(YN,{"data-slot":"dialog-title",className:St("font-heading text-base leading-none font-medium",e),...t})}function DL({className:e,...t}){return n.jsx(qN,{"data-slot":"dialog-description",className:St("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function Jx({value:e,options:t,onChange:a,label:r}){return n.jsx("div",{className:"flex flex-wrap items-center gap-1",role:"group","aria-label":r,children:t.map(i=>n.jsx("button",{type:"button","aria-pressed":e===i.value,onClick:()=>a(i.value),className:me("rounded-md px-2.5 py-1 text-xs font-medium transition-colors",e===i.value?"bg-accent text-accent-fg":"text-muted-fg hover:bg-muted/50 hover:text-foreground"),children:PL(i.label)},i.value))})}function PL(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}const LL={primary:"default",secondary:"outline",ghost:"ghost",destructive:"destructive"},IL={sm:"sm",md:"default"};function ae({variant:e="secondary",size:t="md",loading:a,className:r,children:i,disabled:l,type:d="button",...f}){return n.jsxs(lr,{type:d,variant:LL[e],size:IL[t],disabled:l||a,className:r,...f,children:[a?n.jsx(bn,{size:14}):null,i]})}function Ce(e){return n.jsx(mL,{...e})}function un(e){return n.jsx(gL,{...e})}function $L(e){return n.jsx("select",{...e,className:me("h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",e.className)})}function ie({label:e,hint:t,badge:a,children:r}){return n.jsxs("div",{className:"block space-y-1",children:[n.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[e,a&&n.jsx("span",{className:"rounded bg-muted px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground",children:a})]}),r,t&&n.jsx("span",{className:"block text-[11px] text-muted-foreground/70",children:t})]})}function Dt({checked:e,onChange:t,label:a,disabled:r}){return n.jsxs("label",{className:me("inline-flex items-center gap-2",r&&"opacity-50"),children:[n.jsx(jL,{checked:e,onCheckedChange:t,disabled:r}),a&&n.jsx("span",{className:"text-sm",children:a})]})}function Be({children:e,tone:t="muted",className:a}){const r=t==="danger"?"destructive":t==="muted"?"secondary":"outline",i={muted:"",danger:"",success:"text-emerald-400 border-emerald-500/30",warning:"text-amber-400 border-amber-500/30",info:"text-sky-400 border-sky-500/30"};return n.jsx(bL,{variant:r,className:me("rounded-md",i[t],a),children:e})}function Bt({open:e,onClose:t,title:a,description:r,children:i,footer:l,size:d="md"}){const f={sm:"sm:max-w-md",md:"sm:max-w-lg",lg:"sm:max-w-2xl",xl:"sm:max-w-4xl"};return n.jsx(Xx,{open:e,onOpenChange:p=>{p||t()},children:n.jsxs(Qx,{className:me("flex max-h-[88vh] w-full flex-col gap-0 p-0",f[d]),children:[(a||r)&&n.jsxs(Wx,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[a&&n.jsx(Zx,{children:a}),r&&n.jsx(DL,{children:r})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-5 py-4",children:i}),l&&n.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t border-border px-5 py-4",children:l})]})})}function bn({size:e=14}){return n.jsx(kL,{style:{width:e,height:e}})}function ut({children:e}){return n.jsx("div",{className:"rounded-lg border border-dashed border-border bg-muted/20 px-4 py-6 text-center text-sm text-muted-foreground",children:e})}function tt({label:e="Cargando…"}){return n.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[n.jsx(bn,{})," ",e]})}const KN=x.createContext(null);let BL=1;function UL({children:e}){const[t,a]=x.useState([]),r=x.useCallback((l,d)=>{const f=BL++;a(p=>[...p,{id:f,kind:l,message:d}]),setTimeout(()=>{a(p=>p.filter(g=>g.id!==f))},4500)},[]),i=x.useMemo(()=>({show:r,success:l=>r("success",l),error:l=>r("error",l),info:l=>r("info",l)}),[r]);return x.useEffect(()=>(window.__apxToast=i,()=>{delete window.__apxToast}),[i]),n.jsxs(KN.Provider,{value:i,children:[e,n.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-[100] flex w-80 max-w-[calc(100vw-2rem)] flex-col gap-2",children:t.map(l=>n.jsx("div",{className:me("pointer-events-auto overflow-hidden rounded-lg border bg-card px-3 py-2 text-sm shadow-lg",l.kind==="success"&&"border-emerald-500/40",l.kind==="error"&&"border-destructive/60",l.kind==="info"&&"border-border"),children:n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("span",{className:me("mt-1 size-2 shrink-0 rounded-full",l.kind==="success"&&"bg-emerald-500",l.kind==="error"&&"bg-destructive",l.kind==="info"&&"bg-sky-500")}),n.jsx("span",{className:"flex-1 break-words",children:l.message})]})},l.id))})]})}function Xe(){const e=x.useContext(KN);if(!e)throw new Error("useToast must be used inside <ToastProvider>");return e}function XN(){const{data:e,error:t,isLoading:a}=$e("/api/health",()=>BP.get(),{refreshInterval:sp.health});return{health:e,error:t,isLoading:a,isUp:!t&&!!e}}function qL(){const{data:e,error:t,isLoading:a,mutate:r}=$e("/api/engines",()=>Yc.list());return{engines:e?.engines||[],error:t,isLoading:a,mutate:r}}function HL(){const{data:e,error:t,isLoading:a,mutate:r}=$e("/api/telegram/status",()=>Pn.status(),{refreshInterval:sp.telegramStatus});return{status:e,error:t,isLoading:a,mutate:r}}function Z_(){const{data:e,error:t,isLoading:a,mutate:r}=$e("/api/telegram/channels",()=>Pn.channels.list());return{channels:e?.channels||[],error:t,isLoading:a,mutate:r}}function J_(){const{data:e,error:t,isLoading:a,mutate:r}=$e("/api/telegram/contacts",()=>Pn.contacts.list());return{contacts:e?.contacts||[],roles:e?.roles||{},channelOwners:e?.channel_owners||[],error:t,isLoading:a,mutate:r}}function ps(e){return typeof e=="string"&&e.startsWith("*** set ***")}function Yr(e,t="(no seteada)"){return ps(e)?e:t}function $o(e){if(typeof e!="string")return null;const t=e.match(/\(\.\.\.([^)]+)\)/);return t?t[1]:null}function QN({channel:e,onClose:t,onSaved:a}){const r=Xe(),[i,l]=x.useState(!1),[d,f]=x.useState({name:""});x.useEffect(()=>{f(e?{...e,bot_token:""}:{name:""})},[e?.name]);const p=async()=>{if(!d.name?.trim()){r.error(u("telegram_channel_dialog.name_required"));return}l(!0);try{e&&e.name!==""&&e?.name===d.name?await Pn.channels.patch(e.name,d):await Pn.channels.upsert(d),r.success(u("telegram_channel_dialog.saved")),a()}catch(g){r.error(g.message)}finally{l(!1)}};return n.jsx(Bt,{open:!!e,onClose:t,title:e?.name?u("telegram_channel_dialog.edit_title",{name:e.name}):u("telegram_channel_dialog.new_title"),description:u("telegram_ui.channel_dialog_desc"),footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:t,disabled:i,children:u("common.cancel")}),n.jsx(ae,{variant:"primary",onClick:p,loading:i,children:u("common.save")})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(ie,{label:u("telegram_channel_dialog.name_label"),children:n.jsx(Ce,{value:d.name,onChange:g=>f({...d,name:g.target.value}),disabled:!!e?.name})}),n.jsx(ie,{label:u("telegram_channel_dialog.token_label"),hint:e?.bot_token?Yr(e.bot_token):u("telegram_ui.bot_token_hint"),children:n.jsx(Ce,{type:"password",value:d.bot_token||"",onChange:g=>f({...d,bot_token:g.target.value}),placeholder:e?.bot_token?Yr(e.bot_token):""})}),n.jsx(ie,{label:u("telegram_channel_dialog.chat_id"),children:n.jsx(Ce,{value:d.chat_id||"",onChange:g=>f({...d,chat_id:g.target.value})})}),n.jsx(ie,{label:u("telegram_channel_dialog.project_label"),hint:u("telegram_channel_dialog.project_hint"),children:n.jsx(Ce,{value:d.project||"",onChange:g=>f({...d,project:g.target.value})})}),n.jsx(ie,{label:u("telegram_channel_dialog.route_label"),hint:u("telegram_channel_dialog.route_hint"),children:n.jsx(Ce,{value:d.route_to_agent||"",onChange:g=>f({...d,route_to_agent:g.target.value})})}),n.jsx(ie,{label:u("telegram_channel_dialog.owner_label"),hint:u("telegram_channel_dialog.owner_hint"),children:n.jsx(Ce,{value:d.owner_user_id!=null?String(d.owner_user_id):"",onChange:g=>{const h=g.target.value.trim();f({...d,owner_user_id:h===""?void 0:/^\d+$/.test(h)?Number(h):h})},placeholder:"889721252"})}),n.jsx(Dt,{checked:!!d.respond_with_engine,onChange:g=>f({...d,respond_with_engine:g}),label:u("telegram_channel_dialog.respond_label")})]})})}function WN({channel:e,onClose:t}){const a=Xe(),[r,i]=x.useState(u("admin.telegram_default_message")),[l,d]=x.useState(!1),f=async()=>{if(!(!r.trim()||!e)){d(!0);try{await Pn.send({text:r,channel:e.name}),a.success(u("telegram_ui.message_sent")),t()}catch(p){a.error(p.message)}finally{d(!1)}}};return n.jsx(Bt,{open:!!e,onClose:t,title:e?u("telegram_send_dialog.title",{name:e.name}):"",description:e?u("telegram_ui.send_chat_id",{id:e.chat_id||"—"}):"",footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:t,disabled:l,children:u("common.cancel")}),n.jsx(ae,{variant:"primary",onClick:f,loading:l,children:u("chat_ui.send")})]}),children:n.jsx(ie,{label:u("telegram_ui.message_label"),children:n.jsx(un,{rows:4,value:r,onChange:p=>i(p.target.value)})})})}function ZN({bare:e=!1}){const t=Xe(),{contacts:a,roles:r,channelOwners:i,isLoading:l,mutate:d}=J_(),f=new Set(i.filter(_=>_.owner_user_id!=null).map(_=>String(_.owner_user_id))),p=Array.from(new Set(["owner","guest",...Object.keys(r)])),g=async(_,y)=>{try{await Pn.contacts.patch(_.user_id,{role:y}),t.success(u("telegram_ui.role_assigned",{name:_.name||_.user_id,role:y})),d()}catch(S){t.error(S.message)}},h=async _=>{if(confirm(u("telegram_contacts.delete_confirm",{name:_.name||String(_.user_id)})))try{await Pn.contacts.remove(_.user_id),t.success(u("telegram_contacts.removed")),d()}catch(y){t.error(y.message)}},b=n.jsxs(n.Fragment,{children:[l&&n.jsx(tt,{}),!l&&a.length===0&&n.jsx(ut,{children:u("telegram_contacts.empty")}),a.length>0&&n.jsx("ul",{className:"space-y-2 text-sm",children:a.map(_=>{const y=f.has(String(_.user_id)),S=y?"owner":_.role||"guest";return n.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("span",{className:"font-medium",children:_.name||"—"}),_.username&&n.jsxs("span",{className:"ml-2 text-xs text-muted-fg",children:["@",_.username]}),y&&n.jsx(Be,{tone:"success",children:u("telegram_contacts.owner_badge")})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ue,{content:u(y?"telegram_contacts.owner_hint":"telegram_contacts.assign_role"),children:n.jsx($L,{value:S,disabled:y,onChange:j=>g(_,j.target.value),children:p.map(j=>n.jsx("option",{value:j,children:j},j))})}),n.jsx(ae,{size:"sm",variant:"destructive",onClick:()=>h(_),children:u("common.delete")})]})]}),n.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[n.jsxs("span",{children:["user_id: ",String(_.user_id)]}),n.jsxs("span",{children:[u("telegram_contacts.last_seen")," ",_.last_seen?_.last_seen.slice(0,10):"—"]}),n.jsx("span",{children:VL(r[S])})]})]},String(_.user_id))})})]});return e?b:n.jsx(qe,{title:u("telegram_contacts.title"),description:u("telegram_contacts.desc"),children:b})}function VL(e){return!e||e.tools===void 0?"":e.tools==="*"?u("telegram_contacts.tools_all"):Array.isArray(e.tools)?e.tools.length?`${u("telegram_contacts.tools_label")} ${e.tools.join(", ")}`:u("telegram_contacts.tools_none"):""}function FL(){const e=Sn(),[t,a]=Vo(),r=Xe(),{health:i,isUp:l}=XN(),{projects:d,isLoading:f,mutate:p}=Xo(),{engines:g,isLoading:h}=qL(),{status:b,mutate:_}=HL(),{channels:y,isLoading:S,mutate:j}=Z_(),[k,C]=x.useState(null),[w,E]=x.useState(null),R=async()=>{try{await ll.reload(),r.success(u("admin.reload_success"))}catch(M){r.error(M.message)}},T=async()=>{try{b?.enabled?(await Pn.stop(),r.info(u("admin.telegram_polling_stopped"))):(await Pn.start(),r.success(u("admin.telegram_polling_started"))),_()}catch(M){r.error(M.message)}},A=async M=>{if(confirm(u("telegram_channels.delete_confirm",{name:M})))try{await Pn.channels.remove(M),r.success(u("admin.telegram_channel_removed")),j()}catch(D){r.error(D.message)}},z=async(M,D)=>{if(confirm(u("admin.unregister_confirm",{label:D})))try{await Zn.remove(M),r.success(u("project.unregistered")),p()}catch(L){r.error(L.message)}};return n.jsxs("div",{className:"mx-auto max-w-5xl space-y-6 p-6","data-testid":"screen-admin",children:[n.jsxs("header",{className:"flex items-end justify-between",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:u("admin.title")}),n.jsx("p",{className:"text-sm text-muted-fg",children:u("admin.subtitle")})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(Ue,{content:u("daemon.reload_hint"),children:n.jsxs(ae,{size:"sm",onClick:R,children:[u("common.reload")," config"]})}),n.jsxs(ae,{size:"sm",variant:"primary",onClick:()=>{const M=new URLSearchParams(t);M.set("action","add-project"),a(M)},children:[n.jsx(Ot,{size:14})," ",u("nav.project")]})]})]}),n.jsx(qe,{title:u("daemon.version"),children:n.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[n.jsx(Sh,{label:u("daemon.version"),value:i?.version||"—"}),n.jsx(Sh,{label:u("daemon.uptime"),value:i?`${i.uptime_s}s`:"—"}),n.jsx(Sh,{label:u("daemon.status"),value:u(l?"daemon.running":"daemon.down"),ok:l})]})}),n.jsxs(qe,{title:u("admin.engines_title"),description:u("admin.engines_subtitle"),children:[h&&n.jsx(tt,{}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:g.map(M=>n.jsx(Be,{tone:"info",children:M},M))})]}),n.jsxs(qe,{title:u("admin.telegram_title"),description:u("admin.telegram_subtitle"),action:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Dt,{checked:!!b?.enabled,onChange:T,label:b?.enabled?u("admin.telegram_polling_on"):u("admin.telegram_polling_off")}),n.jsxs(ae,{size:"sm",onClick:()=>C({name:""}),children:[n.jsx(Ot,{size:14})," ",u("admin.telegram_add_channel")]})]}),children:[S&&n.jsx(tt,{}),y.length===0&&n.jsx(ut,{children:u("common.none_yet")}),n.jsx("ul",{className:"space-y-2 text-sm",children:y.map(M=>n.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("span",{className:"font-medium",children:M.name}),n.jsxs("div",{className:"flex items-center gap-2",children:[M.project&&n.jsxs(Be,{tone:"success",children:["project = ",M.project]}),n.jsxs(ae,{size:"sm",variant:"ghost",onClick:()=>E(M),children:[n.jsx(Sa,{size:13})," ",u("admin.telegram_send_test")]}),n.jsx(ae,{size:"sm",variant:"secondary",onClick:()=>C(M),children:u("common.edit")}),n.jsx(ae,{size:"sm",variant:"destructive",onClick:()=>A(M.name),children:u("common.delete")})]})]}),n.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[n.jsxs("span",{children:["chat_id: ",M.chat_id||"—"]}),n.jsxs("span",{children:["route_to_agent: ",M.route_to_agent||"default APX"]}),n.jsxs("span",{children:["engine: ",M.respond_with_engine?u("admin.engine_badge"):u("admin.engine_badge_no")]})]})]},M.name))})]}),n.jsx(ZN,{}),n.jsxs(qe,{title:u("admin.projects_title"),description:u("admin.projects_subtitle"),children:[f&&n.jsx(tt,{}),n.jsx("ul",{className:"divide-y divide-border",children:d.map(M=>n.jsxs("li",{className:"flex items-center gap-3 py-2",children:[n.jsxs("span",{className:"w-10 font-mono text-xs text-muted-fg",children:["#",M.id]}),n.jsxs("button",{type:"button",className:"flex-1 text-left hover:underline",onClick:()=>e(`/p/${M.id}`),children:[n.jsx("span",{className:"font-medium",children:M.name||M.path.split("/").pop()}),n.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:M.path})]}),n.jsxs(Be,{children:[M.agents??0," ",u("admin.agents_badge")]}),Number(M.id)!==0&&n.jsx(ae,{size:"sm",variant:"destructive",onClick:()=>z(String(M.id),M.name||M.path),children:u("admin.unregister")})]},M.id))})]}),n.jsx(QN,{channel:k,onClose:()=>C(null),onSaved:()=>{C(null),j()}}),n.jsx(WN,{channel:w,onClose:()=>E(null)})]})}function Sh({label:e,value:t,ok:a}){return n.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),n.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[a!==void 0&&n.jsx(mu,{ok:a}),n.jsx("span",{children:t})]})]})}const Yk=["bg-emerald-500","bg-orange-500","bg-violet-500","bg-sky-500","bg-rose-500","bg-amber-500","bg-teal-500","bg-fuchsia-500"];function GL(e){let t=0;for(let a=0;a<e.length;a++)t=t*31+e.charCodeAt(a)>>>0;return Yk[t%Yk.length]}function eb(e){return`${e.project_id??"global"}::${e.agent_slug}`}function YL(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?"":new Date().toDateString()===t.toDateString()?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):t.toLocaleDateString(void 0,{day:"numeric",month:"short"})}function KL({rows:e,selectedKey:t,onSelect:a,action:r}){const[i,l]=x.useState(""),d=x.useMemo(()=>{const f=i.trim().toLowerCase();return f?e.filter(p=>[p.agent_name,p.agent_slug,p.project_name,p.preview].filter(Boolean).some(g=>String(g).toLowerCase().includes(f))):e},[e,i]);return n.jsxs("aside",{className:"flex w-full shrink-0 flex-col border-r border-border sm:w-72","data-testid":"inbox-list",children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border p-2",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx(Oo,{size:13,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-fg"}),n.jsx("input",{value:i,onChange:f=>l(f.target.value),placeholder:u("inbox.search"),"aria-label":u("inbox.search"),className:"w-full rounded-lg border border-border bg-muted/30 py-1.5 pl-7 pr-2 text-sm outline-none placeholder:text-muted-fg focus:border-primary/60"})]}),r]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-1.5",children:[d.length?null:n.jsx("p",{className:"px-3 py-6 text-center text-xs text-muted-fg",children:u(i?"inbox.no_match":"inbox.empty")}),d.map(f=>{const p=eb(f),g=p===t,h=f.agent_name||f.agent_slug;return n.jsxs("button",{type:"button","data-testid":`inbox-row-${f.agent_slug}`,onClick:()=>a(f),className:me("flex w-full items-start gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors",g?"bg-accent text-accent-fg":"hover:bg-muted/50"),children:[n.jsx("span",{className:me("mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-full text-sm",GL(f.agent_slug)),"aria-hidden":!0,children:f.agent_emoji||h.slice(0,1).toUpperCase()}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"flex items-baseline gap-2",children:[n.jsx("span",{className:"truncate text-sm font-medium",children:h}),f.pinned?n.jsx("span",{className:"shrink-0 rounded bg-primary/15 px-1 text-[9px] font-semibold uppercase tracking-wide text-primary",children:u("inbox.pinned")}):null,n.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-muted-fg",children:YL(f.last_activity_at)})]}),n.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5 text-[10px] text-muted-fg",children:[f.project_name?n.jsx("span",{className:"truncate",children:f.project_name}):null,f.channel?n.jsxs("span",{className:"opacity-70",children:["· ",f.channel]}):null]}),n.jsx("span",{className:"mt-0.5 block truncate text-xs text-muted-fg",children:f.preview||u("inbox.no_reply_yet")})]})]},p)})]})]})}function ev({value:e,onValueChange:t,onSubmit:a,onStop:r,busy:i=!1,disabled:l=!1,placeholder:d,autoFocus:f,minRows:p=2,maxRows:g=8,footer:h,className:b}){const _=x.useRef(null);x.useLayoutEffect(()=>{const S=_.current;if(!S)return;const j=()=>{S.style.height="auto",S.offsetHeight;const C=parseFloat(getComputedStyle(S).lineHeight)||20,w=C*p,E=C*g;S.style.height=`${Math.min(Math.max(S.scrollHeight,w),E)}px`,S.style.overflowY=S.scrollHeight>E?"auto":"hidden"};j();const k=requestAnimationFrame(j);return()=>cancelAnimationFrame(k)},[e,p,g]);const y=e.trim().length>0&&!l;return n.jsxs("div",{className:St("flex flex-col gap-1.5 rounded-2xl border border-border bg-muted/60 p-2 shadow-sm transition-colors","focus-within:border-foreground/25 focus-within:bg-muted",l&&"opacity-60",b),children:[n.jsx("textarea",{ref:_,rows:p,value:e,autoFocus:f,disabled:l,placeholder:d,onChange:S=>t(S.target.value),onKeyDown:S=>{if(S.key==="Enter"&&!S.shiftKey){if(S.preventDefault(),i||!y)return;a()}},className:"w-full resize-none bg-transparent px-2 pt-1 text-sm leading-relaxed outline-none placeholder:text-muted-foreground"}),n.jsxs("div",{className:"flex items-center justify-between gap-2 pl-1",children:[n.jsx("div",{className:"flex min-w-0 items-center gap-2 text-[11px] text-muted-foreground",children:h}),i&&r?n.jsx(Ue,{content:u("chat_ui.stop"),children:n.jsx(lr,{type:"button",size:"icon-sm",variant:"destructive",onClick:r,"aria-label":u("chat_ui.stop"),children:n.jsx(Bb,{className:"size-3.5",fill:"currentColor"})})}):n.jsx(Ue,{content:u("chat_ui.send"),children:n.jsx(lr,{type:"button",size:"icon-sm",variant:"default",onClick:a,disabled:!y,"aria-label":u("chat_ui.send"),children:n.jsx(FA,{className:"size-4"})})})]})]})}function tv({value:e,onChange:t,disabled:a}){const[r,i]=x.useState(!1),[l,d]=x.useState(""),[f,p]=x.useState([]),[g,h]=x.useState(!1),b=x.useRef(null);x.useEffect(()=>{if(!r)return;const k=C=>{b.current&&!b.current.contains(C.target)&&i(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[r]),x.useEffect(()=>{if(!r||g)return;let k=!1;return(async()=>{try{const{engines:C}=await Yc.list(),w=await Promise.all(C.map(E=>Yc.models({engine:E}).then(R=>(R.models||[]).map(T=>T.includes(":")?T:`${E}:${T}`)).catch(()=>[])));if(!k){const E=Array.from(new Set(w.flat())).sort();p(E),h(!0)}}catch{k||h(!0)}})(),()=>{k=!0}},[r,g]);const _=l.trim().toLowerCase(),y=_?f.filter(k=>k.toLowerCase().includes(_)):f,S=e||u("shared_ui.auto"),j=k=>{t(k),i(!1),d("")};return n.jsxs("div",{ref:b,className:"relative",children:[n.jsx(Ue,{content:u("chat_ui.pick_model"),children:n.jsxs("button",{type:"button",disabled:a,onClick:()=>i(k=>!k),"data-testid":"chat-model-picker",className:me("flex max-w-[200px] items-center gap-1 rounded-md border border-transparent px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors","hover:bg-accent/60 hover:text-foreground",e&&"text-foreground"),"aria-label":u("chat_ui.pick_model"),children:[n.jsx(CS,{className:"size-3 shrink-0"}),n.jsx("span",{className:"truncate font-mono",children:S}),n.jsx(ms,{className:"size-3 shrink-0 opacity-60"})]})}),r&&n.jsxs("div",{className:"absolute bottom-full left-0 z-50 mb-1.5 w-64 rounded-lg border border-border bg-popover p-1.5 shadow-md ring-1 ring-foreground/10",children:[n.jsx("input",{autoFocus:!0,value:l,placeholder:u("shared_ui.model_filter_ph"),onChange:k=>d(k.target.value),onKeyDown:k=>{k.key==="Enter"&&l.trim()&&j(l.trim())},className:"mb-1 w-full rounded-md border border-border bg-background px-2 py-1 text-xs outline-none focus:border-foreground/30"}),n.jsxs("ul",{className:"max-h-56 overflow-y-auto",children:[n.jsx("li",{children:n.jsxs("button",{type:"button",onMouseDown:k=>{k.preventDefault(),j("")},className:me("flex w-full items-center justify-between rounded-md px-2 py-1 text-left text-xs hover:bg-accent hover:text-accent-fg",!e&&"bg-accent/50"),children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(gs,{className:"size-3"})," ",u("shared_ui.auto_router")]}),!e&&n.jsx(Xr,{className:"size-3"})]})}),!g&&n.jsx("li",{className:"px-2 py-1 text-[11px] text-muted-fg",children:u("shared_ui.loading_models")}),g&&y.length===0&&l.trim()&&n.jsx("li",{children:n.jsx("button",{type:"button",onMouseDown:k=>{k.preventDefault(),j(l.trim())},className:"w-full rounded-md px-2 py-1 text-left font-mono text-xs hover:bg-accent hover:text-accent-fg",children:u("shared_ui.use_value",{value:l.trim()})})}),y.map(k=>n.jsx("li",{children:n.jsxs("button",{type:"button",onMouseDown:C=>{C.preventDefault(),j(k)},className:me("flex w-full items-center justify-between rounded-md px-2 py-1 text-left font-mono text-xs hover:bg-accent hover:text-accent-fg",k===e&&"bg-accent/50"),children:[n.jsx("span",{className:"truncate",children:k}),k===e&&n.jsx(Xr,{className:"size-3 shrink-0"})]})},k))]})]})]})}function XL({onSend:e,onStop:t,streaming:a,model:r,onModelChange:i}){const[l,d]=x.useState(""),f=()=>{const p=l.trim();p&&(d(""),e(p))};return n.jsx("div",{className:"border-t border-border bg-card/60 p-3",children:n.jsx(ev,{value:l,onValueChange:d,onSubmit:f,onStop:t,busy:a,placeholder:u("project.chat.placeholder"),maxRows:12,footer:i?n.jsx(tv,{value:r||"",onChange:i,disabled:a}):void 0})})}function QL(){return{read_file:{icon:Wf,label:u("shared_ui.tool_read_file")},write_file:{icon:pM,label:u("shared_ui.tool_write_file")},edit_file:{icon:bf,label:u("shared_ui.tool_edit_file")},list_files:{icon:Ob,label:u("shared_ui.tool_list_files")},search_files:{icon:Oo,label:u("shared_ui.tool_search_files")},search_messages:{icon:Oo,label:u("shared_ui.tool_search_messages")},tail_messages:{icon:Oo,label:u("shared_ui.tool_tail_messages")},run_shell:{icon:ya,label:u("shared_ui.tool_run_shell")},send_telegram:{icon:Sa,label:u("shared_ui.tool_send_telegram")},call_agent:{icon:rn,label:u("shared_ui.tool_call_agent")},call_mcp:{icon:BM,label:u("shared_ui.tool_call_mcp")},call_runtime:{icon:rn,label:u("shared_ui.tool_call_runtime")},create_task:{icon:RM,label:u("shared_ui.tool_create_task")}}}const JN=new Set(["write_file","edit_file"]);function WL(e){return QL()[e]||{icon:aa,label:e}}function ZL(e,t){if(!t)return"";const a=i=>typeof t[i]=="string"?t[i]:void 0,r=a("path")||a("file")||a("pattern")||a("query")||a("command")||a("slug")||a("name")||a("agent");return r?String(r):""}function Kk(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function JL({status:e}){return e==="running"?n.jsx(Js,{className:"size-3 shrink-0 animate-spin text-sky-400"}):e==="error"?n.jsx(gs,{className:"size-3 shrink-0 text-rose-400"}):e==="deduped"?n.jsx(cM,{className:"size-3 shrink-0 text-amber-400"}):n.jsx(Xr,{className:"size-3 shrink-0 text-emerald-400"})}function e8({part:e}){const[t,a]=x.useState(!1),{icon:r,label:i}=WL(e.tool),l=ZL(e.tool,e.args),d=JN.has(e.tool),f=!!e.args||e.result!==void 0;return n.jsxs("div",{className:me("rounded-lg border bg-muted/30 text-[12px]",e.status==="error"?"border-rose-500/30":"border-border"),children:[n.jsxs("button",{type:"button",onClick:()=>f&&a(p=>!p),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left",children:[f?n.jsx(eo,{className:me("size-3 shrink-0 text-muted-foreground transition-transform",t&&"rotate-90")}):n.jsx("span",{className:"size-3 shrink-0"}),n.jsx(r,{className:me("size-3.5 shrink-0",d?"text-violet-400":"text-muted-foreground")}),n.jsx("span",{className:"shrink-0 font-medium",children:i}),l&&n.jsx("span",{className:"truncate font-mono text-muted-foreground",children:l}),n.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[e.status==="deduped"&&n.jsx("span",{className:"text-[10px] text-amber-400",children:u("shared_ui.dedup")}),n.jsx(JL,{status:e.status})]})]}),t&&f&&n.jsxs("div",{className:"space-y-2 border-t border-border/60 px-2.5 py-2",children:[e.args&&Object.keys(e.args).length>0&&n.jsxs("div",{children:[n.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:u("shared_ui.args")}),n.jsx("pre",{className:"max-h-48 overflow-auto rounded-md bg-background/60 p-2 font-mono text-[11px] leading-relaxed text-foreground",children:Kk(e.args)})]}),e.result!==void 0&&n.jsxs("div",{children:[n.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:u("shared_ui.result")}),n.jsx("pre",{className:me("max-h-64 overflow-auto rounded-md bg-background/60 p-2 font-mono text-[11px] leading-relaxed",e.status==="error"?"text-rose-300":"text-foreground"),children:Kk(e.result)})]})]})]})}function t8(e){const t=e.args;return(t&&Array.isArray(t.questions)?t.questions:[]).map(r=>typeof r=="string"?r:r&&typeof r=="object"&&typeof r.question=="string"?r.question:null).filter(r=>!!r)}function n8({part:e,pending:t}){const a=t8(e),r=u(t?"ask_panel.status_waiting":"ask_panel.status_received");return n.jsxs("div",{className:me("rounded-2xl border px-3 py-2 text-sm shadow-sm",t?"rounded-bl-sm border-amber-500/30 bg-amber-500/5 text-foreground":"rounded-bl-sm border-emerald-500/30 bg-emerald-500/5 text-foreground"),"data-testid":"ask-questions-card","data-state":t?"pending":"answered",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[t?n.jsx(Js,{className:"size-3.5 shrink-0 animate-spin text-amber-600 dark:text-amber-400"}):n.jsx(Qf,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),n.jsx(wS,{className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"text-[12px] font-medium",children:r}),a.length>1&&n.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[a.length," preguntas"]})]}),a.length>0&&n.jsx("ul",{className:"mt-1.5 space-y-0.5 pl-5 text-[12px] text-muted-foreground",children:a.map((i,l)=>n.jsx("li",{className:"list-disc",children:i},l))})]})}function eE(e){const t=e.split(`
813
+ `),a=[];let r=null;for(const i of t)if(i.startsWith("- "))r&&a.push(r),r={question:i.slice(2),answer:"",skipped:!1};else if(i.startsWith(" → ")&&r){const l=i.slice(4);r.answer=l,r.skipped=l==="(omitido)"}else return null;return r&&a.push(r),a.length>0?a:null}function s8({text:e}){const t=eE(e);return t?n.jsx("div",{className:"flex w-full justify-center",children:n.jsxs("div",{className:"w-full max-w-[85%] rounded-2xl border border-border/70 bg-card/40 px-4 py-3 shadow-sm","data-testid":"ask-answers-card",children:[n.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[n.jsx(wS,{className:"size-3.5"}),n.jsx("span",{children:u("ask_panel.answers_header")})]}),n.jsx("ul",{className:"space-y-2.5",children:t.map((a,r)=>n.jsxs("li",{className:"space-y-0.5",children:[n.jsx("div",{className:"text-sm font-medium leading-snug text-foreground",children:a.question}),n.jsx("div",{className:me("whitespace-pre-wrap text-[13px] leading-snug",a.skipped?"italic text-muted-foreground/70":"text-muted-foreground"),children:a.answer})]},r))})]})}):null}function tb(e){return e.parts.filter(t=>t.kind==="text").map(t=>t.text).join(`
814
+
815
+ `).trim()}function a8(e){const t=e.args?.questions;if(!Array.isArray(t)||t.length===0)return null;const a=t.map(r=>{if(typeof r=="string")return`- ${r}`;if(!r||typeof r!="object")return null;const i=r;if(typeof i.question!="string")return null;const d=(Array.isArray(i.options)?i.options:[]).map(f=>typeof f=="string"?f:f&&typeof f=="object"&&typeof f.label=="string"?f.label:"").filter(f=>f).join(", ");return d?`- ${i.question} (opciones: ${d})`:`- ${i.question}`}).filter(r=>!!r);return a.length===0?null:`[ask_questions]
816
+ ${a.join(`
817
+ `)}`}function r8(e){const t=[];for(const a of e.parts)if(a.kind==="text"&&a.text)t.push(a.text);else if(a.kind==="tool"&&a.tool==="ask_questions"){const r=a8(a);r&&t.push(r)}return t.join(`
818
+
819
+ `).trim()}const tE=e=>[{kind:"text",text:e}];function nE(e){if(!e||typeof e!="object")return!1;const t=e;return"error"in t&&!!t.error}function o8(e){const t=[];let a=null,r,i=0;for(const l of e){const d=l.ts||new Date().toISOString();if(l.role==="user")a=null,r=void 0,t.push({role:"user",parts:tE(l.content),ts:d});else if(l.role==="assistant"||l.role==="tool"){const f=l.role==="assistant"?l.agent:r;(!a||l.role==="assistant"&&f!==r)&&(a={role:"assistant",parts:[],ts:d},r=f,t.push(a)),l.role==="tool"?a.parts.push({kind:"tool",id:`hist-${i++}`,tool:l.tool||"tool",args:l.args,result:l.result,status:nE(l.result)?"error":"done"}):(l.agent&&(a.agentId=l.agent),l.agent_name&&(a.agent=l.agent_name),l.model&&(a.model=l.model),l.tool_summary&&(a.toolSummary=l.tool_summary),l.usage&&(a.usage={input_tokens:(a.usage?.input_tokens||0)+(l.usage.input_tokens||0),output_tokens:(a.usage?.output_tokens||0)+(l.usage.output_tokens||0)}),l.content&&a.parts.push({kind:"text",text:l.content}))}}return t}function nv(e,t){const a=r=>({...e,notes:[...e.notes||[],r]});switch(t.type){case"model_start":return t.model?{...e,model:t.model}:e;case"model_routed":{const r=t.model?{...e,model:t.model}:e;return t.from_fallback?{...r,notes:[...r.notes||[],`routing fell back → ${t.model}`]}:r}case"engine_failed":return a(`engine ${t.model||"?"} failed → ${t.retry_with||"retry"}`);case"model_retry":return a(`retry (${t.reason||"?"})`);case"tools_suppressed":return a(`tools suppressed: ${(t.tools||[]).join(", ")}`);case"skill_inspector":{const r=t.inspector;return!r||!r.loaded?.length&&!r.hinted?.length?e:{...e,inspector:{embedder:r.embedder,loaded:r.loaded||[],hinted:r.hinted||[]}}}case"assistant_text":return t.text?{...e,parts:[...e.parts,{kind:"text",text:t.text}]}:e;case"tool_start":return t.trace?{...e,parts:[...e.parts,{kind:"tool",id:t.trace.id,tool:t.trace.tool,args:t.trace.args,status:"running"}]}:e;case"tool_deduped":return t.trace?{...e,parts:e.parts.map(r=>r.kind==="tool"&&r.id===t.trace.id?{...r,status:"deduped"}:r)}:e;case"tool_result":if(!t.trace)return e;{const r=nE(t.trace.result);return{...e,parts:e.parts.map(i=>i.kind==="tool"&&i.id===t.trace.id?{...i,result:t.trace.result,status:r?"error":i.status==="deduped"?"deduped":"done"}:i)}}case"final":return{...e,pending:!1,usage:t.result?.usage??e.usage,model:e.model??t.result?.model,agent:e.agent??t.result?.name,parts:t.result?.text&&!e.parts.some(r=>r.kind==="text")?[...e.parts,{kind:"text",text:t.result.text}]:e.parts};default:{const r=t.delta||t.content||"";if(!r)return e;const i=[...e.parts],l=i[i.length-1];return l&&l.kind==="text"?i[i.length-1]={...l,text:l.text+r}:i.push({kind:"text",text:r}),{...e,parts:i}}}}function i8(e,t){const[a,r]=x.useState([]),[i,l]=x.useState(!1),[d,f]=x.useState(void 0),p=x.useRef(null),g=x.useRef(void 0),h=x.useRef(0),b=x.useCallback(w=>{r(E=>{const R=[...E],T=R[R.length-1];return T&&T.role==="assistant"&&(R[R.length-1]=w(T)),R})},[]),_=x.useCallback(w=>{if(w.type==="error"){t?.(w.error||u("shared_ui.err_stream"));return}b(E=>nv(E,w))},[b,t]),y=x.useCallback(async(w,E={})=>{const R=w.trim();if(!R||i)return;const T=()=>new Date().toISOString(),A=a.map(M=>({role:M.role,content:r8(M)}));if(r(M=>[...M,{role:"user",parts:tE(R),ts:T()},{role:"assistant",parts:[],ts:T(),pending:!0}]),l(!0),E.agentSlug){try{const M=await an.chat(e,E.agentSlug,{prompt:R,conversation_id:g.current,model:E.model||void 0,channel:"web"});g.current=M.conversation_id,f(M.conversation_id),b(D=>({...D,pending:!1,model:M.engine,agent:E.agentSlug,agentId:E.agentSlug,usage:M.usage,parts:[{kind:"text",text:M.text}]}))}catch(M){t?.(M?.message||u("shared_ui.err_chat_failed")),r(D=>D.filter((L,I)=>I!==D.length-1))}finally{l(!1)}return}const z=new AbortController;p.current=z;try{await DN.stream(e,{prompt:R,previousMessages:A,model:E.model||void 0,channel:"web"},_,z.signal),b(M=>({...M,pending:!1}))}catch(M){z.signal.aborted?b(D=>({...D,pending:!1,parts:[...D.parts,{kind:"text",text:u("code_module.stopped")}]})):(t?.(M?.message||u("shared_ui.err_stream_failed")),r(D=>D.filter((L,I)=>I!==D.length-1)))}finally{l(!1),p.current=null}},[e,a,i,_,b,t]),S=x.useCallback(()=>p.current?.abort(),[]),j=x.useCallback(()=>{i||(h.current++,g.current=void 0,f(void 0),r([]))},[i]),k=x.useCallback(async(w,E)=>{if(i)return;const R=++h.current;r([]);try{const T=await Jr.get(e,w,E);if(R!==h.current)return;const A=(T.messages??[]).filter(z=>z.role==="user"||z.role==="assistant").map(z=>({role:z.role,parts:[{kind:"text",text:z.content}],ts:z.ts||new Date().toISOString()}));g.current=E,f(E),r(A)}catch(T){if(R!==h.current)return;g.current=void 0,f(void 0),r([]),t?.(T?.message||u("shared_ui.err_load_conversation"))}},[e,i,t]),C=x.useCallback(async(w,E)=>{if(i)return;const R=++h.current;r([]);try{const T=await Jr.thread(e,w,E);if(R!==h.current)return;const A=o8(T.messages??[]);g.current=void 0,f(void 0),r(A)}catch(T){if(R!==h.current)return;g.current=void 0,f(void 0),r([]),t?.(T?.message||u("shared_ui.err_load_conversation"))}},[e,i,t]);return{msgs:a,send:y,stop:S,clear:j,load:k,loadThread:C,streaming:i,conversationId:d}}function l8({msg:e,isLast:t,isAskAnswer:a,onCopy:r}){const i=e.role==="user",l=tb(e),d=e.parts.some(f=>f.kind==="tool");if(i&&a){const f=tb(e);if(eE(f))return n.jsx(s8,{text:f})}return n.jsxs("div",{className:me("group flex items-start gap-2",i?"justify-end":"justify-start"),children:[!i&&n.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:n.jsx(rn,{size:14})}),n.jsxs("div",{className:me("flex min-w-0 flex-col gap-1.5",i?"items-end":"w-full max-w-[85%]"),children:[!i&&e.notes&&e.notes.length>0&&n.jsx("div",{className:"flex flex-col gap-0.5",children:e.notes.map((f,p)=>n.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-amber-400/80",children:[n.jsx(Jf,{size:10})," ",f]},p))}),!i&&e.inspector&&(e.inspector.loaded?.length||e.inspector.hinted?.length)?n.jsx(Ue,{content:u("shared_ui.skill_inspector_title",{embedder:e.inspector.embedder||"RAG"}),children:n.jsxs("div",{className:"flex flex-wrap items-center gap-1 text-[10px] text-sky-400/90",children:[n.jsx(sa,{size:10}),e.inspector.loaded?.map(f=>n.jsx("span",{className:"rounded bg-sky-500/15 px-1 py-0.5 font-mono",children:f},`l-${f}`)),e.inspector.hinted?.map(f=>n.jsxs("span",{className:"rounded border border-sky-500/30 px-1 py-0.5 font-mono opacity-70",children:[f,"?"]},`h-${f}`))]})}):null,e.parts.map((f,p)=>f.kind==="tool"?f.tool==="ask_questions"&&!i?n.jsx(n8,{part:f,pending:!!t},`${f.id}-${p}`):n.jsx(e8,{part:f},`${f.id}-${p}`):f.text?n.jsx("div",{className:me("whitespace-pre-wrap rounded-2xl px-3 py-2 text-sm leading-relaxed shadow-sm",i?"rounded-br-sm border border-emerald-500/30 bg-emerald-500/10 text-foreground dark:bg-emerald-500/15":"w-full rounded-bl-sm border border-border bg-card text-foreground"),children:f.text},p):null),!i&&e.pending&&e.parts.length===0&&n.jsx("div",{className:"rounded-2xl rounded-bl-sm border border-border bg-card px-3 py-2 text-sm text-muted-foreground",children:"…"}),!i&&(e.agent||e.model)&&n.jsxs("div",{className:"flex flex-wrap items-center gap-1 text-[10px]",children:[e.agent&&n.jsx("span",{className:"rounded bg-emerald-500/15 px-1 py-0.5 font-medium text-emerald-300",children:e.agent}),e.model&&n.jsx("span",{className:"rounded border border-border px-1 py-0.5 font-mono text-muted-foreground",children:e.model})]}),n.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",children:[n.jsx("span",{children:c8(e.ts)}),!i&&e.usage&&(e.usage.input_tokens||e.usage.output_tokens)?n.jsxs("span",{className:"font-mono",children:["· ",(e.usage.input_tokens||0)+(e.usage.output_tokens||0)," tok"]}):null,!i&&d&&n.jsxs("span",{children:["· ",u("shared_ui.tools_count",{n:e.parts.filter(f=>f.kind==="tool").length})]}),!i&&!d&&e.toolSummary?.tools?.length?n.jsxs("span",{title:e.toolSummary.tools.map(f=>`${f.name}×${f.count}`).join(", "),children:["· ",u("shared_ui.tools_count",{n:e.toolSummary.total}),e.toolSummary.failed?` (${u("shared_ui.tools_failed",{n:e.toolSummary.failed})})`:""]}):null,r&&l&&n.jsx(Ue,{content:u("chat_ui.copy"),children:n.jsxs("button",{type:"button",onClick:()=>r(l),className:"inline-flex items-center gap-1 hover:text-foreground","aria-label":u("chat_ui.copy"),children:[n.jsx(zo,{size:10})," ",u("chat_ui.copy")]})})]})]}),i&&n.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:n.jsx(qb,{size:14})})]})}function c8(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function sv({msgs:e,onCopy:t}){const a=x.useRef(null);if(x.useEffect(()=>{a.current?.scrollIntoView({behavior:"smooth",block:"end"})},[e]),e.length===0)return n.jsx("div",{className:"grid h-full place-items-center p-6",children:n.jsx(ut,{children:u("project.chat.empty")})});const r=e.length-1;return n.jsxs("div",{className:"space-y-4 px-3 py-4",children:[e.map((i,l)=>n.jsx(l8,{msg:i,isLast:l===r,isAskAnswer:u8(e,l),onCopy:t},l)),n.jsx("div",{ref:a})]})}function u8(e,t){const a=e[t];if(!a||a.role!=="user")return!1;const r=e[t-1];if(!r||r.role!=="assistant")return!1;for(let i=r.parts.length-1;i>=0;i--){const l=r.parts[i];if(l.kind==="tool")return l.tool==="ask_questions"}return!1}function d8(e){if(!e)return;const t=e.path??e.file??e.filename;return typeof t=="string"?t:void 0}function sE({msgs:e}){const[t,a]=x.useState(!1),{inTok:r,outTok:i,toolCount:l,changed:d,actors:f}=x.useMemo(()=>{let h=0,b=0,_=0;const y=new Set,S=[],j=new Map;for(const k of e){if(k.role!=="assistant")continue;const C=k.usage?.input_tokens||0,w=k.usage?.output_tokens||0;if(h+=C,b+=w,k.agent||k.model){const E=`${k.agent||""}::${k.model||""}`,R=j.get(E);R?(R.inTok+=C,R.outTok+=w,R.turns+=1):j.set(E,{key:E,agent:k.agent,model:k.model,inTok:C,outTok:w,turns:1})}for(const E of k.parts)if(E.kind==="tool"&&(_+=1,JN.has(E.tool)&&E.status!=="error")){const R=d8(E.args);R&&!y.has(R)&&(y.add(R),S.push({path:R,tool:E.tool}))}}return{inTok:h,outTok:b,toolCount:_,changed:S,actors:[...j.values()]}},[e]),p=r+i,g=d.length>0||f.length>1;return p===0&&l===0&&f.length===0?null:n.jsxs("div",{className:"shrink-0 border-t border-border bg-card/40 text-[11px]",children:[n.jsxs("button",{type:"button",onClick:()=>g&&a(h=>!h),className:me("flex w-full items-center gap-3 px-4 py-1.5 text-muted-foreground",g&&"hover:text-foreground"),children:[n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx(Zf,{size:12})," ",Ii(p)," tok",n.jsxs("span",{className:"text-muted-foreground/60",children:["(",Ii(r),"↑ / ",Ii(i),"↓)"]})]}),l>0&&n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx(aa,{size:12})," ",l," tools"]}),d.length>0&&n.jsxs("span",{className:"flex items-center gap-1 text-violet-400",children:[n.jsx(bf,{size:12})," ",d.length," ",u("chat_ui.ctx_files")]}),f.length===1&&n.jsx("span",{className:"ml-auto truncate font-mono text-muted-foreground/70",children:[f[0].agent,f[0].model].filter(Boolean).join(" · ")}),f.length>1&&n.jsxs("span",{className:"ml-auto flex items-center gap-1 text-sky-400",children:[n.jsx(rn,{size:12})," ",u("chat_ui.ctx_actors",{n:f.length})]}),g&&n.jsx(ms,{className:me("size-3 shrink-0 transition-transform",t&&"rotate-180")})]}),t&&n.jsxs("div",{className:"max-h-52 space-y-2 overflow-y-auto border-t border-border/60 px-4 py-2",children:[f.length>1&&n.jsx("ul",{className:"space-y-0.5",children:f.map(h=>n.jsxs("li",{className:"flex items-center gap-2 text-[11px]",children:[n.jsx(rn,{size:11,className:"shrink-0 text-sky-400"}),n.jsx("span",{className:"shrink-0 font-medium text-emerald-300",children:h.agent||"—"}),n.jsx("span",{className:"truncate font-mono text-muted-foreground/70",children:h.model||"—"}),n.jsxs("span",{className:"ml-auto shrink-0 font-mono text-[10px] text-muted-foreground/60",children:[Ii(h.inTok+h.outTok)," tok (",Ii(h.inTok),"↑ / ",Ii(h.outTok),"↓) ·"," ",u("chat_ui.ctx_turns",{n:h.turns})]})]},h.key))}),d.length>0&&n.jsx("ul",{className:"space-y-0.5",children:d.map(h=>n.jsxs("li",{className:"flex items-center gap-2 font-mono text-[11px]",children:[n.jsx(bf,{size:11,className:"shrink-0 text-violet-400"}),n.jsx("span",{className:"truncate",children:h.path}),n.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-muted-foreground/60",children:h.tool==="write_file"?"write":"edit"})]},h.path))})]})]})}function Ii(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function qi(){return{picked:new Set,text:"",skipped:!1}}function Xk(e,t){const a=[];return e.forEach((r,i)=>{const l=t[i]||qi();if(l.skipped){a.push(`- ${r.question}
820
+ → (omitido)`);return}const d=[];if(r.options&&r.options.length>0){const g=[...l.picked].sort((h,b)=>h-b).map(h=>r.options[h]?.label).filter(Boolean);g.length>0&&d.push(g.join(", "))}const f=l.text.trim();f&&d.push(r.options&&r.options.length>0?`(Otro: ${f})`:f);const p=d.length>0?d.join(" "):"(sin respuesta)";a.push(`- ${r.question}
821
+ → ${p}`)}),a.join(`
822
+ `)}function aE({turnKey:e,questions:t,onSubmit:a,onDismiss:r,disabled:i}){const l=t.length,[d,f]=x.useState(0),[p,g]=x.useState(()=>t.map(()=>qi()));x.useEffect(()=>{f(0),g(t.map(()=>qi()))},[e,t]);const h=t[d],b=p[d]||qi(),_=!!h?.options&&h.options.length>0,y=!!h?.multiSelect,S=h?.allowText!==!1,j=A=>{g(z=>{const M=[...z],D=M[d]||qi();return M[d]={...D,...A,skipped:!1},M})},k=A=>{g(z=>{const M=[...z],D=M[d]||qi(),L=new Set(D.picked);return y?L.has(A)?L.delete(A):L.add(A):(L.clear(),L.add(A)),M[d]={...D,picked:L,skipped:!1},M})},C=x.useMemo(()=>!0,[]),w=d===l-1,E=()=>f(A=>Math.max(0,A-1)),R=()=>{if(w){a(Xk(t,p));return}f(A=>Math.min(l-1,A+1))},T=()=>{if(g(A=>{const z=[...A];return z[d]={picked:new Set,text:"",skipped:!0},z}),w){const A=p.map((z,M)=>M===d?{picked:new Set,text:"",skipped:!0}:z);a(Xk(t,A))}else f(A=>Math.min(l-1,A+1))};return x.useEffect(()=>{const A=z=>{if(i)return;const M=z.target?.tagName?.toLowerCase(),D=M==="input"||M==="textarea";if(z.key==="Enter"&&(z.metaKey||z.ctrlKey)){z.preventDefault(),R();return}if(!D&&_&&/^[1-9]$/.test(z.key)){const L=parseInt(z.key,10)-1;L<(h?.options?.length||0)&&(z.preventDefault(),k(L))}};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)}),!h||l===0?null:n.jsxs("div",{className:me("mx-3 mb-2 rounded-xl border border-border bg-card/95 shadow-xl backdrop-blur supports-[backdrop-filter]:bg-card/80",i&&"pointer-events-none opacity-60"),"data-testid":"inline-ask-panel",children:[n.jsxs("header",{className:"flex items-start gap-2 border-b border-border px-3 py-2",children:[n.jsxs("span",{className:"mt-0.5 shrink-0 rounded-md bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-mono font-medium text-amber-700 dark:text-amber-300",children:[d+1,"/",l]}),h.header&&n.jsx("span",{className:"mt-0.5 shrink-0 rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:h.header}),n.jsx("p",{className:"min-w-0 flex-1 text-sm font-semibold leading-snug",children:h.question}),r&&n.jsx("button",{type:"button",onClick:r,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground","aria-label":u("common.close"),children:n.jsx(gs,{className:"size-3.5"})})]}),n.jsxs("div",{className:"space-y-1 px-2 py-2",children:[_&&h.options.map((A,z)=>{const M=b.picked.has(z);return n.jsxs("button",{type:"button",onClick:()=>k(z),className:me("flex w-full items-start gap-2 rounded-md border border-transparent px-2 py-1.5 text-left transition",M?"border-emerald-500/40 bg-emerald-500/10":"hover:border-border hover:bg-accent/40"),children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-xs font-medium",children:A.label}),A.description&&n.jsx("div",{className:"text-[11px] text-muted-foreground",children:A.description})]}),y?n.jsx("span",{className:me("mt-0.5 grid size-4 shrink-0 place-items-center rounded border",M?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-background"),children:M&&n.jsx("span",{className:"text-[10px] leading-none",children:"✓"})}):n.jsx("span",{className:me("mt-0.5 grid size-4 shrink-0 place-items-center rounded border font-mono text-[10px]",M?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-muted text-muted-foreground"),children:z+1})]},`${z}:${A.label}`)}),(S||!_)&&n.jsxs("div",{className:"rounded-md border border-transparent px-2 py-1.5 hover:border-border",children:[_&&n.jsx("div",{className:"mb-1 text-xs font-medium",children:u("ask_panel.other")}),n.jsx("input",{type:"text",value:b.text,onChange:A=>j({text:A.target.value}),placeholder:u(_?"ask_panel.other_placeholder":"ask_panel.text_placeholder"),className:"w-full rounded border border-border bg-background px-2 py-1 text-xs outline-none focus:border-emerald-500"})]})]}),n.jsxs("footer",{className:"flex items-center justify-between gap-2 border-t border-border px-3 py-2",children:[n.jsx("button",{type:"button",onClick:E,disabled:d===0,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent disabled:opacity-30",children:u("ask_panel.back")}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick:T,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent",children:u("ask_panel.skip")}),n.jsxs("button",{type:"button",onClick:R,disabled:!C,className:"inline-flex items-center gap-1 rounded bg-emerald-500/15 px-2 py-1 text-[11px] font-medium text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300",children:[u(w?"ask_panel.submit":"ask_panel.next"),n.jsx(lM,{className:"size-3 opacity-60"})]})]})]})]})}function f8(e){if(typeof e=="string")return{question:e,options:[],multiSelect:!1,allowText:!0};if(!e||typeof e!="object")return null;const t=e,a=typeof t.question=="string"?t.question:"";if(!a)return null;const i=(Array.isArray(t.options)?t.options:[]).map(l=>{if(typeof l=="string")return{label:l};if(l&&typeof l=="object"&&typeof l.label=="string"){const d=l;return{label:d.label,description:typeof d.description=="string"?d.description:void 0}}return null}).filter(l=>l!==null);return{question:a,header:typeof t.header=="string"?t.header:void 0,options:i,multiSelect:t.multiSelect===!0,allowText:t.allowText!==!1}}function rE(e){if(!e.length)return null;const t=e[e.length-1];if(t.role!=="assistant")return null;let a=null,r=-1;for(let g=t.parts.length-1;g>=0;g--){const h=t.parts[g];if(h.kind==="tool"&&h.tool==="ask_questions"){a=h,r=g;break}}if(!a||r<0)return null;let i=null;if(typeof a.result=="string")try{i=JSON.parse(a.result)}catch{i=null}else a.result&&typeof a.result=="object"&&(i=a.result);const l=[];Array.isArray(a.args?.questions)&&l.push(a.args.questions),i&&Array.isArray(i.questions)&&l.push(i.questions);let d=[];for(const g of l)if(d=g.map(f8).filter(h=>!!h),d.length>0)break;return d.length?{turnKey:`${t.ts||""}#${r}`,questions:d}:null}function p8(e){const t=x.useRef(!0);t.current&&(t.current=!1,e())}const oE=x.createContext(null);function Na(){const e=x.useContext(oE);if(e===null)throw new Error(gn(60));return e}const m8=(e,t)=>Object.is(e,t);function ul(e,t,a){return e==null||t==null?Object.is(e,t):a(e,t)}function df(e,t,a){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:ul(r,t,a))}function g8(e,t,a){return e.filter(r=>!ul(t,r,a))}function nb(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function iE(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function h8(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(iE(t)){for(const a of t)for(const r of a.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const a of t)if(a&&a.value==null&&a.label!=null)return!0;return!1}function lE(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return nb(e)}function Hi(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?nb(e.value):nb(e)}function cE(e,t,a){function r(){return lE(e,a)}if(a&&e!=null)return a(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){const i=t,l=iE(i)?i.flatMap(d=>d.items):i;if(e==null||typeof e!="object"){const d=l.find(f=>f.value===e);return d&&d.label!=null?d.label:r()}if("value"in e){const d=l.find(f=>f&&f.value===e.value);if(d&&d.label!=null)return d.label}}return r()}function x8(e,t,a){return e.reduce((r,i,l)=>(l>0&&r.push(", "),r.push(n.jsx(x.Fragment,{children:cE(i,t,a)},l)),r),[])}const st={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:a,itemToStringValue:r}=e;return t==null?!1:a&&Array.isArray(t)?t.length>0:Hi(t,r)!==""},hasNullItemLabel:(e,t)=>t?h8(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const a=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(i=>ul(t,i,a)):ul(t,r,a)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function b8(e,t,a=(r,i)=>r===i){return e.length===t.length&&e.every((r,i)=>a(r,t[i]))}function Ec(e,t=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,a))}const Zs=1;function av(e,t){return Math.max(0,e-t)}function Pf(e,t){if(t<=0)return 0;const a=Ec(e,0,t),r=a,i=t-a,l=r<=Zs,d=i<=Zs;return l&&d?r<=i?0:t:l?0:d?t:a}function _8(e){const{id:t,value:a,defaultValue:r=null,onValueChange:i,open:l,defaultOpen:d=!1,onOpenChange:f,name:p,form:g,autoComplete:h,disabled:b=!1,readOnly:_=!1,required:y=!1,modal:S=!0,actionsRef:j,inputRef:k,onOpenChangeComplete:C,items:w,multiple:E=!1,itemToStringLabel:R,itemToStringValue:T,isItemEqualToValue:A=m8,highlightItemOnHover:z=!0,children:M}=e,{clearErrors:D}=Q_(),{setDirty:L,setTouched:I,setFocused:P,validityData:B,setFilled:q,name:Y,disabled:U,validation:V,validationMode:X}=gu(),Q=Rp({id:t}),W=U||b,$=Y??p,[K,J]=ol({controlled:a,default:E?r??ja:r,name:"Select",state:"value"}),[G,te]=ol({controlled:l,default:d,name:"Select",state:"open"}),se=x.useRef([]),pe=x.useRef([]),F=x.useRef(null),oe=x.useRef(null),_e=x.useRef(0),le=x.useRef(null),be=x.useRef([]),ke=x.useRef(!1),Re=x.useRef(null),Ae=x.useRef(null),Ie=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),Oe=x.useRef(!1),{mounted:Te,setMounted:Ee,transitionStatus:Me}=vl(G),{openMethod:De,triggerProps:He}=bN(G),Qe=Vn(()=>new ou({id:Q,labelId:void 0,modal:S,multiple:E,itemToStringLabel:R,itemToStringValue:T,isItemEqualToValue:A,value:K,open:G,mounted:Te,transitionStatus:Me,items:w,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,ge=nt(Qe,st.activeIndex),de=nt(Qe,st.selectedIndex),Le=nt(Qe,st.triggerElement),ye=nt(Qe,st.positionerElement),Ne=W6(De),We=De??Ne,Ge=x.useMemo(()=>E?"":Hi(K,T),[E,K,T]),it=x.useMemo(()=>E&&Array.isArray(K)?K.map(ht=>Hi(ht,T)):Hi(K,T),[E,K,T]),Tt=mn(Le),_t=Ve(()=>it);W_(Tt,Q,K,_t,!W,p);const Ct=x.useRef(K),je=E?Array.isArray(K)&&K.length>0:K!=null&&Ge!=="";Pe(()=>{q(je)},[je,q]),Pe(function(){let Ut=K,Ln=!1;if(E){const Mn=Array.isArray(K)?K:[];Ln=Mn.length===0,Ut=Mn[Mn.length-1]}const rs=Ln?-1:df(be.current,Ut,A),xs=rs===-1?null:rs;xs===null&&(Ae.current=null),!G&&Qe.set("selectedIndex",xs)},[E,G,K,A,Qe]);function ze(ht){const Ut=B.initialValue;return Array.isArray(ht)&&Array.isArray(Ut)?!b8(ht,Ut,(Ln,rs)=>ul(Ln,rs,A)):ht!==Ut}L_(K,()=>{D($),L(ze(K)),V.change(K)});const Ye=Ve((ht,Ut)=>{f?.(ht,Ut),!Ut.isCanceled&&(te(ht),!ht&&(Ut.reason===Po||Ut.reason===fp)&&(I(!0),P(!1),X==="onBlur"&&V.commit(K)))}),Ze=Ve(()=>{Ee(!1),Qe.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),C?.(!1)});Ca({enabled:!j,open:G,ref:F,onComplete(){G||Ze()}}),x.useImperativeHandle(j,()=>({unmount:Ze}),[Ze]);const ft=Ve((ht,Ut)=>{i?.(ht,Ut),!Ut.isCanceled&&J(ht)}),Rt=Ve(ht=>{const Ut=av(ht.scrollHeight,ht.clientHeight),Ln=Pf(ht.scrollTop,Ut),rs=Ln>0,xs=Ln<Ut;Qe.set("scrollUpArrowVisible",rs),Qe.set("scrollDownArrowVisible",xs)}),Qt=p6({open:G,onOpenChange:Ye,elements:{reference:Le,floating:ye}}),ot=jC(Qt,{enabled:!_&&!W,event:"mousedown"}),Lt=gp(Qt),on=VC(Qt,{enabled:!_&&!W,listRef:se,activeIndex:ge,selectedIndex:de,disabledIndices:ja,onNavigate(ht){ht===null&&!G||Qe.set("activeIndex",ht)},focusItemOnHover:z}),Kt=FC(Qt,{enabled:!_&&!W&&(G||!E),listRef:pe,activeIndex:ge,selectedIndex:de,disabledIndices:ht=>jN(se.current[ht]),onMatch(ht){G?Qe.set("activeIndex",ht):ft(be.current[ht],rt(ka))},onTyping(ht){ke.current=ht}}),Gn=x.useMemo(()=>Ss(Kt.reference,on.reference,Lt.reference,ot.reference,He),[ot.reference,Kt.reference,on.reference,Lt.reference,He]),An=x.useMemo(()=>Ss(bp,Kt.floating,on.floating,Lt.floating),[Kt.floating,on.floating,Lt.floating]),as=on.item??sn;p8(()=>{Qe.update({popupProps:An,triggerProps:Gn})}),Qe.useSyncedValues({id:Q,modal:S,multiple:E,value:K,open:G,mounted:Te,transitionStatus:Me,popupProps:An,triggerProps:Gn,items:w,itemToStringLabel:R,itemToStringValue:T,isItemEqualToValue:A,openMethod:We});const dn=x.useMemo(()=>({store:Qe,floatingContext:Qt,required:y,disabled:W,readOnly:_,multiple:E,highlightItemOnHover:z,setValue:ft,setOpen:Ye,listRef:se,popupRef:F,scrollHandlerRef:oe,handleScrollArrowVisibility:Rt,scrollArrowsMountedCountRef:_e,itemProps:as,valueRef:le,valuesRef:be,labelsRef:pe,typingRef:ke,selectionRef:Ie,firstItemTextRef:Re,selectedItemTextRef:Ae,validation:V,onOpenChangeComplete:C,alignItemWithTriggerActiveRef:Oe,initialValueRef:Ct}),[Qe,Qt,y,W,_,E,z,ft,Ye,as,V,C,Rt]),hs=ir(k,V.inputRef),Rs=E?void 0:$,oa=x.useMemo(()=>!E||!Array.isArray(K)||!$?null:K.map(ht=>{const Ut=Hi(ht,T);return n.jsx("input",{type:"hidden",form:g,name:$,value:Ut,disabled:W},Ut)}),[E,K,g,$,T,W]);return n.jsxs(oE.Provider,{value:dn,children:[M,n.jsx("input",{...V.getValidationProps(W,{onFocus(){Qe.state.triggerElement?.focus({focusVisible:!0})},onChange(ht){if(ht.nativeEvent.defaultPrevented||W||_)return;const Ut=ht.currentTarget.value,Ln=rt(ka,ht.nativeEvent);function rs(){if(E)return;const xs=Ut.toLowerCase();let Mn=be.current.findIndex(vn=>Hi(vn,T).toLowerCase()===xs||lE(vn,R).toLowerCase()===xs);Mn===-1&&(Mn=be.current.findIndex((vn,ia)=>{const pr=pe.current[ia];return pr!=null&&pr.toLowerCase()===xs}));const Wt=be.current[Mn];Wt!=null&&ft(Wt,Ln)}Qe.set("forceMount",!0),queueMicrotask(rs)}}),id:Q&&Rs==null?`${Q}-hidden-input`:void 0,form:g,name:Rs,autoComplete:h,value:Ge,disabled:W,required:y&&!(E&&je),readOnly:_,ref:hs,style:$?KS:a_,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),oa]})}function v8(e,t){return e??t}const y8=400,j8={...Ox,...X_,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},k8=x.forwardRef(function(t,a){const{render:r,className:i,id:l,disabled:d=!1,nativeButton:f=!0,style:p,...g}=t,{setTouched:h,setFocused:b,validationMode:_,state:y,disabled:S}=gu(),{labelId:j}=Ep(),{store:k,setOpen:C,selectionRef:w,validation:E,readOnly:R,required:T,alignItemWithTriggerActiveRef:A,disabled:z}=Na(),M=S||z||d,D=nt(k,st.open),L=nt(k,st.mounted),I=nt(k,st.value),P=nt(k,st.triggerProps),B=nt(k,st.positionerElement),q=nt(k,st.listElement),Y=nt(k,st.popupSide),U=nt(k,st.id),V=nt(k,st.labelId),X=nt(k,st.hasSelectedValue),Q=L&&B?Y:null,W=l??U,$=v8(j,V);Rp({id:W});const K=mn(B),J=x.useRef(null),{getButtonProps:G,buttonRef:te}=ao({disabled:M,native:f}),se=k.useStateSetter("triggerElement"),pe=Tn(),F=Tn(),oe=Tn();x.useEffect(()=>{if(D)return oe.start(y8,()=>{w.current.allowUnselectedMouseUp=!0,w.current.allowSelectedMouseUp=!0}),()=>{oe.clear()};w.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},F.clear()},[D,w,F,oe]);const _e=Ss(P,{id:W,role:"combobox","aria-expanded":D,"aria-haspopup":"listbox","aria-controls":D?q?.id??vf(B)?.id:void 0,"aria-labelledby":$,"aria-readonly":R||void 0,"aria-required":T||void 0,tabIndex:M?-1:0,onFocus(ke){b(!0),D&&A.current&&C(!1,rt(ka,ke.nativeEvent)),pe.start(0,()=>{k.set("forceMount",!0)})},onBlur(ke){Je(B,ke.relatedTarget)||(h(!0),b(!1),_==="onBlur"&&E.commit(I))},onMouseDown(ke){if(D)return;const Re=vt(ke.currentTarget);function Ae(Ie){if(!J.current)return;const Oe=Ie.target;Je(J.current,Oe)||Je(K.current,Oe)||_N(Ie,J.current)||C(!1,rt(qS,Ie))}F.start(0,()=>{Re.addEventListener("mouseup",Ae,{once:!0})})}},g,G),le=E.getValidationProps(M,_e);le.role="combobox";const be={...y,open:D,disabled:M,value:I,readOnly:R,popupSide:Q,placeholder:!X};return Et("button",t,{ref:[a,J,te,se],state:be,stateAttributesMapping:j8,props:le})}),w8={value:()=>null},S8=x.forwardRef(function(t,a){const{className:r,render:i,children:l,placeholder:d,style:f,...p}=t,{store:g,valueRef:h}=Na(),b=nt(g,st.value),_=nt(g,st.items),y=nt(g,st.itemToStringLabel),S=nt(g,st.hasSelectedValue),j=!S&&d!=null&&l==null,k=nt(g,st.hasNullItemLabel,j),C={value:b,placeholder:!S};let w=null;return typeof l=="function"?w=l(b):l!=null?w=l:j&&!k?w=d:Array.isArray(b)?w=x8(b,_,y):w=cE(b,_,y),Et("span",t,{state:C,ref:[a,h],props:[{children:w},p],stateAttributesMapping:w8})}),C8=x.forwardRef(function(t,a){const{render:r,className:i,style:l,...d}=t,{store:f}=Na(),g={open:nt(f,st.open)};return Et("span",t,{state:g,ref:a,props:[{"aria-hidden":!0,children:"▼"},d],stateAttributesMapping:YC})}),N8=x.forwardRef(function(t,a){const{store:r}=Na(),i=nt(r,st.mounted),l=nt(r,st.forceMount);return i||l?n.jsx(p_,{ref:a,...t}):null}),uE=x.createContext(void 0);function rv(){const e=x.useContext(uE);if(!e)throw new Error(gn(59));return e}function Lf(e,t){e&&Object.assign(e.style,t)}const dE={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},E8={position:"fixed"},R8=x.forwardRef(function(t,a){const{anchor:r,className:i,render:l,positionMethod:d,side:f,align:p,sideOffset:g,alignOffset:h,collisionBoundary:b="clipping-ancestors",collisionPadding:_,arrowPadding:y,sticky:S,disableAnchorTracking:j,alignItemWithTrigger:k=!0,collisionAvoidance:C=pC,style:w,...E}=t,{store:R,listRef:T,labelsRef:A,alignItemWithTriggerActiveRef:z,selectedItemTextRef:M,valuesRef:D,initialValueRef:L,popupRef:I,setValue:P,floatingContext:B}=Na(),q=nt(R,st.open),Y=nt(R,st.mounted),U=nt(R,st.modal),V=nt(R,st.value),X=nt(R,st.openMethod),Q=nt(R,st.positionerElement),W=nt(R,st.triggerElement),$=nt(R,st.isItemEqualToValue),K=nt(R,st.transitionStatus),J=x.useRef(null),G=x.useRef(null),[te,se]=x.useState(k),pe=Y&&te&&X!=="touch";!Y&&te!==k&&se(k),x.useImperativeHandle(z,()=>pe),mN((pe||U)&&q,X==="touch",Q,W);const F=R_({anchor:r,floatingRootContext:B,positionMethod:d,mounted:Y,side:f,sideOffset:g,align:p,alignOffset:h,arrowPadding:y,collisionBoundary:b,collisionPadding:_,sticky:S,disableAnchorTracking:j??pe,collisionAvoidance:C,keepMounted:!0}),oe=pe?"none":F.side,_e=pe?E8:F.positionerStyles,le={open:q,side:oe,align:F.align,anchorHidden:F.anchorHidden};Pe(()=>{R.set("popupSide",F.side)},[R,F.side]);const be=R.useStateSetter("positionerElement"),ke=T_(t,le,{styles:_e,transitionStatus:K,props:E,refs:[a,be],hidden:!Y,inert:!q}),Re=x.useRef(0),Ae=Ve(Oe=>{if(D.current.length===0)return;const Te=Re.current;if(Re.current=Oe.size,Oe.size===Te)return;const Ee=rt(ka);if(Te!==0&&!R.state.multiple&&V!==null&&df(D.current,V,$)===-1){const De=L.current,Qe=De!=null&&df(D.current,De,$)!==-1?De:null;P(Qe,Ee),Qe===null&&(R.set("selectedIndex",null),M.current=null)}if(Te!==0&&R.state.multiple&&Array.isArray(V)){const Me=V.filter(De=>df(D.current,De,$)!==-1);Me.length!==V.length&&(P(Me,Ee),Me.length===0&&(R.set("selectedIndex",null),M.current=null))}if(q&&pe){R.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Me={height:""};Lf(Q,Me),Lf(I.current,Me)}}),Ie=x.useMemo(()=>({...F,side:oe,alignItemWithTriggerActive:pe,setControlledAlignItemWithTrigger:se,scrollUpArrowRef:J,scrollDownArrowRef:G}),[F,oe,pe,se]);return n.jsx(Sp,{elementsRef:T,labelsRef:A,onMapChange:Ae,children:n.jsxs(uE.Provider,{value:Ie,children:[Y&&U&&n.jsx(P_,{inert:jp(!q),cutout:W}),ke]})})}),Hd="base-ui-disable-scrollbar",sb={className:Hd,getElement(e){return n.jsx("style",{nonce:e,href:Hd,precedence:"base-ui:low",children:`.${Hd}{scrollbar-width:none}.${Hd}::-webkit-scrollbar{display:none}`})}},T8=x.createContext(void 0),A8={disableStyleElements:!1};function M8(){return x.useContext(T8)??A8}const z8={...lu,...Yo},O8=x.forwardRef(function(t,a){const{render:r,className:i,style:l,finalFocus:d,...f}=t,{store:p,popupRef:g,onOpenChangeComplete:h,setOpen:b,valueRef:_,firstItemTextRef:y,selectedItemTextRef:S,multiple:j,handleScrollArrowVisibility:k,scrollHandlerRef:C,listRef:w,highlightItemOnHover:E,floatingContext:R}=Na(),{side:T,align:A,alignItemWithTriggerActive:z,isPositioned:M,setControlledAlignItemWithTrigger:D}=rv(),L=uN()!=null,I=vp(),{nonce:P,disableStyleElements:B}=M8(),q=nt(p,st.id),Y=nt(p,st.open),U=nt(p,st.openMethod),V=nt(p,st.mounted),X=nt(p,st.popupProps),Q=nt(p,st.transitionStatus),W=nt(p,st.triggerElement),$=nt(p,st.positionerElement),K=nt(p,st.listElement),J=x.useRef(!1),G=x.useRef(!1),te=x.useRef({}),se=sl(),pe=Ve(le=>{if(!$||!g.current||!G.current)return;const be=$.style.top==="0px",ke=$.style.bottom==="0px";if(J.current||!z||!be&&!ke){k(le);return}const Re=Wk($),Ae=Rc($.getBoundingClientRect().height,"y",Re),Ie=vt($),Oe=Jt($),Te=Oe.getComputedStyle($),Ee=parseFloat(Te.marginTop),Me=parseFloat(Te.marginBottom),De=Qk(Oe.getComputedStyle(g.current)),He=Math.min(Ie.documentElement.clientHeight-Ee-Me,De),Qe=le.scrollTop,ge=Vd(le);let de=null;const Le=Ge=>{$.style.height=`${Ge}px`},ye=be?ge-Qe:Qe,Ne=Math.min(Ae+ye,He);if(ye<=Zs){const Ge=Ec(ye,0,He-Ae);Ge>0&&Le(Ae+Ge),le.scrollTop=be?ge:0,He-(Ae+Ge)<=Zs&&(J.current=!0),k(le);return}if(He-Ne>Zs)de=be?1/0:0;else if(ke&&Qe<ge){const Ge=Ae+ye-He;de=Qe-(ye-Ge)}const We=Math.ceil(Ne);if(We!==0&&Le(We),de!=null){const Ge=Ec(de,0,Vd(le));Math.abs(le.scrollTop-Ge)>Zs&&(le.scrollTop=Ge)}We>=He-Zs&&(J.current=!0),k(le)});x.useImperativeHandle(C,()=>pe,[pe]),Ca({open:Y,ref:g,onComplete(){Y&&h?.(!0)}});const F={open:Y,transitionStatus:Q,side:T,align:A};Pe(()=>{!$||!g.current||Object.keys(te.current).length||(te.current={top:$.style.top||"0",left:$.style.left||"0",right:$.style.right,height:$.style.height,bottom:$.style.bottom,minHeight:$.style.minHeight,maxHeight:$.style.maxHeight,marginTop:$.style.marginTop,marginBottom:$.style.marginBottom})},[g,$]),Pe(()=>{Y||z||(G.current=!1,J.current=!1,Lf($,te.current))},[Y,z,$,g]),Pe(()=>{const le=g.current;if(!Y||!W||!$||!le||z&&!M||p.state.transitionStatus==="ending")return;if(G.current=!0,le.style.removeProperty("--transform-origin"),!z){se.request(()=>k(K||le));return}const be=D8(le);try{let ke=S.current;ke?.isConnected||(ke=!st.hasSelectedValue(p.state)&&y.current?.isConnected?y.current:null);const Re=_.current,Ae=Jt($),Ie=Ae.getComputedStyle($),Oe=Ae.getComputedStyle(le),Te=vt(W),Ee=Wk(W),Me=Fd(W.getBoundingClientRect(),Ee),De=Fd($.getBoundingClientRect(),Ee),He=Me.height,Qe=K||le,ge=Qe.scrollHeight,de=parseFloat(Oe.borderBottomWidth),Le=parseFloat(Ie.marginTop)||10,ye=parseFloat(Ie.marginBottom)||10,Ne=parseFloat(Ie.minHeight)||100,We=Qk(Oe),Ge=5,it=5,Tt=20,_t=Te.documentElement.clientHeight-Le-ye,Ct=Te.documentElement.clientWidth,je=_t-Me.bottom+He;let ze,Ye=I==="rtl"?Me.right-De.width:Me.left,Ze=0;if(ke&&Re){const dn=Fd(Re.getBoundingClientRect(),Ee);ze=Fd(ke.getBoundingClientRect(),Ee),Ye=De.left+(I==="rtl"?dn.right-ze.right:dn.left-ze.left);const hs=dn.top-Me.top+dn.height/2;Ze=ze.top-De.top+ze.height/2-hs}const ft=je+Ze+ye+de;let Rt=Math.min(_t,ft);const Qt=_t-Le-ye,ot=ft-Rt,Lt=Ct-it;$.style.left=`${Ec(Ye,Ge,Lt-De.width)}px`,$.style.height=`${Rt}px`,$.style.maxHeight="none",$.style.marginTop=`${Le}px`,$.style.marginBottom=`${ye}px`,le.style.height="100%";const on=Vd(Qe),Kt=ot>=on-Zs;Kt&&(Rt=Math.min(_t,De.height)-(ot-on));const Gn=Me.top<Tt||Me.bottom>_t-Tt||Math.ceil(Rt)+Zs<Math.min(ge,Ne),An=(Ae.visualViewport?.scale??1)!==1&&ur;if(Gn||An){Lf($,te.current),D(!1);return}const as=Math.max(Ne,Rt);if(Kt){const dn=Math.max(0,_t-ft);$.style.top=De.height>=Qt?"0":`${dn}px`,$.style.height=`${Rt}px`,Qe.scrollTop=Vd(Qe)}else $.style.bottom="0",Qe.scrollTop=ot;if(ze){const dn=De.top,hs=De.height,Rs=ze.top+ze.height/2,oa=Ec(hs>0?(Rs-dn)/hs*100:50,0,100);le.style.setProperty("--transform-origin",`50% ${oa}%`)}(as===_t||Rt>=We)&&(J.current=!0),k(Qe),E&&p.state.selectedIndex===null&&p.state.activeIndex===null&&w.current[0]!=null&&p.set("activeIndex",0)}finally{be()}},[p,Y,$,W,_,y,S,g,k,z,D,se,K,w,E,I,M]),x.useEffect(()=>{if(!z||!$||!Y)return;const le=Jt($);function be(ke){b(!1,rt(iz,ke))}return xt(le,"resize",be)},[b,z,$,Y]);const oe={...K?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":j||void 0,id:`${q}-list`},onKeyDown(le){L&&wp.has(le.key)&&le.stopPropagation()},onScroll(le){K||pe(le.currentTarget)},...z&&{style:K?{height:"100%"}:dE},className:!K&&z?sb.className:void 0},_e=Et("div",t,{ref:[a,g],state:F,stateAttributesMapping:z8,props:[X,oe,yp(Q),f]});return n.jsxs(x.Fragment,{children:[!B&&sb.getElement(P),n.jsx(h_,{context:R,modal:!1,disabled:!V,openInteractionType:U,returnFocus:d,restoreFocus:!0,children:_e})]})});function Qk(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function Vd(e){return av(e.scrollHeight,e.clientHeight)}function Wk(e){return EC.getScale(e)}function Rc(e,t,a){return e/a[t]}function Fd(e,t){return Hc({x:Rc(e.x,"x",t),y:Rc(e.y,"y",t),width:Rc(e.width,"x",t),height:Rc(e.height,"y",t)})}const Zk=[["transform","none"],["scale","1"],["translate","0 0"]];function D8(e){const{style:t}=e,a={};for(const[r,i]of Zk)a[r]=t.getPropertyValue(r),t.setProperty(r,i,"important");return()=>{for(const[r]of Zk){const i=a[r];i?t.setProperty(r,i):t.removeProperty(r)}}}const P8=x.forwardRef(function(t,a){const{render:r,className:i,style:l,...d}=t,{store:f,scrollHandlerRef:p,multiple:g}=Na(),{alignItemWithTriggerActive:h}=rv(),b=nt(f,st.hasScrollArrows),_=nt(f,st.openMethod),S={id:`${nt(f,st.id)}-list`,role:"listbox","aria-multiselectable":g||void 0,onScroll(k){p.current?.(k.currentTarget)},...h&&{style:dE},className:b&&_!=="touch"?sb.className:void 0},j=f.useStateSetter("listElement");return Et("div",t,{ref:[a,j],props:[S,d]})}),fE=x.createContext(void 0);function ov(){const e=x.useContext(fE);if(!e)throw new Error(gn(57));return e}const L8=x.memo(x.forwardRef(function(t,a){const{render:r,className:i,style:l,value:d=null,label:f,disabled:p=!1,nativeButton:g=!1,...h}=t,b=x.useRef(null),_=cu({guess:!0,label:f,textRef:b}),{store:y,itemProps:S,setOpen:j,setValue:k,selectionRef:C,typingRef:w,valuesRef:E,multiple:R,selectedItemTextRef:T,disabled:A,readOnly:z}=Na(),M=A||p,D=nt(y,st.isActive,_.index),L=nt(y,st.open),I=nt(y,st.isSelected,d),P=nt(y,st.isSelectedByFocus,_.index),B=nt(y,st.isItemEqualToValue),q=_.index,Y=x.useRef(null);Pe(()=>{const se=E.current;return se[q]=d,()=>{delete se[q]}},[q,d,E]),Pe(()=>{const se=y.state.value;let pe=se;R&&Array.isArray(se)&&(pe=se.length>0?se[se.length-1]:void 0),pe!==void 0&&ul(d,pe,B)&&(y.set("selectedIndex",q),b.current&&(T.current=b.current))},[q,R,B,y,d,T]);const U=x.useRef("mouse"),V=x.useRef(!1),{getButtonProps:X,buttonRef:Q}=ao({disabled:M,focusableWhenDisabled:!0,native:g,composite:!0}),W={disabled:M,selected:I,highlighted:D};function $(se){if(A||z)return;const pe=y.state.value;if(R){const F=Array.isArray(pe)?pe:[],oe=I?g8(F,d,B):[...F,d];k(oe,rt(Ki,se))}else k(d,rt(Ki,se)),j(!1,rt(Ki,se))}function K(){C.current.dragY=0}const J={role:"option","aria-selected":I,tabIndex:L&&D?0:-1,onKeyDown(se){y.set("activeIndex",q),se.key===" "&&w.current&&se.preventDefault()},onClick(se){const pe=U.current!=="touch",F=se.nativeEvent.pointerType,oe=pe&&Qb(se.nativeEvent)&&(F!==void 0||D),_e=pe&&!oe&&!V.current;V.current=!1,!(M||_e)&&$(se.nativeEvent)},onPointerEnter(se){U.current=se.pointerType},onPointerMove(se){if(se.pointerType==="mouse"&&se.buttons===1){const pe=C.current;pe.dragY+=se.movementY,pe.dragY**2>=64&&(pe.allowUnselectedMouseUp=!0)}},onPointerDown(se){U.current=se.pointerType,V.current=!0,K()},onMouseUp(){if(K(),M||U.current==="touch"||V.current)return;const se=!C.current.allowSelectedMouseUp&&I,pe=!C.current.allowUnselectedMouseUp&&!I;se||pe||(V.current=!0,Y.current?.click(),V.current=!1)}},G=Et("div",t,{ref:[Q,a,_.ref,Y],state:W,props:[S,J,h,X]}),te=x.useMemo(()=>({selected:I,index:q,textRef:b,selectedByFocus:P}),[I,q,b,P]);return n.jsx(fE.Provider,{value:te,children:G})})),I8=x.forwardRef(function(t,a){const{selected:r}=ov();return t.keepMounted||r?n.jsx($8,{...t,ref:a}):null}),$8=x.memo(x.forwardRef((e,t)=>{const{render:a,className:r,style:i,keepMounted:l,...d}=e,{selected:f}=ov(),p=x.useRef(null),{transitionStatus:g,setMounted:h}=vl(f),_=Et("span",e,{ref:[t,p],state:{selected:f,transitionStatus:g},props:[{"aria-hidden":!0,children:"✔️"},d],stateAttributesMapping:Yo});return Ca({open:f,ref:p,onComplete(){f||h(!1)}}),_})),B8=x.memo(x.forwardRef(function(t,a){const{index:r,textRef:i,selectedByFocus:l}=ov(),{firstItemTextRef:d,selectedItemTextRef:f}=Na(),{render:p,className:g,style:h,...b}=t,_=x.useCallback(S=>{S&&(r===0&&(d.current=S),l&&(f.current=S))},[d,f,r,l]);return Et("div",t,{ref:[_,a,i],props:b})})),pE=x.forwardRef(function(t,a){const{render:r,className:i,style:l,direction:d,keepMounted:f,...p}=t,g=d==="up",{store:h,popupRef:b,listRef:_,handleScrollArrowVisibility:y,scrollArrowsMountedCountRef:S}=Na(),{side:j,scrollDownArrowRef:k,scrollUpArrowRef:C}=rv(),w=g?st.scrollUpArrowVisible:st.scrollDownArrowVisible,E=nt(h,w),R=nt(h,st.openMethod),T=E&&R!=="touch",A=Tn(),z=g?C:k,{mounted:M,transitionStatus:D,setMounted:L}=vl(T);Pe(()=>(S.current+=1,h.set("hasScrollArrows",!0),()=>{S.current=Math.max(0,S.current-1),S.current===0&&h.set("hasScrollArrows",!1)}),[h,S]),Ca({open:T,ref:z,onComplete(){T||L(!1)}});const B=Et("div",t,{ref:[a,z],state:{direction:d,visible:T,side:j,transitionStatus:D},props:[{"aria-hidden":!0,children:g?"▲":"▼",style:{position:"absolute"},onMouseMove(Y){if(Y.movementX===0&&Y.movementY===0||A.isStarted())return;h.set("activeIndex",null);function U(){const V=h.state.listElement??b.current;if(!V)return;h.set("activeIndex",null),y(V);const X=av(V.scrollHeight,V.clientHeight),Q=Pf(V.scrollTop,X),W=Q===(g?0:X),$=_.current;if(Q!==V.scrollTop&&(V.scrollTop=Q),W){A.clear();return}if($.length>0){const K=z.current?.offsetHeight||0;V.scrollTop=U8($,g,Q,V.clientHeight,K,X)}A.start(40,U)}A.start(40,U)},onMouseLeave(){A.clear()}},p],stateAttributesMapping:Yo});return M||f?B:null});function U8(e,t,a,r,i,l){if(t){let h=0;const b=a+i-Zs;for(let S=0;S<e.length;S+=1){const j=e[S];if(j&&j.offsetTop>=b){h=S;break}}const _=Math.max(0,h-1),y=e[_];return _<h&&y?Pf(y.offsetTop-i,l):0}let d=e.length-1;const f=a+r-i+Zs;for(let h=0;h<e.length;h+=1){const b=e[h];if(b&&b.offsetTop+b.offsetHeight>f){d=Math.max(0,h-1);break}}const p=Math.min(e.length-1,d+1),g=e[p];return p>d&&g?Pf(g.offsetTop+g.offsetHeight-r+i,l):l}const q8=x.forwardRef(function(t,a){return n.jsx(pE,{...t,ref:a,direction:"down"})}),H8=x.forwardRef(function(t,a){return n.jsx(pE,{...t,ref:a,direction:"up"})}),V8=_8;function F8({className:e,...t}){return n.jsx(S8,{"data-slot":"select-value",className:St("flex flex-1 text-left",e),...t})}function G8({className:e,size:t="default",children:a,...r}){return n.jsxs(k8,{"data-slot":"select-trigger","data-size":t,className:St("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[a,n.jsx(C8,{render:n.jsx(ms,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function Y8({className:e,children:t,side:a="bottom",sideOffset:r=4,align:i="center",alignOffset:l=0,alignItemWithTrigger:d=!0,...f}){return n.jsx(N8,{children:n.jsx(R8,{side:a,sideOffset:r,align:i,alignOffset:l,alignItemWithTrigger:d,className:"isolate z-50",children:n.jsxs(O8,{"data-slot":"select-content","data-align-trigger":d,className:St("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...f,children:[n.jsx(X8,{}),n.jsx(P8,{children:t}),n.jsx(Q8,{})]})})})}function K8({className:e,children:t,...a}){return n.jsxs(L8,{"data-slot":"select-item",className:St("relative flex w-full cursor-default items-center gap-2 rounded-md py-2 pr-8 pl-2.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...a,children:[n.jsx(B8,{className:"flex min-w-0 flex-1 gap-2 overflow-hidden whitespace-nowrap",children:t}),n.jsx(I8,{render:n.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:n.jsx(Xr,{className:"pointer-events-none"})})]})}function X8({className:e,...t}){return n.jsx(H8,{"data-slot":"select-scroll-up-button",className:St("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:n.jsx(Eb,{})})}function Q8({className:e,...t}){return n.jsx(q8,{"data-slot":"select-scroll-down-button",className:St("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:n.jsx(ms,{})})}function ct({value:e,onChange:t,options:a,placeholder:r="— elegir —",disabled:i,className:l,showIcon:d=!1}){return n.jsxs(V8,{value:e,onValueChange:f=>t(f??""),disabled:i,children:[n.jsx(G8,{className:me("h-9 w-full",l),children:n.jsx(F8,{placeholder:r,children:f=>{const p=a.find(h=>h.value===f),g=d?p?.icon:void 0;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[g&&n.jsx(g,{className:"size-3.5 shrink-0"}),n.jsx("span",{className:"truncate",children:p?.label??f})]})}})}),n.jsx(Y8,{side:"bottom",sideOffset:6,align:"start",alignItemWithTrigger:!1,className:"w-[var(--anchor-width)] p-1.5",children:a.map(f=>{const p=f.icon;return n.jsx(K8,{value:f.value,disabled:f.disabled,children:n.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[p?n.jsx(p,{className:"size-4 shrink-0 text-muted-fg"}):null,f.description?n.jsxs("span",{className:"flex min-w-0 flex-col leading-tight",children:[n.jsx("span",{className:"truncate font-medium",children:f.label}),n.jsx("span",{className:"truncate text-[11px] text-muted-fg",children:f.description})]}):n.jsx("span",{className:"truncate",children:f.label})]})},f.value)})})]})}const ab={web:{label:"Web",icon:Db,order:0},telegram:{label:"Telegram",icon:Sa,order:1},desktop:{label:"Desktop",icon:Lb,order:2},voice:{label:"Voice",icon:Pb,order:3},a2a:{label:"Agent ↔ Agent",icon:rn,order:4},schedule:{label:"Schedule",icon:WM,order:5},other:{label:"Other",icon:Go,order:6}};function Jk(e){if(!e)return"web";const t=e.toLowerCase();return t==="telegram"?"telegram":t==="voice"||t==="overlay"?"voice":t==="desktop"?"desktop":t==="web"||t==="sidebar"||t==="web-sidebar"?"web":t==="a2a"||t.startsWith("agent")?"a2a":t==="schedule"||t==="cron"||t==="routine"?"schedule":"other"}function W8({pid:e,slug:t,onLoaded:a}){const{data:r}=$e(`/api/projects/${e}/agents/${t}/conversations`,()=>Jr.list(e,t),{revalidateOnFocus:!1});return x.useEffect(()=>{a(t,r)},[t,r]),null}function Z8({pid:e,agents:t,superAgentSlug:a,superAgentLabel:r,selected:i,onSelect:l,onNewChat:d}){const[f,p]=x.useState(""),[g,h]=x.useState(""),[b,_]=x.useState({}),[y,S]=x.useState({}),[j,k]=x.useState(!1),C=String(e)==="0",w=$e(C?`/api/projects/${e}/super-agent/threads`:null,()=>Jr.threads(e),{revalidateOnFocus:!1}),E=(P,B)=>{B&&S(q=>{const Y=q[P];return Y&&Y.length===B.length&&Y===B?q:{...q,[P]:B}})},R=x.useMemo(()=>{const P=[];for(const B of t)for(const q of y[B.slug]||[])P.push({...q,agent_slug:q.agent_slug||B.slug});return P},[t,y]),T=x.useMemo(()=>{const P=f.trim().toLowerCase();return R.filter(B=>!(g&&B.agent_slug!==g||P&&!`${B.title||""} ${B.id} ${B.agent_slug}`.toLowerCase().includes(P)))},[R,f,g]),A=x.useMemo(()=>{if(g&&g!==a)return[];const P=f.trim().toLowerCase();return(w.data||[]).filter(B=>P?`${B.title} ${B.id} ${B.channel}`.toLowerCase().includes(P):!0)},[w.data,f,g,a]),z=x.useMemo(()=>{const P=new Map,B=(q,Y)=>{const U=P.get(q);U?U.push(Y):P.set(q,[Y])};for(const q of T)B(Jk(q.channel),{type:"conv",conv:q,sortTs:q.started_at||""});for(const q of A)B(Jk(q.channel),{type:"thread",thread:q,sortTs:q.last_ts||q.started_at||""});return Array.from(P.entries()).map(([q,Y])=>({key:q,items:Y.sort((U,V)=>new Date(V.sortTs||0).getTime()-new Date(U.sortTs||0).getTime())})).sort((q,Y)=>ab[q.key].order-ab[Y.key].order)},[T,A]),M=x.useMemo(()=>[{slug:a,label:r},...t.map(P=>({slug:P.slug,label:P.slug}))],[t,a,r]),D=x.useMemo(()=>[{value:"",label:u("project.chat.list.all_agents")},{value:a,label:r},...t.map(P=>({value:P.slug,label:P.slug}))],[t,a,r]),L=R.length+(w.data?.length||0),I=Object.keys(y).length>0||t.length===0||!!w.data;return n.jsxs("aside",{className:"flex h-full w-72 shrink-0 flex-col border-r border-border bg-card/30",children:[t.map(P=>n.jsx(W8,{pid:e,slug:P.slug,onLoaded:E},P.slug)),n.jsxs("header",{className:"flex h-[57px] shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"truncate text-sm font-semibold",children:u("project.chat.list.title")}),n.jsx("p",{className:"text-[10px] text-muted-fg",children:u("project.chat.list.count",{n:L})})]}),n.jsxs("div",{className:"relative",children:[n.jsxs("button",{type:"button",onClick:()=>k(P=>!P),className:"inline-flex items-center gap-1 rounded-md border border-border bg-accent/60 px-2 py-1 text-[11px] font-medium hover:bg-accent",children:[n.jsx(Ot,{className:"size-3"})," ",u("project.chat.list.new")]}),j&&n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button","aria-hidden":!0,tabIndex:-1,className:"fixed inset-0 z-10 cursor-default",onClick:()=>k(!1)}),n.jsxs("div",{className:"absolute right-0 top-full z-20 mt-1 w-56 rounded-md border border-border bg-card p-1 shadow-lg",children:[n.jsx("p",{className:"px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-fg",children:u("project.chat.list.pick_agent")}),n.jsx("div",{className:"max-h-64 overflow-y-auto",children:M.map(P=>n.jsxs("button",{type:"button",onClick:()=>{k(!1),d(P.slug)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs hover:bg-accent/50",children:[n.jsx(rn,{className:"size-3 shrink-0 text-muted-fg"}),n.jsx("span",{className:"truncate",children:P.label})]},`new-${P.slug}`))})]})]})]})]}),n.jsxs("div",{className:"space-y-2 border-b border-border p-2",children:[n.jsx(Ce,{value:f,onChange:P=>p(P.target.value),placeholder:u("project.chat.list.search")}),n.jsx(ct,{value:g,onChange:h,options:D})]}),n.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-2",children:[!I&&n.jsx("div",{className:"px-2 py-1",children:n.jsx(tt,{})}),z.map(P=>n.jsx(J8,{keyName:P.key,count:P.items.length,collapsed:!!b[P.key],onToggle:()=>_(B=>({...B,[P.key]:!B[P.key]})),children:P.items.map(B=>{if(B.type==="thread"){const U=B.thread,V=i.kind==="thread"&&i.channel===U.channel&&i.threadId===U.id;return n.jsx(ew,{title:U.title,subtitle:[U.channel,`${U.messages} msg`].join(" · "),badge:"super",timeAgo:U.last_ts,selected:V,onClick:()=>l({kind:"thread",channel:U.channel,threadId:U.id},{channel:U.channel,createdAt:U.started_at,title:U.title})},`thread-${U.channel}-${U.id}`)}const q=B.conv,Y=i.kind==="conv"&&i.agentSlug===q.agent_slug&&i.convId===q.id;return n.jsx(ew,{title:q.title||q.id,subtitle:[q.agent_slug,`${q.messages??0} msg`].filter(Boolean).join(" · "),badge:q.agent_slug,timeAgo:q.started_at,selected:Y,onClick:()=>l({kind:"conv",agentSlug:q.agent_slug,convId:q.id},{channel:q.channel,createdAt:q.started_at,title:q.title})},`${q.agent_slug}-${q.id}`)})},P.key)),I&&R.length===0&&A.length===0&&n.jsx("p",{className:"px-3 py-6 text-center text-xs text-muted-fg",children:u("project.chat.list.empty")})]})]})}function J8({keyName:e,count:t,collapsed:a,onToggle:r,children:i}){const l=ab[e],d=l.icon;return n.jsxs("section",{className:"space-y-1",children:[n.jsxs("button",{type:"button",onClick:r,className:"flex w-full items-center justify-between rounded-md px-2 py-1 text-muted-fg hover:bg-accent/30",children:[n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[a?n.jsx(eo,{className:"size-3"}):n.jsx(ms,{className:"size-3"}),n.jsx(d,{className:"size-3"}),n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",children:l.label})]}),n.jsx("span",{className:"text-[10px]",children:t})]}),!a&&n.jsx("div",{className:"space-y-0.5",children:i})]})}function ew({title:e,subtitle:t,badge:a,timeAgo:r,selected:i,onClick:l}){return n.jsxs("button",{type:"button",onClick:l,className:Bc("w-full rounded-md border px-2.5 py-2 text-left transition-colors",i?"border-primary/50 bg-primary/10":"border-transparent hover:border-border hover:bg-accent/40"),children:[n.jsxs("div",{className:"flex items-start justify-between gap-2",children:[n.jsx("p",{className:Bc("truncate text-sm",i?"font-semibold":"font-medium"),children:e}),r&&n.jsxs("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[10px] text-muted-fg",children:[n.jsx(Rb,{className:"size-2.5"}),eI(r)]})]}),n.jsxs("div",{className:"mt-0.5 flex items-center justify-between gap-2 text-[10px] text-muted-fg",children:[n.jsx("span",{className:"truncate",children:t}),a&&n.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-accent/50 px-1.5 py-0.5",children:[n.jsx(qb,{className:"size-2.5"}),a]})]})]})}function eI(e){if(!e)return"";const t=new Date(e).getTime();if(!Number.isFinite(t))return"";const a=Date.now()-t,r=Math.floor(a/6e4);if(r<1)return"now";if(r<60)return`${r}m`;const i=Math.floor(r/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`}const Gd="__super_agent__";function mE({pid:e,hideSidebar:t=!1,initialSelection:a}){const r=Xe(),[i,l]=Vo(),d=$e(`/api/projects/${e}/agents`,()=>an.list(e)),[f,p]=x.useState(!1),[g,h]=x.useState(""),[b,_]=x.useState(null),{msgs:y,send:S,stop:j,clear:k,load:C,loadThread:w,streaming:E}=i8(e,F=>r.error(F)),R=pu(),[T,A]=x.useState(()=>{if(a)return a;const F=i.get("agent"),oe=i.get("conv"),_e=i.get("channel"),le=i.get("thread");return _e&&le?{kind:"thread",channel:_e,threadId:le}:F&&oe?{kind:"conv",agentSlug:F,convId:oe}:F?{kind:"live",agentSlug:F}:{kind:"live",agentSlug:Gd}}),[z,M]=x.useState(void 0),[D,L]=x.useState(!1),[I,P]=x.useState(!1),B=(F,oe)=>{A(F),M(oe);const _e=new URLSearchParams;F.kind==="conv"?(_e.set("agent",F.agentSlug),_e.set("conv",F.convId)):F.kind==="thread"?(_e.set("channel",F.channel),_e.set("thread",F.threadId)):_e.set("agent",F.agentSlug),l(_e,{replace:!0})},q=d.data||[],Y=F=>F===Gd,U=x.useMemo(()=>T.kind==="thread"?void 0:q.find(F=>F.slug===T.agentSlug),[q,T]),V=T.kind==="thread"||Y(T.agentSlug);x.useEffect(()=>{T.kind==="conv"?C(T.agentSlug,T.convId):T.kind==="thread"?w(T.channel,T.threadId):k()},[T.kind,T.kind==="conv"?T.convId:T.kind==="thread"?`${T.channel}:${T.threadId}`:T.agentSlug]);const X=async F=>{if(V){await S(F,{model:g||void 0});return}U&&await S(F,{model:g||void 0,agentSlug:U.slug})},Q=async F=>{try{await navigator.clipboard.writeText(F),r.info(u("project.chat.copied"))}catch{}},W=F=>{B({kind:"live",agentSlug:F}),k()},$=()=>{const F=V?Gd:U?.slug??T.agentSlug;B({kind:"live",agentSlug:F}),k()},K=async()=>{P(!0);try{T.kind==="conv"?(await Jr.remove(e,T.agentSlug,T.convId),Tf(`/api/projects/${e}/agents/${T.agentSlug}/conversations`)):T.kind==="thread"&&(await Jr.removeThread(e,T.channel,T.threadId),Tf(`/api/projects/${e}/super-agent/threads`)),r.success(u("project.chat.deleted")),L(!1),$()}catch(F){r.error(F?.message||u("shared_ui.err_chat_failed"))}finally{P(!1)}},J=V?R:U?.slug??T.agentSlug,G=T.kind==="thread"?T.channel:z?.channel||"web",te=T.kind==="thread"?T.threadId:z?.createdAt,se=T.kind==="live"?u("project.chat.live_title",{agent:J}):z?.title||(T.kind==="thread"?T.threadId:T.convId),pe=te?u("project.chat.meta_created",{date:tI(te),channel:G}):u("project.chat.meta_new",{channel:G});return d.isLoading?n.jsx(tt,{}):n.jsxs("div",{className:"flex h-full overflow-hidden rounded-xl border border-border bg-card/40",children:[t?null:n.jsx(Z8,{pid:e,agents:q,superAgentSlug:Gd,superAgentLabel:u("agents_ui.super_agent_label",{persona:R}),selected:T,onSelect:B,onNewChat:W}),n.jsxs("section",{className:"flex min-w-0 flex-1 flex-col",children:[n.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"truncate text-sm font-semibold",children:se}),n.jsx("p",{className:"truncate text-[11px] text-muted-fg",children:pe})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[V?n.jsx(Be,{tone:"success",children:u("agents_ui.super_agent_badge")}):n.jsx(Be,{tone:"info",children:J}),!q.length&&!V&&n.jsxs(ae,{variant:"primary",size:"sm",onClick:()=>p(!0),children:[n.jsx(Ot,{size:14})," ",u("project.chat.create_agent")]}),n.jsxs(ae,{variant:"ghost",size:"sm",disabled:E||y.length===0,onClick:$,children:[n.jsx(hl,{size:13})," ",u("project.chat.new_session")]}),(T.kind==="conv"||T.kind==="thread")&&n.jsxs(ae,{variant:"destructive",size:"sm",disabled:E,onClick:()=>L(!0),children:[n.jsx(_n,{size:13})," ",u("project.chat.delete")]})]})]}),n.jsx("div",{className:"flex-1 overflow-y-auto",children:y.length?n.jsx(sv,{msgs:y,onCopy:Q}):n.jsx("div",{className:"flex h-full items-center justify-center p-8",children:n.jsx("p",{className:"text-sm text-muted-fg",children:u("project.chat.empty")})})}),n.jsx(sE,{msgs:y}),(()=>{const F=E?null:rE(y);return!F||F.turnKey===b?null:n.jsx(aE,{turnKey:F.turnKey,questions:F.questions,onSubmit:oe=>void X(oe),onDismiss:()=>_(F.turnKey),disabled:E})})(),n.jsx(XL,{onSend:X,onStop:j,streaming:E,model:g,onModelChange:h})]}),n.jsx(nI,{open:f,pid:e,onClose:()=>p(!1),onCreated:()=>{p(!1),d.mutate()}}),n.jsx(Bt,{open:D,onClose:()=>L(!1),title:u("project.chat.delete_confirm_title"),description:u("project.chat.delete_confirm_desc"),size:"sm",footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:()=>L(!1),disabled:I,children:u("common.cancel")}),n.jsxs(ae,{variant:"destructive",onClick:K,loading:I,children:[n.jsx(_n,{size:14})," ",u("project.chat.delete")]})]}),children:n.jsx("p",{className:"text-sm text-muted-fg",children:se})})]})}function tI(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString()}function nI({open:e,onClose:t,onCreated:a,pid:r}){const i=Xe(),[l,d]=x.useState(""),[f,p]=x.useState("master"),[g,h]=x.useState(""),[b,_]=x.useState(!0),[y,S]=x.useState(!1),j=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(l)){i.error(u("project.agents.slug_invalid"));return}S(!0);try{await an.create(r,{slug:l,role:f,model:g||void 0,is_master:b}),i.success(u("project.agents.created",{slug:l})),d(""),p("master"),h(""),_(!0),a()}catch(k){i.error(k.message)}finally{S(!1)}};return n.jsx(Bt,{open:e,onClose:t,title:u("project.chat.create_agent_title"),description:u("project.chat.create_agent_desc"),footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:t,disabled:y,children:u("common.cancel")}),n.jsx(ae,{variant:"primary",onClick:j,loading:y,children:u("common.create")})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(ie,{label:"slug",children:n.jsx(Ce,{autoFocus:!0,value:l,onChange:k=>d(k.target.value),placeholder:"master"})}),n.jsx(ie,{label:u("project.chat.role_label"),children:n.jsx(Ce,{value:f,onChange:k=>p(k.target.value),placeholder:"master"})}),n.jsx(ie,{label:u("project.chat.model_label"),hint:u("project.chat.model_hint"),children:n.jsx(Ce,{value:g,onChange:k=>h(k.target.value)})}),n.jsx(Dt,{checked:b,onChange:_,label:u("project.chat.master_label")})]})})}const sI={list:(e=!1)=>ne.get(`/api/inbox${e?"?include_empty=1":""}`).then(t=>Ja(t).items)};function aI(e=!1){const{data:t,error:a,isLoading:r,mutate:i}=$e(`/api/inbox?include_empty=${e?1:0}`,()=>sI.list(e),{refreshInterval:15e3});return{rows:t??[],error:a,isLoading:r,mutate:i}}function rI(){const e=Sn(),[t,a]=x.useState(!1),{rows:r,isLoading:i}=aI(t),[l,d]=x.useState(null);if(x.useEffect(()=>{!l&&r.length&&d(r[0])},[r,l]),i)return n.jsx(tt,{});const f=l?String(l.project_id??0):null,p=l?l.agent_name||l.agent_slug:"",g=h=>h.kind==="super_agent"?h.channel&&h.conversation_id?{kind:"thread",channel:h.channel,threadId:h.conversation_id}:void 0:h.conversation_id?{kind:"conv",agentSlug:h.agent_slug,convId:h.conversation_id}:{kind:"live",agentSlug:h.agent_slug};return n.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-3","data-testid":"inbox-screen",children:[n.jsxs("div",{className:"flex shrink-0 items-baseline justify-between gap-3",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-lg font-semibold",children:u("inbox.title")}),n.jsx("p",{className:"text-xs text-muted-fg",children:u("inbox.subtitle")})]}),n.jsx(Ue,{content:u(t?"inbox.hide_quiet":"inbox.show_quiet"),children:n.jsxs(ae,{size:"sm",variant:t?"primary":"ghost",onClick:()=>a(h=>!h),children:[t?n.jsx(Mb,{size:14}):n.jsx(Fo,{size:14}),n.jsx("span",{className:"hidden sm:inline",children:u("inbox.show_quiet")})]})})]}),n.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden rounded-xl border border-border bg-card/40",children:[n.jsx(KL,{rows:r,selectedKey:l?eb(l):null,onSelect:d}),n.jsx("section",{className:"flex min-w-0 flex-1 flex-col",children:l?n.jsxs(n.Fragment,{children:[n.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-2.5",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"truncate text-sm font-semibold",children:p}),n.jsxs("p",{className:"truncate text-[11px] text-muted-fg",children:[l.project_name||u("inbox.super_agent_scope"),l.channel?` · ${l.channel}`:""]})]}),n.jsxs(ae,{size:"sm",variant:"ghost",onClick:()=>e(l.kind==="super_agent"?"/p/0/chat":`/p/${l.project_id}/agents/${encodeURIComponent(l.agent_slug)}`),children:[u("inbox.open_in_project")," ",n.jsx(Cb,{size:13})]})]}),n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(mE,{pid:f,hideSidebar:!0,initialSelection:g(l)},eb(l))})]}):n.jsx("div",{className:"flex h-full items-center justify-center p-8",children:n.jsx("p",{className:"text-sm text-muted-fg",children:u("inbox.empty")})})})]})]})}const gE=x.createContext(null),hE=x.createContext(null),xE=x.createContext(""),bE=x.createContext(null),_E=x.createContext(null),vE=x.createContext(null);function oI({children:e}){const[t,a]=x.useState(null),[r,i]=x.useState(""),[l,d]=x.useState(null);return n.jsx(hE.Provider,{value:a,children:n.jsx(gE.Provider,{value:t,children:n.jsx(bE.Provider,{value:i,children:n.jsx(xE.Provider,{value:r,children:n.jsx(vE.Provider,{value:d,children:n.jsx(_E.Provider,{value:l,children:e})})})})})})}function iI(){return x.useContext(gE)}function lI(e,t){const a=x.useContext(hE);x.useEffect(()=>(a?.({collapsed:e,toggle:t}),()=>a?.(null)),[e,t,a])}function cI(){return x.useContext(xE)}function uI(e){const t=x.useContext(bE);x.useEffect(()=>(t?.(e),()=>t?.("")),[e,t])}function dI(){return x.useContext(_E)}function fI(e){const t=x.useContext(vE);x.useEffect(()=>(t?.(e),()=>t?.(null)),[e,t])}function yE({sections:e,active:t,onChange:a,collapsed:r,onToggleCollapse:i,actions:l,contentClassName:d,testId:f,children:p}){return lI(r,i),n.jsxs("div",{className:"flex h-full",children:[n.jsx(cP,{sections:e,active:t,onChange:a,collapsed:r}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[l?n.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 px-6 pt-3",children:l}):null,n.jsx("div",{className:me("flex-1 min-h-0 overflow-y-auto",d),"data-testid":f,children:p})]})]})}function pI({className:e}){return n.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M18.833 9.637a4.167 4.167 0 1 1 0 8.333 4.167 4.167 0 0 1 0-8.333zm-13.666 0a4.167 4.167 0 1 1 0 8.333 4.167 4.167 0 0 1 0-8.333zM12 2a4.167 4.167 0 1 1 0 8.333A4.167 4.167 0 0 1 12 2z"})})}function jE({className:e}){return n.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M19.355 18.538a68.967 68.959 0 0 0 1.858-2.954.81.81 0 0 0-.062-.9c-.516-.685-1.504-2.075-2.042-3.362-.553-1.321-.636-3.375-.64-4.377a1.707 1.707 0 0 0-.358-1.05l-3.198-4.064a3.744 3.744 0 0 1-.076.543c-.106.503-.307 1.004-.536 1.5-.134.29-.29.6-.446.914l-.31.626c-.516 1.068-.997 2.227-1.132 3.59-.124 1.26.046 2.73.815 4.481.128.011.257.025.386.044a6.363 6.363 0 0 1 3.326 1.505c.916.79 1.744 1.922 2.415 3.5zM8.199 22.569c.073.012.146.02.22.02.78.024 2.095.092 3.16.29.87.16 2.593.64 4.01 1.055 1.083.316 2.198-.548 2.355-1.664.114-.814.33-1.735.725-2.58l-.01.005c-.67-1.87-1.522-3.078-2.416-3.849a5.295 5.295 0 0 0-2.778-1.257c-1.54-.216-2.952.19-3.84.45.532 2.218.368 4.829-1.425 7.531zM5.533 9.938c-.023.1-.056.197-.098.29L2.82 16.059a1.602 1.602 0 0 0 .313 1.772l4.116 4.24c2.103-3.101 1.796-6.02.836-8.3-.728-1.73-1.832-3.081-2.55-3.831zM9.32 14.01c.615-.183 1.606-.465 2.745-.534-.683-1.725-.848-3.233-.716-4.577.154-1.552.7-2.847 1.235-3.95.113-.235.223-.454.328-.664.149-.297.288-.577.419-.86.217-.47.379-.885.46-1.27.08-.38.08-.72-.014-1.043-.095-.325-.297-.675-.68-1.06a1.6 1.6 0 0 0-1.475.36l-4.95 4.452a1.602 1.602 0 0 0-.513.952l-.427 2.83c.672.59 2.328 2.316 3.335 4.711.09.21.175.43.253.653z"})})}function mI({className:e}){return n.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"})})}const tw={happy:{eyes:["◕","◕"],mouth:"‿"},wave:{eyes:["◕","◕"],mouth:"▽",top:"·"},confused:{eyes:["◑","◐"],mouth:"o",top:"?"},sad:{eyes:["╥","╥"],mouth:"◠"},excited:{eyes:["★","★"],mouth:"▽",top:"✦"},sleeping:{eyes:["−","−"],mouth:"‿",top:"z z"}};function kE({mood:e="happy",className:t}){const a=tw[e]??tw.happy,[r,i]=a.eyes,l="text-emerald-700 dark:text-emerald-600/70";return n.jsxs("div",{"aria-hidden":!0,className:St("select-none whitespace-pre font-mono leading-none text-emerald-400",t),children:[a.top&&n.jsx("div",{children:n.jsx("span",{className:l,children:` ${a.top}`})}),n.jsx("div",{children:" ▄███████▄"}),n.jsxs("div",{children:[" █ ",n.jsx("span",{className:l,children:"██"})," ",n.jsx("span",{className:l,children:"██"})," █"]}),n.jsx("div",{children:` █ ${r} ${i} █`}),n.jsx("div",{children:` █ ${a.mouth} █`}),n.jsx("div",{children:" ▀███████▀"})]})}function wE({mood:e="confused",title:t,titleClassName:a,message:r,action:i,className:l,testId:d}){return n.jsx("div",{className:St("grid h-full place-items-center p-8",l),"data-testid":d,children:n.jsxs("div",{className:"flex flex-col items-center text-center",children:[n.jsx(kE,{mood:e,className:"mb-6 text-sm"}),t!=null&&n.jsx("div",{className:St("font-mono font-semibold leading-none tracking-tight text-foreground",a),children:t}),r!=null&&n.jsx("p",{className:"mt-4 max-w-sm text-sm text-muted-fg",children:r}),i&&n.jsx("div",{className:"mt-6",children:i})]})})}const iv={pending:{labelKey:"tasks.status_pending",color:"text-amber-500",dot:"bg-amber-400",Icon:nM},running:{labelKey:"tasks.status_running",color:"text-sky-500",dot:"bg-sky-400",Icon:Js,spin:!0},in_review:{labelKey:"tasks.status_in_review",color:"text-violet-500",dot:"bg-violet-400",Icon:Rb},blocked:{labelKey:"tasks.status_blocked",color:"text-slate-400",dot:"bg-slate-400",Icon:sM}},SE=["pending","running","in_review","blocked"];function If(e){return e.state==="done"?"done":e.state==="dropped"?"dropped":e.status??"pending"}function lv(e){return u(iv[e].labelKey)}function $f({status:e,className:t}){if(e==="done")return n.jsx(Qf,{className:me("size-4 text-emerald-500",t)});if(e==="dropped")return n.jsx(pS,{className:me("size-4 text-muted-foreground",t)});const a=iv[e];return n.jsx(a.Icon,{className:me("size-4",a.color,a.spin&&"animate-spin",t)})}function cv({status:e}){const t=e==="done"?u("tasks.done_label"):e==="dropped"?u("tasks.dropped_label"):lv(e),a=e==="done"?"text-emerald-500 border-emerald-500/30":e==="dropped"?"text-muted-foreground border-border":`${iv[e].color} border-current/30`;return n.jsxs("span",{className:me("inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[10px] font-medium capitalize",a),children:[n.jsx($f,{status:e,className:"size-3"}),t]})}function gI(e,t){var a,r=1;e==null&&(e=0),t==null&&(t=0);function i(){var l,d=a.length,f,p=0,g=0;for(l=0;l<d;++l)f=a[l],p+=f.x,g+=f.y;for(p=(p/d-e)*r,g=(g/d-t)*r,l=0;l<d;++l)f=a[l],f.x-=p,f.y-=g}return i.initialize=function(l){a=l},i.x=function(l){return arguments.length?(e=+l,i):e},i.y=function(l){return arguments.length?(t=+l,i):t},i.strength=function(l){return arguments.length?(r=+l,i):r},i}function hI(e){const t=+this._x.call(null,e),a=+this._y.call(null,e);return CE(this.cover(t,a),t,a,e)}function CE(e,t,a,r){if(isNaN(t)||isNaN(a))return e;var i,l=e._root,d={data:r},f=e._x0,p=e._y0,g=e._x1,h=e._y1,b,_,y,S,j,k,C,w;if(!l)return e._root=d,e;for(;l.length;)if((j=t>=(b=(f+g)/2))?f=b:g=b,(k=a>=(_=(p+h)/2))?p=_:h=_,i=l,!(l=l[C=k<<1|j]))return i[C]=d,e;if(y=+e._x.call(null,l.data),S=+e._y.call(null,l.data),t===y&&a===S)return d.next=l,i?i[C]=d:e._root=d,e;do i=i?i[C]=new Array(4):e._root=new Array(4),(j=t>=(b=(f+g)/2))?f=b:g=b,(k=a>=(_=(p+h)/2))?p=_:h=_;while((C=k<<1|j)===(w=(S>=_)<<1|y>=b));return i[w]=l,i[C]=d,e}function xI(e){var t,a,r=e.length,i,l,d=new Array(r),f=new Array(r),p=1/0,g=1/0,h=-1/0,b=-1/0;for(a=0;a<r;++a)isNaN(i=+this._x.call(null,t=e[a]))||isNaN(l=+this._y.call(null,t))||(d[a]=i,f[a]=l,i<p&&(p=i),i>h&&(h=i),l<g&&(g=l),l>b&&(b=l));if(p>h||g>b)return this;for(this.cover(p,g).cover(h,b),a=0;a<r;++a)CE(this,d[a],f[a],e[a]);return this}function bI(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var a=this._x0,r=this._y0,i=this._x1,l=this._y1;if(isNaN(a))i=(a=Math.floor(e))+1,l=(r=Math.floor(t))+1;else{for(var d=i-a||1,f=this._root,p,g;a>e||e>=i||r>t||t>=l;)switch(g=(t<r)<<1|e<a,p=new Array(4),p[g]=f,f=p,d*=2,g){case 0:i=a+d,l=r+d;break;case 1:a=i-d,l=r+d;break;case 2:i=a+d,r=l-d;break;case 3:a=i-d,r=l-d;break}this._root&&this._root.length&&(this._root=f)}return this._x0=a,this._y0=r,this._x1=i,this._y1=l,this}function _I(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function vI(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Jn(e,t,a,r,i){this.node=e,this.x0=t,this.y0=a,this.x1=r,this.y1=i}function yI(e,t,a){var r,i=this._x0,l=this._y0,d,f,p,g,h=this._x1,b=this._y1,_=[],y=this._root,S,j;for(y&&_.push(new Jn(y,i,l,h,b)),a==null?a=1/0:(i=e-a,l=t-a,h=e+a,b=t+a,a*=a);S=_.pop();)if(!(!(y=S.node)||(d=S.x0)>h||(f=S.y0)>b||(p=S.x1)<i||(g=S.y1)<l))if(y.length){var k=(d+p)/2,C=(f+g)/2;_.push(new Jn(y[3],k,C,p,g),new Jn(y[2],d,C,k,g),new Jn(y[1],k,f,p,C),new Jn(y[0],d,f,k,C)),(j=(t>=C)<<1|e>=k)&&(S=_[_.length-1],_[_.length-1]=_[_.length-1-j],_[_.length-1-j]=S)}else{var w=e-+this._x.call(null,y.data),E=t-+this._y.call(null,y.data),R=w*w+E*E;if(R<a){var T=Math.sqrt(a=R);i=e-T,l=t-T,h=e+T,b=t+T,r=y.data}}return r}function jI(e){if(isNaN(h=+this._x.call(null,e))||isNaN(b=+this._y.call(null,e)))return this;var t,a=this._root,r,i,l,d=this._x0,f=this._y0,p=this._x1,g=this._y1,h,b,_,y,S,j,k,C;if(!a)return this;if(a.length)for(;;){if((S=h>=(_=(d+p)/2))?d=_:p=_,(j=b>=(y=(f+g)/2))?f=y:g=y,t=a,!(a=a[k=j<<1|S]))return this;if(!a.length)break;(t[k+1&3]||t[k+2&3]||t[k+3&3])&&(r=t,C=k)}for(;a.data!==e;)if(i=a,!(a=a.next))return this;return(l=a.next)&&delete a.next,i?(l?i.next=l:delete i.next,this):t?(l?t[k]=l:delete t[k],(a=t[0]||t[1]||t[2]||t[3])&&a===(t[3]||t[2]||t[1]||t[0])&&!a.length&&(r?r[C]=a:this._root=a),this):(this._root=l,this)}function kI(e){for(var t=0,a=e.length;t<a;++t)this.remove(e[t]);return this}function wI(){return this._root}function SI(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function CI(e){var t=[],a,r=this._root,i,l,d,f,p;for(r&&t.push(new Jn(r,this._x0,this._y0,this._x1,this._y1));a=t.pop();)if(!e(r=a.node,l=a.x0,d=a.y0,f=a.x1,p=a.y1)&&r.length){var g=(l+f)/2,h=(d+p)/2;(i=r[3])&&t.push(new Jn(i,g,h,f,p)),(i=r[2])&&t.push(new Jn(i,l,h,g,p)),(i=r[1])&&t.push(new Jn(i,g,d,f,h)),(i=r[0])&&t.push(new Jn(i,l,d,g,h))}return this}function NI(e){var t=[],a=[],r;for(this._root&&t.push(new Jn(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var i=r.node;if(i.length){var l,d=r.x0,f=r.y0,p=r.x1,g=r.y1,h=(d+p)/2,b=(f+g)/2;(l=i[0])&&t.push(new Jn(l,d,f,h,b)),(l=i[1])&&t.push(new Jn(l,h,f,p,b)),(l=i[2])&&t.push(new Jn(l,d,b,h,g)),(l=i[3])&&t.push(new Jn(l,h,b,p,g))}a.push(r)}for(;r=a.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function EI(e){return e[0]}function RI(e){return arguments.length?(this._x=e,this):this._x}function TI(e){return e[1]}function AI(e){return arguments.length?(this._y=e,this):this._y}function uv(e,t,a){var r=new dv(t??EI,a??TI,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function dv(e,t,a,r,i,l){this._x=e,this._y=t,this._x0=a,this._y0=r,this._x1=i,this._y1=l,this._root=void 0}function nw(e){for(var t={data:e.data},a=t;e=e.next;)a=a.next={data:e.data};return t}var ss=uv.prototype=dv.prototype;ss.copy=function(){var e=new dv(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,a,r;if(!t)return e;if(!t.length)return e._root=nw(t),e;for(a=[{source:t,target:e._root=new Array(4)}];t=a.pop();)for(var i=0;i<4;++i)(r=t.source[i])&&(r.length?a.push({source:r,target:t.target[i]=new Array(4)}):t.target[i]=nw(r));return e};ss.add=hI;ss.addAll=xI;ss.cover=bI;ss.data=_I;ss.extent=vI;ss.find=yI;ss.remove=jI;ss.removeAll=kI;ss.root=wI;ss.size=SI;ss.visit=CI;ss.visitAfter=NI;ss.x=RI;ss.y=AI;function es(e){return function(){return e}}function Vr(e){return(e()-.5)*1e-6}function MI(e){return e.x+e.vx}function zI(e){return e.y+e.vy}function OI(e){var t,a,r,i=1,l=1;typeof e!="function"&&(e=es(e==null?1:+e));function d(){for(var g,h=t.length,b,_,y,S,j,k,C=0;C<l;++C)for(b=uv(t,MI,zI).visitAfter(f),g=0;g<h;++g)_=t[g],j=a[_.index],k=j*j,y=_.x+_.vx,S=_.y+_.vy,b.visit(w);function w(E,R,T,A,z){var M=E.data,D=E.r,L=j+D;if(M){if(M.index>_.index){var I=y-M.x-M.vx,P=S-M.y-M.vy,B=I*I+P*P;B<L*L&&(I===0&&(I=Vr(r),B+=I*I),P===0&&(P=Vr(r),B+=P*P),B=(L-(B=Math.sqrt(B)))/B*i,_.vx+=(I*=B)*(L=(D*=D)/(k+D)),_.vy+=(P*=B)*L,M.vx-=I*(L=1-L),M.vy-=P*L)}return}return R>y+L||A<y-L||T>S+L||z<S-L}}function f(g){if(g.data)return g.r=a[g.data.index];for(var h=g.r=0;h<4;++h)g[h]&&g[h].r>g.r&&(g.r=g[h].r)}function p(){if(t){var g,h=t.length,b;for(a=new Array(h),g=0;g<h;++g)b=t[g],a[b.index]=+e(b,g,t)}}return d.initialize=function(g,h){t=g,r=h,p()},d.iterations=function(g){return arguments.length?(l=+g,d):l},d.strength=function(g){return arguments.length?(i=+g,d):i},d.radius=function(g){return arguments.length?(e=typeof g=="function"?g:es(+g),p(),d):e},d}function DI(e){return e.index}function sw(e,t){var a=e.get(t);if(!a)throw new Error("node not found: "+t);return a}function PI(e){var t=DI,a=b,r,i=es(30),l,d,f,p,g,h=1;e==null&&(e=[]);function b(k){return 1/Math.min(f[k.source.index],f[k.target.index])}function _(k){for(var C=0,w=e.length;C<h;++C)for(var E=0,R,T,A,z,M,D,L;E<w;++E)R=e[E],T=R.source,A=R.target,z=A.x+A.vx-T.x-T.vx||Vr(g),M=A.y+A.vy-T.y-T.vy||Vr(g),D=Math.sqrt(z*z+M*M),D=(D-l[E])/D*k*r[E],z*=D,M*=D,A.vx-=z*(L=p[E]),A.vy-=M*L,T.vx+=z*(L=1-L),T.vy+=M*L}function y(){if(d){var k,C=d.length,w=e.length,E=new Map(d.map((T,A)=>[t(T,A,d),T])),R;for(k=0,f=new Array(C);k<w;++k)R=e[k],R.index=k,typeof R.source!="object"&&(R.source=sw(E,R.source)),typeof R.target!="object"&&(R.target=sw(E,R.target)),f[R.source.index]=(f[R.source.index]||0)+1,f[R.target.index]=(f[R.target.index]||0)+1;for(k=0,p=new Array(w);k<w;++k)R=e[k],p[k]=f[R.source.index]/(f[R.source.index]+f[R.target.index]);r=new Array(w),S(),l=new Array(w),j()}}function S(){if(d)for(var k=0,C=e.length;k<C;++k)r[k]=+a(e[k],k,e)}function j(){if(d)for(var k=0,C=e.length;k<C;++k)l[k]=+i(e[k],k,e)}return _.initialize=function(k,C){d=k,g=C,y()},_.links=function(k){return arguments.length?(e=k,y(),_):e},_.id=function(k){return arguments.length?(t=k,_):t},_.iterations=function(k){return arguments.length?(h=+k,_):h},_.strength=function(k){return arguments.length?(a=typeof k=="function"?k:es(+k),S(),_):a},_.distance=function(k){return arguments.length?(i=typeof k=="function"?k:es(+k),j(),_):i},_}var LI={value:()=>{}};function NE(){for(var e=0,t=arguments.length,a={},r;e<t;++e){if(!(r=arguments[e]+"")||r in a||/[\s.]/.test(r))throw new Error("illegal type: "+r);a[r]=[]}return new ff(a)}function ff(e){this._=e}function II(e,t){return e.trim().split(/^|\s+/).map(function(a){var r="",i=a.indexOf(".");if(i>=0&&(r=a.slice(i+1),a=a.slice(0,i)),a&&!t.hasOwnProperty(a))throw new Error("unknown type: "+a);return{type:a,name:r}})}ff.prototype=NE.prototype={constructor:ff,on:function(e,t){var a=this._,r=II(e+"",a),i,l=-1,d=r.length;if(arguments.length<2){for(;++l<d;)if((i=(e=r[l]).type)&&(i=$I(a[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<d;)if(i=(e=r[l]).type)a[i]=aw(a[i],e.name,t);else if(t==null)for(i in a)a[i]=aw(a[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var a in t)e[a]=t[a].slice();return new ff(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var a=new Array(i),r=0,i,l;r<i;++r)a[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],r=0,i=l.length;r<i;++r)l[r].value.apply(t,a)},apply:function(e,t,a){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,l=r.length;i<l;++i)r[i].value.apply(t,a)}};function $I(e,t){for(var a=0,r=e.length,i;a<r;++a)if((i=e[a]).name===t)return i.value}function aw(e,t,a){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=LI,e=e.slice(0,r).concat(e.slice(r+1));break}return a!=null&&e.push({name:t,value:a}),e}var dl=0,Tc=0,_c=0,EE=1e3,Bf,Ac,Uf=0,Bo=0,Ap=0,Kc=typeof performance=="object"&&performance.now?performance:Date,RE=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function TE(){return Bo||(RE(BI),Bo=Kc.now()+Ap)}function BI(){Bo=0}function rb(){this._call=this._time=this._next=null}rb.prototype=AE.prototype={constructor:rb,restart:function(e,t,a){if(typeof e!="function")throw new TypeError("callback is not a function");a=(a==null?TE():+a)+(t==null?0:+t),!this._next&&Ac!==this&&(Ac?Ac._next=this:Bf=this,Ac=this),this._call=e,this._time=a,ob()},stop:function(){this._call&&(this._call=null,this._time=1/0,ob())}};function AE(e,t,a){var r=new rb;return r.restart(e,t,a),r}function UI(){TE(),++dl;for(var e=Bf,t;e;)(t=Bo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--dl}function rw(){Bo=(Uf=Kc.now())+Ap,dl=Tc=0;try{UI()}finally{dl=0,HI(),Bo=0}}function qI(){var e=Kc.now(),t=e-Uf;t>EE&&(Ap-=t,Uf=e)}function HI(){for(var e,t=Bf,a,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(a=t._next,t._next=null,t=e?e._next=a:Bf=a);Ac=e,ob(r)}function ob(e){if(!dl){Tc&&(Tc=clearTimeout(Tc));var t=e-Bo;t>24?(e<1/0&&(Tc=setTimeout(rw,e-Kc.now()-Ap)),_c&&(_c=clearInterval(_c))):(_c||(Uf=Kc.now(),_c=setInterval(qI,EE)),dl=1,RE(rw))}}const VI=1664525,FI=1013904223,ow=4294967296;function GI(){let e=1;return()=>(e=(VI*e+FI)%ow)/ow}function YI(e){return e.x}function KI(e){return e.y}var XI=10,QI=Math.PI*(3-Math.sqrt(5));function WI(e){var t,a=1,r=.001,i=1-Math.pow(r,1/300),l=0,d=.6,f=new Map,p=AE(b),g=NE("tick","end"),h=GI();e==null&&(e=[]);function b(){_(),g.call("tick",t),a<r&&(p.stop(),g.call("end",t))}function _(j){var k,C=e.length,w;j===void 0&&(j=1);for(var E=0;E<j;++E)for(a+=(l-a)*i,f.forEach(function(R){R(a)}),k=0;k<C;++k)w=e[k],w.fx==null?w.x+=w.vx*=d:(w.x=w.fx,w.vx=0),w.fy==null?w.y+=w.vy*=d:(w.y=w.fy,w.vy=0);return t}function y(){for(var j=0,k=e.length,C;j<k;++j){if(C=e[j],C.index=j,C.fx!=null&&(C.x=C.fx),C.fy!=null&&(C.y=C.fy),isNaN(C.x)||isNaN(C.y)){var w=XI*Math.sqrt(.5+j),E=j*QI;C.x=w*Math.cos(E),C.y=w*Math.sin(E)}(isNaN(C.vx)||isNaN(C.vy))&&(C.vx=C.vy=0)}}function S(j){return j.initialize&&j.initialize(e,h),j}return y(),t={tick:_,restart:function(){return p.restart(b),t},stop:function(){return p.stop(),t},nodes:function(j){return arguments.length?(e=j,y(),f.forEach(S),t):e},alpha:function(j){return arguments.length?(a=+j,t):a},alphaMin:function(j){return arguments.length?(r=+j,t):r},alphaDecay:function(j){return arguments.length?(i=+j,t):+i},alphaTarget:function(j){return arguments.length?(l=+j,t):l},velocityDecay:function(j){return arguments.length?(d=1-j,t):1-d},randomSource:function(j){return arguments.length?(h=j,f.forEach(S),t):h},force:function(j,k){return arguments.length>1?(k==null?f.delete(j):f.set(j,S(k)),t):f.get(j)},find:function(j,k,C){var w=0,E=e.length,R,T,A,z,M;for(C==null?C=1/0:C*=C,w=0;w<E;++w)z=e[w],R=j-z.x,T=k-z.y,A=R*R+T*T,A<C&&(M=z,C=A);return M},on:function(j,k){return arguments.length>1?(g.on(j,k),t):g.on(j)}}}function ZI(){var e,t,a,r,i=es(-30),l,d=1,f=1/0,p=.81;function g(y){var S,j=e.length,k=uv(e,YI,KI).visitAfter(b);for(r=y,S=0;S<j;++S)t=e[S],k.visit(_)}function h(){if(e){var y,S=e.length,j;for(l=new Array(S),y=0;y<S;++y)j=e[y],l[j.index]=+i(j,y,e)}}function b(y){var S=0,j,k,C=0,w,E,R;if(y.length){for(w=E=R=0;R<4;++R)(j=y[R])&&(k=Math.abs(j.value))&&(S+=j.value,C+=k,w+=k*j.x,E+=k*j.y);y.x=w/C,y.y=E/C}else{j=y,j.x=j.data.x,j.y=j.data.y;do S+=l[j.data.index];while(j=j.next)}y.value=S}function _(y,S,j,k){if(!y.value)return!0;var C=y.x-t.x,w=y.y-t.y,E=k-S,R=C*C+w*w;if(E*E/p<R)return R<f&&(C===0&&(C=Vr(a),R+=C*C),w===0&&(w=Vr(a),R+=w*w),R<d&&(R=Math.sqrt(d*R)),t.vx+=C*y.value*r/R,t.vy+=w*y.value*r/R),!0;if(y.length||R>=f)return;(y.data!==t||y.next)&&(C===0&&(C=Vr(a),R+=C*C),w===0&&(w=Vr(a),R+=w*w),R<d&&(R=Math.sqrt(d*R)));do y.data!==t&&(E=l[y.data.index]*r/R,t.vx+=C*E,t.vy+=w*E);while(y=y.next)}return g.initialize=function(y,S){e=y,a=S,h()},g.strength=function(y){return arguments.length?(i=typeof y=="function"?y:es(+y),h(),g):i},g.distanceMin=function(y){return arguments.length?(d=y*y,g):Math.sqrt(d)},g.distanceMax=function(y){return arguments.length?(f=y*y,g):Math.sqrt(f)},g.theta=function(y){return arguments.length?(p=y*y,g):Math.sqrt(p)},g}function JI(e){var t=es(.1),a,r,i;typeof e!="function"&&(e=es(e==null?0:+e));function l(f){for(var p=0,g=a.length,h;p<g;++p)h=a[p],h.vx+=(i[p]-h.x)*r[p]*f}function d(){if(a){var f,p=a.length;for(r=new Array(p),i=new Array(p),f=0;f<p;++f)r[f]=isNaN(i[f]=+e(a[f],f,a))?0:+t(a[f],f,a)}}return l.initialize=function(f){a=f,d()},l.strength=function(f){return arguments.length?(t=typeof f=="function"?f:es(+f),d(),l):t},l.x=function(f){return arguments.length?(e=typeof f=="function"?f:es(+f),d(),l):e},l}function e7(e){var t=es(.1),a,r,i;typeof e!="function"&&(e=es(e==null?0:+e));function l(f){for(var p=0,g=a.length,h;p<g;++p)h=a[p],h.vy+=(i[p]-h.y)*r[p]*f}function d(){if(a){var f,p=a.length;for(r=new Array(p),i=new Array(p),f=0;f<p;++f)r[f]=isNaN(i[f]=+e(a[f],f,a))?0:+t(a[f],f,a)}}return l.initialize=function(f){a=f,d()},l.strength=function(f){return arguments.length?(t=typeof f=="function"?f:es(+f),d(),l):t},l.y=function(f){return arguments.length?(e=typeof f=="function"?f:es(+f),d(),l):e},l}const Bs={agent:"#a78bfa",memory:"#38bdf8",thread:"#34d399",task:"#fbbf24",routine:"#f472b6",agentlink:"#c084fc",hub:"#94a3b8"};function iw(e){return{agent:u("agents_ui.kind_agent"),memory:u("agents_ui.kind_memory"),thread:u("agents_ui.kind_thread"),task:u("agents_ui.kind_task"),routine:u("agents_ui.kind_routine"),agentlink:u("agents_ui.kind_hierarchy")}[e]??e}const lw={core:24,hub:12,leaf:6},$r=e=>e.role??"leaf",cw=(e,t,a)=>Math.max(t,Math.min(a,e)),uw=e=>{const t=new Map;for(const a of e)t.set(a.id,a);return[...t.values()]},t7=(e,t=26)=>e.length>t?`${e.slice(0,t)}…`:e;function ME({nodes:e,edges:t,height:a=520,onNodeClick:r,toolbar:i}){const d=Math.round(1e3*a/760),f=x.useRef(null),p=x.useRef(null),g=x.useRef(null),h=x.useRef([]),b=x.useRef([]),_=x.useRef(null),y=x.useRef(null),S=x.useRef(null),j=x.useRef(!1),k=x.useRef({tx:0,ty:0,k:1}),C=x.useRef(()=>{}),[,w]=x.useState(0),[E,R]=x.useState(null),[T,A]=x.useState(!1),z=1e3/2,M=d/2,D=()=>w(F=>F+1),L=e.length>44;x.useEffect(()=>{const F=Math.min(1e3,d)*.3,oe=e.filter(Te=>$r(Te)==="hub"),_e=new Map;oe.forEach((Te,Ee)=>_e.set(Te.id,Ee/Math.max(1,oe.length)*Math.PI*2-Math.PI/2));const le=e.map((Te,Ee)=>{const Me=$r(Te);if(Me==="core")return{...Te,x:z,y:M,fx:z,fy:M};const De=_e.get(Te.id)??Ee/Math.max(1,e.length)*Math.PI*2,He=Me==="hub"?F:F*1.7;return{...Te,x:z+Math.cos(De)*He,y:M+Math.sin(De)*He}}),be=new Map(le.map(Te=>[Te.id,Te])),ke=t.map(Te=>({source:be.get(Te.source),target:be.get(Te.target)})).filter(Te=>!!Te.source&&!!Te.target);h.current=le,b.current=ke,D();const Re=Te=>{const Ee=$r(Te.source),Me=$r(Te.target);return Ee==="core"||Me==="core"?170:Ee==="hub"&&Me==="hub"?130:58},Ae=Te=>{const Ee=$r(Te);return Ee==="core"?-700:Ee==="hub"?-360:-90},Ie=WI(le).force("link",PI(ke).distance(Re).strength(.5)).force("charge",ZI().strength(Ae)).force("center",gI(z,M).strength(.03)).force("x",JI(z).strength(.02)).force("y",e7(M).strength(.02)).force("collide",OI(Te=>lw[$r(Te)]+8)).alphaDecay(.025).on("tick",D);g.current=Ie;const Oe=setTimeout(()=>C.current(),1400);return()=>{clearTimeout(Oe),Ie.stop()}},[e,t,a]);const I=(F,oe)=>{const _e=p.current.getBoundingClientRect();return{x:(F-_e.left)/_e.width*1e3,y:(oe-_e.top)/_e.height*d}},P=(F,oe,_e)=>{const le=k.current,be=cw(le.k*_e,.25,8);k.current={k:be,tx:F-(F-le.tx)*(be/le.k),ty:oe-(oe-le.ty)*(be/le.k)},D()};C.current=()=>{const F=h.current.filter(Ee=>Ee.x!=null&&Ee.y!=null);if(!F.length)return;let oe=1/0,_e=1/0,le=-1/0,be=-1/0;for(const Ee of F)oe=Math.min(oe,Ee.x),_e=Math.min(_e,Ee.y),le=Math.max(le,Ee.x),be=Math.max(be,Ee.y);const ke=60,Re=Math.max(1,le-oe),Ae=Math.max(1,be-_e),Ie=cw(Math.min((1e3-ke*2)/Re,(d-ke*2)/Ae),.25,2.5),Oe=(oe+le)/2,Te=(_e+be)/2;k.current={k:Ie,tx:1e3/2-Oe*Ie,ty:d/2-Te*Ie},D()},x.useEffect(()=>{const F=p.current;if(!F)return;const oe=_e=>{_e.preventDefault();const le=I(_e.clientX,_e.clientY);P(le.x,le.y,_e.deltaY>0?.9:1.1)};return F.addEventListener("wheel",oe,{passive:!1}),()=>F.removeEventListener("wheel",oe)},[]),x.useEffect(()=>{if(!T)return;const F=oe=>{oe.key==="Escape"&&A(!1)};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[T]);const B=(F,oe)=>{const _e=I(F,oe),le=k.current;return{x:(_e.x-le.tx)/le.k,y:(_e.y-le.ty)/le.k}},q=F=>oe=>{$r(F)!=="core"&&(oe.stopPropagation(),_.current=F,S.current={x:oe.clientX,y:oe.clientY},j.current=!1,oe.target.setPointerCapture?.(oe.pointerId),g.current?.alphaTarget(.3).restart())},Y=F=>{y.current={x:F.clientX,y:F.clientY},F.currentTarget.setPointerCapture?.(F.pointerId)},U=F=>{if(_.current){const oe=S.current;oe&&!j.current&&Math.hypot(F.clientX-oe.x,F.clientY-oe.y)>4&&(j.current=!0);const _e=B(F.clientX,F.clientY);_.current.fx=_e.x,_.current.fy=_e.y;return}if(y.current){const oe=p.current.getBoundingClientRect();k.current.tx+=(F.clientX-y.current.x)/oe.width*1e3,k.current.ty+=(F.clientY-y.current.y)/oe.height*d,y.current={x:F.clientX,y:F.clientY},D()}},V=()=>{const F=_.current;F&&(F.fx=null,F.fy=null),_.current=null,y.current=null,g.current?.alphaTarget(0)},X=F=>()=>{j.current||J(F)},Q=h.current,W=b.current,$=k.current,K=[...new Set(e.map(F=>F.kind))].filter(F=>F!=="agent"&&F!=="hub"),J=F=>{R(F),r?.(F)},G=E?uw(W.filter(F=>F.target.id===E.id).map(F=>F.source)):[],te=E?uw(W.filter(F=>F.source.id===E.id).map(F=>F.target)):[],se=E?.detail&&E.detail.trim()!==E.label.trim()?E.detail:null,pe=({onClick:F,title:oe,children:_e})=>n.jsx("button",{type:"button",title:oe,onClick:F,className:"grid size-7 place-items-center rounded-md border border-border bg-card/80 text-muted-fg backdrop-blur hover:text-foreground",children:_e});return n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{ref:f,className:T?"fixed inset-0 z-[60] flex flex-col gap-3 bg-background p-4":"relative",children:[n.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden rounded-xl border border-border bg-gradient-to-b from-background to-muted/20",children:[n.jsxs("div",{className:"absolute right-2 top-2 z-10 flex items-center gap-1.5",children:[i,n.jsx(pe,{onClick:()=>P(z,M,1.2),title:u("agents_ui.brain_zoom_in"),children:n.jsx(Ot,{size:14})}),n.jsx(pe,{onClick:()=>P(z,M,.83),title:u("agents_ui.brain_zoom_out"),children:n.jsx(zM,{size:14})}),n.jsx(pe,{onClick:()=>C.current(),title:u("agents_ui.brain_fit"),children:n.jsx(bM,{size:14})}),n.jsx(pe,{onClick:()=>A(F=>!F),title:u(T?"agents_ui.brain_exit_fs":"agents_ui.brain_fullscreen"),children:T?n.jsx(MM,{size:14}):n.jsx(AM,{size:14})})]}),n.jsxs("svg",{ref:p,viewBox:`0 0 1000 ${d}`,preserveAspectRatio:"xMidYMid meet",style:T?{height:"100%",width:"100%"}:{height:a},className:"w-full touch-none select-none",onPointerMove:U,onPointerUp:V,onPointerLeave:V,children:[n.jsxs("defs",{children:[n.jsxs("filter",{id:"brain-glow",x:"-80%",y:"-80%",width:"260%",height:"260%",children:[n.jsx("feGaussianBlur",{stdDeviation:"3",result:"blur"}),n.jsxs("feMerge",{children:[n.jsx("feMergeNode",{in:"blur"}),n.jsx("feMergeNode",{in:"SourceGraphic"})]})]}),n.jsxs("radialGradient",{id:"brain-core",cx:"50%",cy:"50%",r:"50%",children:[n.jsx("stop",{offset:"0%",stopColor:Bs.agent,stopOpacity:"0.9"}),n.jsx("stop",{offset:"55%",stopColor:Bs.agent,stopOpacity:"0.35"}),n.jsx("stop",{offset:"100%",stopColor:Bs.agent,stopOpacity:"0"})]}),n.jsxs("radialGradient",{id:"brain-bg",cx:"50%",cy:"50%",r:"60%",children:[n.jsx("stop",{offset:"0%",stopColor:Bs.agent,stopOpacity:"0.10"}),n.jsx("stop",{offset:"100%",stopColor:Bs.agent,stopOpacity:"0"})]})]}),n.jsx("rect",{x:0,y:0,width:1e3,height:d,fill:"url(#brain-bg)",onPointerDown:Y,className:"cursor-grab active:cursor-grabbing"}),n.jsxs("g",{transform:`translate(${$.tx},${$.ty}) scale(${$.k})`,children:[W.map((F,oe)=>{const _e=Bs[F.target.kind==="hub"?F.source.kind:F.target.kind],le=1.4+oe%5*.35;return n.jsxs("g",{children:[n.jsx("line",{x1:F.source.x,y1:F.source.y,x2:F.target.x,y2:F.target.y,stroke:_e,strokeOpacity:.16,strokeWidth:1.4}),n.jsx("line",{x1:F.target.x,y1:F.target.y,x2:F.source.x,y2:F.source.y,stroke:_e,strokeOpacity:.5,strokeWidth:2,strokeLinecap:"round",strokeDasharray:"1 14",children:n.jsx("animate",{attributeName:"stroke-dashoffset",values:"15;0",dur:`${le}s`,repeatCount:"indefinite"})})]},oe)}),Q.map((F,oe)=>{const _e=$r(F),le=Bs[F.kind];if(_e==="core"){const Te=F.emoji&&F.emoji.trim()||F.label.slice(0,2).toUpperCase();return n.jsxs("g",{transform:`translate(${F.x},${F.y})`,children:[n.jsxs("circle",{r:54,fill:"url(#brain-core)",children:[n.jsx("animate",{attributeName:"r",values:"50;58;50",dur:"4s",repeatCount:"indefinite"}),n.jsx("animate",{attributeName:"opacity",values:"0.85;1;0.85",dur:"4s",repeatCount:"indefinite"})]}),n.jsxs("circle",{r:26,fill:"none",stroke:Bs.agent,strokeWidth:1.5,opacity:.5,children:[n.jsx("animate",{attributeName:"r",values:"26;48",dur:"3.2s",repeatCount:"indefinite"}),n.jsx("animate",{attributeName:"opacity",values:"0.5;0",dur:"3.2s",repeatCount:"indefinite"})]}),n.jsx("circle",{r:24,fill:Bs.agent,filter:"url(#brain-glow)"}),n.jsx("circle",{r:24,fill:"none",stroke:"#ffffff",strokeOpacity:.35,strokeWidth:1}),n.jsx("text",{textAnchor:"middle",dominantBaseline:"central",fontSize:Te.length<=2?20:11,fontWeight:700,fill:"#1a1030",children:Te.length>8?Te.slice(0,8):Te})]},F.id)}const be=E?.id===F.id,ke=lw[_e]+(be?3:0),Re=2.4+oe%6*.4,Ae=`${oe%6*.3}s`,Ie=_e==="hub",Oe=Ie||be||!L;return n.jsxs("g",{transform:`translate(${F.x},${F.y})`,className:"cursor-grab active:cursor-grabbing",onPointerDown:q(F),onClick:X(F),children:[n.jsxs("circle",{r:ke,fill:le,filter:"url(#brain-glow)",opacity:.3,children:[n.jsx("animate",{attributeName:"r",values:`${ke};${ke+6};${ke}`,dur:`${Re}s`,begin:Ae,repeatCount:"indefinite"}),n.jsx("animate",{attributeName:"opacity",values:"0.32;0.08;0.32",dur:`${Re}s`,begin:Ae,repeatCount:"indefinite"})]}),n.jsx("circle",{r:ke,fill:le,fillOpacity:be?1:.95,stroke:be?"#fff":"#ffffff",strokeOpacity:be?1:.25,strokeWidth:be?2:1}),F.emoji&&Ie&&n.jsx("text",{textAnchor:"middle",dominantBaseline:"central",fontSize:11,style:{pointerEvents:"none"},children:F.emoji}),Oe&&n.jsx("text",{x:ke+4,y:4,fontSize:Ie?11:10,className:Ie?"fill-foreground font-medium":"fill-foreground/80",style:{pointerEvents:"none"},children:F.label.length>22?`${F.label.slice(0,22)}…`:F.label})]},F.id)})]})]})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[11px] text-muted-fg",children:[K.map(F=>n.jsxs("span",{className:"inline-flex items-center gap-1",children:[n.jsx("span",{className:"size-2 rounded-full",style:{background:Bs[F]}})," ",iw(F)]},F)),n.jsxs("span",{className:"ml-auto",children:[u("agents_ui.brain_pan_hint")," · ",u("agents_ui.nodes_drag_hint",{n:String(e.length)})]})]})]}),E&&n.jsxs("div",{className:"space-y-2.5 rounded-lg border border-border bg-card p-3 text-xs",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("span",{className:"size-2.5 rounded-full",style:{background:Bs[E.kind]}}),E.emoji&&n.jsx("span",{className:"text-sm leading-none",children:E.emoji}),n.jsx("span",{className:"text-[13px] font-semibold",children:E.label}),n.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-fg",children:iw(E.kind)}),E.relation&&n.jsxs("span",{className:"text-muted-fg",children:["· ",E.relation]}),n.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[E.slug&&r&&n.jsx("button",{type:"button",onClick:()=>r(E),className:"text-primary hover:underline",children:u("agents_ui.brain_open")}),n.jsx("button",{type:"button",onClick:()=>R(null),className:"text-muted-fg hover:text-foreground",children:"✕"})]})]}),se&&n.jsx("p",{className:"whitespace-pre-wrap text-muted-fg",children:se}),G.length>0&&n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-fg/70",children:u("agents_ui.brain_part_of")}),G.map(F=>n.jsx(dw,{node:F,onClick:()=>R(F)},F.id))]}),te.length>0&&n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsxs("span",{className:"text-[10px] uppercase tracking-wide text-muted-fg/70",children:[u("agents_ui.brain_branches")," · ",te.length]}),te.map(F=>n.jsx(dw,{node:F,onClick:()=>R(F)},F.id))]})]})]})}function dw({node:e,onClick:t}){return n.jsxs("button",{type:"button",onClick:t,className:"inline-flex max-w-[220px] items-center gap-1 rounded-md border border-border bg-muted/40 px-1.5 py-0.5 text-[11px] hover:border-muted-fg/50 hover:bg-muted",children:[n.jsx("span",{className:"size-1.5 shrink-0 rounded-full",style:{background:Bs[e.kind]}}),e.emoji&&n.jsx("span",{className:"leading-none",children:e.emoji}),n.jsx("span",{className:"truncate",children:t7(e.label,28)})]})}function fw({pid:e}){const t=Sn(),a=$e(`/api/projects/${e}/tasks?state=open`,()=>qn.list(e),{refreshInterval:2e4}),r=$e(`/api/projects/${e}/tasks-summary`,()=>qn.summary(e),{refreshInterval:2e4}),i=$e(`/api/projects/${e}/routines`,()=>Ur.list(e)),l=$e(`/api/projects/${e}/agents`,()=>an.list(e)),d=$e(`/api/projects/${e}/mcps`,()=>qr.list(e)),f=$e(`/api/projects/${e}/artifacts`,()=>Ws.list(e)),p=l.data??[],g=p.filter(j=>j.is_master||j.type==="orchestrator"),h=p.filter(j=>!(j.is_master||j.type==="orchestrator")),b=n7(p),_=b.some(j=>j.area),y=(i.data??[]).filter(j=>j.enabled).length,S=[...a.data??[]].sort((j,k)=>(k.created_at||"").localeCompare(j.created_at||"")).slice(0,6);return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[n.jsx(No,{title:u("project.overview.agents"),value:p.length,href:`/p/${e}/agents`,icon:rn}),n.jsx(No,{title:u("project.overview.tasks_open"),value:r.data?.open??a.data?.length??"…",href:`/p/${e}/tasks`,icon:xl}),n.jsx(No,{title:u("project.overview.routines_active"),value:y,href:`/p/${e}/routines`,icon:Do}),n.jsx(No,{title:u("project.overview.artifacts"),value:f.data?.length??"…",href:`/p/${e}/artifacts`,icon:zb})]}),r.data&&n.jsx("div",{className:"flex flex-wrap gap-2",children:SE.map(j=>n.jsxs(xf,{to:`/p/${e}/tasks`,className:"flex items-center gap-1.5 rounded-lg border border-border bg-card px-3 py-1.5 text-xs hover:bg-accent/40",children:[n.jsx($f,{status:j,className:"size-3.5"}),n.jsx("span",{className:"capitalize text-muted-foreground",children:lv(j)}),n.jsx("span",{className:"font-semibold",children:r.data.status?.[j]??0})]},j))}),n.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[n.jsx(qe,{title:u("project.overview.roster"),className:"!p-4",children:p.length===0?n.jsx("p",{className:"text-sm text-muted-fg",children:u("project.overview.no_agents")}):_?n.jsx("div",{className:"space-y-3",children:b.map(j=>n.jsx(Ch,{label:j.area||u("agents_ui.uncategorized"),icon:Nb,agents:j.agents,pid:e,navigate:t},j.area??"__none"))}):n.jsxs("div",{className:"space-y-3",children:[g.length>0&&n.jsx(Ch,{label:u("project.overview.orchestrators"),icon:va,agents:g,pid:e,navigate:t}),h.length>0&&n.jsx(Ch,{label:u("project.overview.specialists"),icon:rn,agents:h,pid:e,navigate:t})]})}),n.jsx(qe,{title:u("project.overview.recent_tasks"),className:"!p-4",action:n.jsx(xf,{to:`/p/${e}/tasks`,className:"text-xs text-sky-500 hover:text-sky-400",children:u("common.view_all")}),children:S.length===0?n.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-fg",children:[n.jsx(Xf,{className:"size-4"}),u("project.overview.no_activity")]}):n.jsx("ul",{className:"space-y-1.5",children:S.map(j=>n.jsx("li",{children:n.jsxs("button",{type:"button",onClick:()=>t(`/p/${e}/tasks?task=${j.id}`),className:"flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left hover:bg-accent/40",children:[n.jsx($f,{status:If(j),className:"size-3.5 shrink-0"}),n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:j.title}),n.jsx(cv,{status:If(j)})]})},j.id))})})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-3",children:[n.jsx(No,{title:u("project.overview.chat"),value:u("project.overview.chat_value"),href:`/p/${e}/chat`,icon:nu}),n.jsx(No,{title:u("project.overview.mcps"),value:d.data?.length??"…",href:`/p/${e}/mcps`,icon:ep}),n.jsx(No,{title:u("project.overview.routines"),value:i.data?.length??"…",href:`/p/${e}/routines`,icon:Do})]}),p.length>0&&n.jsx(qe,{title:u("project.overview.brain_title"),description:u("project.overview.brain_desc"),className:"!p-4",children:n.jsx(a7,{pid:e,agents:p,routines:i.data??[],navigate:t})})]})}function n7(e){const t=new Map;for(const a of e){const r=a.area||null;t.has(r)||t.set(r,[]),t.get(r).push(a)}return[...t.entries()].sort(([a],[r])=>a===null?1:r===null?-1:a.localeCompare(r)).map(([a,r])=>({area:a,agents:r}))}function s7(e){return e.split(`
823
+ `).map(t=>t.replace(/^[-*#>\s]+/,"").trim()).filter(t=>t.length>2&&!t.startsWith("```")).slice(0,5)}function a7({pid:e,agents:t,routines:a,navigate:r}){const[i,l]=x.useState(!1),d=$e(i?`/team-brain/${e}/${t.map(b=>b.slug).join(",")}`:null,async()=>{const b=await qn.list(e,"all"),_=await Promise.all(t.map(async y=>{const[S,j]=await Promise.all([an.get(e,y.slug).catch(()=>null),Jr.list(e,y.slug).catch(()=>[])]);return[y.slug,{memory:S?.memory||"",threads:(j||[]).slice(0,4).map(k=>({title:k.title||k.filename,id:k.id}))}]}));return{tasks:b,perAgent:Object.fromEntries(_)}}),f=i&&!!d.data,{nodes:p,edges:g}=x.useMemo(()=>{const b=[],_=[],y="__root";b.push({id:y,label:u("project.overview.brain_core"),kind:"agent",role:"core",emoji:"🧠"});const S=new Set(t.map(k=>k.slug)),j=k=>t.some(C=>C.parent===k);for(const k of t){const C=!!k.is_master||k.type==="orchestrator";b.push({id:k.slug,label:k.slug,slug:k.slug,kind:C?"agent":"agentlink",role:f||C||j(k.slug)?"hub":"leaf",emoji:k.emoji||void 0,relation:k.role||u(C?"project.agents.orchestrator":"project.overview.specialists"),detail:k.description||void 0})}for(const k of t){const C=k.parent&&S.has(k.parent)?k.parent:y;_.push({source:C,target:k.slug})}if(f&&d.data){const{tasks:k,perAgent:C}=d.data,w=(E,R,T,A,z)=>{b.push({id:E,label:R,kind:T,detail:z}),_.push({source:A,target:E})};for(const E of t){const R=C[E.slug];s7(R?.memory||"").forEach((T,A)=>w(`${E.slug}:m${A}`,T,"memory",E.slug,T)),(R?.threads||[]).forEach((T,A)=>w(`${E.slug}:th${A}`,T.title,"thread",E.slug)),k.filter(T=>T.agent===E.slug).slice(0,4).forEach((T,A)=>w(`${E.slug}:ts${A}`,T.title,"task",E.slug,T.body||void 0)),a.filter(T=>T.spec?.agent===E.slug).slice(0,2).forEach((T,A)=>w(`${E.slug}:rt${A}`,T.name,"routine",E.slug,`schedule: ${T.schedule}`))}}return{nodes:b,edges:_}},[t,a,f,d.data]),h=n.jsxs("button",{type:"button",onClick:()=>l(b=>!b),className:me("inline-flex items-center gap-1.5 rounded-md border px-2 py-1 text-[11px] font-medium backdrop-blur transition-colors",i?"border-primary/40 bg-primary/15 text-foreground":"border-border bg-card/80 text-muted-fg hover:text-foreground"),children:[n.jsx($c,{className:me("size-3.5",d.isLoading&&"animate-pulse")}),u(i?"agents_ui.brain_collapse":"agents_ui.brain_expand")]});return n.jsx(ME,{nodes:p,edges:g,height:620,toolbar:h,onNodeClick:b=>{b.slug&&r(`/p/${e}/agents/${b.slug}`)}})}function Ch({label:e,icon:t,agents:a,pid:r,navigate:i}){return n.jsxs("div",{children:[n.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[n.jsx(t,{className:"size-3.5"}),e," (",a.length,")"]}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.map(l=>n.jsxs("button",{type:"button",onClick:()=>i(`/p/${r}/agents/${l.slug}`),className:me("inline-flex items-center gap-1.5 rounded-lg border border-border bg-card px-2 py-1 text-xs hover:border-muted-fg/50"),children:[n.jsx("span",{className:"text-sm leading-none",children:l.emoji||"🤖"}),n.jsx("span",{className:"truncate",children:l.slug}),l.role&&n.jsxs("span",{className:"truncate text-[10px] text-muted-fg",children:["· ",l.role]})]},l.slug))})]})}function No({title:e,value:t,href:a,icon:r}){return n.jsxs(xf,{to:a,className:"flex items-center gap-3 rounded-xl border border-border bg-card p-4 hover:bg-accent/40",children:[n.jsx("span",{className:"grid size-10 place-items-center rounded-lg bg-muted text-muted-fg",children:n.jsx(r,{size:20})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),n.jsx("div",{className:"text-2xl font-semibold",children:t})]})]})}function r7(){const e=Sn(),{projects:t,isLoading:a}=Xo();return n.jsxs(qe,{title:u("base.workspaces_title"),description:u("base.workspaces_desc"),action:n.jsxs(ae,{size:"sm",variant:"primary",onClick:()=>e("/p/0/workspaces?action=add-project"),children:[n.jsx(Ot,{size:14})," ",u("base.workspaces_new")]}),children:[a&&n.jsx(tt,{}),!a&&t.length===0&&n.jsx(ut,{children:u("base.workspaces_empty")}),n.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:t.map(r=>{const i=String(r.id)==="0",l=i?u("base.title"):r.name||r.path.split("/").pop()||String(r.id);return n.jsxs("button",{type:"button",onClick:()=>e(`/p/${r.id}`),className:"flex cursor-pointer flex-col gap-2 rounded-xl border border-border bg-card p-4 text-left transition-colors hover:border-muted-fg/50",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(xS,{className:"size-4 text-muted-fg"}),n.jsx("span",{className:"truncate text-sm font-semibold",children:l}),n.jsx(Be,{tone:i?"success":"info",children:i?u("base.title"):LN(r.kind)})]}),n.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:r.path})]},r.id)})})]})}const pw=320;function o7(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function i7(e){return e.agent_slug||e.actor_id||e.author||e.actor_kind||"—"}function mw(e){const t=e.meta?.event;return typeof t!="string"?null:t==="routine_created"?u("logs.event_routine_created"):t==="routine_updated"?u("logs.event_routine_updated"):null}function l7(e){const t=e.meta?.model;return typeof t=="string"&&t?t:null}function c7(e){const t=e.meta?.usage;if(!t||typeof t!="object")return null;const a=(t.input_tokens||0)+(t.output_tokens||0);return a>0?a:null}function u7({m:e}){const[t,a]=x.useState(!1),r=(e.body?.length||0)>pw,i=!r||t?e.body:`${e.body.slice(0,pw)}…`,l=l7(e),d=c7(e);return n.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsx("span",{className:"mt-0.5 shrink-0",children:e.direction==="in"?n.jsx(dS,{size:14,className:"text-blue-400"}):n.jsx(Cb,{size:14,className:"text-emerald-400"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[n.jsx("span",{className:"font-mono",children:o7(e.ts)}),n.jsx(Be,{tone:"info",children:e.channel}),e.type&&n.jsx(Be,{children:e.type}),mw(e)&&n.jsx(Be,{tone:"success",children:mw(e)}),n.jsx("span",{className:"font-medium text-foreground",children:i7(e)}),l&&n.jsx("span",{className:"font-mono text-[11px] text-sky-400/90",children:l}),d!==null&&n.jsxs("span",{className:"font-mono text-[11px]",children:[d," tok"]})]}),e.body&&n.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs",children:i}),r&&n.jsx("button",{type:"button",onClick:()=>a(f=>!f),className:"mt-1 text-[11px] font-medium text-sky-400 hover:underline",children:u(t?"logs.show_less":"logs.show_more")})]})]})}function d7(){const[e,t]=x.useState(!1),a=$e(e?"/api/admin/logs?errors":null,()=>ll.logs("errors",200)),r=a.data?.entries||[];return n.jsxs("details",{className:"mb-3 rounded-lg border border-border bg-muted/20",onToggle:i=>t(i.target.open),children:[n.jsxs("summary",{className:"cursor-pointer px-3 py-2 text-xs font-medium text-muted-fg",children:[u("logs.daemon_errors"),r.length?` · ${r.length}`:""]}),n.jsxs("div",{className:"border-t border-border p-3",children:[a.isLoading&&n.jsx(tt,{}),e&&!a.isLoading&&r.length===0&&n.jsx("p",{className:"text-xs text-muted-fg",children:u("logs.no_errors")}),n.jsx("ul",{className:"space-y-1",children:r.map((i,l)=>n.jsxs("li",{className:"rounded-md bg-card px-2 py-1 text-[11px]",children:[n.jsxs("div",{className:"flex items-center gap-2 text-muted-fg",children:[typeof i.ts=="string"&&n.jsx("span",{className:"font-mono",children:new Date(i.ts).toLocaleString()}),typeof i.level=="string"&&n.jsx("span",{className:"text-destructive",children:i.level})]}),n.jsx("p",{className:"whitespace-pre-wrap break-words font-mono",children:String(i.msg??i.message??i.error??i.raw??JSON.stringify(i)).slice(0,500)})]},l))})]})]})}function f7({pid:e}){const t=!e||String(e)==="0",[a,r]=x.useState(""),[i,l]=x.useState(""),[d,f]=x.useState(""),[p,g]=x.useState(""),h=a.trim()||void 0,b=t?`/api/messages/global?channel=${h??""}`:`/api/projects/${e}/messages?channel=${h??""}`,_=$e(b,()=>t?Mf.global({channel:h,limit:300}):Mf.project(e,{channel:h,limit:300})),y=x.useMemo(()=>[..._.data||[]].sort((k,C)=>(C.ts||"").localeCompare(k.ts||"")),[_.data]),S=x.useMemo(()=>Array.from(new Set(y.map(k=>k.type).filter(Boolean))),[y]),j=x.useMemo(()=>y.filter(k=>!(i&&k.direction!==i||d&&k.type!==d||p&&!(k.body||"").toLowerCase().includes(p.toLowerCase()))),[y,i,d,p]);return n.jsxs(qe,{title:u("logs.title"),description:u(t?"logs.desc_global":"logs.desc_project"),action:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ce,{placeholder:u("logs.filter_channel"),value:a,onChange:k=>r(k.target.value),className:"w-44"}),n.jsx(ae,{size:"sm",variant:"secondary",onClick:()=>_.mutate(),children:n.jsx(Cs,{size:13})})]}),children:[t&&n.jsx(d7,{}),n.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[n.jsx("div",{className:"w-36",children:n.jsx(ct,{value:i,onChange:l,placeholder:u("logs.filter_dir"),options:[{value:"",label:u("logs.all_directions")},{value:"in",label:u("logs.in")},{value:"out",label:u("logs.out")}]})}),n.jsx("div",{className:"w-40",children:n.jsx(ct,{value:d,onChange:f,placeholder:u("logs.filter_type"),options:[{value:"",label:u("logs.all_types")},...S.map(k=>({value:k,label:k}))]})}),n.jsx(Ce,{placeholder:u("logs.search_text"),value:p,onChange:k=>g(k.target.value),className:"w-56"}),n.jsxs("span",{className:"text-[11px] text-muted-fg",children:[j.length," ",u("logs.count_of")," ",y.length]})]}),_.isLoading&&n.jsx(tt,{}),_.error&&n.jsx(ut,{children:u("logs.error",{msg:_.error.message})}),!_.isLoading&&!_.error&&j.length===0&&n.jsx(ut,{children:h?u("logs.no_activity_ch",{ch:h}):u("logs.no_activity")}),n.jsx("ul",{className:"space-y-1 text-sm",children:j.map((k,C)=>n.jsx(u7,{m:k},`${k.ts}-${C}`))})]})}function zE({value:e,onChange:t,options:a,placeholder:r=u("shared_ui.model_combobox_ph"),invalid:i,invalidHint:l,className:d}){const[f,p]=x.useState(!1),[g,h]=x.useState(e),b=x.useRef(null),_=x.useRef(null),[y,S]=x.useState(null);x.useEffect(()=>{h(e)},[e]),x.useLayoutEffect(()=>{if(!f)return;const E=()=>{const R=b.current;if(!R)return;const T=R.getBoundingClientRect();S({top:T.bottom+4,left:T.left,width:T.width})};return E(),window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[f]),x.useEffect(()=>{if(!f)return;const E=R=>{const T=R.target;b.current?.contains(T)||_.current?.contains(T)||p(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[f]);const j=g.trim().toLowerCase(),C=j&&!(g===e)?a.filter(E=>E.toLowerCase().includes(j)):a,w=E=>{t(E),h(E),p(!1)};return n.jsxs("div",{ref:b,className:me("relative",d),children:[n.jsxs("div",{className:me("flex items-center gap-1 rounded-lg border bg-background px-2.5 transition-colors focus-within:border-ring focus-within:ring-1 focus-within:ring-ring",i?"border-amber-500/60":"border-border"),children:[i&&n.jsx(Ue,{content:l||u("models_ui.invalid_hint"),children:n.jsx("span",{children:n.jsx(Ub,{className:"size-3.5 shrink-0 text-amber-400"})})}),n.jsx("input",{value:g,placeholder:r,onChange:E=>{h(E.target.value),t(E.target.value),p(!0)},onFocus:()=>p(!0),className:"w-full bg-transparent py-1.5 text-sm outline-none placeholder:text-muted-fg/60"}),n.jsx("button",{type:"button",tabIndex:-1,onClick:()=>p(E=>!E),className:"shrink-0 text-muted-fg hover:text-foreground",children:n.jsx(ms,{className:"size-4"})})]}),f&&C.length>0&&y&&Gs.createPortal(n.jsx("ul",{ref:_,style:{position:"fixed",top:y.top,left:y.left,width:y.width},className:"z-[1000] max-h-56 overflow-y-auto rounded-lg border border-border bg-popover p-1 shadow-md ring-1 ring-foreground/10",children:C.map(E=>n.jsx("li",{children:n.jsx("button",{type:"button",onMouseDown:R=>{R.preventDefault(),w(E)},className:me("flex w-full items-center rounded-md px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-fg",E===e&&"bg-accent/50"),children:n.jsx("span",{className:"truncate font-mono text-xs",children:E})})},E))}),document.body)]})}function fr(){const{data:e,error:t,isLoading:a,mutate:r}=$e("/api/admin/config",()=>ll.config.get()),i=async(l,d)=>{const f=await ll.config.patch({set:l,unset:d});return await r({config:f.config},{revalidate:!1}),f.config};return{config:e?.config||{},error:t,isLoading:a,mutate:r,patch:i}}function OE(){const{data:e,error:t,isLoading:a,mutate:r}=$e("/api/admin/super-agent",()=>ll.superAgent());return{superAgent:e,error:t,isLoading:a,mutate:r}}const p7="modulepreload",m7=function(e){return"/"+e},gw={},g7=function(t,a,r){let i=Promise.resolve();if(a&&a.length>0){let d=function(g){return Promise.all(g.map(h=>Promise.resolve(h).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),p=f?.nonce||f?.getAttribute("nonce");i=d(a.map(g=>{if(g=m7(g),g in gw)return;gw[g]=!0;const h=g.endsWith(".css"),b=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${b}`))return;const _=document.createElement("link");if(_.rel=h?"stylesheet":p7,h||(_.as="script"),_.crossOrigin="",_.href=g,p&&_.setAttribute("nonce",p),document.head.appendChild(_),h)return new Promise((y,S)=>{_.addEventListener("load",y),_.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${g}`)))})}))}function l(d){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=d,window.dispatchEvent(f),!f.defaultPrevented)throw d}return i.then(d=>{for(const f of d||[])f.status==="rejected"&&l(f.reason);return t().catch(l)})},h7={anthropic:"from-orange-600 to-amber-600",openai:"from-emerald-600 to-teal-600",gemini:"from-blue-600 to-indigo-600",groq:"from-cyan-600 to-teal-600",openrouter:"from-violet-600 to-indigo-600",ollama:"from-amber-600 to-orange-600",azure:"from-blue-600 to-cyan-600",mock:"from-slate-600 to-gray-600",custom:"from-slate-600 to-gray-600"},x7={anthropic:"bg-orange-500/20 text-orange-300 border border-orange-500/40",openai:"bg-emerald-500/20 text-emerald-300 border border-emerald-500/40",gemini:"bg-blue-500/20 text-blue-300 border border-blue-500/40",groq:"bg-cyan-500/20 text-cyan-300 border border-cyan-500/40",openrouter:"bg-violet-500/20 text-violet-300 border border-violet-500/40",ollama:"bg-amber-500/20 text-amber-300 border border-amber-500/40",azure:"bg-blue-500/20 text-blue-300 border border-blue-500/40",mock:"bg-slate-500/20 text-slate-300 border border-slate-500/40",custom:"bg-slate-500/20 text-slate-300 border border-slate-500/40"},Pc=[{value:"anthropic",label:"Anthropic"},{value:"openai",label:"OpenAI-compatible"},{value:"gemini",label:"Gemini"},{value:"groq",label:"Groq"},{value:"openrouter",label:"OpenRouter"},{value:"ollama",label:"Ollama"},{value:"azure",label:"Azure OpenAI"},{value:"mock",label:"Mock (test)"},{value:"custom",label:"Custom"}];function Nh(e,t){return t&&t in e?e[t]:e.custom}const qf={anthropic:sa,openai:rn,gemini:_M,groq:xl,openrouter:tu,ollama:CS,azure:rM,mock:_x,custom:aa},er={anthropic:{base_url:"",default_model:"claude-sonnet-5",api_key_env:"ANTHROPIC_API_KEY",known_models:["claude-opus-4-8","claude-sonnet-5","claude-haiku-4-5","claude-fable-5"]},openai:{base_url:"https://api.openai.com/v1",default_model:"gpt-5.4-mini",api_key_env:"OPENAI_API_KEY",known_models:["gpt-5.5","gpt-5.4-mini","gpt-5.4-nano","gpt-5.1","gpt-4.1-mini"]},gemini:{base_url:"https://generativelanguage.googleapis.com/v1beta/openai",default_model:"gemini-2.5-flash",api_key_env:"GEMINI_API_KEY",known_models:["gemini-3.5-flash","gemini-3.1-pro-preview","gemini-2.5-pro","gemini-2.5-flash","gemini-2.5-flash-lite"]},groq:{base_url:"https://api.groq.com/openai/v1",default_model:"openai/gpt-oss-20b",api_key_env:"GROQ_API_KEY",known_models:["openai/gpt-oss-120b","openai/gpt-oss-20b","qwen/qwen3.6-27b","groq/compound","groq/compound-mini","whisper-large-v3-turbo"]},openrouter:{base_url:"https://openrouter.ai/api/v1",default_model:"openrouter/auto",api_key_env:"OPENROUTER_API_KEY",known_models:["openrouter/auto","openrouter/free","anthropic/claude-sonnet-5","openai/gpt-5.4-mini","google/gemini-2.5-flash"]},ollama:{base_url:"http://127.0.0.1:11434",default_model:"gemma2:9b",api_key_env:"",known_models:[]},azure:{base_url:"",default_model:"",api_key_env:"AZURE_OPENAI_API_KEY",known_models:[]},mock:{base_url:"",default_model:"mock",api_key_env:"",known_models:["mock"]},custom:{base_url:"",default_model:"",api_key_env:"",known_models:[]}};let hw=!1;async function b7(){if(!hw)try{const{Engines:e}=await g7(async()=>{const{Engines:a}=await Promise.resolve().then(()=>HP);return{Engines:a}},[]),{presets:t}=await e.presets();for(const[a,r]of Object.entries(t||{}))a in er&&r&&Object.assign(er[a],r);hw=!0}catch{}}function DE(e){const t=e.indexOf(":");return t<0?{provider:e,model:""}:{provider:e.slice(0,t),model:e.slice(t+1)}}function Eh({value:e,onChange:t,providers:a}){const{provider:r,model:i}=DE(e),l=a.find(h=>h.slug===r),d=!!r&&!l,f=x.useMemo(()=>{const h=l?er[l.engine]?.known_models||[]:[];return Array.from(new Set([...l?.default_model?[l.default_model]:[],...h]))},[l]),p=h=>{const b=a.find(y=>y.slug===h),_=b?.default_model||er[b?.engine]?.default_model||"";t(_?`${h}:${_}`:`${h}:`)},g=h=>t(`${r}:${h}`);return n.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[n.jsx(ct,{value:r,onChange:p,placeholder:d?u("router_panel.provider_not_found",{name:r}):u("router_panel.provider_ph"),options:a.map(h=>({value:h.slug,label:h.slug,icon:qf[h.engine]}))}),n.jsx(zE,{value:i,onChange:g,options:f,invalid:d,invalidHint:u("router_panel.provider_not_configured",{name:r})})]})}function _7(){const e=Xe(),{superAgent:t,isLoading:a,mutate:r}=OE(),{config:i,patch:l}=fr(),[d,f]=x.useState(""),[p,g]=x.useState([]),[h,b]=x.useState(""),[_,y]=x.useState(null),[S,j]=x.useState(!1),[k,C]=x.useState({model:"",fallback:[]});x.useEffect(()=>{if(!t)return;const L=t.model_fallback?.models||[],I=Array.isArray(L)?L:[];f(t.model||""),g(I),C({model:t.model||"",fallback:I})},[t]);const w=x.useMemo(()=>{const L=i.engines||{};return Object.entries(L).map(([I,P])=>({slug:I,engine:P?.engine||I,default_model:P?.default_model||er[P?.engine||I]?.default_model}))},[i.engines]),E=L=>{const{provider:I}=DE(L);return w.some(P=>P.slug===I)};if(a||!t)return n.jsx(tt,{});const R=d!==k.model||JSON.stringify(p)!==JSON.stringify(k.fallback),T=async()=>{j(!0);try{await l({"super_agent.model":d,"super_agent.model_fallback.enabled":p.length>0,"super_agent.model_fallback.models":p}),e.success(u("router_panel.saved_toast")),C({model:d,fallback:p}),r()}catch(L){e.error(L.message)}finally{j(!1)}},A=()=>{const L=h.trim().replace(/:$/,"");!L||!L.includes(":")||p.includes(L)||(g([...p,L]),b(""))},z=(L,I)=>{const P=[...p];P[L]=I,g(P)},M=L=>{g(p.filter((I,P)=>P!==L)),_===L&&y(null)},D=(L,I)=>{const P=L+I;if(P<0||P>=p.length)return;const B=[...p];[B[L],B[P]]=[B[P],B[L]],g(B)};return n.jsx(qe,{title:u("router_panel.title"),description:u("router_panel.description"),children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-muted/20 p-3",children:[n.jsxs(Be,{tone:"success",children:[n.jsx(tu,{size:11})," ",u("router_panel.badge_default")]}),n.jsx("span",{className:`font-mono text-xs ${!E(d)&&d?"text-amber-400":""}`,children:d||"—"}),p.map(L=>n.jsxs("span",{className:"flex items-center gap-2 text-muted-fg",children:[n.jsx(fS,{size:12}),n.jsx("span",{className:`font-mono text-xs ${E(L)?"":"text-amber-400"}`,children:L})]},L))]}),w.length===0?n.jsx("p",{className:"text-xs text-muted-fg",children:u("router_panel.no_providers")}):n.jsx(ie,{label:u("router_panel.active_model_label"),hint:u("router_panel.active_model_hint"),children:n.jsx(Eh,{value:d,onChange:f,providers:w})}),n.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[n.jsxs("div",{className:"mb-2",children:[n.jsx("div",{className:"text-sm font-medium",children:u("router_panel.fallback_title")}),n.jsx("div",{className:"text-xs text-muted-fg",children:u("router_panel.fallback_desc")})]}),n.jsxs("ul",{className:"mb-3 space-y-1",children:[p.map((L,I)=>{const P=!E(L),B=_===I;return n.jsx("li",{className:"rounded-md bg-card px-2 py-1.5 text-xs",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{className:"w-6 text-muted-fg",children:["#",I+1]}),B?n.jsx("div",{className:"flex-1",children:n.jsx(Eh,{value:L,onChange:q=>z(I,q),providers:w})}):n.jsxs("button",{type:"button",onClick:()=>y(I),className:"flex flex-1 items-center gap-1.5 text-left",children:[P&&n.jsx(Ub,{size:12,className:"text-amber-400"}),n.jsx("span",{className:`font-mono ${P?"text-amber-400":""}`,children:L})]}),B?n.jsx(ae,{size:"sm",variant:"secondary",onClick:()=>y(null),children:u("router_panel.done")}):n.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>y(I),children:n.jsx(wa,{size:12})}),n.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>D(I,-1),disabled:I===0,children:"↑"}),n.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>D(I,1),disabled:I===p.length-1,children:"↓"}),n.jsx(ae,{size:"sm",variant:"destructive",onClick:()=>M(I),children:n.jsx(_n,{size:12})})]})},`${I}-${L}`)}),p.length===0&&n.jsx("li",{className:"text-xs text-muted-fg",children:u("router_panel.fallback_empty")})]}),w.length>0&&n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"text-xs text-muted-fg",children:u("router_panel.add_to_chain")}),n.jsx(Eh,{value:h,onChange:b,providers:w}),n.jsxs(ae,{size:"sm",variant:"secondary",onClick:A,disabled:!h.includes(":")||h.endsWith(":"),children:[n.jsx(Ot,{size:13})," ",u("router_panel.add_to_chain")]})]})]}),n.jsx(ae,{variant:"primary",loading:S,disabled:!R,onClick:T,children:u(R?"router_panel.save":"router_panel.saved")})]})})}const v7=[{model:"openai:gpt-4o",when:{has_image:!0}},{model:"anthropic:claude-3-5-haiku",when:{max_prompt_chars:400}}];function y7({when:e}){const t=[];return!e||Object.keys(e).length===0?t.push({icon:n.jsx(eo,{size:11}),label:u("routing_panel.when_any")}):(e.has_image===!0&&t.push({icon:n.jsx(vx,{size:11}),label:u("routing_panel.when_image")}),e.has_image===!1&&t.push({icon:n.jsx(vx,{size:11}),label:u("routing_panel.when_no_image")}),Number.isFinite(e.min_prompt_chars)&&t.push({icon:n.jsx(th,{size:11}),label:u("routing_panel.when_min_prompt",{n:String(e.min_prompt_chars)})}),Number.isFinite(e.max_prompt_chars)&&t.push({icon:n.jsx(th,{size:11}),label:u("routing_panel.when_max_prompt",{n:String(e.max_prompt_chars)})}),Number.isFinite(e.min_context_chars)&&t.push({icon:n.jsx(th,{size:11}),label:u("routing_panel.when_min_context",{n:String(e.min_context_chars)})}),Array.isArray(e.channels)&&e.channels.length>0&&t.push({icon:n.jsx(qM,{size:11}),label:u("routing_panel.when_channels",{list:e.channels.join(", ")})}),Array.isArray(e.keywords)&&e.keywords.length>0&&t.push({icon:n.jsx(kM,{size:11}),label:u("routing_panel.when_keywords",{list:e.keywords.join(", ")})})),n.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:t.map((a,r)=>n.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px] text-muted-fg",children:[a.icon," ",a.label]},r))})}function j7(){const e=Xe(),{config:t,isLoading:a,patch:r}=fr(),[i,l]=x.useState(!1),[d,f]=x.useState("[]"),[p,g]=x.useState(!1),[h,b]=x.useState(!1),[_,y]=x.useState(!1),[S,j]=x.useState({enabled:!1,rulesText:"[]"});x.useEffect(()=>{const M=t.super_agent?.routing||{},D=Array.isArray(M.rules)?M.rules:[],L=JSON.stringify(D,null,2);l(M.enabled===!0),f(L),j({enabled:M.enabled===!0,rulesText:L})},[t.super_agent?.routing]);const k=x.useMemo(()=>{try{const M=JSON.parse(d);return Array.isArray(M)?{rules:M,error:null}:{rules:[],error:u("routing_panel.json_not_array")}}catch(M){return{rules:[],error:u("routing_panel.json_error",{msg:M.message})}}},[d]);if(a)return n.jsx(tt,{});const C=k.rules,w=C.length,E=k.error?d:JSON.stringify(C),R=(()=>{try{return JSON.stringify(JSON.parse(S.rulesText))}catch{return S.rulesText}})(),T=i!==S.enabled||E!==R,A=async()=>{if(!k.error){b(!0);try{await r({"super_agent.routing":{enabled:i,rules:C}}),e.success(u("routing_panel.saved_toast"));const M=JSON.stringify(C,null,2);f(M),j({enabled:i,rulesText:M})}catch(M){e.error(M.message)}finally{b(!1),y(!1)}}},z=i&&w>0;return n.jsxs("div",{"data-testid":"routing-panel",children:[n.jsx(qe,{title:u("routing_panel.title"),description:u("routing_panel.description"),children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-muted/20 p-3",children:[n.jsx("span",{"data-testid":"routing-signal",children:z?n.jsxs(Be,{tone:"success",children:[n.jsx(eh,{size:11})," ",u("routing_panel.signal_on",{n:String(w)})]}):i?n.jsxs(Be,{tone:"warning",children:[n.jsx(eh,{size:11})," ",u("routing_panel.signal_on_empty")]}):n.jsxs(Be,{tone:"muted",children:[n.jsx(eh,{size:11})," ",u("routing_panel.signal_off")]})}),n.jsx(Ue,{content:u("routing_panel.helper"),children:n.jsx("span",{className:"text-xs text-muted-fg underline decoration-dotted underline-offset-2",children:u("routing_panel.how_it_works")})})]}),n.jsx(Dt,{checked:i,onChange:l,label:u("routing_panel.enable_label")}),n.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[n.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:u("routing_panel.rules_title")}),n.jsx("div",{className:"text-xs text-muted-fg",children:u("routing_panel.rules_desc")})]}),n.jsx(ae,{size:"sm",variant:"secondary",onClick:()=>g(M=>!M),children:u(p?"routing_panel.hide_editor":"routing_panel.edit_rules")})]}),n.jsxs("ul",{className:"space-y-1.5",children:[C.map((M,D)=>n.jsxs("li",{className:"rounded-md bg-card px-2.5 py-2 text-xs",children:[n.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[n.jsxs("span",{className:"w-6 text-muted-fg",children:["#",D+1]}),n.jsx("span",{className:"font-mono text-[12px]",children:M.model||"—"})]}),n.jsx("div",{className:"pl-8",children:n.jsx(y7,{when:M.when})})]},D)),w===0&&!k.error&&n.jsx("li",{className:"text-xs text-muted-fg",children:u("routing_panel.rules_empty")})]})]}),p&&n.jsxs(ie,{label:u("routing_panel.editor_label"),hint:u("routing_panel.json_hint"),children:[n.jsx(un,{rows:10,className:"font-mono text-xs",value:d,onChange:M=>f(M.target.value),spellCheck:!1}),k.error?n.jsx("span",{className:"mt-1 block text-[11px] text-red-400",children:k.error}):n.jsx("button",{type:"button",className:"mt-1 text-[11px] text-muted-fg underline decoration-dotted underline-offset-2",onClick:()=>f(JSON.stringify(v7,null,2)),children:u("routing_panel.insert_example")})]}),n.jsx("p",{className:"text-[11px] leading-relaxed text-muted-fg",children:u("routing_panel.helper")}),n.jsx(ae,{variant:"primary",loading:h,disabled:!T||!!k.error,onClick:()=>y(!0),children:u(T?"routing_panel.save":"routing_panel.saved")})]})}),n.jsx(Bt,{open:_,onClose:()=>y(!1),title:u("routing_panel.confirm_title"),description:u("routing_panel.confirm_body"),footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:()=>y(!1),children:u("routing_panel.cancel")}),n.jsx(ae,{variant:"primary",loading:h,onClick:A,children:u("routing_panel.confirm_apply")})]}),children:n.jsx("p",{className:"text-sm text-muted-fg",children:i?u("routing_panel.confirm_on",{n:String(w)}):u("routing_panel.confirm_off")})})]})}function k7({provider:e,onEdit:t,onDelete:a,onToggle:r}){const i=Nh(h7,e.engine),l=Nh(x7,e.engine),d=Nh(qf,e.engine),f=Pc.find(b=>b.value===e.engine)?.label||e.engine,p=typeof e.api_key=="string"&&e.api_key.length>0,g=$o(e.api_key),h=e.is_active!==!1;return n.jsxs("div",{className:"group flex h-full cursor-pointer flex-col gap-3 rounded-xl border border-border bg-card p-4 transition-colors hover:border-muted-fg/50",onClick:t,children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:me("flex size-10 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",i),children:n.jsx(d,{className:"size-5 text-white"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("h3",{className:"truncate text-sm font-semibold",children:e.name||e.slug}),n.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:e.slug}),n.jsxs("span",{className:me("mt-1 inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium",l),children:[n.jsx(d,{className:"size-3"})," ",f]})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[n.jsx(Ue,{content:u(h?"providers_modal.toggle_active":"providers_modal.toggle_inactive"),children:n.jsxs("button",{type:"button",onClick:b=>{b.stopPropagation(),r()},className:me("flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[10px] font-medium transition-colors",h?"border-emerald-500/40 text-emerald-400 hover:bg-emerald-500/10":"border-border text-muted-fg hover:text-foreground"),children:[n.jsx("span",{className:me("size-1.5 rounded-full",h?"bg-emerald-400":"bg-muted-fg/40")}),u(h?"providers_card.active":"providers_card.off")]})}),n.jsx(Ue,{content:u("providers_modal.delete"),children:n.jsx("button",{type:"button",onClick:b=>{b.stopPropagation(),a()},className:"rounded-md p-1 text-muted-fg hover:bg-destructive/10 hover:text-destructive",children:n.jsx(_n,{className:"size-3.5"})})})]})]}),n.jsxs("div",{className:"mt-auto space-y-1 text-xs",children:[n.jsx(vc,{label:u("providers_card.model"),value:e.default_model||"—",mono:!0}),e.base_url&&n.jsx(vc,{label:u("providers_card.base_url"),value:e.base_url,mono:!0,truncate:!0}),n.jsx(vc,{label:u("providers_card.api_key"),value:p?g?`…${g}`:u("providers_card.key_set"):"—",mono:!!g}),e.default_temperature!==void 0&&n.jsx(vc,{label:u("providers_card.temp"),value:e.default_temperature.toFixed(1)}),e.pricing?.input_per_million!==void 0&&n.jsx(vc,{label:u("providers_card.price_io"),value:`${e.pricing.input_per_million??0} / ${e.pricing.output_per_million??0}`})]})]})}function vc({label:e,value:t,mono:a,truncate:r}){return n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("span",{className:"text-muted-fg",children:e}),n.jsx("span",{className:me("text-foreground",a&&"font-mono",r&&"max-w-[180px] truncate"),children:t})]})}const xw={name:"",slug:"",engine:"anthropic",base_url:"",api_key_value:"",default_model:"",default_temperature:.7,default_max_tokens:4096,is_active:!0,context_limit_tokens:2e5,model_context_limits_json:"",p_input:"",p_output:"",p_cache_read:"",p_cache_write:""},w7=["anthropic","openai","gemini","groq","openrouter","ollama","custom"];function yc(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Yd(e){if(e==null)return"";const t=Number(e);return Number.isFinite(t)?String(t):""}function S7(e){return{name:e.name||e.slug,slug:e.slug,engine:e.engine||"custom",base_url:e.base_url||"",api_key_value:"",default_model:e.default_model||"",default_temperature:e.default_temperature??.7,default_max_tokens:e.default_max_tokens??4096,is_active:e.is_active!==!1,context_limit_tokens:e.context_limit_tokens??2e5,model_context_limits_json:e.model_context_limits?JSON.stringify(e.model_context_limits,null,2):"",p_input:Yd(e.pricing?.input_per_million),p_output:Yd(e.pricing?.output_per_million),p_cache_read:Yd(e.pricing?.cache_read_per_million),p_cache_write:Yd(e.pricing?.cache_write_per_million)}}function C7({open:e,initial:t,existingSlugs:a,onClose:r,onSave:i}){const l=!!t,[d,f]=x.useState(xw),[p,g]=x.useState(!1),[h,b]=x.useState(null),[_,y]=x.useState([]),[S,j]=x.useState(!1),[k,C]=x.useState(null),[w,E]=x.useState(!1),[R,T]=x.useState("");x.useEffect(()=>{if(!e)return;const Q=t?S7(t):xw;f(Q),b(null),C(null),E(!1);const W=er[Q.engine];y(W?.known_models||[])},[e,t]);const A=Q=>f(W=>({...W,...Q})),z=Q=>{const W=er[Q];A({engine:Q,name:Q==="custom"?d.name:Pc.find($=>$.value===Q)?.label||Q,slug:Q==="custom"?d.slug:Q,base_url:W.base_url,default_model:W.default_model}),y(W.known_models),C(null)},M=Q=>{const W=er[Q];A({engine:Q,base_url:d.base_url||W.base_url,default_model:d.default_model||W.default_model}),y(W.known_models)},D=async()=>{j(!0),C(null);try{const Q=await Yc.models({engine:d.engine,slug:d.slug||yc(d.name),base_url:d.base_url||void 0,api_key:d.api_key_value||void 0});if(Q.error){C(Q.error);return}y(Q.models),Q.models.length===0&&C(u("providers_modal.err_no_models"))}catch(Q){C(Q.message||u("providers_modal.err_list_models"))}finally{j(!1)}},L=x.useMemo(()=>d.default_model&&!_.includes(d.default_model)?[d.default_model,..._]:_,[_,d.default_model]),I=()=>{const Q=(d.slug||yc(d.name)).trim();if(!Q)return b(u("providers_modal.err_slug_required")),null;if(!l&&a.includes(Q))return b(u("providers_modal.err_slug_exists",{slug:Q})),null;let W;if(d.model_context_limits_json.trim())try{const J=JSON.parse(d.model_context_limits_json);if(!J||typeof J!="object"||Array.isArray(J))throw new Error;W=J}catch{return b(u("providers_modal.err_model_limits_json")),null}const K=[d.p_input,d.p_output,d.p_cache_read,d.p_cache_write].map(J=>J.trim()).some(Boolean)?{input_per_million:Number(d.p_input||0),output_per_million:Number(d.p_output||0),cache_read_per_million:Number(d.p_cache_read||0),cache_write_per_million:Number(d.p_cache_write||0)}:void 0;return{provider:{slug:Q,name:d.name.trim()||Q,engine:d.engine,base_url:d.base_url.trim()||void 0,default_model:d.default_model.trim()||void 0,default_temperature:d.default_temperature,default_max_tokens:d.default_max_tokens,is_active:d.is_active,context_limit_tokens:d.context_limit_tokens||void 0,model_context_limits:W,pricing:K},modelLimits:W}},P=()=>{const Q=I();if(!Q)return;const{provider:W}=Q,$={name:W.name,engine:W.engine,is_active:W.is_active!==!1,default_temperature:W.default_temperature,default_max_tokens:W.default_max_tokens};W.base_url&&($.base_url=W.base_url),W.default_model&&($.default_model=W.default_model),W.context_limit_tokens&&($.context_limit_tokens=W.context_limit_tokens),W.model_context_limits&&($.model_context_limits=W.model_context_limits),W.pricing&&($.pricing=W.pricing),d.api_key_value.trim()&&($.api_key=d.api_key_value.trim()),T(JSON.stringify($,null,2)),b(null),E(!0)},B=async()=>{g(!0),b(null);try{if(w){const W=(d.slug||yc(d.name)).trim();if(!W){b(u("providers_modal.err_slug_required_form"));return}let $;try{$=JSON.parse(R)}catch{b(u("providers_modal.err_json_invalid"));return}if(!$||typeof $!="object"||Array.isArray($)){b(u("providers_modal.err_json_object"));return}const K=$;if(!K.engine||typeof K.engine!="string"){b(u("providers_modal.err_engine_missing"));return}const J={slug:W,name:typeof K.name=="string"?K.name:W,engine:String(K.engine),base_url:typeof K.base_url=="string"?K.base_url:void 0,default_model:typeof K.default_model=="string"?K.default_model:void 0,is_active:K.is_active!==!1};await i({provider:J,raw:K,originalSlug:t?.slug}),r();return}const Q=I();if(!Q)return;await i({provider:Q.provider,apiKeyValue:d.api_key_value.trim()||void 0,originalSlug:t?.slug}),r()}catch(Q){b(Q.message||u("providers_modal.err_save"))}finally{g(!1)}},q=l&&ps(t?.api_key),Y=$o(t?.api_key),U=q?u("providers_modal.api_key_set",{suffix:Y??""}):"sk-…",V=d.engine==="ollama",X=er[d.engine]?.api_key_env;return n.jsx(Bt,{open:e,onClose:r,title:l?u("providers_modal.edit_title",{name:t?.name||t?.slug||""}):u("providers_modal.new_title"),description:u("providers_modal.description"),size:"lg",footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:r,disabled:p,children:u("common.cancel")}),n.jsx(ae,{variant:"primary",onClick:B,loading:p,children:u(l?"common.save":"common.create")})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[l?n.jsx("span",{}):n.jsx("div",{className:"flex flex-wrap gap-1.5",children:w7.map(Q=>{const W=qf[Q],$=Q==="custom"?u("providers_modal.custom"):Pc.find(J=>J.value===Q)?.label||Q,K=d.engine===Q;return n.jsxs("button",{type:"button",onClick:()=>z(Q),className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${K?"border-emerald-500/50 bg-emerald-500/10 text-emerald-400":"border-border text-muted-fg hover:border-muted-fg/60 hover:text-foreground"}`,children:[n.jsx(W,{className:"size-3.5"})," ",$]},Q)})}),n.jsxs("button",{type:"button",onClick:()=>w?E(!1):P(),className:`flex shrink-0 items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${w?"border-sky-500/50 bg-sky-500/10 text-sky-400":"border-border text-muted-fg hover:text-foreground"}`,children:[n.jsx(QA,{className:"size-3.5"})," ",u(w?"providers_modal.form_mode":"providers_modal.json_mode")]})]}),w?n.jsxs("div",{className:"space-y-2",children:[n.jsx(ie,{label:u("providers_modal.json_label"),hint:u("providers_modal.json_hint",{slug:d.slug||yc(d.name)||"<slug>"}),children:n.jsx(un,{rows:14,className:"font-mono text-xs",value:R,onChange:Q=>T(Q.target.value),spellCheck:!1})}),n.jsx("p",{className:"text-[11px] text-muted-fg",children:u("providers_modal.json_help")})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(ie,{label:u("providers_modal.name_label"),children:n.jsx(Ce,{value:d.name,onChange:Q=>A({name:Q.target.value,slug:l?d.slug:yc(Q.target.value)}),placeholder:u("providers_modal.name_ph")})}),n.jsx(ie,{label:u("providers_modal.engine_label"),children:n.jsx(ct,{value:d.engine,onChange:Q=>M(Q),options:Pc.map(Q=>({value:Q.value,label:Q.label,icon:qf[Q.value]}))})})]}),n.jsx(ie,{label:u("providers_modal.base_url_label"),hint:u("providers_modal.base_url_hint"),children:n.jsx(Ce,{value:d.base_url,onChange:Q=>A({base_url:Q.target.value}),placeholder:u("providers_modal.base_url_ph")})}),!V&&n.jsx(ie,{label:u("providers_modal.api_key_label"),hint:q?u("providers_modal.api_key_hint_existing"):X?u("providers_modal.api_key_hint_env",{env:X}):u("providers_modal.api_key_hint"),children:n.jsx(Ce,{type:"password",autoComplete:"new-password",value:d.api_key_value,onChange:Q=>A({api_key_value:Q.target.value}),placeholder:U})}),n.jsx(ie,{label:u("providers_modal.model_label"),children:n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(zE,{value:d.default_model,onChange:Q=>A({default_model:Q}),options:L,className:"flex-1"}),n.jsx(Ue,{content:u("providers_modal.list_models_hint"),children:n.jsxs(ae,{size:"sm",variant:"secondary",onClick:D,disabled:S,"aria-label":u("providers_modal.list_models_hint"),children:[S?n.jsx(Js,{className:"size-3.5 animate-spin"}):n.jsx(Cs,{className:"size-3.5"}),u("providers_modal.load_models")]})})]}),k&&n.jsx("p",{className:"text-[11px] text-amber-400",children:k})]})}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(ie,{label:u("providers_modal.max_tokens_label"),children:n.jsx(Ce,{type:"number",min:256,step:256,value:d.default_max_tokens,onChange:Q=>A({default_max_tokens:parseInt(Q.target.value)||4096})})}),n.jsx(ie,{label:u("providers_modal.temperature_label",{value:d.default_temperature.toFixed(1)}),children:n.jsx("input",{type:"range",min:0,max:2,step:.1,value:d.default_temperature,onChange:Q=>A({default_temperature:parseFloat(Q.target.value)}),className:"mt-2 w-full accent-foreground"})})]}),n.jsxs("details",{className:"rounded-md border border-border bg-muted/20 p-3",children:[n.jsx("summary",{className:"cursor-pointer text-xs font-medium text-muted-fg",children:u("providers_modal.pricing_summary")}),n.jsxs("div",{className:"mt-3 space-y-3",children:[n.jsx(ie,{label:u("providers_modal.context_limit_label"),children:n.jsx(Ce,{type:"number",min:0,step:1024,value:d.context_limit_tokens,onChange:Q=>A({context_limit_tokens:parseInt(Q.target.value)||0})})}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(ie,{label:u("providers_modal.price_input"),children:n.jsx(Ce,{type:"number",min:0,step:1e-4,value:d.p_input,onChange:Q=>A({p_input:Q.target.value}),placeholder:"0.15"})}),n.jsx(ie,{label:u("providers_modal.price_output"),children:n.jsx(Ce,{type:"number",min:0,step:1e-4,value:d.p_output,onChange:Q=>A({p_output:Q.target.value}),placeholder:"0.60"})}),n.jsx(ie,{label:u("providers_modal.price_cache_read"),children:n.jsx(Ce,{type:"number",min:0,step:1e-4,value:d.p_cache_read,onChange:Q=>A({p_cache_read:Q.target.value}),placeholder:"0.03"})}),n.jsx(ie,{label:u("providers_modal.price_cache_write"),children:n.jsx(Ce,{type:"number",min:0,step:1e-4,value:d.p_cache_write,onChange:Q=>A({p_cache_write:Q.target.value}),placeholder:"0.00"})})]}),n.jsx(ie,{label:u("providers_modal.model_limits_label"),hint:'{"gpt-4o-mini":128000}',children:n.jsx(un,{rows:3,className:"font-mono text-xs",value:d.model_context_limits_json,onChange:Q=>A({model_context_limits_json:Q.target.value})})})]})]}),n.jsx(Dt,{checked:d.is_active,onChange:Q=>A({is_active:Q}),label:u("providers_modal.active_label")})]}),h&&n.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:h})]})})}const N7=new Set(Pc.map(e=>e.value));function E7(e,t){const a=typeof t.engine=="string"&&t.engine||(N7.has(e)?e:"custom");return{slug:e,name:typeof t.name=="string"?t.name:void 0,engine:a,base_url:typeof t.base_url=="string"?t.base_url:void 0,api_key:typeof t.api_key=="string"?t.api_key:void 0,default_model:typeof t.default_model=="string"?t.default_model:void 0,default_temperature:typeof t.default_temperature=="number"?t.default_temperature:void 0,default_max_tokens:typeof t.default_max_tokens=="number"?t.default_max_tokens:void 0,is_active:typeof t.is_active=="boolean"?t.is_active:void 0,context_limit_tokens:typeof t.context_limit_tokens=="number"?t.context_limit_tokens:void 0,model_context_limits:t.model_context_limits||void 0,pricing:t.pricing||void 0}}function R7(){const e=Xe(),{config:t,isLoading:a,patch:r,mutate:i}=fr(),[l,d]=x.useState(!1),[f,p]=x.useState(null);if(a)return n.jsx(tt,{});const g=t.engines||{},h=Object.entries(g).map(([C,w])=>E7(C,w||{})),b=h.map(C=>C.slug),_=()=>{p(null),d(!0)},y=C=>{p(C),d(!0)},S=async({provider:C,apiKeyValue:w,raw:E})=>{if(E){await r({[`engines.${C.slug}`]:E}),e.success(u("engines_panel.saved_json")),i();return}const R=`engines.${C.slug}`,T={[`${R}.name`]:C.name,[`${R}.engine`]:C.engine,[`${R}.is_active`]:C.is_active!==!1,[`${R}.default_temperature`]:C.default_temperature,[`${R}.default_max_tokens`]:C.default_max_tokens},A=[],z=(M,D)=>{D===void 0||D===""?A.push(`${R}.${M}`):T[`${R}.${M}`]=D};z("base_url",C.base_url),z("default_model",C.default_model),z("context_limit_tokens",C.context_limit_tokens),z("pricing",C.pricing),z("model_context_limits",C.model_context_limits),w&&(T[`${R}.api_key`]=w),await r(T,A),e.success(u("engines_panel.saved")),i()},j=async C=>{try{await r({[`engines.${C.slug}.is_active`]:C.is_active===!1}),i()}catch(w){e.error(w.message)}},k=async C=>{if(confirm(u("engines_panel.delete_confirm",{name:C.name||C.slug})))try{await r(void 0,[`engines.${C.slug}`]),e.success(u("engines_panel.deleted")),i()}catch(w){e.error(w.message)}};return n.jsxs(qe,{title:u("engines_panel.title"),description:u("engines_panel.description"),action:n.jsxs(ae,{size:"sm",variant:"primary",onClick:_,children:[n.jsx(Ot,{size:14})," ",u("engines_panel.new_btn")]}),children:[h.length===0?n.jsx(ut,{children:u("engines_panel.empty")}):n.jsxs("div",{className:"grid grid-cols-1 items-stretch gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[h.map(C=>n.jsx(k7,{provider:C,onEdit:()=>y(C),onDelete:()=>k(C),onToggle:()=>j(C)},C.slug)),n.jsxs("button",{type:"button",onClick:_,className:"flex min-h-[120px] flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-border text-muted-fg transition-colors hover:border-muted-fg/60 hover:text-foreground",children:[n.jsx(Ot,{size:20}),n.jsx("span",{className:"text-sm font-medium",children:u("engines_panel.add_card")})]})]}),n.jsx(C7,{open:l,initial:f,existingSlugs:b,onClose:()=>{d(!1),p(null)},onSave:S})]})}function PE(){return n.jsxs("div",{className:"space-y-6",children:[n.jsx(_7,{}),n.jsx(j7,{}),n.jsx(R7,{})]})}function T7(){const e=Xe(),[t,a]=x.useState(!1),i=$e(t?"/api/agents/vault?include_removed=1":"/api/agents/vault",()=>an.vault({includeRemoved:t})),l=i.data||[],[d,f]=x.useState(null),p=async h=>{const b=h.source!=="user",_=b?u("base.defaults_tombstone_msg",{slug:h.slug}):u("base.defaults_delete_msg",{slug:h.slug});if(confirm(_))try{await an.vaultRemove(h.slug),e.success(u(b?"base.defaults_hidden":"base.defaults_deleted")),i.mutate()}catch(y){e.error(y.message)}},g=async h=>{try{await an.vaultRestore(h),e.success(u("base.defaults_restored")),i.mutate()}catch(b){e.error(b.message)}};return n.jsxs(qe,{title:u("base.defaults_title"),description:u("base.defaults_desc"),action:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Dt,{checked:t,onChange:a,label:u("base.defaults_show_removed")}),n.jsxs(ae,{size:"sm",onClick:()=>f("new"),children:[n.jsx(Ot,{size:14})," ",u("base.defaults_new")]})]}),children:[i.isLoading&&n.jsx(tt,{}),!i.isLoading&&l.length===0&&n.jsx(ut,{children:u("base.defaults_empty")}),n.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:l.map(h=>{const b=t&&h.tombstoned;return n.jsxs("div",{className:`flex flex-col gap-2 rounded-xl border bg-card p-4 ${b?"border-dashed border-border opacity-60":"border-border"}`,children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-slate-600 to-gray-600",children:h.is_master?n.jsx(va,{className:"size-4 text-white"}):n.jsx(rn,{className:"size-4 text-white"})}),n.jsx("span",{className:"truncate text-sm font-semibold",children:h.slug}),n.jsx(A7,{source:h.source})]}),n.jsx("div",{className:"flex shrink-0 items-center gap-0.5",children:b?n.jsx(Rh,{label:u("base.defaults_restore"),onClick:()=>g(h.slug),variant:"secondary",children:n.jsx(hl,{size:13})}):n.jsxs(n.Fragment,{children:[n.jsx(Rh,{label:u("base.defaults_edit"),onClick:()=>f(h),variant:"ghost",children:n.jsx(wa,{size:13})}),n.jsx(Rh,{label:h.source==="user"?u("base.defaults_delete"):u("base.defaults_hide"),onClick:()=>p(h),variant:"ghost-destructive",children:n.jsx(_n,{size:13})})]})})]}),h.model?n.jsx(Be,{tone:"info",children:h.model}):n.jsx("span",{className:"text-[10px] text-muted-fg",children:u("agents_ui.model_router_default")}),h.description&&n.jsx("p",{className:"line-clamp-3 text-xs text-muted-fg",children:h.description}),n.jsxs("div",{className:"flex flex-wrap gap-1",children:[h.role&&n.jsx(Be,{children:h.role}),h.skills?.map(_=>n.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[n.jsx(sa,{size:9})," ",_]},_)),h.tools?.map(_=>n.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[n.jsx(aa,{size:9})," ",_]},_))]})]},h.slug)})}),d!==null&&n.jsx(M7,{agent:d==="new"?null:d,onClose:()=>f(null),onSaved:()=>{f(null),i.mutate()}})]})}function A7({source:e}){return e==="user"?n.jsx(Be,{tone:"success",children:u("agents_ui.source_user")}):e==="user-override"?n.jsx(Be,{tone:"warning",children:u("agents_ui.source_override")}):n.jsx(Be,{tone:"muted",children:u("agents_ui.source_bundled")})}function Rh({label:e,onClick:t,variant:a="ghost",children:r}){const i="inline-flex size-7 items-center justify-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",l={ghost:"text-muted-fg hover:bg-accent hover:text-accent-fg","ghost-destructive":"text-muted-fg hover:bg-destructive/15 hover:text-destructive",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80"};return n.jsxs(A_,{children:[n.jsx(M_,{render:n.jsx("button",{type:"button",onClick:t,"aria-label":e,className:`${i} ${l[a]}`,children:r})}),n.jsx(z_,{children:e})]})}function M7({agent:e,onClose:t,onSaved:a}){const r=Xe(),[i,l]=x.useState(!1),d=!e,[f,p]=x.useState(e?.slug??""),[g,h]=x.useState(e?.role??""),[b,_]=x.useState(e?.model??""),[y,S]=x.useState(e?.description??""),[j,k]=x.useState(e?.language??"es"),[C,w]=x.useState((e?.skills??[]).join(", ")),[E,R]=x.useState((e?.tools??[]).join(", ")),[T,A]=x.useState(!!e?.is_master),[z,M]=x.useState(e?.body??""),D=async()=>{const L={role:g||void 0,model:b||void 0,description:y||void 0,language:j||void 0,skills:C,tools:E,is_master:T};l(!0);try{if(d){if(!/^[a-z][a-z0-9_-]*$/.test(f))throw new Error(u("base.defaults_slug_invalid"));await an.vaultCreate(f,L,z),r.success(u("base.defaults_created",{slug:f}))}else await an.vaultPatch(e.slug,{fields:L,body:z}),r.success(u("base.defaults_saved",{slug:e.slug}));a()}catch(I){r.error(I.message)}finally{l(!1)}};return n.jsx(Bt,{open:!0,onClose:t,title:d?u("base.defaults_new_title"):u("base.defaults_edit_title",{slug:e.slug}),description:d?u("base.defaults_new_desc"):e.source==="bundled"?u("base.defaults_bundled_desc"):u("base.defaults_user_desc"),size:"lg",footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:t,disabled:i,children:u("common.cancel")}),n.jsx(ae,{variant:"primary",onClick:D,loading:i,children:u("common.save")})]}),children:n.jsxs("div",{className:"space-y-3",children:[d&&n.jsx(ie,{label:"slug",hint:u("agents_ui.slug_kebab_hint"),children:n.jsx(Ce,{autoFocus:!0,value:f,onChange:L=>p(L.target.value),placeholder:"reviewer"})}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(ie,{label:"role",children:n.jsx(Ce,{value:g,onChange:L=>h(L.target.value),placeholder:"Code reviewer"})}),n.jsx(ie,{label:"model",children:n.jsx(Ce,{value:b,onChange:L=>_(L.target.value),placeholder:"openrouter:..."})}),n.jsx(ie,{label:"language",children:n.jsx(Ce,{value:j,onChange:L=>k(L.target.value),placeholder:"es"})}),n.jsx(ie,{label:"is_master",children:n.jsx("div",{className:"flex h-9 items-center",children:n.jsx(Dt,{checked:T,onChange:A,label:u("base.defaults_master_label")})})})]}),n.jsx(ie,{label:"description",children:n.jsx(Ce,{value:y,onChange:L=>S(L.target.value)})}),n.jsx(ie,{label:"skills",hint:u("agents_ui.comma_separated"),children:n.jsx(Ce,{value:C,onChange:L=>w(L.target.value),placeholder:"code-review, git"})}),n.jsx(ie,{label:"tools",hint:u("agents_ui.comma_separated"),children:n.jsx(Ce,{value:E,onChange:L=>R(L.target.value),placeholder:"read, write, run"})}),n.jsx(ie,{label:"body",hint:u("agents_ui.body_hint"),children:n.jsx(un,{value:z,onChange:L=>M(L.target.value),rows:10,placeholder:"# Mission\\n..."})})]})})}const z7=20,bw=[10,20,50,100];function Mp({key:e,fetchPage:t,resetKey:a,initialPageSize:r=z7,swr:i}){const[l,d]=x.useState(1),[f,p]=x.useState(r);x.useEffect(()=>{d(1)},[a]);const g=(l-1)*f,h=$e(e==null?null:[e,f,g],()=>t(f,g),{keepPreviousData:!0,...i}),b=h.data?.total??0,_=Math.max(1,Math.ceil(b/f)),y=Math.min(l,_);x.useEffect(()=>{l!==y&&d(y)},[l,y]);const S=b===0?0:g,j=Math.min(g+f,b);return{items:h.data?.items??[],isLoading:h.isLoading,error:h.error,mutate:h.mutate,page:y,pageCount:_,total:b,start:S,end:j,pageSize:f,setPage:d,setPageSize:k=>{p(k),d(1)}}}function O7({page:e,pageCount:t,total:a,start:r,end:i,pageSize:l,onPage:d,onPageSize:f}){return a<=bw[0]?null:n.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-3 text-xs text-muted-fg",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"tabular-nums",children:u("common.pager_range",{from:r+1,to:i,total:a})}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{children:u("common.pager_per_page")}),n.jsx("div",{className:"w-[4.5rem]",children:n.jsx(ct,{value:String(l),onChange:p=>f(Number(p)),options:bw.map(p=>({value:String(p),label:String(p)}))})})]})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(ae,{size:"sm",variant:"ghost",disabled:e<=1,onClick:()=>d(e-1),"aria-label":u("common.pager_prev"),children:n.jsx(JA,{size:14})}),n.jsx("span",{className:"px-1 tabular-nums",children:u("common.pager_page",{page:e,total:t})}),n.jsx(ae,{size:"sm",variant:"ghost",disabled:e>=t,onClick:()=>d(e+1),"aria-label":u("common.pager_next"),children:n.jsx(eo,{size:14})})]})]})}function zp({paged:e,fullHeight:t,className:a,children:r}){const i=n.jsx(O7,{page:e.page,pageCount:e.pageCount,total:e.total,start:e.start,end:e.end,pageSize:e.pageSize,onPage:e.setPage,onPageSize:e.setPageSize});return t?n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n.jsx("div",{className:me("min-h-0 flex-1 overflow-y-auto",a),children:r}),n.jsx("div",{className:"shrink-0",children:i})]}):n.jsxs("div",{className:a,children:[r,i]})}const D7={apx:"success",claude:"info",codex:"warning"};function P7({pid:e}={}){const t=Xe(),a=pu(),r=!e||String(e)==="0",{project:i}=fu(r?"":e),l=r?void 0:i?.path||void 0,[d,f]=x.useState(""),[p,g]=x.useState(""),[h,b]=x.useState(""),[_,y]=x.useState(!1);x.useEffect(()=>{const R=setTimeout(()=>b(p.trim()),350);return()=>clearTimeout(R)},[p]);const S=Mp({key:`/api/sessions?engine=${d}&q=${h}&deep=${_?1:0}&cwd=${l||""}`,fetchPage:(R,T)=>UP.page({engine:d||void 0,q:h||void 0,deep:_,cwd:l,limit:R,offset:T}),resetKey:`${d}|${h}|${_?1:0}|${l||""}`}),j=()=>{g(""),b(""),f(""),y(!1)},k=async R=>{try{await navigator.clipboard.writeText(`apx session resume ${R.id} --continue`),t.success(u("base.sessions_cmd_copied"))}catch{t.error(u("base.sessions_copy_failed"))}},C=R=>{const T=`Continue this session: ${R.id} (engine: ${R.engine}${R.title?`, title: "${R.title}"`:""}${R.cwd?`, folder: ${R.cwd}`:""}). With these instructions: `;window.dispatchEvent(new CustomEvent("apx:roby-prompt",{detail:{prompt:T}}))},w=async R=>{if(!R.cwd){t.error(u("base.sessions_no_folder"));return}try{await PN.exec({kind:"open_path",target:R.cwd})}catch(T){t.error(u("base.sessions_folder_failed",{msg:T.message}))}},E=async R=>{const T=R.path||R.cwd;if(!T){t.error(u("base.sessions_no_path"));return}try{await navigator.clipboard.writeText(T),t.success(u("base.sessions_path_copied"))}catch{t.error(u("base.sessions_copy_failed"))}};return n.jsxs(qe,{fullHeight:!0,title:u("base.sessions_title"),description:r?u("base.sessions_desc"):u("base.sessions_desc_scoped",{path:l||"…"}),action:n.jsx(Ue,{content:u("base.sessions_refresh"),children:n.jsx(ae,{size:"sm",variant:"secondary",onClick:()=>S.mutate(),children:n.jsx(Cs,{size:13})})}),children:[n.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx(Oo,{size:14,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-fg"}),n.jsx(Ce,{className:"pl-8",placeholder:u("base.sessions_search_ph"),value:p,onChange:R=>g(R.target.value)})]}),n.jsx(Ue,{content:u("base.sessions_deep_tip"),children:n.jsx(ae,{size:"sm",variant:_?"primary":"secondary",onClick:()=>y(R=>!R),children:u("base.sessions_deep")})}),n.jsx("div",{className:"w-36",children:n.jsx(ct,{value:d,onChange:f,options:[{value:"",label:u("base.sessions_all")},{value:"apx",label:"apx"},{value:"claude",label:"claude"},{value:"codex",label:"codex"}]})}),n.jsx(Ue,{content:u("base.sessions_clear"),children:n.jsx(ae,{size:"sm",variant:"ghost",onClick:j,children:n.jsx(gs,{size:14})})})]}),S.isLoading&&n.jsx(tt,{}),S.error&&n.jsx(ut,{children:u("base.sessions_error",{msg:S.error.message})}),!S.isLoading&&!S.error&&S.total===0&&n.jsx(ut,{children:h?u("base.sessions_no_match",{q:h}):u("base.sessions_empty")}),n.jsx(zp,{paged:S,fullHeight:!0,children:n.jsx("ul",{className:"space-y-1 text-sm",children:S.items.map((R,T)=>n.jsxs("li",{className:"group flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsx(Be,{tone:D7[R.engine]||"muted",children:R.engine}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate",children:R.title||R.id}),n.jsxs("div",{className:"flex items-center gap-2 font-mono text-[10px] text-muted-fg",children:[n.jsx("span",{className:"shrink-0",children:R.id}),R.cwd&&n.jsxs("span",{className:"truncate",children:["· ",R.cwd]})]})]}),R.mtime>0&&n.jsx("span",{className:"shrink-0 text-[11px] text-muted-fg",children:new Date(R.mtime).toLocaleString()}),n.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 opacity-60 transition-opacity group-hover:opacity-100",children:[n.jsx(Ue,{content:u("base.sessions_act_cmd"),children:n.jsx(ae,{size:"sm",variant:"ghost","aria-label":u("base.sessions_act_cmd"),onClick:()=>k(R),children:n.jsx(ya,{size:13})})}),n.jsx(Ue,{content:u("base.sessions_act_ask",{name:a}),children:n.jsx(ae,{size:"sm",variant:"ghost","aria-label":u("base.sessions_act_ask",{name:a}),onClick:()=>C(R),children:n.jsx(rn,{size:13})})}),n.jsx(Ue,{content:u("base.sessions_act_folder"),children:n.jsx(ae,{size:"sm",variant:"ghost","aria-label":u("base.sessions_act_folder"),onClick:()=>w(R),children:n.jsx(Go,{size:13})})}),n.jsx(Ue,{content:u("base.sessions_act_path"),children:n.jsx(ae,{size:"sm",variant:"ghost","aria-label":u("base.sessions_act_path"),onClick:()=>E(R),children:n.jsx(zo,{size:13})})})]})]},`${R.engine}-${R.id}-${T}`))})})]})}function L7(){const e=Sn(),[t,a]=x.useState("open"),[r,i]=x.useState(""),l=t==="open"?r:"",[d,f]=x.useState(!1),[p,g]=x.useState(""),[h,b]=x.useState(""),[_,y]=x.useState(""),[S,j]=x.useState(!1),{projects:k}=Xo(),C=Xe(),w=Mp({key:`/api/tasks?state=${t}&status=${l}`,fetchPage:(R,T)=>qn.globalPage({state:t,limit:R,offset:T,status:l}),resetKey:`${t}|${l}`}),E=async()=>{if(!(!p.trim()||!h)){j(!0);try{await qn.add(String(h),{title:p.trim(),due:_||null}),await w.mutate(),f(!1),g(""),y("")}catch(R){C.error(R.message)}finally{j(!1)}}};return n.jsxs(qe,{fullHeight:!0,title:u("project.global_tasks.title"),description:u("project.global_tasks.subtitle"),action:n.jsxs(ae,{size:"sm",variant:"primary",onClick:()=>{b(String(k[0]?.id??"")),f(!0)},children:[n.jsx(Ot,{size:14})," ",u("project.global_tasks.add")]}),filters:n.jsxs(n.Fragment,{children:[n.jsx(Jx,{value:t,onChange:a,label:u("project.global_tasks.title"),options:["open","done","dropped","all"].map(R=>({value:R,label:R}))}),t==="open"?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"mx-1 h-4 w-px bg-border","aria-hidden":!0}),n.jsx(Jx,{value:r,onChange:i,label:u("project.global_tasks.any_status"),options:[{value:"",label:u("project.global_tasks.any_status")},...["pending","running","in_review","blocked"].map(R=>({value:R,label:R.replace("_"," ")}))]})]}):null]}),children:[w.isLoading&&n.jsx(tt,{}),!w.isLoading&&w.total===0&&n.jsx(ut,{children:u("project.global_tasks.empty")}),n.jsx(zp,{paged:w,fullHeight:!0,children:n.jsx("ul",{className:"space-y-2 text-sm",children:w.items.map(R=>n.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsx("button",{type:"button",onClick:()=>e(`/p/${R.project_id}/tasks`),title:u("project.global_tasks.go_project"),children:n.jsx(Be,{tone:"info",children:(R.project_name||"").split("/").pop()||R.project_id})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"font-medium",children:R.title}),n.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[n.jsx("span",{children:R.state}),R.agent&&n.jsxs(Be,{tone:"muted",children:["@",R.agent]}),R.tags?.map(T=>n.jsxs("span",{children:["#",T]},T)),R.due&&n.jsxs("span",{children:[u("project.global_tasks.due")," ",R.due]})]})]})]},`${R.project_id}-${R.id}`))})}),n.jsx(Bt,{open:d,onClose:()=>f(!1),title:u("project.global_tasks.add_title"),footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{onClick:()=>f(!1),children:u("common.cancel")}),n.jsx(ae,{variant:"primary",loading:S,disabled:!p.trim()||!h,onClick:E,children:u("project.global_tasks.add")})]}),children:n.jsxs("div",{className:"flex flex-col gap-3 p-5",children:[n.jsx(ie,{label:u("project.global_tasks.field_title"),children:n.jsx(Ce,{value:p,onChange:R=>g(R.target.value),autoFocus:!0,onKeyDown:R=>{R.key==="Enter"&&p.trim()&&h&&E()}})}),n.jsx(ie,{label:u("project.global_tasks.field_project"),children:n.jsx(ct,{value:String(h),onChange:b,options:k.map(R=>({value:String(R.id),label:R.name||R.path}))})}),n.jsx(ie,{label:u("project.global_tasks.field_due"),children:n.jsx(Ce,{type:"date",value:_,onChange:R=>y(R.target.value)})})]})})]})}function _w(e){const t=new URLSearchParams;return e.state&&t.set("state",e.state),e.counterparty&&t.set("counterparty",e.counterparty),e.overdue&&t.set("overdue","1"),t.set("limit",String(e.limit)),t.set("offset",String(e.offset)),t.toString()}const Kd={globalPage:e=>ne.get(`/api/commitments?${_w(e)}`).then(t=>Ja(t)),listPage:(e,t)=>ne.get(`/api/projects/${e}/commitments?${_w(t)}`).then(a=>Ja(a)),add:(e,t)=>ne.post(`/api/projects/${e}/commitments`,t),kept:(e,t,a)=>ne.post(`/api/projects/${e}/commitments/${t}/kept`,{note:a}),missed:(e,t,a)=>ne.post(`/api/projects/${e}/commitments/${t}/missed`,{note:a}),renegotiate:(e,t,a,r)=>ne.post(`/api/projects/${e}/commitments/${t}/renegotiate`,{due:a,note:r})};function I7({pid:e}){const t=Sn(),a=Xe(),[r,i]=x.useState("open"),[l,d]=x.useState(!1),[f,p]=x.useState(!1),[g,h]=x.useState(""),[b,_]=x.useState(""),[y,S]=x.useState(""),[j,k]=x.useState(e??""),[C,w]=x.useState(!1),{projects:E}=Xo(),R=Mp({key:`/api/commitments?pid=${e??"all"}&state=${r}&overdue=${l}`,fetchPage:(D,L)=>e?Kd.listPage(e,{state:r,overdue:l,limit:D,offset:L}):Kd.globalPage({state:r,overdue:l,limit:D,offset:L}),resetKey:`${e??"all"}|${r}|${l}`}),T=async(D,L,I)=>{try{await Kd[I](D,L),await R.mutate()}catch(P){a.error(P.message)}},A=D=>D.state==="open"&&!!D.due&&D.due<new Date().toISOString(),z=()=>{h(""),_(""),S(""),k(e??"")},M=async()=>{const D=e??j;if(!(!g.trim()||!b.trim()||!D)){w(!0);try{await Kd.add(String(D),{counterparty:g.trim(),body:b.trim(),due:y?new Date(y).toISOString():null}),await R.mutate(),p(!1),z()}catch(L){a.error(L.message)}finally{w(!1)}}};return n.jsxs(qe,{fullHeight:!0,title:u("project.commitments.title"),description:u("project.commitments.subtitle"),action:n.jsxs(ae,{size:"sm",variant:"primary",onClick:()=>p(!0),children:[n.jsx(Ot,{size:14})," ",u("project.commitments.add")]}),filters:n.jsxs(n.Fragment,{children:[n.jsx(Jx,{value:r,onChange:i,label:u("project.commitments.title"),options:["open","kept","missed","all"].map(D=>({value:D,label:u(`project.commitments.state.${D}`)}))}),n.jsx(ae,{size:"sm",variant:l?"primary":"ghost",onClick:()=>d(D=>!D),children:u("project.commitments.overdue_only")})]}),children:[R.isLoading&&n.jsx(tt,{}),!R.isLoading&&R.total===0&&n.jsx(ut,{children:u("project.commitments.empty")}),n.jsx(zp,{paged:R,fullHeight:!0,children:n.jsx("ul",{className:"space-y-2 text-sm","data-testid":"commitments-list",children:R.items.map(D=>{const L=String(D.project_id??e??""),I=D.project_name;return n.jsxs("li",{className:`flex items-start gap-3 rounded-md border px-3 py-2 ${A(D)?"border-red-500/40 bg-red-500/5":"border-border bg-muted/30"}`,children:[I?n.jsx("button",{type:"button",onClick:()=>t(`/p/${L}/commitments`),title:u("project.global_tasks.go_project"),children:n.jsx(Be,{tone:"info",children:I.split("/").pop()||L})}):null,n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[n.jsx("span",{className:"font-medium",children:D.counterparty}),n.jsxs("span",{className:"opacity-80",children:["— ",D.body]})]}),n.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[D.due?n.jsxs("span",{className:A(D)?"font-medium text-red-500":"",children:[A(D)?u("project.commitments.overdue"):u("project.global_tasks.due")," ",D.due.slice(0,10)]}):n.jsx("span",{className:"opacity-60",children:u("project.commitments.no_date")}),D.origin_channel?n.jsxs("span",{children:["· ",D.origin_channel]}):null,D.renegotiated_count?n.jsxs(Be,{tone:"warning",children:[u("project.commitments.moved")," ×",D.renegotiated_count]}):null,D.state!=="open"?n.jsx(Be,{children:u(`project.commitments.state.${D.state}`)}):null]})]}),D.state==="open"&&L?n.jsxs("div",{className:"flex shrink-0 gap-1",children:[n.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>T(L,D.id,"kept"),children:u("project.commitments.mark_kept")}),n.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>T(L,D.id,"missed"),children:u("project.commitments.mark_missed")})]}):null]},`${L}-${D.id}`)})})}),n.jsx(Bt,{open:f,onClose:()=>{p(!1),z()},title:u("project.commitments.add_title"),description:u("project.commitments.add_hint"),footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{onClick:()=>{p(!1),z()},children:u("common.cancel")}),n.jsx(ae,{variant:"primary",loading:C,disabled:!g.trim()||!b.trim()||!(e??j),onClick:M,children:u("project.commitments.add")})]}),children:n.jsxs("div",{className:"flex flex-col gap-3 p-5",children:[n.jsx(ie,{label:u("project.commitments.field_who"),hint:u("project.commitments.field_who_hint"),children:n.jsx(Ce,{value:g,onChange:D=>h(D.target.value),placeholder:"Ana",autoFocus:!0})}),n.jsx(ie,{label:u("project.commitments.field_what"),children:n.jsx(Ce,{value:b,onChange:D=>_(D.target.value),placeholder:u("project.commitments.field_what_ph"),onKeyDown:D=>{D.key==="Enter"&&g.trim()&&b.trim()&&M()}})}),n.jsx(ie,{label:u("project.commitments.field_due"),hint:u("project.commitments.field_due_hint"),children:n.jsx(Ce,{type:"date",value:y,onChange:D=>S(D.target.value)})}),e?null:n.jsx(ie,{label:u("project.commitments.field_project"),children:n.jsx(ct,{value:String(j),onChange:k,options:E.map(D=>({value:String(D.id),label:D.name||D.path}))})})]})})]})}const LE=x.createContext(void 0);function fv(){const e=x.useContext(LE);if(e===void 0)throw new Error(gn(64));return e}const Op={tabActivationDirection:e=>({"data-activation-direction":e})},$7=x.forwardRef(function(t,a){const{className:r,defaultValue:i=0,onValueChange:l,orientation:d="horizontal",render:f,value:p,style:g,...h}=t,b=t.defaultValue!==void 0,_=x.useRef([]),[y,S]=x.useState(()=>new Map),[j,k]=ol({controlled:p,default:i,name:"Tabs",state:"value"}),C=p!==void 0,[w,E]=x.useState(()=>new Map),R=x.useRef(void 0),T=x.useCallback(F=>ib(w,F),[w]),[A,z]=x.useState(()=>({previousValue:j,tabActivationDirection:"none"})),{previousValue:M,tabActivationDirection:D}=A;let L=D,I=!1;M!==j&&(L=vw(M,j,d,w),I=M!=null&&j!=null&&T(j)==null);const P=I?M:j,B=M!==P||D!==L;Pe(()=>{B&&z({previousValue:P,tabActivationDirection:L})},[P,B,L]);const q=Ve((F,oe)=>{const _e=vw(j,F,d,w);oe.activationDirection=_e,l?.(F,oe),!oe.isCanceled&&k(F)}),Y=Ve((F,oe)=>{l?.(F,rt(oe,void 0,void 0,{activationDirection:"none"}))}),U=Ve((F,oe)=>(S(_e=>{const le=new Map(_e);return le.set(F,oe),le}),()=>{S(_e=>{if(_e.get(F)!==oe)return _e;const le=new Map(_e);return le.delete(F),le})})),V=x.useCallback(F=>y.get(F),[y]),X=x.useCallback(F=>{for(const oe of w.values())if(F===oe.value)return oe.id},[w]),Q=x.useMemo(()=>({getTabElementBySelectedValue:T,getTabIdByPanelValue:X,getTabPanelIdByValue:V,onValueChange:q,orientation:d,registerMountedTabPanel:U,setTabMap:E,tabActivationDirection:L,value:j}),[T,X,V,q,d,U,E,L,j]),W=x.useMemo(()=>{for(const F of w.values())if(F.value===j)return F},[w,j]),$=x.useMemo(()=>{for(const F of w.values())if(!F.disabled)return F.value},[w]),K=x.useRef(!b),J=x.useRef(i),G=x.useRef(b),te=x.useRef(!1);Pe(()=>{if(C)return;function F(be,ke){k(be),z({previousValue:be,tabActivationDirection:"none"}),Y(be,ke),K.current=!1}if(w.size===0){te.current&&j!==null&&!R.current?.isConnected&&F(null,Hj);return}te.current=!0,R.current=w.keys().next().value;const oe=W?.disabled,_e=W==null&&j!==null;if(!oe&&j===J.current&&(G.current=!1),G.current&&oe&&j===J.current)return;const le=K.current;if(oe||_e){const be=$??null;if(j===be){K.current=!1;return}let ke=Hj;le?ke=Vj:oe&&(ke=HS),F(be,ke);return}le&&W!=null&&(Y(j,Vj),K.current=!1)},[$,C,Y,W,k,w,j]);const pe=Et("div",t,{state:{orientation:d,tabActivationDirection:L},ref:a,props:h,stateAttributesMapping:Op});return n.jsx(LE.Provider,{value:Q,children:n.jsx(Sp,{elementsRef:_,children:pe})})});function ib(e,t){for(const[a,r]of e.entries())if(t===r.value)return a;return null}function vw(e,t,a,r){if(e==null||t==null)return"none";const[i,l,d]=a==="horizontal"?["left","left","right"]:["top","up","down"],f=ib(r,e),p=ib(r,t);if(f==null||p==null)return f!==p&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof t?t>e?d:l:"none";const g=f.getBoundingClientRect()[i],h=p.getBoundingClientRect()[i];return h<g?l:h>g?d:"none"}const IE="data-composite-item-active",$E=x.createContext(void 0);function B7(){const e=x.useContext($E);if(e===void 0)throw new Error(gn(65));return e}const U7=x.forwardRef(function(t,a){const{className:r,disabled:i=!1,render:l,value:d,id:f,nativeButton:p=!0,style:g,...h}=t,{value:b,getTabPanelIdByValue:_,onValueChange:y,orientation:S,tabActivationDirection:j}=fv(),{activateOnFocus:k,registerTabResizeObserverElement:C,tabsListElement:w}=B7(),{highlightedIndex:E,onHighlightedIndexChange:R}=kp(),T=ra(f),A=x.useMemo(()=>({disabled:i,id:T,value:d}),[i,T,d]),{compositeProps:z,compositeRef:M,index:D}=vN({metadata:A}),L=d===b,I=x.useRef(!1),P=x.useRef(null),B=Ve(te=>{P.current?.(),P.current=te?C(te):null});Pe(()=>{if(I.current){I.current=!1;return}if(!(L&&D>-1&&E!==D))return;const te=w;if(te!=null){const se=Xn(vt(te));if(se&&Je(te,se))return}i||R(D)},[L,D,E,R,i,w]);const{getButtonProps:q,buttonRef:Y}=ao({disabled:i,native:p,focusableWhenDisabled:!0}),U=_(d),V=x.useRef(!1),X=x.useRef(!1);function Q(te){y(d,rt(ka,te.nativeEvent,void 0,{activationDirection:"none"}))}function W(te){L||i||Q(te)}function $(te){L||i||k&&(!V.current||X.current)&&Q(te)}function K(te){if(L||i)return;V.current=!0,X.current=te.button===0;const se=vt(te.currentTarget);function pe(){V.current=!1,X.current=!1,se.removeEventListener("pointerup",pe),se.removeEventListener("pointercancel",pe)}se.addEventListener("pointerup",pe),se.addEventListener("pointercancel",pe)}return Et("button",t,{state:{disabled:i,active:L,orientation:S,tabActivationDirection:j},ref:[a,Y,M,B],props:[z,{role:"tab","aria-controls":U,"aria-selected":L,id:T,onClick:W,onFocus:$,onPointerDown:K,[IE]:L?"":void 0,onKeyDownCapture(){I.current=!0}},h,q],stateAttributesMapping:Op})}),q7={...Op,...Yo},H7=x.forwardRef(function(t,a){const{className:r,value:i,render:l,keepMounted:d=!1,style:f,...p}=t,{value:g,getTabIdByPanelValue:h,orientation:b,tabActivationDirection:_,registerMountedTabPanel:y}=fv(),S=ra(),{ref:j,index:k}=cu(),C=i===g,{mounted:w,transitionStatus:E,setMounted:R}=vl(C),T=!w,A=h(i),z={hidden:T,orientation:b,tabActivationDirection:_,transitionStatus:E},M=x.useRef(null),D=Et("div",t,{state:z,ref:[a,j,M],props:[{"aria-labelledby":A,hidden:T,id:S,role:"tabpanel",tabIndex:C?0:-1,inert:jp(!C),"data-index":k},p],stateAttributesMapping:q7});return Ca({open:C,ref:M,onComplete(){C||R(!1)}}),Pe(()=>{if(!(S==null||T&&!d))return y(i,S)},[T,d,i,S,y]),d||w?D:null}),V7=[];function F7(e){const{loopFocus:t=!0,orientation:a="both",grid:r,onLoop:i,direction:l,highlightedIndex:d,onHighlightedIndexChange:f,rootRef:p,enableHomeAndEndKeys:g=!1,stopEventPropagation:h,disabledIndices:b,modifierKeys:_=V7}=e,[y,S]=x.useState(0),j=r!=null,k=x.useRef(null),C=ir(k,p),w=x.useRef([]),E=x.useRef(!1),R=d??y,T=Ve((L,I=!1)=>{if((f??S)(L),I){const P=w.current[L];Rk(k.current,P,l,a)}}),A=Ve(L=>{if(L.size===0||E.current)return;E.current=!0;const I=Array.from(L.keys()),P=I.find(q=>q?.hasAttribute(IE))??null,B=P?L.get(P)?.index??-1:-1;if(B!==-1)T(B);else if(kf(I,R,b)){const q=Wa(I,{disabledIndices:b});zc(I,q)||T(q)}Rk(k.current,P,l,a)});Pe(()=>{if(b==null||d!=null||!E.current)return;const L=w.current;if(kf(L,R,b)){const I=Wa(L,{disabledIndices:b});zc(L,I)||T(I)}},[b,d,R,w,T]);const z=Ve((L,I,P)=>i?i(L,I,P,w):P),M=Ve(L=>{const I=L.key===$x||L.key===Bx;if(!wp.has(L.key)||!g&&I||G7(L,_)||!k.current)return;const B=l==="rtl",q=B?Lx:Ix,Y=B?Ix:Lx,U=a==="vertical"?Px:q,V=a==="vertical"?Dx:Y,X=Hn(L.nativeEvent);if(X!=null&&Ek(X)&&!jN(X)){const G=X.selectionStart,te=X.selectionEnd,se=X.value;if(G==null||L.shiftKey||G!==te||L.key!==V&&G<se.length||L.key!==U&&G>0)return}let Q=R;const W=of(w,b),$=Tx(w,b);r!=null&&(Q=r({disabledIndices:b,elementsRef:w,event:L,highlightedIndex:R,loopFocus:t,maxIndex:$,minIndex:W,onLoop:z,orientation:a,rtl:B}));const K=a!=="vertical"&&L.key===q||a!=="horizontal"&&L.key===Px,J=a!=="vertical"&&L.key===Y||a!=="horizontal"&&L.key===Dx;g&&(L.key===$x?Q=W:L.key===Bx&&(Q=$)),Q===R&&(K||J)&&(t&&Q===$&&K?(Q=W,i&&(Q=i(L,R,Q,w))):t&&Q===W&&J?(Q=$,i&&(Q=i(L,R,Q,w))):Q=Wa(w.current,{startingIndex:Q,decrement:J,disabledIndices:b})),Q!==R&&!zc(w.current,Q)&&(h&&L.stopPropagation(),(j||I||K||J)&&L.preventDefault(),T(Q,!0),queueMicrotask(()=>{w.current[Q]?.focus()}))});return{props:{ref:C,onFocus(L){const I=k.current,P=Hn(L.nativeEvent);!I||P==null||!Ek(P)||P.setSelectionRange(0,P.value.length)},onKeyDown:M},highlightedIndex:R,onHighlightedIndexChange:T,elementsRef:w,onMapChange:A,relayKeyboardEvent:M}}function G7(e,t){for(const a of pD)if(!t.includes(a)&&e.getModifierState(a))return!0;return!1}function Y7(e){const{render:t,className:a,style:r,refs:i=ja,props:l=ja,state:d=sn,stateAttributesMapping:f,highlightedIndex:p,onHighlightedIndexChange:g,orientation:h,grid:b,loopFocus:_,onLoop:y,enableHomeAndEndKeys:S,onMapChange:j,stopEventPropagation:k=!0,rootRef:C,disabledIndices:w,modifierKeys:E,highlightItemOnHover:R=!1,tag:T="div",...A}=e,z=vp(),{props:M,highlightedIndex:D,onHighlightedIndexChange:L,elementsRef:I,onMapChange:P,relayKeyboardEvent:B}=F7({grid:b,loopFocus:_,onLoop:y,orientation:h,highlightedIndex:p,onHighlightedIndexChange:g,rootRef:C,stopEventPropagation:k,enableHomeAndEndKeys:S,direction:z,disabledIndices:w,modifierKeys:E}),q=Et(T,e,{state:d,ref:i,props:[M,...l,A],stateAttributesMapping:f}),Y=x.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:L,highlightItemOnHover:R,relayKeyboardEvent:B}),[D,L,R,B]);return n.jsx(rN.Provider,{value:Y,children:n.jsx(Sp,{elementsRef:I,onMapChange:U=>{j?.(U),P(U)},children:q})})}const K7=x.forwardRef(function(t,a){const{activateOnFocus:r=!1,className:i,loopFocus:l=!0,render:d,style:f,...p}=t,{orientation:g,setTabMap:h,tabActivationDirection:b}=fv(),[_,y]=x.useState(0),[S,j]=x.useState(null),k=x.useRef(new Set),C=x.useRef(new Set),w=x.useRef(null);Pe(()=>{if(typeof ResizeObserver>"u")return;const M=new ResizeObserver(()=>{k.current.forEach(D=>{D()})});return w.current=M,S&&M.observe(S),C.current.forEach(D=>{M.observe(D)}),()=>{M.disconnect(),w.current=null}},[S]);const E=Ve(M=>(k.current.add(M),()=>{k.current.delete(M)})),R=Ve(M=>(C.current.add(M),w.current?.observe(M),()=>{C.current.delete(M),w.current?.unobserve(M)})),T={orientation:g,tabActivationDirection:b},A={"aria-orientation":g==="vertical"?"vertical":void 0,role:"tablist"},z=x.useMemo(()=>({activateOnFocus:r,registerIndicatorUpdateListener:E,registerTabResizeObserverElement:R,tabsListElement:S}),[r,E,R,S]);return n.jsx($E.Provider,{value:z,children:n.jsx(Y7,{render:d,className:i,style:f,state:T,refs:[a,j],props:[A,p],stateAttributesMapping:Op,highlightedIndex:_,enableHomeAndEndKeys:!0,loopFocus:l,orientation:g,onHighlightedIndexChange:y,onMapChange:h,disabledIndices:ja})})});function Dp({className:e,...t}){return n.jsx($7,{"data-slot":"tabs",className:St("flex flex-col gap-4",e),...t})}const X7=K_("inline-flex h-9 w-fit items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground data-[variant=line]:h-8 data-[variant=line]:gap-1 data-[variant=line]:rounded-none data-[variant=line]:bg-transparent data-[variant=line]:p-0",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Pp({className:e,variant:t="default",...a}){return n.jsx(K7,{"data-slot":"tabs-list","data-variant":t,className:St(X7({variant:t}),e),...a})}function qs({className:e,...t}){return n.jsx(U7,{"data-slot":"tabs-trigger",className:St("inline-flex h-7 items-center justify-center gap-1.5 rounded-md border border-transparent px-3 py-1 text-sm font-medium whitespace-nowrap text-muted-fg transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 data-active:bg-background data-active:text-foreground data-active:shadow-sm dark:data-active:border-input dark:data-active:bg-input/30 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function fs({className:e,...t}){return n.jsx(H7,{"data-slot":"tabs-content",className:St("text-sm outline-none",e),...t})}function yw(e,t){let a=e;for(const r of t.split(".")){if(!a||typeof a!="object"||Array.isArray(a))return;a=a[r]}return a}function pv(e,t=""){const a={};for(const[r,i]of Object.entries(e)){const l=t?`${t}.${r}`:r;i&&typeof i=="object"&&!Array.isArray(i)?Object.assign(a,pv(i,l)):a[l]=i}return a}function BE(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("JSON debe ser objeto.");return t}function pf({sections:e,source:t,placeholderSource:a,jsonTitle:r,jsonDescription:i,saveLabel:l=u("common.save"),onSaveFields:d,onSaveJson:f,busy:p,hideJson:g=!1}){const h=e[0]?.key||"json",[b,_]=x.useState({}),[y,S]=x.useState(""),[j,k]=x.useState("");x.useEffect(()=>{const T={};for(const A of e.flatMap(z=>z.fields))T[A.path]=yw(t,A.path)??"";_(T),S(JSON.stringify(t||{},null,2)),k("")},[t,e]);const C=x.useMemo(()=>new Set(e.flatMap(T=>T.fields.map(A=>A.path))),[e]),w=async()=>{const T={},A=[];for(const z of e.flatMap(M=>M.fields)){const M=b[z.path];if(!ps(M)){if(M===""||M===void 0||M===null){A.push(z.path);continue}if(z.kind==="number"){const D=Number(M);Number.isFinite(D)&&(T[z.path]=D)}else T[z.path]=M}}await d(T,A.filter(z=>C.has(z)))},E=async()=>{k("");try{await f(BE(y))}catch(T){k(T.message)}},R=T=>n.jsxs("div",{className:"space-y-4",children:[T.description&&n.jsx("p",{className:"text-sm text-muted-fg",children:T.description}),n.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:T.fields.map(A=>n.jsx(Q7,{field:A,value:b[A.path],inherited:yw(a,A.path),onChange:z=>_(M=>({...M,[A.path]:z}))},A.path))}),n.jsx(ae,{variant:"primary",loading:p,onClick:w,children:l})]});return g&&e.length<=1?e[0]?R(e[0]):null:n.jsxs(Dp,{defaultValue:h,className:"space-y-4",children:[n.jsxs(Pp,{className:"flex flex-wrap",children:[e.map(T=>n.jsx(qs,{value:T.key,children:T.label},T.key)),!g&&n.jsx(qs,{value:"json",children:"JSON"})]}),e.map(T=>n.jsx(fs,{value:T.key,children:R(T)},T.key)),!g&&n.jsx(fs,{value:"json",children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:r}),i&&n.jsx("p",{className:"text-xs text-muted-fg",children:i})]}),n.jsx(un,{rows:18,className:"font-mono text-xs",value:y,onChange:T=>S(T.target.value)}),j&&n.jsx("p",{className:"text-xs text-destructive",children:j}),n.jsx(ae,{variant:"primary",loading:p,onClick:E,children:u("settings_ui.save_json")})]})})]})}function Q7({field:e,value:t,inherited:a,onChange:r}){const i=e.placeholder||jw(a)||(ps(t)?Yr(t):""),l=e.hint||(a!==void 0?`Heredado: ${jw(a)}`:void 0);return e.kind==="boolean"?n.jsx("div",{className:"flex items-end pb-1",children:n.jsx(Dt,{checked:t===!0,onChange:r,label:e.label})}):n.jsx(ie,{label:e.label,hint:l,children:e.kind==="select"?n.jsx(ct,{value:String(t||""),onChange:r,placeholder:i||"(sin override)",options:[{value:"",label:i||"(sin override)"},...(e.options||[]).map(d=>({value:String(d.value),label:d.label}))]}):e.kind==="textarea"?n.jsx(un,{rows:4,value:String(t||""),placeholder:i,onChange:d=>r(d.target.value)}):n.jsx(Ce,{type:e.kind==="password"?"password":e.kind==="number"?"number":"text",value:String(ps(t)?"":t||""),placeholder:e.kind==="password"&&ps(t)?Yr(t):e.kind==="password"&&ps(a)?Yr(a):i,onChange:d=>r(d.target.value)})})}function jw(e){return e==null||e===""?"":ps(e)?Yr(e):Array.isArray(e)?e.join(", "):typeof e=="object"?JSON.stringify(e):String(e)}function W7(){return[{key:"routing",label:u("settings_ui.cfg_overrides_label"),description:u("settings_ui.cfg_overrides_desc"),fields:[{path:"route_to_agent",label:u("settings_ui.cfg_route_to_agent"),placeholder:"master"},{path:"super_agent.model",label:u("settings_ui.cfg_super_agent_model")},{path:"super_agent.permission_mode",label:u("settings_ui.cfg_permission_mode"),kind:"select",options:Hb.map(e=>({value:e,label:e}))},{path:"super_agent.system",label:u("settings_ui.cfg_extra_prompt"),kind:"textarea"}]}]}function Z7(){return[{key:"engines",label:u("settings_ui.cfg_engines_label"),fields:[{path:"engines.ollama.base_url",label:u("settings_ui.cfg_ollama_url")},{path:"engines.anthropic.api_key",label:u("settings_ui.cfg_anthropic_key"),kind:"password"},{path:"engines.openai.api_key",label:u("settings_ui.cfg_openai_key"),kind:"password"},{path:"engines.groq.api_key",label:u("settings_ui.cfg_groq_key"),kind:"password"},{path:"engines.openrouter.api_key",label:u("settings_ui.cfg_openrouter_key"),kind:"password"},{path:"engines.gemini.api_key",label:u("settings_ui.cfg_gemini_key"),kind:"password"}]}]}function J7(){return[{key:"identity",label:u("settings_ui.cfg_project_label"),description:u("settings_ui.cfg_project_desc"),fields:[{path:"name",label:u("settings_ui.cfg_name")},{path:"version",label:u("settings_ui.cfg_version")},{path:"apf",label:u("settings_ui.cfg_apc_spec")},{path:"apx",label:u("settings_ui.cfg_apx_install")},{path:"apx_id",label:u("settings_ui.cfg_apx_storage_id")}]}]}function UE({pid:e}){const t=Xe(),{project:a}=fu(e),{channels:r,isLoading:i,mutate:l}=Z_(),d=String(e),f=a?.name||a?.path?.split("/").pop()||d,p=`proj-${d}`,g=r.find(z=>z.project===d||z.project===f||z.name===p),[h,b]=x.useState(!!g),[_,y]=x.useState(""),[S,j]=x.useState(""),[k,C]=x.useState(""),[w,E]=x.useState(!0),[R,T]=x.useState(!1);if(x.useEffect(()=>{g?(b(!0),y(""),j(g.chat_id||""),C(g.route_to_agent||""),E(g.respond_with_engine??!0)):(b(!1),y(""),j(""),C(""),E(!0))},[g?.name,g?.chat_id,g?.route_to_agent]),i)return n.jsx(tt,{});const A=async()=>{T(!0);try{if(!h){g&&(await Pn.channels.remove(g.name),t.success(u("project.telegram.cleared"))),await l();return}const z={name:g?.name||p,project:d,chat_id:S,route_to_agent:k,respond_with_engine:w,..._?{bot_token:_}:{}};g?await Pn.channels.patch(g.name,z):await Pn.channels.upsert(z),t.success(u("project.telegram.saved")),await l(),y("")}catch(z){t.error(z.message)}finally{T(!1)}};return n.jsx(qe,{title:u("project.telegram.title"),description:u("project.telegram.subtitle"),children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Dt,{checked:h,onChange:b,label:u(h?"project.telegram.override_active":"project.telegram.use_default")}),g&&n.jsx(Be,{tone:"success",children:u("project.telegram.channel_badge",{name:g.name})})]}),h&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(ie,{label:u("project.telegram.bot_token"),hint:g?.bot_token?`${Yr(g.bot_token)} ${u("telegram_ui.empty_keep")}`:u("project.telegram.bot_hint_none"),children:n.jsx(Ce,{type:"password",value:_,onChange:z=>y(z.target.value),placeholder:g?.bot_token?Yr(g.bot_token):""})}),n.jsx(ie,{label:u("project.telegram.chat_id"),children:n.jsx(Ce,{value:S,onChange:z=>j(z.target.value)})}),n.jsx(ie,{label:u("project.telegram.route_agent"),hint:u("project.telegram.route_hint"),children:n.jsx(Ce,{value:k,onChange:z=>C(z.target.value)})})]}),n.jsx(Dt,{checked:w,onChange:E,label:u("project.telegram.respond_engine")})]}),n.jsx("div",{className:"pt-2",children:n.jsx(ae,{variant:"primary",loading:R,onClick:A,children:u("common.save")})}),!h&&!g&&n.jsx(ut,{children:u("project.telegram.no_override")})]})})}function e9({pid:e}){const t=Xe(),a=Sn(),{project:r,mutate:i}=fu(e),l=$e(`/api/projects/${e}/config`,()=>Zn.config.show(e)),d=String(e)==="0";if(l.isLoading)return n.jsx(tt,{});if(!l.data)return n.jsx(ut,{children:u("project.config.no_data")});const f=async h=>{await Zn.apcProject.put(e,h),t.success(u("project.config.save_project")),l.mutate()},p=async h=>{await Zn.config.put(e,h),t.success(u("project.config.save_override")),l.mutate()},g=async(h,b)=>{await Zn.config.set(e,h),b.length&&await Zn.config.unset(e,b),t.success(u("project.config.save_fields_success")),l.mutate()};return n.jsxs("div",{className:"space-y-6",children:[n.jsx(qe,{title:u("project.config.section_title"),description:u("project.config.section_desc"),children:n.jsxs(Dp,{defaultValue:"settings",className:"space-y-4",children:[n.jsxs(Pp,{className:"flex flex-wrap",children:[n.jsx(qs,{value:"settings",children:u("project.config.tab_settings")}),n.jsx(qs,{value:"engines",children:u("settings_ui.cfg_engines_label")}),!d&&n.jsx(qs,{value:"telegram",children:u("project.nav.telegram")}),n.jsx(qs,{value:"project",children:u("project.config.tab_project")}),n.jsx(qs,{value:"json",children:"JSON"})]}),n.jsx(fs,{value:"settings",children:n.jsx(pf,{sections:W7(),source:l.data.project_only,placeholderSource:l.data.effective,jsonTitle:l.data.project_config_path,onSaveFields:g,onSaveJson:p,hideJson:!0})}),n.jsx(fs,{value:"engines",children:n.jsx(pf,{sections:Z7(),source:l.data.project_only,placeholderSource:l.data.effective,jsonTitle:l.data.project_config_path,onSaveFields:g,onSaveJson:p,hideJson:!0})}),!d&&n.jsx(fs,{value:"telegram",children:n.jsx(UE,{pid:e})}),n.jsx(fs,{value:"project",children:n.jsx(pf,{sections:J7(),source:l.data.apc_project||{},jsonTitle:l.data.project_json_path,onSaveFields:async(h,b)=>{await Zn.apcProject.set(e,n9(h),b),t.success(u("project.config.save_meta_success")),l.mutate()},onSaveJson:f,hideJson:!0})}),n.jsx(fs,{value:"json",children:n.jsxs("div",{className:"space-y-6",children:[n.jsx(kw,{title:l.data.project_config_path,description:".apc/config.json — overrides del proyecto.",source:l.data.project_only,onSave:p}),n.jsx(kw,{title:l.data.project_json_path,description:".apc/project.json — metadata APC portable.",source:l.data.apc_project||{},onSave:f}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"text-xs text-muted-fg",children:u("project.config.effective_read")}),n.jsx("pre",{className:"max-h-96 overflow-auto rounded-lg border border-border bg-muted/40 p-3 text-xs",children:JSON.stringify(l.data.effective,null,2)})]})]})})]})}),!d&&r?n.jsx(t9,{pid:e,label:r.name||r.path,onRebuilt:()=>l.mutate(),onUnregistered:()=>{i(),a("/")}}):null]})}function t9({pid:e,label:t,onRebuilt:a,onUnregistered:r}){const i=Xe(),[l,d]=x.useState(null),[f,p]=x.useState(null),g=async()=>{d("rebuild");try{await Zn.rebuild(e),i.success(u("project.rebuild_done")),a()}catch(b){i.error(b.message)}finally{d(null),p(null)}},h=async()=>{d("unregister");try{await Zn.remove(e),i.success(u("project.unregistered")),r()}catch(b){i.error(b.message)}finally{d(null),p(null)}};return n.jsxs(n.Fragment,{children:[n.jsx(qe,{title:u("project.danger.title"),description:u("project.danger.subtitle"),children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-border bg-muted/30 px-3 py-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-sm font-medium",children:u("project.rebuild")}),n.jsx("div",{className:"text-xs text-muted-fg",children:u("project.danger.rebuild_desc")})]}),n.jsxs(ae,{size:"sm",variant:"secondary",onClick:()=>p("rebuild"),children:[n.jsx(Cs,{size:13})," ",u("project.rebuild")]})]}),n.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-red-500/40 bg-red-500/5 px-3 py-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-sm font-medium",children:u("admin.unregister")}),n.jsx("div",{className:"text-xs text-muted-fg",children:u("project.danger.unregister_desc")})]}),n.jsxs(ae,{size:"sm",variant:"destructive",onClick:()=>p("unregister"),children:[n.jsx(_n,{size:13})," ",u("admin.unregister")]})]})]})}),n.jsx(Bt,{open:f==="rebuild",onClose:()=>l?null:p(null),title:u("project.danger.rebuild_confirm_title"),description:u("project.danger.rebuild_confirm_desc",{label:t}),size:"sm",footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:()=>p(null),disabled:l!==null,children:u("common.cancel")}),n.jsx(ae,{variant:"primary",onClick:g,loading:l==="rebuild",children:u("project.rebuild")})]}),children:n.jsx("p",{className:"text-sm text-muted-fg",children:u("project.danger.rebuild_long")})}),n.jsx(Bt,{open:f==="unregister",onClose:()=>l?null:p(null),title:u("project.danger.unregister_confirm_title"),description:u("project.unregister_confirm",{label:t}),size:"sm",footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:()=>p(null),disabled:l!==null,children:u("common.cancel")}),n.jsx(ae,{variant:"destructive",onClick:h,loading:l==="unregister",children:u("admin.unregister")})]}),children:n.jsx("p",{className:"text-sm text-muted-fg",children:u("project.danger.unregister_long")})})]})}function kw({title:e,description:t,source:a,onSave:r}){const[i,l]=x.useState(""),[d,f]=x.useState(""),[p,g]=x.useState(!1);x.useEffect(()=>{l(JSON.stringify(a||{},null,2)),f("")},[a]);const h=async()=>{f(""),g(!0);try{await r(BE(i))}catch(b){f(b.message)}finally{g(!1)}};return n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:e}),t&&n.jsx("p",{className:"text-xs text-muted-fg",children:t})]}),n.jsx(un,{rows:14,className:"font-mono text-xs",value:i,onChange:b=>l(b.target.value)}),d&&n.jsx("p",{className:"text-xs text-destructive",children:d}),n.jsx(ae,{variant:"primary",loading:p,onClick:h,children:u("settings_ui.save_json")})]})}function n9(e){const t={};for(const[a,r]of Object.entries(pv(e)))ps(r)||(t[a]=r);return t}function Wi(e){return String(e||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function qE({open:e,onClose:t,pid:a,editing:r,onSaved:i}){const l=Xe(),[d,f]=x.useState(""),[p,g]=x.useState(""),[h,b]=x.useState(""),[_,y]=x.useState(!1);x.useEffect(()=>{e&&(f(r?.name??""),g(r?.slug??""),b(r?.goal??""))},[e,r]);const S=async()=>{if(d.trim()){y(!0);try{r?await Gr.updateArea(a,r.slug,{name:d,goal:h}):await Gr.createArea(a,{name:d,slug:p||Wi(d),goal:h}),l.success(u("common.saved")),i(),t()}catch(j){l.error(j instanceof Error?j.message:String(j))}finally{y(!1)}}};return n.jsx(Bt,{open:e,onClose:t,title:u(r?"structure.edit_area":"structure.new_area"),footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:t,children:u("common.cancel")}),n.jsx(ae,{variant:"primary","data-testid":"area-create",onClick:()=>void S(),loading:_,disabled:!d.trim(),children:u(r?"common.save":"structure.create_area")})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(ie,{label:u("structure.name"),children:n.jsx(Ce,{autoFocus:!0,"data-testid":"area-name",value:d,onChange:j=>{f(j.target.value),r||g(Wi(j.target.value))},placeholder:"Engineering"})}),!r&&n.jsx(ie,{label:u("structure.slug"),children:n.jsx(Ce,{value:p,onChange:j=>g(Wi(j.target.value)),className:"font-mono",placeholder:"engineering"})}),n.jsx(ie,{label:u("structure.goal"),hint:u("structure.goal_hint"),children:n.jsx(un,{value:h,onChange:j=>b(j.target.value),rows:2})})]})})}function HE({open:e,onClose:t,pid:a,areas:r,editing:i,presetArea:l,onSaved:d}){const f=Xe(),[p,g]=x.useState(""),[h,b]=x.useState(""),[_,y]=x.useState(""),[S,j]=x.useState(""),[k,C]=x.useState(!1);x.useEffect(()=>{e&&(g(i?.name??""),b(i?.slug??""),y(i?.area??l??""),j(i?.description??""))},[e,i,l]);const w=async()=>{if(p.trim()){C(!0);try{i?await Gr.updateRole(a,i.slug,{name:p,area:_||null,description:S}):await Gr.createRole(a,{name:p,slug:h||Wi(p),area:_||null,description:S}),f.success(u("common.saved")),d(),t()}catch(R){f.error(R instanceof Error?R.message:String(R))}finally{C(!1)}}},E=[{value:"",label:u("structure.no_area")},...r.map(R=>({value:R.slug,label:R.name}))];return n.jsx(Bt,{open:e,onClose:t,title:u(i?"structure.edit_role":"structure.new_role"),footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:t,children:u("common.cancel")}),n.jsx(ae,{variant:"primary",onClick:()=>void w(),loading:k,disabled:!p.trim(),children:u(i?"common.save":"structure.create_role")})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(ie,{label:u("structure.name"),children:n.jsx(Ce,{autoFocus:!0,value:p,onChange:R=>{g(R.target.value),i||b(Wi(R.target.value))},placeholder:"Tech Lead"})}),!i&&n.jsx(ie,{label:u("structure.slug"),children:n.jsx(Ce,{value:h,onChange:R=>b(Wi(R.target.value)),className:"font-mono",placeholder:"tech-lead"})}),n.jsx(ie,{label:u("structure.area"),children:n.jsx(ct,{value:_,onChange:y,options:E,placeholder:u("structure.no_area")})}),n.jsx(ie,{label:u("structure.description"),children:n.jsx(un,{value:S,onChange:R=>j(R.target.value),rows:2})})]})})}function VE({value:e,onChange:t}){return n.jsx(Ce,{value:e,onChange:a=>t([...a.target.value].slice(-2).join("")),className:"text-center text-lg",placeholder:"🤖","aria-label":u("agents_form.emoji")})}const s9=[{value:"total",labelKey:"auto_total"},{value:"automatico",labelKey:"auto_automatico"},{value:"permiso",labelKey:"auto_permiso"}];function FE({value:e,onChange:t}){return n.jsx("div",{className:"inline-flex w-full rounded-lg border border-border p-0.5",children:s9.map(a=>n.jsx("button",{type:"button",onClick:()=>t(a.value),className:me("flex-1 rounded-md px-2 py-1 text-[12px] font-medium capitalize transition-colors",e===a.value?"bg-primary/15 text-foreground":"text-muted-foreground hover:text-foreground"),children:u(`agents_form.${a.labelKey}`)},a.value))})}function GE({pid:e,area:t,role:a,onArea:r,onRole:i}){const l=$e(`/api/projects/${e}/organization`,()=>Gr.get(e)),[d,f]=x.useState(!1),[p,g]=x.useState(!1),h=l.data?.areas??[],_=(l.data?.roles??[]).filter(j=>t?j.area===t||j.area===null:!0),y=[{value:"",label:u("structure.no_area")},...h.map(j=>({value:j.slug,label:j.name}))],S=[{value:"",label:u("agents_form.no_role")},..._.map(j=>({value:j.slug,label:j.name}))];return n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(ie,{label:u("agents_form.area"),children:n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(ct,{value:t,onChange:j=>{r(j)},options:y,placeholder:u("structure.no_area"),className:"flex-1"}),n.jsx(ww,{label:u("structure.new_area"),onClick:()=>f(!0)})]})}),n.jsx(ie,{label:u("agents_form.role"),children:n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(ct,{value:a,onChange:i,options:S,placeholder:u("agents_form.no_role"),className:"flex-1"}),n.jsx(ww,{label:u("structure.new_role"),onClick:()=>g(!0)})]})})]}),n.jsx(qE,{open:d,onClose:()=>f(!1),pid:e,onSaved:()=>void l.mutate()}),n.jsx(HE,{open:p,onClose:()=>g(!1),pid:e,areas:h,presetArea:t||null,onSaved:()=>void l.mutate()})]})}function ww({label:e,onClick:t}){return n.jsx("button",{type:"button",onClick:t,title:e,"aria-label":e,className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border text-muted-foreground hover:bg-accent hover:text-foreground",children:n.jsx(Ot,{className:"size-4"})})}function YE({open:e,onClose:t,onConfirm:a,title:r,description:i,confirmLabel:l,destructive:d=!0}){const[f,p]=x.useState(!1),g=async()=>{p(!0);try{await a(),t()}finally{p(!1)}};return n.jsx(Bt,{open:e,onClose:t,title:r,footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:t,disabled:f,children:u("common.cancel")}),n.jsx(ae,{variant:d?"destructive":"primary",onClick:()=>void g(),loading:f,children:l??u("common.confirm")})]}),children:n.jsx("p",{className:"text-sm text-muted-foreground",children:i})})}function Xd(e,t){const a=[],r=/(\*\*([^*]+)\*\*)|(\*([^*]+)\*)|(`([^`]+)`)|(\[([^\]]+)\]\(([^)]+)\))/g;let i=0,l,d=0;for(;l=r.exec(e);)l.index>i&&a.push(n.jsx(x.Fragment,{children:e.slice(i,l.index)},`${t}-t${d}`)),l[2]!==void 0?a.push(n.jsx("strong",{children:l[2]},`${t}-b${d}`)):l[4]!==void 0?a.push(n.jsx("em",{children:l[4]},`${t}-i${d}`)):l[6]!==void 0?a.push(n.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.85em]",children:l[6]},`${t}-c${d}`)):l[8]!==void 0&&a.push(n.jsx("a",{href:l[9],target:"_blank",rel:"noreferrer",className:"text-sky-500 underline underline-offset-2 hover:text-sky-400",children:l[8]},`${t}-l${d}`)),i=r.lastIndex,d+=1;return i<e.length&&a.push(n.jsx(x.Fragment,{children:e.slice(i)},`${t}-tend`)),a}function KE({content:e,className:t}){const a=e.replace(/\r\n/g,`
824
+ `).split(`
825
+ `),r=[];let i=0,l=0;const d=(f,p)=>{const g=p?"ol":"ul";r.push(n.jsx(g,{className:me("my-2 space-y-1 pl-5",p?"list-decimal":"list-disc"),children:f.map((h,b)=>n.jsx("li",{children:Xd(h,`li${l}-${b}`)},b))},`k${l++}`))};for(;i<a.length;){const f=a[i];if(/^```/.test(f.trim())){const h=[];for(i+=1;i<a.length&&!/^```/.test(a[i].trim());)h.push(a[i++]);i+=1,r.push(n.jsx("pre",{className:"my-2 overflow-x-auto rounded-lg bg-muted/60 p-3 font-mono text-[12px] leading-[1.6]",children:n.jsx("code",{children:h.join(`
826
+ `)})},`k${l++}`));continue}if(f.trim()===""){i+=1;continue}const p=f.match(/^(#{1,6})\s+(.*)$/);if(p){const h=p[1].length,b=["text-2xl","text-xl","text-lg","text-base","text-sm","text-sm"];r.push(n.jsx("div",{className:me("mt-3 mb-1 font-semibold text-foreground",b[h-1]),children:Xd(p[2],`h${l}`)},`k${l++}`)),i+=1;continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(f.trim())){r.push(n.jsx("hr",{className:"my-3 border-border"},`k${l++}`)),i+=1;continue}if(/^>\s?/.test(f)){const h=[];for(;i<a.length&&/^>\s?/.test(a[i]);)h.push(a[i++].replace(/^>\s?/,""));r.push(n.jsx("blockquote",{className:"my-2 border-l-2 border-border pl-3 text-muted-foreground",children:Xd(h.join(" "),`q${l}`)},`k${l++}`));continue}if(/^\s*[-*+]\s+/.test(f)){const h=[];for(;i<a.length&&/^\s*[-*+]\s+/.test(a[i]);)h.push(a[i++].replace(/^\s*[-*+]\s+/,""));d(h,!1);continue}if(/^\s*\d+\.\s+/.test(f)){const h=[];for(;i<a.length&&/^\s*\d+\.\s+/.test(a[i]);)h.push(a[i++].replace(/^\s*\d+\.\s+/,""));d(h,!0);continue}const g=[];for(;i<a.length&&a[i].trim()!==""&&!/^(#{1,6})\s/.test(a[i])&&!/^```/.test(a[i].trim())&&!/^>\s?/.test(a[i])&&!/^\s*[-*+]\s+/.test(a[i])&&!/^\s*\d+\.\s+/.test(a[i]);)g.push(a[i++]);r.push(n.jsx("p",{className:"my-2 leading-relaxed",children:Xd(g.join(" "),`p${l}`)},`k${l++}`))}return n.jsx("div",{className:me("text-sm text-foreground/90",t),children:r})}function a9({value:e,onChange:t,showPreview:a=!1,placeholder:r,onSave:i,className:l}){return n.jsxs("div",{className:me("flex min-h-0 flex-1",l),children:[n.jsx("textarea",{value:e,onChange:d=>t(d.target.value),onKeyDown:d=>{i&&(d.metaKey||d.ctrlKey)&&d.key==="s"&&(d.preventDefault(),i())},placeholder:r,spellCheck:!1,className:me("min-h-0 resize-none bg-transparent p-4 font-mono text-[13px] leading-[1.7] text-foreground/90 outline-none",a?"w-1/2 border-r border-border":"w-full")}),a&&n.jsx("div",{className:"min-h-0 w-1/2 overflow-y-auto p-4",children:n.jsx(KE,{content:e})})]})}function Qd({onClick:e,active:t,disabled:a,children:r}){return n.jsx("button",{type:"button",onClick:e,disabled:a,className:me("inline-flex items-center gap-1 rounded px-2 py-0.5 text-[11px] font-medium transition-colors disabled:opacity-40",t?"bg-primary/15 text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:r})}function r9({content:e}){return n.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:n.jsx("table",{className:"w-full border-collapse font-mono text-[12px] leading-[1.6]",children:n.jsx("tbody",{children:e.split(`
827
+ `).map((t,a)=>n.jsxs("tr",{className:"hover:bg-accent/20",children:[n.jsx("td",{className:"w-12 select-none border-r border-border/30 px-3 text-right align-top text-[10px] text-muted-foreground/40","aria-hidden":"true",children:a+1}),n.jsx("td",{className:"whitespace-pre px-4 align-top text-foreground/90",children:t||" "})]},a))})})})}function mv({file:e,loading:t,onSave:a}){const r=typeof a=="function",[i,l]=x.useState(""),[d,f]=x.useState(!1),[p,g]=x.useState(!0),[h,b]=x.useState(!1);if(x.useEffect(()=>{l(e?.content??""),f(!1),g(!0)},[e?.path,e?.content]),t)return n.jsx("div",{className:"flex flex-1 items-center justify-center",children:n.jsx(bn,{size:16})});if(!e)return n.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:u("files.select_prompt")});const _=e.kind==="markdown",y=e.kind==="text"||e.kind==="markdown",S=d&&i!==(e.content??""),j=async()=>{if(!(!a||!S)){b(!0);try{await a(i),f(!1)}finally{b(!1)}}};return n.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/40","data-testid":"file-viewer",children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5",children:[n.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",children:[e.path,S&&n.jsx("span",{className:"ml-1 text-amber-400",children:"•"})]}),_&&d&&n.jsxs(Qd,{onClick:()=>g(k=>!k),active:p,children:[n.jsx(oM,{className:"size-3"}),u("files.preview")]}),r&&y&&(d?n.jsxs(n.Fragment,{children:[n.jsxs(Qd,{onClick:()=>{l(e.content??""),f(!1)},disabled:h,children:[n.jsx(hl,{className:"size-3"}),u("files.discard")]}),n.jsxs(Qd,{onClick:()=>void j(),disabled:!S||h,active:S,children:[h?n.jsx(bn,{size:10}):n.jsx(tp,{className:"size-3"}),u("files.save")]})]}):n.jsxs(Qd,{onClick:()=>f(!0),children:[n.jsx(wa,{className:"size-3"}),u("files.edit")]}))]}),_?d?n.jsx(a9,{value:i,onChange:l,showPreview:p,onSave:()=>void j()}):n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4",children:n.jsx(KE,{content:e.content??""})}):e.kind==="text"?d?n.jsx("textarea",{value:i,onChange:k=>l(k.target.value),onKeyDown:k=>{(k.metaKey||k.ctrlKey)&&k.key==="s"&&(k.preventDefault(),j())},spellCheck:!1,className:"min-h-0 flex-1 resize-none bg-transparent p-4 font-mono text-[12px] leading-[1.6] text-foreground/90 outline-none"}):n.jsx(r9,{content:e.content??""}):e.kind==="image"&&e.encoding==="base64"?n.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center overflow-auto p-4",children:n.jsx("img",{src:`data:${e.mime};base64,${e.content}`,alt:e.name,className:"max-h-full max-w-full rounded object-contain"})}):n.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 text-sm text-muted-foreground",children:[n.jsx(mM,{className:"size-8 opacity-50"}),n.jsx("span",{children:e.too_large?u("files.too_large"):u("files.no_preview")}),n.jsxs("span",{className:"flex items-center gap-1 text-xs opacity-70",children:[n.jsx(uM,{className:"size-3"}),(e.size/1024).toFixed(1)," KB"]})]})]})}function o9(){return[{key:"overview",label:u("agents_ui.tab_explorer"),icon:Zf},{key:"memories",label:u("project.nav.memories"),icon:$c},{key:"records",label:u("project.agent_detail.records_title"),icon:Xf},{key:"sleep",label:u("project.agent_detail.sleep_title"),icon:Do},{key:"brain",label:u("project.agent_detail.brain_title"),icon:sa},{key:"config",label:u("settings.tabs.advanced"),icon:np}]}function XE(){return[{value:"",label:u("agents_ui.type_none")},{value:"orchestrator",label:u("agents_ui.type_orchestrator"),description:u("agents_ui.type_orchestrator_desc")},{value:"specialist",label:u("agents_ui.type_specialist"),description:u("agents_ui.type_specialist_desc")},{value:"assistant",label:u("agents_ui.type_assistant"),description:u("agents_ui.type_assistant_desc")},{value:"worker",label:u("agents_ui.type_worker"),description:u("agents_ui.type_worker_desc")},{value:"monitor",label:u("agents_ui.type_monitor"),description:u("agents_ui.type_monitor_desc")}]}const lb=e=>e.split(",").map(t=>t.trim()).filter(Boolean),i9=(e,t)=>e.filter(a=>a.spec?.agent===t||t==="super-agent"&&a.kind==="super_agent");function l9(e){return e.split(`
828
+ `).map(t=>t.replace(/^[-*#>\s]+/,"").trim()).filter(t=>t.length>2&&!t.startsWith("```")).slice(0,12)}function c9({pid:e}){const{slug:t=""}=sS(),a=Sn(),[r,i]=x.useState("overview"),l=o9(),d=$e(`/api/projects/${e}/agents/${t}`,()=>an.get(e,t)),f=$e(`/api/projects/${e}/agents`,()=>an.list(e)),p=$e(`/api/projects/${e}/routines`,()=>Ur.list(e)),g=$e(`/api/projects/${e}/messages?agent=${t}`,()=>Mf.project(e,{agent:t,limit:200})),h=$e(`/api/projects/${e}/agents/${t}/conversations`,()=>Jr.list(e,t)),b=$e(`/api/projects/${e}/tasks?all`,()=>qn.list(e,"all")),_=d.data,y=i9(p.data||[],t),S=(b.data||[]).filter(C=>C.agent===t),j=(f.data||[]).filter(C=>C.parent===t);if(d.isLoading)return n.jsx(tt,{});if(!_)return n.jsx("div",{className:"text-sm text-muted-fg",children:u("project.agent_detail.not_found")});const k=_.is_master?va:rn;return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("button",{onClick:()=>a(`/p/${e}/agents`),className:"mt-1 text-muted-fg hover:text-foreground",children:n.jsx(VA,{size:16})}),n.jsx("div",{className:me("flex size-11 items-center justify-center rounded-xl bg-gradient-to-br",_.is_master?"from-violet-600 to-indigo-600":"from-slate-600 to-gray-600"),children:n.jsx(k,{className:"size-5 text-white"})}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("h1",{className:"text-lg font-semibold",children:_.slug}),_.is_master&&n.jsxs(Be,{tone:"success",children:[n.jsx(va,{size:10})," ",u("project.agents.orchestrator")]}),_.role&&n.jsx(Be,{children:_.role}),_.model&&n.jsx(Be,{tone:"info",children:_.model}),_.parent&&n.jsxs("button",{onClick:()=>a(`/p/${e}/agents/${_.parent}`),className:"text-[11px] text-violet-400 hover:underline",children:[u("project.agent_detail.reports_to")," ",_.parent]})]}),_.description&&n.jsx("p",{className:"mt-0.5 max-w-2xl text-xs text-muted-fg",children:_.description})]})]}),n.jsxs(ae,{size:"sm",variant:"primary",onClick:()=>a(`/p/${e}/chat?agent=${t}`),children:[n.jsx(Sa,{size:13})," ",u("project.agent_detail.chat_btn",{slug:_.slug})]})]}),n.jsx("div",{className:"flex flex-wrap gap-1 border-b border-border",children:l.map(({key:C,label:w,icon:E})=>n.jsxs("button",{onClick:()=>i(C),className:me("flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm transition-colors -mb-px",r===C?"border-foreground text-foreground":"border-transparent text-muted-fg hover:text-foreground"),children:[n.jsx(E,{size:14})," ",w]},C))}),r==="overview"&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[n.jsx(Wd,{label:u("agents_ui.stat_threads"),value:h.data?.length??0,icon:nu}),n.jsx(Wd,{label:u("agents_ui.stat_records"),value:g.data?.length??0,icon:Xf}),n.jsx(Wd,{label:u("agents_ui.stat_tasks"),value:S.length,icon:Zf}),n.jsx(Wd,{label:u("agents_ui.stat_heartbeats"),value:y.length,icon:Do})]}),n.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[n.jsx(qe,{title:u("agent_detail_extra.skills_title"),description:"",children:n.jsxs("div",{className:"flex flex-wrap gap-1",children:[_.skills?.map(C=>n.jsxs(Be,{tone:"info",children:[n.jsx(sa,{size:10})," ",C]},C)),_.tools?.map(C=>n.jsxs(Be,{children:[n.jsx(aa,{size:10})," ",C]},C)),!_.skills?.length&&!_.tools?.length&&n.jsx("span",{className:"text-xs text-muted-fg",children:"—"})]})}),n.jsx(qe,{title:u("project.agent_detail.threads_recent"),description:"",children:n.jsxs("ul",{className:"space-y-1 text-xs",children:[(h.data||[]).slice(0,6).map(C=>n.jsxs("li",{className:"flex items-center justify-between rounded-md bg-muted/30 px-2 py-1",children:[n.jsx("span",{className:"truncate",children:C.title||C.filename}),n.jsxs("span",{className:"shrink-0 text-muted-fg",children:[C.messages??0," ",u("project.agent_detail.msgs_count")]})]},C.id)),!h.data?.length&&n.jsx("li",{className:"text-muted-fg",children:u("project.agent_detail.no_threads")})]})})]}),j.length>0&&n.jsx(qe,{title:u("project.agent_detail.subagents"),description:u("project.agent_detail.subagents_desc"),children:n.jsx("div",{className:"flex flex-wrap gap-2",children:j.map(C=>n.jsxs("button",{onClick:()=>a(`/p/${e}/agents/${C.slug}`),className:"flex items-center gap-2 rounded-lg border border-border bg-muted/30 px-3 py-1.5 text-sm hover:border-muted-fg/50",children:[n.jsx(rn,{size:14,className:"text-muted-fg"})," ",C.slug]},C.slug))})})]}),r==="memories"&&n.jsx(d9,{pid:e,slug:t,onSaved:()=>d.mutate()}),r==="records"&&n.jsx(f9,{records:g.data||[],loading:g.isLoading}),r==="sleep"&&n.jsx(p9,{routines:y}),r==="brain"&&n.jsx(x9,{slug:t,emoji:_.emoji||void 0,memory:_.memory||"",threads:(h.data||[]).map(C=>({id:C.id,label:C.title||C.filename})),tasks:S.map(C=>({id:C.id,label:C.title,detail:C.body||void 0})),routines:y,parent:_.parent||null,children:j.map(C=>C.slug)}),r==="config"&&n.jsx(u9,{pid:e,agent:_,agents:f.data||[],onSaved:()=>{d.mutate(),f.mutate()},onDeleted:()=>{f.mutate(),a(`/p/${e}/agents`)}})]})}function u9({pid:e,agent:t,agents:a,onSaved:r,onDeleted:i}){const l=Xe(),[d,f]=x.useState(t.emoji||""),[p,g]=x.useState(t.type||""),[h,b]=x.useState(t.area||""),[_,y]=x.useState(t.role||""),[S,j]=x.useState(t.autonomy||""),[k,C]=x.useState(t.model||""),[w,E]=x.useState(t.parent||""),[R,T]=x.useState(!!t.is_master),[A,z]=x.useState((t.skills||[]).join(", ")),[M,D]=x.useState((t.tools||[]).join(", ")),[L,I]=x.useState(t.description||""),[P,B]=x.useState(t.system||""),[q,Y]=x.useState(!1),[U,V]=x.useState(!1),X=async()=>{Y(!0);try{await an.update(e,t.slug,{emoji:d||null,type:p||null,area:h||null,role:_||null,autonomy:S||null,model:k||null,parent:w||null,is_master:R||p==="orchestrator",skills:lb(A),tools:lb(M),description:L||null,system:P}),l.success(u("project.agent_detail.update_success")),r()}catch(W){l.error(W.message)}finally{Y(!1)}},Q=async()=>{await an.remove(e,t.slug),l.success(u("project.agent_detail.delete_success")),i()};return n.jsxs(qe,{title:u("project.agent_detail.config_title"),description:`.apc/agents/${t.slug}.md — ${u("agents_ui.config_def_desc")}`,children:[n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"grid grid-cols-[80px_1fr] gap-3",children:[n.jsx(ie,{label:u("agents_form.emoji"),children:n.jsx(VE,{value:d,onChange:f})}),n.jsx(ie,{label:u("project.agent_detail.type_label"),children:n.jsx(ct,{value:p,onChange:g,options:XE()})})]}),n.jsx(GE,{pid:e,area:h,role:_,onArea:b,onRole:y}),n.jsx(ie,{label:u("agents_form.autonomy"),hint:u("agents_form.autonomy_hint"),children:n.jsx(FE,{value:S,onChange:j})}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(ie,{label:u("project.agent_detail.parent_label"),children:n.jsx(ct,{value:w,onChange:E,placeholder:u("project.agent_detail.none_parent"),options:[{value:"",label:u("project.agent_detail.none_parent")},...a.filter(W=>W.slug!==t.slug).map(W=>({value:W.slug,label:W.slug}))]})}),n.jsx(ie,{label:u("project.agent_detail.model_label"),hint:u("project.agent_detail.model_hint"),children:n.jsx(Ce,{value:k,onChange:W=>C(W.target.value),placeholder:u("project.agent_detail.model_ph")})})]}),n.jsx(ie,{label:u("project.agent_detail.skills_label"),children:n.jsx(Ce,{value:A,onChange:W=>z(W.target.value),placeholder:"skill-a, skill-b"})}),n.jsx(m9,{value:M,onChange:D}),n.jsx(ie,{label:u("project.agent_detail.bio_label"),children:n.jsx(un,{rows:2,value:L,onChange:W=>I(W.target.value)})}),n.jsx(ie,{label:u("project.agent_detail.system_label"),hint:u("project.agent_detail.system_hint"),children:n.jsx(un,{rows:10,className:"font-mono text-xs",value:P,onChange:W=>B(W.target.value),placeholder:"You are…"})}),n.jsx(Dt,{checked:R,onChange:T,label:u("project.agent_detail.master_label")}),n.jsxs("div",{className:"flex items-center justify-between border-t border-border pt-3",children:[n.jsxs(ae,{variant:"destructive",onClick:()=>V(!0),children:[n.jsx(_n,{size:13})," ",u("project.agent_detail.delete_btn")]}),n.jsxs(ae,{variant:"primary",loading:q,onClick:X,children:[n.jsx(tp,{size:13})," ",u("project.agent_detail.save_btn")]})]})]}),n.jsx(YE,{open:U,onClose:()=>V(!1),onConfirm:Q,title:u("project.agent_detail.delete_btn"),description:u("project.agent_detail.delete_confirm",{slug:t.slug}),confirmLabel:u("project.agent_detail.delete_btn")})]})}function Wd({label:e,value:t,icon:a}){return n.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[n.jsx(a,{size:13})," ",e]}),n.jsx("div",{className:"mt-1 text-2xl font-semibold",children:t})]})}function d9({pid:e,slug:t,onSaved:a}){const r=Xe(),i=$e(`/api/memory/${e}/agent:${t}`,()=>an.memory.get(e,t).then(f=>f.body)),l=x.useMemo(()=>{if(i.data===void 0)return null;const f=i.data??"";return{path:`agents/${t}/memory.md`,name:"memory.md",kind:"markdown",size:f.length,modified:"",encoding:"utf8",content:f}},[i.data,t]),d=async f=>{await an.memory.put(e,t,f),r.success(u("project.agent_detail.memory_saved")),i.mutate(f,{revalidate:!1}),a()};return n.jsx("div",{className:"flex h-[65vh] min-h-[420px] flex-col overflow-hidden rounded-xl border border-border bg-card",children:n.jsx(mv,{file:l,loading:i.isLoading,onSave:d})})}function f9({records:e,loading:t}){const a=x.useMemo(()=>[...e].sort((r,i)=>(i.ts||"").localeCompare(r.ts||"")),[e]);return n.jsxs(qe,{title:u("project.agent_detail.records_title"),description:u("project.agent_detail.records_desc"),children:[t&&n.jsx(tt,{}),!t&&a.length===0&&n.jsx("p",{className:"text-xs text-muted-fg",children:u("project.agent_detail.no_activity")}),n.jsx("ul",{className:"space-y-1 text-sm",children:a.map((r,i)=>n.jsxs("li",{className:"flex items-start gap-2 rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsx("span",{className:"mt-0.5 shrink-0",children:r.direction==="in"?n.jsx(dS,{size:13,className:"text-blue-400"}):n.jsx(Cb,{size:13,className:"text-emerald-400"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-fg",children:[n.jsx("span",{className:"font-mono",children:new Date(r.ts).toLocaleString()}),n.jsx(Be,{tone:"info",children:r.channel}),r.type&&n.jsx(Be,{children:r.type})]}),r.body&&n.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs",children:r.body.length>400?`${r.body.slice(0,400)}…`:r.body})]})]},`${r.ts}-${i}`))})]})}function p9({routines:e}){return e.length===0?n.jsx(qe,{title:u("project.agent_detail.sleep_title"),description:u("project.agent_detail.sleep_desc"),children:n.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4 text-sm",children:[n.jsx("div",{className:"font-medium text-amber-400",children:u("project.agent_detail.sleep_deep")}),n.jsx("p",{className:"mt-1 text-xs text-muted-fg",children:u("project.agent_detail.sleep_deep_desc")})]})}):n.jsx(qe,{title:u("project.agent_detail.sleep_title"),description:u("project.agent_detail.sleep_desc"),children:n.jsx("div",{className:"space-y-3",children:e.map(t=>{const a=t.enabled,r=t.last_status==="error";return n.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:me("size-2 rounded-full",r?"bg-destructive":a?"bg-emerald-400":"bg-muted-fg/40")}),n.jsx("span",{className:"text-sm font-medium",children:t.name}),n.jsx(Be,{tone:a?"success":"muted",children:u(a?"agents_ui.running":"agents_ui.paused")}),r&&n.jsx(Be,{tone:"danger",children:u("agents_ui.last_error")})]}),n.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-2 text-xs sm:grid-cols-4",children:[n.jsx(Zd,{label:u("agents_ui.field_tick"),value:t.schedule}),n.jsx(Zd,{label:u("agents_ui.field_next_tick"),value:t.next_run_at?new Date(t.next_run_at).toLocaleString():"—"}),n.jsx(Zd,{label:u("agents_ui.field_last_tick"),value:t.last_run_at?new Date(t.last_run_at).toLocaleString():"—"}),n.jsx(Zd,{label:u("agents_ui.field_last_run"),value:t.last_status||"—"})]}),t.last_error&&n.jsx("p",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1 text-[11px] text-destructive",children:t.last_error})]},t.name)})})})}function Zd({label:e,value:t}){return n.jsxs("div",{className:"rounded-md border border-border bg-card p-2",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-fg",children:e}),n.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px]",children:t})]})}function m9({value:e,onChange:t}){const a=$e("/api/tools",()=>qP.list()),r=lb(e),i=a.data||[],l=f=>{const p=new Set(r);p.has(f)?p.delete(f):p.add(f),t([...p].join(", "))},d=r.filter(f=>!i.some(p=>p.name===f));return n.jsxs(ie,{label:u("agents_ui.tools_label"),hint:u("project.agent_detail.tools_hint"),children:[n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i.map(f=>{const p=r.includes(f.name);return n.jsx(Ue,{content:f.description||f.name,children:n.jsx("button",{type:"button",onClick:()=>l(f.name),className:me("rounded-md border px-2 py-0.5 font-mono text-[11px] transition-colors",p?"border-emerald-500/50 bg-emerald-500/10 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:f.name})},f.name)}),d.map(f=>n.jsxs("button",{type:"button",onClick:()=>l(f),className:"rounded-md border border-sky-500/50 bg-sky-500/10 px-2 py-0.5 font-mono text-[11px] text-sky-400",children:[f," ✕"]},f))]}),n.jsx(Ce,{className:"mt-2",value:e,onChange:f=>t(f.target.value),placeholder:u("project.agent_detail.tools_custom_ph")})]})}const g9=new Set(["the","and","for","with","from","into","your","that","this","una","las","los","del","por","con","para","post","posts","demo","week","weekly"]);function Sw(e){return new Set(e.toLowerCase().split(/[^a-záéíóúñ0-9]+/).filter(t=>t.length>3&&!g9.has(t)))}function h9(e,t){for(const a of e)if(t.has(a))return!0;return!1}function x9({slug:e,emoji:t,memory:a,threads:r,tasks:i,routines:l,parent:d,children:f}){const{nodes:p,edges:g}=x.useMemo(()=>{const h=[],b=[],_="__core";h.push({id:_,label:e,kind:"agent",role:"core",emoji:t,relation:"self"});const y=(w,E,R)=>{h.push({id:w,label:E,kind:R,role:"hub",relation:"cluster"}),b.push({source:_,target:w})},S=l9(a),j=r.slice(0,8),k=i.slice(0,8);S.length&&(y("hub-mem",u("agents_ui.kind_memory"),"memory"),S.forEach((w,E)=>{h.push({id:`m${E}`,label:w,kind:"memory",relation:"knows",detail:w}),b.push({source:"hub-mem",target:`m${E}`})})),j.length&&(y("hub-thread",u("agents_ui.kind_thread"),"thread"),j.forEach(w=>{h.push({id:`th-${w.id}`,label:w.label,kind:"thread",relation:"in_thread"}),b.push({source:"hub-thread",target:`th-${w.id}`})})),k.length&&(y("hub-task",u("agents_ui.kind_task"),"task"),k.forEach(w=>{h.push({id:`ts-${w.id}`,label:w.label,kind:"task",relation:"handles_task",detail:w.detail}),b.push({source:"hub-task",target:`ts-${w.id}`})})),l.length&&(y("hub-routine",u("agents_ui.kind_routine"),"routine"),l.forEach(w=>{h.push({id:`rt-${w.name}`,label:w.name,kind:"routine",relation:"ticks",detail:`schedule: ${w.schedule}`}),b.push({source:"hub-routine",target:`rt-${w.name}`})})),f.length&&(y("hub-team",u("agents_ui.kind_hierarchy"),"agentlink"),f.forEach(w=>{h.push({id:`c-${w}`,label:w,kind:"agentlink",role:"hub",relation:"orchestrates",slug:w}),b.push({source:"hub-team",target:`c-${w}`})})),d&&(h.push({id:`p-${d}`,label:d,kind:"agentlink",role:"hub",relation:"reports_to",slug:d}),b.push({source:`p-${d}`,target:_}));const C=j.map(w=>({id:`th-${w.id}`,kw:Sw(w.label)}));return k.forEach(w=>{const E=Sw(w.label),R=C.find(T=>h9(E,T.kw));R&&b.push({source:`ts-${w.id}`,target:R.id})}),{nodes:h,edges:b}},[e,t,a,r,i,l,d,f]);return n.jsx(qe,{title:u("project.agent_detail.brain_title"),description:u("project.agent_detail.brain_desc"),children:p.length<=1?n.jsx("p",{className:"text-xs text-muted-fg",children:u("project.agent_detail.brain_empty")}):n.jsx(ME,{nodes:p,edges:g})})}const b9=["","es","en","pt","fr","it","de"],Cw=e=>e.split(",").map(t=>t.trim()).filter(Boolean);function QE(e){return e.is_master?{gradient:"from-violet-600 to-indigo-600",Icon:va}:{gradient:"from-slate-600 to-gray-600",Icon:rn}}const _9=[{key:"threads",icon:nu,i18n:"agents_ui.stat_threads"},{key:"records",icon:Xf,i18n:"agents_ui.stat_records"},{key:"tasks",icon:xl,i18n:"agents_ui.stat_tasks"},{key:"heartbeats",icon:Do,i18n:"agents_ui.stat_heartbeats"}];function WE({stats:e,className:t}){return e?n.jsx("div",{className:me("flex items-center gap-3 text-[11px] text-muted-fg",t),children:_9.map(({key:a,icon:r,i18n:i})=>n.jsx(Ue,{content:u(i),children:n.jsxs("span",{className:"inline-flex items-center gap-1 tabular-nums",children:[n.jsx(r,{size:12})," ",e[a]]})},a))}):null}function v9(e){const t=new Map;for(const a of e){const r=a.area||null;t.has(r)||t.set(r,[]),t.get(r).push(a)}return[...t.entries()].sort(([a],[r])=>a===null?1:r===null?-1:a.localeCompare(r)).map(([a,r])=>({area:a,agents:r}))}function y9(e){const t=e.filter(d=>d.is_master),a=t.length===1?t[0]:null,r=d=>d.parent?d.parent:a&&!d.is_master&&d.slug!==a.slug?a.slug:null,i=new Map,l=[];for(const d of e){const f=r(d);f&&e.some(p=>p.slug===f)?(i.has(f)||i.set(f,[]),i.get(f).push(d)):l.push(d)}return{roots:l,childrenByParent:i}}function j9({pid:e}){const t=Sn();Xe();const a=$e(`/api/projects/${e}/agents?stats=1`,()=>an.list(e,{stats:!0})),[r,i]=x.useState("hierarchy"),[l,d]=x.useState(!1),[f,p]=x.useState(!1),g=a.data||[],h=S=>t(`/p/${e}/agents/${S}`),b=S=>t(S?`/p/${e}/chat?agent=${S}`:`/p/${e}/chat`),{roots:_,childrenByParent:y}=x.useMemo(()=>y9(g),[g]);return n.jsxs(qe,{title:u("project.agents.title"),description:u("project.agents.subtitle_full"),action:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("div",{className:"flex rounded-lg border border-border p-0.5",children:[n.jsxs("button",{onClick:()=>i("hierarchy"),className:me("flex items-center gap-1 rounded-md px-2 py-1 text-xs",r==="hierarchy"?"bg-accent text-accent-fg":"text-muted-fg"),children:[n.jsx(tu,{size:13})," ",u("project.agents.hierarchy")]}),n.jsxs("button",{onClick:()=>i("list"),className:me("flex items-center gap-1 rounded-md px-2 py-1 text-xs",r==="list"?"bg-accent text-accent-fg":"text-muted-fg"),children:[n.jsx(TM,{size:13})," ",u("project.agents.list_view")]})]}),n.jsxs(ae,{size:"sm",variant:"ghost",onClick:()=>p(!0),children:[n.jsx(NS,{size:13})," ",u("project.agents.import")]}),n.jsxs(ae,{size:"sm",variant:"secondary",onClick:()=>b(),children:[n.jsx(Sa,{size:13})," ",u("project.agents.chat")]}),n.jsxs(ae,{size:"sm",variant:"primary","data-testid":"agent-new",onClick:()=>d(!0),children:[n.jsx(Ot,{size:14})," ",u("project.agents.new")]})]}),children:[a.isLoading&&n.jsx(tt,{}),!a.isLoading&&g.length===0&&n.jsx(ut,{children:u("project.agents.empty_text")}),!a.isLoading&&g.length>0&&(r==="hierarchy"?n.jsx(w9,{roots:_,childrenByParent:y,onOpen:h,onChat:b}):n.jsx(S9,{agents:g,onOpen:h,onChat:b})),n.jsx(C9,{open:l,pid:e,agents:g,onClose:()=>d(!1),onCreated:()=>{d(!1),a.mutate()}}),n.jsx(k9,{open:f,pid:e,existing:g.map(S=>S.slug),onClose:()=>p(!1),onImported:()=>a.mutate()})]})}function k9({open:e,onClose:t,onImported:a,pid:r,existing:i}){const l=Xe(),d=$e(e?"/api/agents/vault":null,()=>an.vault()),[f,p]=x.useState(""),g=d.data||[],h=async b=>{p(b);try{await an.import(r,b),l.success(u("project.agents.import_success",{slug:b})),a()}catch(_){l.error(_.message)}finally{p("")}};return n.jsxs(Bt,{open:e,onClose:t,title:u("project.agents.import_title"),description:u("project.agents.import_desc"),size:"lg",footer:n.jsx(ae,{variant:"ghost",onClick:t,children:u("common.close")}),children:[d.isLoading&&n.jsx(tt,{}),!d.isLoading&&g.length===0&&n.jsx(ut,{children:u("project.agents.import_empty")}),n.jsx("ul",{className:"space-y-2",children:g.map(b=>{const _=i.includes(b.slug);return n.jsxs("li",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted/30 p-3",children:[n.jsx(rn,{size:16,className:"shrink-0 text-muted-fg"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("span",{className:"text-sm font-medium",children:b.slug}),b.is_master&&n.jsxs(Be,{tone:"success",children:[n.jsx(va,{size:9})," ",u("project.agents.orchestrator")]}),b.model&&n.jsx(Be,{tone:"info",children:b.model})]}),b.description&&n.jsx("p",{className:"truncate text-xs text-muted-fg",children:b.description})]}),n.jsx(ae,{size:"sm",variant:"primary",disabled:_||f===b.slug,loading:f===b.slug,onClick:()=>h(b.slug),children:u(_?"project.agents.import_already":"project.agents.import_btn")})]},b.slug)})})]})}function w9({roots:e,childrenByParent:t,onOpen:a,onChat:r}){return n.jsx("div",{className:"space-y-8",children:e.map(i=>{const l=t.get(i.slug)||[],d=v9(l),f=d.some(p=>p.area);return n.jsxs("div",{className:"flex flex-col items-center",children:[n.jsx(Th,{agent:i,onOpen:a,onChat:r,wide:!0}),l.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"h-5 w-px bg-border"}),n.jsx("div",{className:"flex flex-col gap-6 border-t border-border pt-5",children:d.map(p=>n.jsxs("div",{className:"flex flex-col items-center gap-3",children:[f&&n.jsxs("span",{className:"rounded-full border border-border bg-muted/40 px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted-fg",children:[p.area||u("agents_ui.uncategorized")," · ",p.agents.length]}),n.jsx("div",{className:"flex flex-wrap items-start justify-center gap-4",children:p.agents.map(g=>n.jsxs("div",{className:"flex flex-col items-center",children:[n.jsx(Th,{agent:g,onOpen:a,onChat:r}),(t.get(g.slug)||[]).length>0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"h-4 w-px bg-border"}),n.jsx("div",{className:"flex flex-wrap justify-center gap-3 border-t border-border pt-4",children:(t.get(g.slug)||[]).map(h=>n.jsx(Th,{agent:h,onOpen:a,onChat:r,compact:!0},h.slug))})]})]},g.slug))})]},p.area??"__none"))})]})]},i.slug)})})}function Th({agent:e,onOpen:t,onChat:a,wide:r,compact:i}){const{gradient:l,Icon:d}=QE(e);return n.jsxs("div",{"data-testid":`agent-card-${e.slug}`,className:me("cursor-pointer rounded-xl border border-border bg-card p-3 transition-colors hover:border-muted-fg/50",r?"w-64":i?"w-44":"w-52"),onClick:()=>t(e.slug),children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:me("flex size-8 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br",l),children:e.emoji?n.jsx("span",{className:"text-base leading-none",children:e.emoji}):n.jsx(d,{className:"size-4 text-white"})}),n.jsx("span",{className:"truncate text-sm font-semibold",children:e.slug})]}),n.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1",children:[e.is_master&&n.jsxs(Be,{tone:"success",children:[n.jsx(va,{size:9})," ",u("project.agents.orchestrator")]}),e.role&&n.jsx(Be,{children:e.role}),e.model&&!i&&n.jsx(Be,{tone:"info",children:e.model})]}),n.jsx(WE,{stats:e.stats,className:"mt-2"}),n.jsxs("div",{className:"mt-2 flex items-center gap-3 border-t border-border pt-2 text-xs text-muted-fg",onClick:f=>f.stopPropagation(),children:[n.jsxs("button",{onClick:()=>t(e.slug),className:"flex items-center gap-1 hover:text-foreground",children:[n.jsx(Fo,{size:12})," ",u("project.agents.view")]}),n.jsxs("button",{onClick:()=>a(e.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[n.jsx(Sa,{size:12})," ",u("project.agents.chat")]})]})]})}function S9({agents:e,onOpen:t,onChat:a}){const r=[...e].sort((i,l)=>+!!l.is_master-+!!i.is_master||i.slug.localeCompare(l.slug));return n.jsx("div",{className:"space-y-2",children:r.map(i=>{const{gradient:l,Icon:d}=QE(i);return n.jsxs("div",{"data-testid":`agent-card-${i.slug}`,className:"flex cursor-pointer items-center gap-4 rounded-xl border border-border bg-muted/30 p-3 hover:border-muted-fg/50",onClick:()=>t(i.slug),children:[n.jsx("div",{className:me("flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",l),children:i.emoji?n.jsx("span",{className:"text-lg leading-none",children:i.emoji}):n.jsx(d,{className:"size-4 text-white"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("span",{className:"text-sm font-semibold",children:i.slug}),i.is_master&&n.jsxs(Be,{tone:"success",children:[n.jsx(va,{size:10})," ",u("project.agents.orchestrator")]}),i.role&&n.jsx(Be,{children:i.role}),i.model&&n.jsx(Be,{tone:"info",children:i.model}),i.parent&&n.jsxs("span",{className:"text-[10px] text-violet-400",children:["↳ ",i.parent]})]}),i.description&&n.jsx("p",{className:"mt-1 truncate text-xs text-muted-fg",children:i.description}),n.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[i.skills?.map(f=>n.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[n.jsx(sa,{size:9})," ",f]},f)),i.tools?.map(f=>n.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[n.jsx(aa,{size:9})," ",f]},f))]})]}),n.jsx(WE,{stats:i.stats,className:"hidden shrink-0 sm:flex"}),n.jsxs("div",{className:"flex shrink-0 items-center gap-3 text-xs text-muted-fg",onClick:f=>f.stopPropagation(),children:[n.jsxs("button",{onClick:()=>t(i.slug),className:"flex items-center gap-1 hover:text-foreground",children:[n.jsx(Fo,{size:12})," ",u("project.agents.view")]}),n.jsxs("button",{onClick:()=>a(i.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[n.jsx(Sa,{size:12})," ",u("project.agents.chat")]})]})]},i.slug)})})}function C9({open:e,onClose:t,onCreated:a,pid:r,agents:i}){const l=Xe(),[d,f]=x.useState(""),[p,g]=x.useState(""),[h,b]=x.useState(""),[_,y]=x.useState(""),[S,j]=x.useState(""),[k,C]=x.useState(""),[w,E]=x.useState(""),[R,T]=x.useState(""),[A,z]=x.useState(""),[M,D]=x.useState(""),[L,I]=x.useState(""),[P,B]=x.useState(!1),[q,Y]=x.useState(""),[U,V]=x.useState(!1),X=()=>{f(""),g(""),b(""),y(""),j(""),C(""),E(""),T(""),z(""),D(""),I(""),B(!1),Y("")},Q=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(d)){l.error(u("project.agents.slug_invalid"));return}V(!0);try{await an.create(r,{slug:d,emoji:p||void 0,type:h||void 0,role:_||void 0,area:S||void 0,autonomy:k||void 0,model:w||void 0,language:R||void 0,description:A||void 0,skills:Cw(M),tools:Cw(L),is_master:P||h==="orchestrator",parent:q||void 0}),l.success(u("project.agents.create_success",{slug:d})),a(),X()}catch(W){l.error(W?.message||u("project.agents.create_error"))}finally{V(!1)}};return n.jsx(Bt,{open:e,onClose:t,title:u("project.agents.new_title"),description:u("project.agents.new_desc"),size:"lg",footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:t,disabled:U,children:u("common.cancel")}),n.jsx(ae,{variant:"primary","data-testid":"agent-create-submit",onClick:Q,loading:U,children:u("common.create")})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"grid grid-cols-[80px_1fr_1fr] gap-3",children:[n.jsx(ie,{label:u("agents_form.emoji"),children:n.jsx(VE,{value:p,onChange:g})}),n.jsx(ie,{label:u("project.agents.slug_label"),children:n.jsx(Ce,{autoFocus:!0,"data-testid":"agent-slug",value:d,onChange:W=>f(W.target.value),placeholder:u("project.agents.slug_ph")})}),n.jsx(ie,{label:u("project.agent_detail.type_label"),children:n.jsx(ct,{value:h,onChange:b,options:XE()})})]}),n.jsx(GE,{pid:r,area:S,role:_,onArea:j,onRole:y}),n.jsx(ie,{label:u("agents_form.autonomy"),hint:u("agents_form.autonomy_hint"),children:n.jsx(FE,{value:k,onChange:C})}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(ie,{label:u("project.agents.model_label"),hint:u("project.agents.model_hint"),children:n.jsx(Ce,{value:w,onChange:W=>E(W.target.value)})}),n.jsx(ie,{label:u("project.agents.lang_label"),children:n.jsx(ct,{value:R,onChange:T,options:b9.map(W=>({value:W,label:W||"—"}))})})]}),n.jsx(ie,{label:u("project.agents.desc_label"),children:n.jsx(un,{rows:2,value:A,onChange:W=>z(W.target.value),placeholder:u("project.agents.desc_ph")})}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(ie,{label:u("project.agents.skills_label"),children:n.jsx(Ce,{value:M,onChange:W=>D(W.target.value),placeholder:u("project.agents.skills_ph")})}),n.jsx(ie,{label:u("project.agents.tools_label"),children:n.jsx(Ce,{value:L,onChange:W=>I(W.target.value),placeholder:u("project.agents.tools_ph")})})]}),n.jsxs("div",{className:"grid grid-cols-2 items-end gap-3",children:[n.jsx(ie,{label:u("project.agents.parent_label"),hint:u("project.agents.parent_hint"),children:n.jsx(ct,{value:q,onChange:Y,placeholder:u("project.agents.none_parent"),options:[{value:"",label:u("project.agents.none_parent")},...i.filter(W=>W.slug!==d).map(W=>({value:W.slug,label:W.slug}))]})}),n.jsx(Dt,{checked:P,onChange:B,label:u("project.agents.master_label")})]})]})})}const ZE=["sun","mon","tue","wed","thu","fri","sat"];function hu(e){const t=String(e||"").trim().split(/\s+/);return t.length!==5?null:{minute:t[0],hour:t[1],dom:t[2],month:t[3],dow:t[4]}}function Zi(e,t,a){const r=new Set;for(const i of String(e).split(",")){const l=i.match(/^(.+)\/(\d+)$/),d=l?l[1]:i,f=l?Number(l[2]):1;if(!Number.isFinite(f)||f<1)return null;let p,g;if(d==="*")p=t,g=a;else{const h=d.match(/^(\d+)-(\d+)$/);if(h)p=Number(h[1]),g=Number(h[2]);else if(/^\d+$/.test(d))p=Number(d),g=p;else return null}if(p<t||g>a||p>g)return null;for(let h=p;h<=g;h+=f)r.add(h)}return[...r].sort((i,l)=>i-l)}function gv(e){if(e==="*"||e==="?")return[];const t=Zi(e.replace(/\b7\b/g,"0"),0,6);return t&&t.length?t:null}function JE(e,t){const a=hu(e);if(!a||a.month!=="*"||a.dom!=="*"&&a.dow!=="*")return null;const r=a.hour.match(/^\*\/(\d+)$/);if(r&&/^\d+$/.test(a.minute)){const _=Number(r[1]);return _===1?t("cron.every_hour",{minute:Qa(Number(a.minute))}):t("cron.every_n_hours",{n:_,minute:Qa(Number(a.minute))})}const i=a.minute.match(/^\*\/(\d+)$/);if(i&&a.hour==="*")return t("cron.every_n_minutes",{n:Number(i[1])});if(a.minute==="*"&&a.hour==="*")return t("cron.every_minute");const l=Zi(a.hour,0,23),d=Zi(a.minute,0,59);if(!l||!d||d.length!==1)return null;const f=l.length===1?`${Qa(l[0])}:${Qa(d[0])}`:l.map(_=>`${Qa(_)}:${Qa(d[0])}`).join(", ");if(a.dom!=="*"){const _=Zi(a.dom,1,31);return!_||_.length!==1?null:t("cron.monthly",{day:_[0],at:f})}const p=gv(a.dow);if(p===null)return null;if(!p.length)return t("cron.daily",{at:f});const g=[1,2,3,4,5];if(p.length===5&&g.every(_=>p.includes(_)))return t("cron.weekdays",{at:f});if(p.length===2&&p.includes(0)&&p.includes(6))return t("cron.weekends",{at:f});const b=p.map(_=>t(`cron.day_short.${ZE[_]}`)).join(", ");return t("cron.on_days",{days:b,at:f})}function eR(e){const t=hu(e),a={time:"08:00",days:[],everyHours:0};if(!t)return a;const r=t.hour.match(/^\*\/(\d+)$/);if(r)return{time:`00:${Qa(Number(/^\d+$/.test(t.minute)?t.minute:0))}`,days:[],everyHours:Number(r[1])};const i=Zi(t.hour,0,23),l=Zi(t.minute,0,59),d=gv(t.dow);return{time:i?.length&&l?.length?`${Qa(i[0])}:${Qa(l[0])}`:a.time,days:d??[],everyHours:0}}function tR(e){if(e.everyHours>0){const[,i]=Nw(e.time);return`${i} */${cb(e.everyHours,1,23)} * * *`}const[t,a]=Nw(e.time),r=e.days.length&&e.days.length<7?[...e.days].sort((i,l)=>i-l).join(","):"*";return`${a} ${t} * * ${r}`}function Ah(e){const t=hu(e);return!t||t.month!=="*"||t.dom!=="*"?!1:tR(eR(e))===nR(e)}function nR(e){const t=hu(e);if(!t)return String(e||"").trim();const a=gv(t.dow),r=a&&a.length&&a.length<7?a.join(","):"*",i=l=>/^\d+$/.test(l)?String(Number(l)):l;return`${i(t.minute)} ${i(t.hour)} ${t.dom} ${t.month} ${r}`}function Nw(e){const t=/^(\d{1,2}):(\d{2})$/.exec(String(e||"").trim());return t?[String(cb(Number(t[1]),0,23)),String(cb(Number(t[2]),0,59))]:["8","0"]}function Qa(e){return String(e).padStart(2,"0")}function cb(e,t,a){return Math.min(a,Math.max(t,Number.isFinite(e)?e:t))}function Jd(e){return e.split(`
829
+ `).map(t=>t.trim()).filter(Boolean)}function Xc(){return{exec_agent:{label:u("agents_ui.kind_exec_agent"),desc:u("agents_ui.kind_exec_agent_desc"),icon:rn},super_agent:{label:u("agents_ui.kind_super_agent"),desc:u("agents_ui.kind_super_agent_desc"),icon:va},telegram:{label:u("agents_ui.kind_telegram"),desc:u("agents_ui.kind_telegram_desc"),icon:Sa},shell:{label:u("agents_ui.kind_shell"),desc:u("agents_ui.kind_shell_desc"),icon:ya},watch:{label:u("agents_ui.kind_watch"),desc:u("agents_ui.kind_watch_desc"),icon:Fo},heartbeat:{label:u("agents_ui.kind_heartbeat"),desc:u("agents_ui.kind_heartbeat_desc"),icon:Do}}}function N9(e){const t=Xc();return Object.keys(t).filter(a=>a!=="heartbeat"||e==="heartbeat").map(a=>({value:a,label:t[a].label,description:t[a].desc,icon:t[a].icon}))}function hv(e){if(!e)return"—";if(e.startsWith("every:")){const a=e.slice(6),r=a.match(/^(\d+)(s|m|h|d)$/);if(r){const i=r[1],l={s:u("agents_ui.unit_seconds"),m:u("agents_ui.unit_minutes"),h:u("agents_ui.unit_hours"),d:u("agents_ui.unit_days")}[r[2]]||r[2];return u("agents_ui.every_n_unit",{n:i,unit:l})}return u("agents_ui.every_v",{v:a})}if(e.startsWith("once:"))return`once · ${new Date(e.slice(5)).toLocaleString()}`;if(e.trim().toLowerCase()==="manual")return u("agents_ui.sched_manual");const t=e.replace(/^cron\s+/i,"");return JE(t,u)||t}function E9(){return[{label:u("agents_ui.preset_every_10m"),value:"every:10m"},{label:u("agents_ui.preset_hourly"),value:"every:1h"},{label:u("agents_ui.preset_daily_9am"),value:"0 9 * * *"},{label:u("agents_ui.preset_weekdays_9am"),value:"0 9 * * 1-5"}]}function sR(){return[{v:"{{pre_output}}",where:"prompt",desc:u("agents_ui.var_pre_output_prompt")},{v:"$APX_LLM_OUTPUT",where:"post",desc:u("agents_ui.var_llm_output")},{v:"$APX_STATUS",where:"post",desc:u("agents_ui.var_status")},{v:"$APX_SKIPPED",where:"post",desc:u("agents_ui.var_skipped")},{v:"$APX_PRE_OUTPUT",where:"post",desc:u("agents_ui.var_pre_output")},{v:"$APX_PRE_OUTPUT_FILE",where:"post",desc:u("agents_ui.var_pre_output_file")},{v:"$APX_PRE_EXIT",where:"post",desc:u("agents_ui.var_pre_exit")},{v:"$APX_ROUTINE",where:"pre/post",desc:u("agents_ui.var_routine")}]}function jc(e){return sR().filter(t=>e==="pre"?t.where.includes("pre"):e==="prompt"?t.where==="prompt":t.where==="post"||t.where==="pre/post")}function R9({routines:e,selectedName:t,onSelect:a}){return n.jsxs("aside",{className:"flex h-full min-h-0 flex-col border-r border-border",children:[n.jsx("div",{className:"shrink-0 px-3 py-2.5 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:u("project.routines.list_title")}),n.jsx("ul",{className:"min-h-0 flex-1 space-y-1 overflow-y-auto p-2 pt-0",children:e.map(r=>{const i=Xc()[r.kind],l=i?.icon||xl,d=r.name===t;return n.jsx("li",{children:n.jsxs("button",{type:"button",onClick:()=>a(r.name),"aria-current":d,className:me("w-full rounded-lg border px-2.5 py-2 text-left transition-colors",d?"border-primary/50 bg-primary/10":"border-transparent hover:border-border hover:bg-accent/40"),children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:me("flex size-6 shrink-0 items-center justify-center rounded-md",r.enabled?"bg-emerald-500/15 text-emerald-400":"bg-muted text-muted-fg"),children:n.jsx(l,{size:13})}),n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:r.name}),!r.enabled&&n.jsx("span",{className:"shrink-0 text-[10px] text-muted-fg",children:u("project.routines.paused")}),n.jsx(mu,{ok:r.last_status==="ok"?!0:r.last_status==="error"?!1:null})]}),n.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2 pl-8 text-[10px] text-muted-fg",children:[n.jsx("span",{className:"truncate",children:i?.label||r.kind}),n.jsxs("span",{className:"shrink-0",children:["⏱ ",hv(r.schedule)]})]})]})},r.name)})})]})}const ub=6e4,db=60*ub,Ew=24*db;function Rw(e,t,a=Date.now()){const r=Date.parse(e);if(!Number.isFinite(r))return"—";const i=r-a,l=i>=0,d=Math.abs(i);if(d<ub)return t("when.now");const[f,p]=d<db?[Math.round(d/ub),"minutes"]:d<Ew?[Math.round(d/db),"hours"]:[Math.round(d/Ew),"days"],g=t(`when.${p}`,{n:f});return l?t("when.in",{amount:g}):t("when.ago",{amount:g})}function T9({title:e,body:t,mono:a}){return n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:e}),n.jsx("div",{className:me("max-h-44 overflow-auto whitespace-pre-wrap break-words rounded-lg border border-border bg-muted/20 px-3 py-2 text-xs",a&&"font-mono"),children:t.trim()?t:n.jsx("span",{className:"text-muted-fg",children:u("project.routines.block_empty")})})]})}function aR(e){const t=e.meta||{};return t.skipped?"skipped":t.status==="error"?"error":"ok"}function rR(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function oR({st:e}){return e==="ok"?n.jsx(Xr,{size:13,className:"shrink-0 text-emerald-500"}):e==="error"?n.jsx(gs,{size:13,className:"shrink-0 text-destructive"}):n.jsx(GA,{size:13,className:"shrink-0 text-amber-500"})}function iR(e){return u(e==="ok"?"project.routines.status_ok":e==="error"?"project.routines.status_error":"project.routines.status_skipped")}function Mh({title:e,children:t}){return n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-fg",children:e}),t]})}const zh="whitespace-pre-wrap break-words rounded-lg border border-border bg-muted/20 px-3 py-2 font-mono text-[11px]";function A9({m:e,onClose:t}){const a=aR(e),r=e.meta||{},i=r.result||{},l=r.flow||null,d=String(i.reply??i.text??i.stdout??""),f=String(i.error??i.stderr??""),p=String(i.note??""),g=n.jsx("span",{className:"text-muted-fg",children:u("project.routines.block_empty")});return n.jsxs("div",{className:"flex min-h-0 flex-col border-l border-border",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 px-4 py-2",children:[n.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[n.jsx(oR,{st:a}),n.jsx("span",{className:me("font-medium",a==="ok"&&"text-emerald-500",a==="error"&&"text-destructive",a==="skipped"&&"text-amber-500"),children:iR(a)}),n.jsx("span",{className:"font-mono text-muted-fg",children:rR(e.ts)})]}),n.jsx("button",{type:"button",onClick:t,"aria-label":u("project.routines.runs_close"),className:"rounded-md p-1 text-muted-fg hover:bg-muted hover:text-foreground",children:n.jsx(gs,{size:14})})]}),n.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto px-4 pb-4 text-xs",children:[e.body&&n.jsx("div",{className:"text-muted-fg",children:e.body}),l?.pre&&n.jsx(Mh,{title:u("project.routines.block_pre"),children:l.pre.output?.trim()?n.jsx("pre",{className:zh,children:l.pre.output}):g}),n.jsx(Mh,{title:u("project.routines.runs_output"),children:d?n.jsx("pre",{className:zh,children:d}):f?n.jsx("pre",{className:"whitespace-pre-wrap break-words rounded-lg bg-destructive/10 px-3 py-2 font-mono text-[11px] text-destructive",children:f}):p?n.jsx("div",{className:"text-muted-fg",children:p}):g}),l?.post&&l.post.length>0&&n.jsx(Mh,{title:u("project.routines.block_post"),children:n.jsx("div",{className:"space-y-1.5",children:l.post.map((h,b)=>n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-mono text-[10px] text-muted-fg",children:["$ ",h.cmd," ",n.jsxs("span",{className:"opacity-70",children:["· exit ",h.exit]})]}),(h.stdout||h.stderr)&&n.jsx("pre",{className:zh,children:h.stdout||h.stderr})]},b))})})]})]})}function M9({pid:e,name:t,running:a}){const r=$e(`/api/projects/${e}/routines/${t}/runs`,async()=>(await Mf.project(e,{channel:"routine",limit:200})).filter(g=>g.meta?.routine===t&&(g.actor_id==="apx:routine"||g.type==="system"))),i=(r.data||[]).slice(0,50),[l,d]=x.useState(null),f=l&&i.find(p=>p.ts===l)||null;return n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col border-t border-border",children:[n.jsx("div",{className:"shrink-0 px-4 pb-1.5 pt-3 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:u("project.routines.runs_title")}),n.jsxs("div",{className:me("grid min-h-0 flex-1 overflow-hidden",f?"grid-cols-[minmax(0,1fr)_minmax(0,1.1fr)]":"grid-cols-1"),children:[n.jsxs("div",{className:"min-h-0 overflow-y-auto px-4 pb-4",children:[r.isLoading&&n.jsx(tt,{}),!r.isLoading&&i.length===0&&n.jsx("div",{className:"text-xs text-muted-fg",children:u("project.routines.runs_empty")}),n.jsxs("ul",{className:"space-y-1",children:[a&&n.jsx("li",{children:n.jsxs("div",{className:"flex w-full items-center gap-2 rounded-md border border-primary/40 bg-primary/5 px-3 py-1.5 text-xs",children:[n.jsx(bn,{size:12}),n.jsx("span",{className:"text-muted-fg",children:u("project.routines.running")})]})}),i.map((p,g)=>{const h=aR(p),b=l===p.ts;return n.jsx("li",{children:n.jsxs("button",{type:"button",onClick:()=>d(b?null:p.ts),"aria-current":b,className:me("flex w-full items-center gap-2 rounded-md border px-3 py-1.5 text-left text-xs transition-colors",b?"border-primary/50 bg-primary/10":"border-border bg-muted/30 hover:border-muted-fg/40"),children:[n.jsx(oR,{st:h}),n.jsx("span",{className:"font-mono text-muted-fg",children:rR(p.ts)}),n.jsx("span",{className:me("font-medium",h==="ok"&&"text-emerald-500",h==="error"&&"text-destructive",h==="skipped"&&"text-amber-500"),children:iR(h)})]})},`${p.ts}-${g}`)})]})]}),f&&n.jsx(A9,{m:f,onClose:()=>d(null)})]})]})}function z9({pid:e,routine:t,onEdit:a,onRun:r,onToggle:i,onDelete:l,running:d}){const f=Xc()[t.kind],p=f?.icon||xl,g=t.spec||{},h=t.pre_commands||[],b=t.post_commands||[],_=[];return h.length&&_.push({title:u("project.routines.block_pre"),body:h.join(`
830
+ `),mono:!0}),t.kind==="exec_agent"||t.kind==="super_agent"||t.kind==="watch"?_.push({title:u("project.routines.block_prompt"),body:String(g.prompt||"")}):t.kind==="telegram"?_.push({title:u("project.routines.block_text"),body:String(g.text||"")}):t.kind==="shell"?_.push({title:u("project.routines.block_command"),body:String(g.command||""),mono:!0}):t.kind==="heartbeat"&&_.push({title:u("project.routines.block_text"),body:String(g.message||"")}),b.length&&_.push({title:u("project.routines.block_post"),body:b.join(`
831
+ `),mono:!0}),n.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[n.jsxs("div",{className:"min-h-0 shrink space-y-4 overflow-y-auto p-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx("span",{className:me("flex size-7 shrink-0 items-center justify-center rounded-lg",t.enabled?"bg-emerald-500/15 text-emerald-400":"bg-muted text-muted-fg"),children:n.jsx(p,{size:14})}),n.jsx("h3",{className:"truncate text-base font-semibold",children:t.name}),n.jsx(Be,{tone:t.kind==="shell"?"warning":"info",children:f?.label||t.kind})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(Dt,{checked:t.enabled,onChange:i}),n.jsx(Ue,{content:u("common.run"),children:n.jsx(ae,{size:"sm",variant:"secondary",onClick:r,loading:d,children:n.jsx(Ib,{size:13})})}),n.jsx(Ue,{content:u("project.routines.edit_hint"),children:n.jsxs(ae,{size:"sm",variant:"secondary",onClick:a,children:[n.jsx(wa,{size:13})," ",u("project.routines.edit_btn")]})}),n.jsx(Ue,{content:u("common.delete"),children:n.jsx(ae,{size:"sm",variant:"destructive",onClick:l,children:n.jsx(_n,{size:13})})})]})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-fg",children:[n.jsxs("span",{title:t.schedule,children:["⏱ ",hv(t.schedule)]}),t.next_run_at&&n.jsxs("span",{title:new Date(t.next_run_at).toLocaleString(),children:[u("project.routines.next_run")," ",Rw(t.next_run_at,u)]}),t.last_run_at&&n.jsxs("span",{title:new Date(t.last_run_at).toLocaleString(),children:[u("project.routines.last_run")," ",Rw(t.last_run_at,u)]}),n.jsxs("span",{className:me(t.last_status==="ok"&&"text-emerald-500",t.last_status==="error"&&"text-destructive"),children:[u("agents_ui.last_label")," ",t.last_status||"—"]})]}),t.last_error&&n.jsx("div",{className:"rounded-md bg-destructive/10 px-2 py-1 text-xs text-destructive",children:t.last_error}),n.jsx("div",{className:"space-y-3",children:_.map(y=>n.jsx(T9,{title:y.title,body:y.body,mono:y.mono},y.title))})]}),n.jsx(M9,{pid:e,name:t.name,running:d})]})}function O9({expr:e,className:t}){const a=JE(e,u);return n.jsxs("span",{className:me("inline-flex items-center gap-1.5",t),title:e,children:[n.jsx(Rb,{size:12,className:"shrink-0 opacity-60"}),a?n.jsx("span",{children:a}):n.jsx("code",{className:"font-mono text-[11px]",children:e})]})}function lR({value:e,onChange:t,disabled:a,allowEveryHours:r=!0}){const i=x.useMemo(()=>Ah(e),[e]),[l,d]=x.useState(!i),[f,p]=x.useState(e),g=x.useMemo(()=>eR(e),[e]);x.useEffect(()=>{p(e),Ah(e)||d(!0)},[e]);const h=y=>t(tR({...g,...y})),b=y=>{const S=g.days.includes(y)?g.days.filter(j=>j!==y):[...g.days,y];h({days:S})},_=y=>h({days:y});return n.jsxs("div",{className:"flex flex-col gap-2","data-testid":"cron-picker",children:[l?n.jsx("input",{value:f,disabled:a,onChange:y=>p(y.target.value),onBlur:()=>t(f.trim()),onKeyDown:y=>{y.key==="Enter"&&t(f.trim())},placeholder:"30 8 * * 1-5",className:"w-full rounded-lg border border-border bg-muted/30 px-2.5 py-1.5 font-mono text-sm outline-none focus:border-primary/60","data-testid":"cron-raw"}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("input",{type:"time",value:g.everyHours>0?"00:00":g.time,disabled:a||g.everyHours>0,onChange:y=>h({time:y.target.value,everyHours:0}),className:"rounded-lg border border-border bg-muted/30 px-2.5 py-1.5 text-sm outline-none focus:border-primary/60 disabled:opacity-50","data-testid":"cron-time"}),r?n.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-muted-fg",children:[n.jsx("input",{type:"checkbox",checked:g.everyHours>0,disabled:a,onChange:y=>h({everyHours:y.target.checked?2:0}),className:"size-3.5 accent-[var(--primary)]"}),u("cron.every_label")]}):null,g.everyHours>0?n.jsx("input",{type:"number",min:1,max:23,value:g.everyHours,disabled:a,onChange:y=>h({everyHours:Number(y.target.value)}),className:"w-16 rounded-lg border border-border bg-muted/30 px-2 py-1.5 text-sm outline-none focus:border-primary/60","aria-label":u("cron.every_label")}):null]}),g.everyHours===0?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex flex-wrap gap-1","data-testid":"cron-days",children:ZE.map((y,S)=>{const j=g.days.length===0||g.days.includes(S);return n.jsx("button",{type:"button",disabled:a,"aria-pressed":g.days.includes(S),onClick:()=>b(S),className:me("min-w-9 rounded-md border px-2 py-1 text-[11px] font-medium transition-colors",g.days.includes(S)?"border-primary bg-primary/15 text-foreground":j?"border-border bg-muted/40 text-muted-fg":"border-border text-muted-fg/60 hover:bg-muted/40"),children:u(`cron.day_short.${y}`)},y)})}),n.jsx("div",{className:"flex flex-wrap gap-1 text-[11px]",children:[["cron.preset_every_day",[]],["cron.preset_weekdays",[1,2,3,4,5]],["cron.preset_weekends",[0,6]]].map(([y,S])=>n.jsx("button",{type:"button",disabled:a,onClick:()=>_([...S]),className:"rounded-md px-1.5 py-0.5 text-muted-fg underline-offset-2 hover:text-foreground hover:underline",children:u(y)},y))})]}):null]}),n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx(O9,{expr:l?f:e,className:"text-[11px] text-muted-fg"}),n.jsxs("button",{type:"button",disabled:a,onClick:()=>{if(l){const y=f.trim();t(y),Ah(y)&&d(!1)}else p(nR(e)),d(!0)},className:"inline-flex shrink-0 items-center gap-1 text-[11px] text-muted-fg hover:text-foreground","data-testid":"cron-toggle-raw",children:[n.jsx(mS,{size:11})," ",u(l?"cron.use_picker":"cron.use_cron")]})]})]})}function $i({label:e,hint:t,value:a,onChange:r,vars:i,rows:l=3,mono:d,placeholder:f}){const p=x.useRef(null),g=h=>{const b=p.current?.querySelector("textarea");if(!b){r(a?`${a}${h}`:h);return}const _=b.selectionStart??a.length,y=b.selectionEnd??a.length,S=a.slice(0,_)+h+a.slice(y);r(S),requestAnimationFrame(()=>{b.focus();const j=_+h.length;b.setSelectionRange(j,j)})};return n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:e}),t&&n.jsx("div",{className:"text-[11px] text-muted-foreground/70",children:t}),n.jsxs("div",{ref:p,className:"space-y-1.5",children:[n.jsx(un,{rows:l,className:me(d&&"font-mono text-xs"),value:a,onChange:h=>r(h.target.value),placeholder:f}),i.length>0&&n.jsx("div",{className:"flex flex-wrap gap-1",children:i.map(h=>n.jsx("button",{type:"button",onClick:()=>g(h.v),className:"inline-flex items-center rounded-md border border-border bg-card px-1.5 py-0.5 font-mono text-[10px] text-muted-fg transition-colors hover:border-muted-fg/50 hover:text-foreground",children:h.v},h.v))})]})]})}function D9(){return n.jsxs("div",{className:"rounded-lg border border-border bg-muted/10 p-3",children:[n.jsx("div",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:u("project.routines.vars_title")}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:sR().map(e=>n.jsx(Ue,{content:n.jsx("span",{className:"block max-w-[240px] whitespace-normal leading-snug",children:e.desc}),children:n.jsxs("span",{className:"inline-flex cursor-help items-center gap-1 rounded-md border border-border bg-card px-1.5 py-0.5 font-mono text-[10px]",children:[e.v,n.jsxs("span",{className:"not-italic text-muted-fg",children:["· ",e.where]})]})},e.v))})]})}function P9({draft:e,onClose:t,onSaved:a,pid:r}){const i=Xe(),l=$e(e?`/api/projects/${r}/agents`:null,()=>an.list(r)),[d,f]=x.useState(!1),[p,g]=x.useState(""),[h,b]=x.useState("super_agent"),[_,y]=x.useState("every:10m"),[S,j]=x.useState(!0),[k,C]=x.useState(""),[w,E]=x.useState(""),[R,T]=x.useState("default"),[A,z]=x.useState(""),[M,D]=x.useState(""),[L,I]=x.useState(""),[P,B]=x.useState("heartbeat"),[q,Y]=x.useState(""),[U,V]=x.useState(""),[X,Q]=x.useState(""),W=$e(e&&h==="telegram"?"/api/telegram/channels":null,()=>Pn.channels.list());x.useEffect(()=>{if(!e)return;const le=e.spec&&typeof e.spec=="object"?e.spec:{};g(e.name||""),b(e.kind||"super_agent"),y(e.schedule||"every:10m"),j(e.enabled??!0),C(le.agent||""),E(le.prompt||""),T(le.channel||"default"),z(le.chat_id?String(le.chat_id):""),D(le.text||""),I(le.command||""),B(le.channel||"heartbeat"),Y(le.message||""),V((e.pre_commands||[]).join(`
832
+ `)),Q((e.post_commands||[]).join(`
833
+ `))},[e]);const $=h==="exec_agent"||h==="super_agent"||h==="telegram"||h==="watch",K=()=>{switch(h){case"exec_agent":return{agent:k,prompt:w};case"super_agent":return{prompt:w};case"watch":return{prompt:w};case"telegram":return{channel:R,...A?{chat_id:A}:{},text:M};case"shell":return{command:L};case"heartbeat":return{channel:P,message:q}}},J=async()=>{if(!p){i.error(u("project.routines.name_required"));return}f(!0);try{await Ur.upsert(r,{name:p,kind:h,schedule:_,enabled:S,spec:K(),pre_commands:$?Jd(U):[],post_commands:$?Jd(X):[]}),i.success(u("project.routines.saved")),a()}catch(le){i.error(le?.message||u("project.routines.save_error"))}finally{f(!1)}},G=(()=>{const le=W.data?.channels||[],be=["default",...le.map(Re=>Re.name)];R&&!be.includes(R)&&be.push(R);const ke=new Set;return be.filter(Re=>ke.has(Re)?!1:(ke.add(Re),!0)).map(Re=>{const Ae=le.find(Oe=>Oe.name===Re),Ie=Ae?.project?`proyecto ${Ae.project}`:Ae?.chat_id?`chat ${Ae.chat_id}`:void 0;return{value:Re,label:Re,description:Ie}})})(),te=$?Jd(U):[],se=$?Jd(X):[],pe=(()=>{switch(h){case"exec_agent":return k?u("agents_ui.action_agent_answers",{agent:k}):u("agents_ui.action_agent_pick_answers");case"super_agent":return u("agents_ui.action_super_answers");case"watch":return u("agents_ui.action_watch");case"telegram":return u("agents_ui.action_telegram_channel",{channel:R});case"shell":return L?u("agents_ui.summary_runs_cmd",{cmd:L.slice(0,48)}):u("agents_ui.action_runs_shell");case"heartbeat":return u("agents_ui.summary_heartbeat")}})(),F=h==="telegram"?M:h==="shell"?L:h==="heartbeat"?q:w,oe=Xc()[h].icon,_e=[...te.map((le,be)=>({id:`pre-${be}`,icon:ya,label:u("agents_ui.step_pre"),detail:le,action:!1})),{id:"action",icon:oe,label:pe,detail:F?F.slice(0,90):u("project.routines.block_empty"),action:!0},...se.map((le,be)=>({id:`post-${be}`,icon:ya,label:u("agents_ui.step_post"),detail:le,action:!1}))];return n.jsx(Bt,{open:!!e,onClose:t,title:e?.name?u("project.routines.edit_title",{name:e.name}):u("project.routines.new_title"),description:u("project.routines.dialog_desc"),size:"xl",footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:t,disabled:d,children:u("common.cancel")}),n.jsx(ae,{variant:"primary",onClick:J,loading:d,children:u("common.save")})]}),children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 px-3 py-2",children:[n.jsx(Dt,{checked:S,onChange:j,label:u("project.routines.enabled_label")}),n.jsx("span",{className:"text-[11px] text-muted-fg",children:u(S?"project.routines.enabled_hint":"project.routines.disabled_hint")})]}),n.jsx(ie,{label:u("project.routines.name_field"),hint:e?.name?u("project.routines.name_no_edit"):void 0,children:n.jsx(Ce,{value:p,disabled:!!e?.name,onChange:le=>g(le.target.value),placeholder:"resumen-diario"})}),n.jsx(ie,{label:u("project.routines.kind_field"),children:n.jsx(ct,{value:h,onChange:le=>b(le),options:N9(h)})}),n.jsx("p",{className:"-mt-1 text-[11px] text-muted-fg",children:Xc()[h].desc}),h==="exec_agent"&&n.jsx(ie,{label:u("project.routines.agent_field"),hint:u("project.routines.agent_hint"),children:n.jsx(ct,{value:k,onChange:C,placeholder:l.isLoading?u("project.routines.agent_loading"):u("project.routines.agent_pick"),options:(l.data||[]).map(le=>({value:le.slug,label:le.slug,description:[le.role,le.model].filter(Boolean).join(" · ")||void 0}))})}),n.jsx(ie,{label:u("project.routines.schedule_field"),hint:u("project.routines.schedule_hint"),children:n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex flex-wrap gap-1",children:[E9().map(le=>n.jsx("button",{type:"button",onClick:()=>y(le.value),className:me("rounded-md border px-2 py-0.5 text-[11px]",_===le.value?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:le.label},le.value)),n.jsx("button",{type:"button",onClick:()=>y("manual"),className:me("rounded-md border px-2 py-0.5 text-[11px]",_==="manual"?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:u("agents_ui.preset_manual")})]}),hu(_.replace(/^cron\s+/i,""))?n.jsx(lR,{value:_.replace(/^cron\s+/i,""),onChange:y}):n.jsx(Ce,{value:_,onChange:le=>y(le.target.value),placeholder:"every:10m · 0 9 * * 1-5 · once:ISO · manual"})]})}),n.jsx(D9,{})]}),n.jsxs("div",{className:"space-y-3",children:[$&&n.jsx($i,{label:u("project.routines.pre_field"),hint:u("project.routines.pre_hint"),rows:2,mono:!0,value:U,onChange:V,vars:jc("pre"),placeholder:"curl -s https://wttr.in/Bariloche"}),h==="exec_agent"&&n.jsx($i,{label:u("project.routines.prompt_exec"),rows:4,value:w,onChange:E,vars:jc("prompt"),placeholder:u("project.routines.prompt_exec_ph")}),h==="super_agent"&&n.jsx($i,{label:u("project.routines.prompt_super"),rows:4,value:w,onChange:E,vars:jc("prompt"),placeholder:u("project.routines.prompt_super_ph")}),h==="telegram"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(ie,{label:u("project.routines.tg_channel"),children:n.jsx(ct,{value:R,onChange:T,options:G})}),n.jsx(ie,{label:u("project.routines.tg_chat_id"),children:n.jsx(Ce,{value:A,onChange:le=>z(le.target.value),placeholder:u("agents_ui.tg_chat_id_ph")})})]}),n.jsx($i,{label:u("project.routines.tg_text"),hint:u("project.routines.tg_text_hint"),rows:6,value:M,onChange:D,vars:jc("prompt"),placeholder:u("agents_ui.tg_text_ph")})]}),h==="shell"&&n.jsx($i,{label:u("project.routines.shell_field"),hint:u("project.routines.shell_hint"),rows:11,mono:!0,value:L,onChange:I,vars:[],placeholder:"cd /repo && git pull && npm test"}),h==="heartbeat"&&n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(ie,{label:u("project.routines.hb_channel"),children:n.jsx(Ce,{value:P,onChange:le=>B(le.target.value),placeholder:"heartbeat"})}),n.jsx(ie,{label:u("project.routines.hb_message"),children:n.jsx(Ce,{value:q,onChange:le=>Y(le.target.value),placeholder:u("agents_ui.hb_message_ph")})})]}),$&&n.jsx($i,{label:u("project.routines.post_field"),hint:u("project.routines.post_hint"),rows:2,mono:!0,value:X,onChange:Q,vars:jc("post"),placeholder:'apx telegram send "$APX_LLM_OUTPUT"'})]})]}),n.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[n.jsxs("div",{className:"mb-2 text-xs font-semibold text-muted-fg",children:[u("project.routines.what_happens")," ",n.jsxs("span",{className:"font-normal text-muted-fg",children:["· ⏱ ",hv(_)]})]}),n.jsx("div",{className:"flex flex-wrap items-stretch gap-2",children:_e.map((le,be)=>n.jsxs("div",{className:"flex items-stretch gap-2",children:[n.jsxs("div",{className:me("flex max-w-[240px] flex-col gap-1 rounded-lg border px-2.5 py-2",le.action?"border-emerald-500/40 bg-emerald-500/5":"border-border bg-card"),children:[n.jsxs("div",{className:me("flex items-center gap-1.5 text-[11px] font-medium",le.action?"text-emerald-400":"text-muted-fg"),children:[n.jsx(le.icon,{size:12})," ",le.label]}),le.detail&&n.jsx("div",{className:"line-clamp-2 font-mono text-[10px] text-muted-fg",children:le.detail})]}),be<_e.length-1&&n.jsx(fS,{size:14,className:"shrink-0 self-center text-muted-fg"})]},le.id))})]})]})})}function L9({pid:e}){const t=Xe(),a=$e(`/api/projects/${e}/routines`,()=>Ur.list(e)),[r,i]=Vo(),[l,d]=x.useState(null),[f,p]=x.useState(null),[g,h]=x.useState(!1),[b,_]=x.useState(null),[y,S]=x.useState(null),j=a.data||[],k=r.get("r_id"),C=j.find(A=>A.name===k)||null,w=A=>i(z=>{const M=new URLSearchParams(z);return A?M.set("r_id",A):M.delete("r_id"),M},{replace:!0});x.useEffect(()=>{j.length!==0&&(k&&j.some(A=>A.name===k)||w(j[0].name))},[j,k]);const E=async A=>{try{await(A.enabled?Ur.disable:Ur.enable)(e,A.name),a.mutate()}catch(z){t.error(z?.message||u("project.routines.toggle_error"))}},R=async()=>{if(!b)return;const A=b;_(null),S(A.name);try{await Ur.run(e,A.name),t.success(u("project.routines.run_success",{name:A.name})),await Promise.all([a.mutate(),Tf(`/api/projects/${e}/routines/${A.name}/runs`)])}catch(z){t.error(z?.message||u("project.routines.run_error"))}finally{S(null)}},T=async()=>{if(f){h(!0);try{await Ur.remove(e,f.name),t.success(u("project.routines.delete_success")),k===f.name&&w(null),p(null),a.mutate()}catch(A){t.error(A?.message||u("project.routines.delete_error"))}finally{h(!1)}}};return n.jsxs(qe,{fullHeight:!0,title:u("project.routines.title"),description:u("project.routines.subtitle"),action:n.jsxs(ae,{size:"sm",variant:"primary",onClick:()=>d({kind:"super_agent",schedule:"every:10m",enabled:!0}),children:[n.jsx(Ot,{size:14})," ",u("project.routines.new_btn")]}),children:[a.isLoading&&n.jsx(tt,{}),!a.isLoading&&j.length===0&&n.jsx(ut,{children:u("project.routines.empty")}),j.length>0&&n.jsxs("div",{className:"grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)] grid-cols-[minmax(200px,260px)_1fr] overflow-hidden rounded-lg border border-border",children:[n.jsx(R9,{routines:j,selectedName:C?.name??null,onSelect:w}),n.jsx("div",{className:"min-h-0 min-w-0 overflow-hidden",children:C?n.jsx(z9,{pid:e,routine:C,onEdit:()=>d({...C}),onRun:()=>_(C),onToggle:()=>E(C),onDelete:()=>p(C),running:y===C.name},C.name):n.jsx("div",{className:"flex h-full items-center justify-center p-8",children:n.jsx("p",{className:"text-sm text-muted-fg",children:u("project.routines.detail_empty")})})})]}),n.jsx(P9,{draft:l,onClose:()=>d(null),onSaved:()=>{d(null),a.mutate()},pid:e}),n.jsx(Bt,{open:!!f,onClose:()=>g?null:p(null),title:u("project.routines.delete_confirm",{name:f?.name||""}),size:"sm",footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:()=>p(null),disabled:g,children:u("common.cancel")}),n.jsx(ae,{variant:"destructive",onClick:T,loading:g,children:u("common.delete")})]}),children:n.jsx("p",{className:"text-sm text-muted-fg",children:u("project.routines.delete_confirm_body")})}),n.jsx(Bt,{open:!!b,onClose:()=>_(null),title:u("project.routines.run_confirm",{name:b?.name||""}),size:"sm",footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:()=>_(null),children:u("common.cancel")}),n.jsx(ae,{variant:"primary",onClick:R,children:u("common.run")})]}),children:n.jsx("p",{className:"text-sm text-muted-fg",children:u("project.routines.run_confirm_body")})})]})}function Eo({label:e,children:t}){return n.jsxs("div",{className:"flex items-baseline justify-between gap-3 text-xs",children:[n.jsx("span",{className:"text-muted-foreground",children:e}),n.jsx("span",{className:"text-right font-mono text-foreground/90",children:t})]})}function I9({pid:e,taskId:t,onClose:a,onChanged:r}){const i=Xe(),l=Sn(),{data:d,isLoading:f,mutate:p}=$e(`/api/projects/${e}/tasks/${t}`,()=>qn.get(e,t)),[g,h]=x.useState(""),[b,_]=x.useState(!1);x.useEffect(()=>{h(d?.body??"")},[d?.id,d?.body]);const y=()=>{p(),r()},S=async w=>{_(!0);try{await w(),y()}catch(E){i.error(E instanceof Error?E.message:String(E))}finally{_(!1)}};if(f)return n.jsx("div",{className:"flex w-80 items-center justify-center border-l border-border",children:n.jsx(bn,{})});if(!d)return null;const j=If(d),k=d.state==="open",C=g!==(d.body??"");return n.jsxs("div",{className:"flex w-80 shrink-0 flex-col border-l border-border bg-card/40","data-testid":"task-detail",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border px-4 py-2.5",children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:u("tasks.detail_title")}),n.jsx("button",{type:"button",onClick:a,"aria-label":u("common.close"),className:"text-muted-foreground hover:text-foreground",children:n.jsx(gs,{className:"size-4"})})]}),n.jsxs("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto px-4 py-4",children:[n.jsxs("div",{children:[n.jsx("div",{className:"mb-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:u("tasks.field_title")}),n.jsx("div",{className:"text-sm font-semibold",children:d.title})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(cv,{status:j}),n.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:d.id})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:u("tasks.field_prompt")}),C&&n.jsxs("button",{type:"button",onClick:()=>S(async()=>{await qn.patch(e,d.id,{body:g}),i.success(u("common.saved"))}),className:"flex items-center gap-1 text-[10px] text-emerald-500 hover:text-emerald-400",children:[n.jsx(tp,{className:"size-3"}),u("files.save")]})]}),n.jsx(un,{rows:4,value:g,onChange:w=>h(w.target.value),placeholder:u("tasks.prompt_ph"),className:"text-xs"})]}),k&&n.jsxs("div",{children:[n.jsx("div",{className:"mb-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:u("tasks.field_status")}),n.jsx(ct,{value:d.status??"pending",onChange:w=>S(()=>qn.status(e,d.id,w)),options:SE.map(w=>({value:w,label:lv(w)}))})]}),n.jsxs("div",{className:"space-y-1.5 rounded-lg border border-border bg-background/40 p-2.5",children:[d.agent&&n.jsxs(Eo,{label:u("tasks.field_agent"),children:["@",d.agent]}),d.created_by&&n.jsx(Eo,{label:u("tasks.field_creator"),children:d.created_by}),d.source&&n.jsx(Eo,{label:u("tasks.field_source"),children:d.source}),d.due&&n.jsx(Eo,{label:u("project.tasks.due"),children:d.due}),n.jsx(Eo,{label:u("tasks.field_created"),children:new Date(d.created_at).toLocaleString()}),n.jsx(Eo,{label:u("tasks.field_updated"),children:new Date(d.updated_at).toLocaleString()}),d.done_at&&n.jsx(Eo,{label:u("tasks.field_done"),children:new Date(d.done_at).toLocaleString()})]}),d.thread&&n.jsxs("button",{type:"button",onClick:()=>l(`/p/${e}/chat?thread=${d.thread}`),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-sky-500/30 bg-sky-500/5 px-3 py-2 text-xs text-sky-500 hover:bg-sky-500/10",children:[n.jsx(Ab,{className:"size-3.5"}),u("tasks.view_thread")]})]}),n.jsx("div",{className:"flex shrink-0 gap-2 border-t border-border px-4 py-3",children:k?n.jsxs(n.Fragment,{children:[n.jsxs(ae,{size:"sm",variant:"primary",className:"flex-1",loading:b,onClick:()=>S(()=>qn.done(e,d.id)),children:[n.jsx(Xr,{size:13}),u("tasks.mark_done")]}),n.jsx(ae,{size:"sm",variant:"destructive",loading:b,onClick:()=>S(()=>qn.drop(e,d.id)),"aria-label":u("project.tasks.aria_drop"),children:n.jsx(_n,{size:13})})]}):n.jsxs(ae,{size:"sm",variant:"secondary",className:"flex-1",loading:b,onClick:()=>S(()=>qn.reopen(e,d.id)),children:[n.jsx(hl,{size:13}),u("project.tasks.reopen")]})})]})}function $9({pid:e}){const[t,a]=x.useState("open"),[r,i]=Vo(),l=r.get("task"),d=Xe(),f=Mp({key:`/api/projects/${e}/tasks?state=${t}`,fetchPage:(E,R)=>qn.listPage(e,{state:t,limit:E,offset:R}),resetKey:t,swr:{dedupingInterval:0,revalidateOnFocus:!0}}),[p,g]=x.useState(""),[h,b]=x.useState(""),[_,y]=x.useState(!1),[S,j]=x.useState(!1),k=E=>{const R=new URLSearchParams(r);E?R.set("task",E):R.delete("task"),i(R,{replace:!0})},C=async()=>{if(p.trim()){j(!0);try{await qn.add(e,{title:p.trim(),body:h.trim()||null,source:"web"}),g(""),b(""),y(!1),d.success(u("project.tasks.created")),f.mutate()}catch(E){d.error(E?.message||u("project.tasks.create_error"))}finally{j(!1)}}},w=async(E,R)=>{try{await E(),d.success(R),f.mutate()}catch(T){d.error(T?.message||u("common.error_generic"))}};return n.jsxs(qe,{fullHeight:!0,title:u("project.tasks.title"),description:u("project.tasks.subtitle"),action:n.jsx("div",{className:"flex gap-1",children:["open","done","dropped"].map(E=>n.jsx(ae,{size:"sm","data-testid":`task-filter-${E}`,variant:t===E?"primary":"ghost",onClick:()=>a(E),children:u(`tasks.state_${E}`)},E))}),children:[n.jsxs("div",{className:"mb-4 shrink-0 space-y-2",children:[n.jsxs("div",{className:"flex items-end gap-2",children:[n.jsx(ie,{label:u("project.tasks.add_label"),children:n.jsx(Ce,{"data-testid":"task-input",placeholder:u("project.tasks.add_placeholder"),value:p,onChange:E=>g(E.target.value),onKeyDown:E=>{E.key==="Enter"&&!_&&C()}})}),n.jsxs(ae,{variant:"ghost",size:"sm",onClick:()=>y(E=>!E),"aria-label":u("tasks.toggle_prompt"),children:[_?n.jsx(Eb,{size:14}):n.jsx(ms,{size:14})," ",u("tasks.field_prompt")]}),n.jsxs(ae,{variant:"primary","data-testid":"task-add",onClick:C,loading:S,children:[n.jsx(Ot,{size:14})," ",u("project.tasks.add")]})]}),_&&n.jsx(un,{rows:3,value:h,onChange:E=>b(E.target.value),placeholder:u("tasks.prompt_ph"),className:"text-xs"})]}),n.jsxs("div",{className:"flex min-h-0 flex-1 gap-4",children:[n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[f.isLoading&&n.jsx(tt,{}),!f.isLoading&&f.total===0&&n.jsxs(ut,{children:[t==="open"?u("project.tasks.empty_open"):u("project.tasks.empty",{state:t})," ",n.jsx("code",{children:'apx task add "…"'})]}),n.jsx(zp,{paged:f,fullHeight:!0,children:n.jsx("ul",{className:"space-y-2 text-sm","data-testid":"task-list",children:f.items.map(E=>{const R=If(E);return n.jsxs("li",{"data-testid":`task-${E.id}`,onClick:()=>k(E.id),className:`flex cursor-pointer items-start gap-3 rounded-md border px-3 py-2 hover:border-muted-fg/50 ${l===E.id?"border-primary/50 bg-primary/5":"border-border bg-muted/30"}`,children:[n.jsx($f,{status:R,className:"mt-0.5 shrink-0"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate font-medium",children:E.title}),n.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[E.state==="open"&&n.jsx(cv,{status:R}),E.tags?.map(T=>n.jsxs(Be,{children:["#",T]},T)),E.agent&&n.jsxs(Be,{tone:"info",children:["@",E.agent]}),E.due&&n.jsxs("span",{children:[u("project.tasks.due")," ",E.due]})]})]}),n.jsx("div",{className:"flex shrink-0 gap-1",onClick:T=>T.stopPropagation(),children:E.state==="open"?n.jsxs(n.Fragment,{children:[n.jsx(ae,{size:"sm",variant:"secondary","aria-label":u("project.tasks.aria_done"),"data-testid":`task-done-${E.id}`,onClick:()=>w(()=>qn.done(e,E.id),u("project.tasks.done")),children:n.jsx(Xr,{size:13})}),n.jsx(ae,{size:"sm",variant:"destructive","aria-label":u("project.tasks.aria_drop"),"data-testid":`task-drop-${E.id}`,onClick:()=>w(()=>qn.drop(e,E.id),u("project.tasks.drop")),children:n.jsx(_n,{size:13})})]}):n.jsx(ae,{size:"sm",variant:"ghost","aria-label":u("project.tasks.aria_reopen"),"data-testid":`task-reopen-${E.id}`,onClick:()=>w(()=>qn.reopen(e,E.id),u("project.tasks.reopen")),children:n.jsx(hl,{size:13})})})]},E.id)})})})]}),l&&n.jsx(I9,{pid:e,taskId:l,onClose:()=>k(null),onChanged:()=>f.mutate()})]})]})}const B9="\\$\\{var\\.([^}\\s]+)\\}";function cR(e="g"){return new RegExp(B9,e)}function uR(e){return cR("").test(e)}function U9(e){const t=[];let a=0;for(const r of e.matchAll(cR("g"))){const i=r.index??0;i>a&&t.push({type:"text",value:e.slice(a,i)}),t.push({type:"var",value:r[1]}),a=i+r[0].length}return a<e.length&&t.push({type:"text",value:e.slice(a)}),t}function Oh(e){let t="";for(const a of Array.from(e.childNodes))if(a.nodeType===Node.TEXT_NODE)t+=a.textContent??"";else if(a instanceof HTMLElement){const r=a.dataset.varName;r?t+=`\${var.${r}}`:a.tagName==="BR"?t+="":t+=a.textContent??""}return t.replace(/[\u200B-\u200F\u202A-\u202E\u2060\uFEFF]/g,"").replace(/\u00A0/g," ")}function Tw(e,t){e.replaceChildren();const a=U9(t);for(const r of a)r.type==="text"?e.appendChild(document.createTextNode(r.value)):e.appendChild(dR(r.value));(a.length===0||a[a.length-1].type==="var")&&e.appendChild(document.createTextNode(""))}function dR(e){const t=document.createElement("span");return t.contentEditable="false",t.dataset.varName=e,t.className="inline-flex items-baseline px-1 rounded bg-primary/10 text-primary font-mono text-[12px] select-none cursor-default whitespace-nowrap",t.textContent=`$${e}`,t.title=`\${var.${e}}`,t}function q9(e,t){e.deleteContents(),e.insertNode(t),e.setStartAfter(t),e.collapse(!0);const a=window.getSelection();a?.removeAllRanges(),a?.addRange(e)}function H9(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!1);const a=window.getSelection();a?.removeAllRanges(),a?.addRange(t)}const xv=x.forwardRef(function({value:t,onChange:a,placeholder:r,className:i,varNames:l=[],onCreateVar:d},f){const p=x.useRef(null),g=x.useRef(null),h=x.useRef(null),[b,_]=x.useState(!1),[y,S]=x.useState(""),j=x.useRef(t);x.useEffect(()=>{const A=p.current;A&&(t===j.current&&A.childNodes.length>0||(Tw(A,t),j.current=t))},[t]);const k=x.useCallback(()=>{const A=p.current;if(!A)return;const z=Oh(A);j.current=z,z!==t&&a(z)},[a,t]),C=x.useCallback(()=>{const A=p.current;if(!A)return;const z=Oh(A);if(uR(z)&&F9(A)){const M=G9(A);Tw(A,z),M!=null&&Y9(A,M)}j.current=Oh(A),j.current!==t&&a(j.current)},[a,t]),w=x.useCallback(()=>{const A=window.getSelection();if(!A||A.rangeCount===0)return;const z=A.getRangeAt(0),M=p.current;M&&M.contains(z.startContainer)&&(h.current=z.cloneRange())},[]),E=x.useCallback(A=>{if(A.key==="Enter"){A.preventDefault(),A.currentTarget.blur();return}if(A.key==="Backspace"){const z=window.getSelection();if(!z||z.rangeCount===0)return;const M=z.getRangeAt(0);if(!M.collapsed)return;const{startContainer:D,startOffset:L}=M;if(D.nodeType===Node.TEXT_NODE&&L===0){const I=D.previousSibling;if(I instanceof HTMLElement&&I.dataset.varName){A.preventDefault(),I.remove(),k();return}}else if(D===p.current){const I=D.childNodes[L-1];if(I instanceof HTMLElement&&I.dataset.varName){A.preventDefault(),I.remove(),k();return}}}},[k]),R=x.useCallback(A=>{const z=p.current;if(!z)return;const M=h.current;z.focus();let D;M&&z.contains(M.startContainer)?D=M:(D=document.createRange(),D.selectNodeContents(z),D.collapse(!1)),q9(D,dR(A)),h.current=null,k()},[k]);x.useImperativeHandle(f,()=>({insertVar:R,focus:()=>p.current?.focus()}),[R]);const T=l.filter(A=>A.toLowerCase().includes(y.toLowerCase()));return n.jsxs("div",{className:me("group flex items-stretch w-full min-w-0 rounded-lg border border-input bg-transparent dark:bg-input/30 transition-colors","focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50",i),children:[n.jsxs("div",{className:"relative flex-1 min-w-0",children:[n.jsx("div",{ref:p,role:"textbox",contentEditable:!0,suppressContentEditableWarning:!0,onInput:C,onKeyDown:E,onBlur:k,onFocus:w,onMouseUp:w,onKeyUp:w,className:me("h-8 w-full whitespace-nowrap overflow-x-auto px-2.5 py-1 text-sm rounded-l-lg","focus:outline-none font-mono leading-7","[&_*]:align-baseline"),"data-placeholder":r||"",style:{caretColor:"currentColor"}}),t===""&&r&&n.jsx("span",{className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 select-none text-sm text-muted-foreground font-mono",children:r})]}),n.jsxs("div",{ref:g,className:"relative flex",children:[n.jsx(Ue,{content:u("chat_ui.insert_variable"),children:n.jsx("button",{type:"button",onMouseDown:A=>{A.preventDefault(),w()},onClick:()=>_(A=>!A),"aria-label":u("chat_ui.insert_variable"),className:me("flex items-center justify-center px-2 min-w-8 border-l border-input text-muted-foreground rounded-r-lg","hover:bg-muted/60 hover:text-foreground transition-colors",b&&"bg-muted/60 text-foreground"),children:n.jsx(Ot,{size:14})})}),b&&n.jsx(V9,{anchorRef:g,query:y,onQuery:S,varNames:T,onPick:A=>{R(A),_(!1),S("")},onClose:()=>{_(!1),S("")},onCreateVar:d})]})]})});function V9({anchorRef:e,query:t,onQuery:a,varNames:r,onPick:i,onClose:l,onCreateVar:d}){const f=x.useRef(null),p=x.useRef(null),[g,h]=x.useState(null),b=x.useCallback(()=>{const _=e.current;if(!_)return;const y=_.getBoundingClientRect(),S=256,j=4,k=8,C=window.innerWidth-S-k,w=Math.max(k,Math.min(y.right-S,C)),E=y.bottom+j,R=f.current?.offsetHeight??260,T=E+R<=window.innerHeight-k?E:Math.max(k,y.top-R-j);h({left:w,top:T,width:S})},[e]);return x.useLayoutEffect(()=>{b()},[b,t,r.length]),x.useEffect(()=>(b(),window.addEventListener("resize",b),window.addEventListener("scroll",b,!0),()=>{window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0)}),[b]),x.useEffect(()=>{p.current?.focus({preventScroll:!0})},[]),x.useEffect(()=>{function _(y){const S=y.target;f.current?.contains(S)||e.current?.contains(S)||l()}return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[e,l]),g?Gs.createPortal(n.jsxs("div",{ref:f,style:g,className:"fixed z-[1000] rounded-md border border-border bg-popover shadow-lg",children:[n.jsx("div",{className:"border-b border-border p-2",children:n.jsx("input",{ref:p,value:t,onChange:_=>a(_.target.value),placeholder:u("shared_ui.search_variable_ph"),className:"w-full rounded bg-muted/40 px-2 py-1 text-xs font-mono outline-none"})}),n.jsxs("ul",{className:"max-h-44 overflow-auto p-1 text-xs",children:[r.length===0&&n.jsx("li",{className:"px-2 py-1.5 text-muted-foreground",children:u("shared_ui.no_matches")}),r.map(_=>n.jsx("li",{children:n.jsx("button",{type:"button",onMouseDown:y=>y.preventDefault(),onClick:()=>i(_),className:"block w-full rounded px-2 py-1.5 text-left font-mono hover:bg-muted/60",children:_})},_))]}),d&&n.jsx("div",{className:"border-t border-border p-1",children:n.jsxs("button",{type:"button",onMouseDown:_=>_.preventDefault(),onClick:()=>{d(),l()},className:"flex w-full items-center gap-1 rounded px-2 py-1.5 text-left text-xs hover:bg-muted/60",children:[n.jsx(Ot,{size:12})," ",u("shared_ui.create_variable")]})})]}),document.body):null}function F9(e){for(const t of Array.from(e.childNodes))if(t.nodeType===Node.TEXT_NODE&&uR(t.textContent??""))return!0;return!1}function G9(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const a=t.getRangeAt(0);if(!e.contains(a.startContainer))return null;const r=a.cloneRange();return r.selectNodeContents(e),r.setEnd(a.startContainer,a.startOffset),r.toString().length}function Y9(e,t){const a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=t,i=a.nextNode();for(;i;){const l=(i.textContent??"").length;if(r<=l){const d=document.createRange();d.setStart(i,r),d.collapse(!0);const f=window.getSelection();f?.removeAllRanges(),f?.addRange(d);return}r-=l,i=a.nextNode()}H9(e)}function Aw(e){return e?Object.entries(e).map(([t,a])=>({key:t,value:String(a)})):[]}function Mw(e){const t={};for(const a of e)a.key.trim()&&(t[a.key.trim()]=a.value);return t}function zw({rows:e,onChange:t,keyPlaceholder:a=u("shared_ui.kv_key_ph"),valuePlaceholder:r=u("shared_ui.kv_value_ph"),varNames:i,onCreateVar:l,emptyLabel:d}){const f=(h,b)=>{const _=e.slice();_[h]={..._[h],...b},t(_)},p=h=>t(e.filter((b,_)=>_!==h)),g=()=>t([...e,{key:"",value:""}]);return n.jsxs("div",{className:"space-y-2",children:[e.length===0&&d&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:d}),e.map((h,b)=>n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(Ce,{value:h.key,onChange:_=>f(b,{key:_.target.value}),placeholder:a,className:"w-40 font-mono text-xs"}),n.jsx("div",{className:"flex-1",children:n.jsx(xv,{value:h.value,onChange:_=>f(b,{value:_}),placeholder:r,varNames:i,onCreateVar:l})}),n.jsx(ae,{type:"button",size:"sm",variant:"ghost",onClick:()=>p(b),"aria-label":u("shared_ui.remove_row"),children:n.jsx(_n,{size:13})})]},b)),n.jsxs(ae,{type:"button",size:"sm",variant:"ghost",onClick:g,children:[n.jsx(Ot,{size:12})," ",u("shared_ui.add_row")]})]})}function K9(e){const t=e.raw||{};if(typeof t.description=="string"&&t.description.trim())return t.description.trim();if(e.transport==="http"&&e.url)return e.url.length>64?e.url.slice(0,61)+"…":e.url;const a=[e.command,...e.args||[]].filter(Boolean).join(" ");return a?"$ "+(a.length>64?a.slice(0,61)+"…":a):""}function X9(e,t){return t?.busy?"bg-amber-400 animate-pulse":t?.ok===!1?"bg-red-400":t?.ok?"bg-emerald-400":e?"bg-emerald-500/70":"bg-slate-500"}const Q9={apc:"info",runtime:"success",global:"muted"};function fb(e){return e==="runtime"?"runtime":e==="global"?"global":"shared"}function Dh(e){return e==="runtime"?u("project.mcps.source_runtime"):e==="apc"?u("project.mcps.source_apc"):e==="claude"?u("project.mcps.source_claude"):e==="codex"?u("project.mcps.source_codex"):e==="cursor"?u("project.mcps.source_cursor"):e==="vscode"?u("project.mcps.source_vscode"):e==="roo"?u("project.mcps.source_roo"):e==="gemini"?u("project.mcps.source_gemini"):e==="global"?u("project.mcps.scope_global"):e}function W9({pid:e}){const t=Xe(),a=$e(`/api/projects/${e}/mcps`,()=>qr.list(e)),r=$e(`/api/projects/${e}/mcps/check`,()=>qr.check(e)),i=$e(`/api/projects/${e}/vars`,()=>Gc.list(e)),[l,d]=x.useState(null),[f,p]=x.useState(null),[g,h]=x.useState({}),[b,_]=x.useState({}),y=x.useMemo(()=>i.data?Object.keys(i.data.effective).sort():[],[i.data]),S=async(C,w)=>{if(confirm(u("project.mcps.delete_confirm",{name:C,scope:w})))try{await qr.remove(e,C,w),t.success(u("project.mcps.removed")),a.mutate(),f===C&&p(null)}catch(E){t.error(E?.message||u("common.error_generic"))}},j=async C=>{try{await qr.add(e,fb(C.source),{name:C.name,enabled:!C.enabled}),a.mutate()}catch(w){t.error(w?.message||u("common.error_generic"))}},k=async C=>{p(C),h(w=>({...w,[C]:{busy:!0}})),_(w=>({...w,[C]:!0}));try{const w=await qr.test(e,C);h(E=>({...E,[C]:{ok:w.ok,error:w.error,tools:w.tools}}))}catch(w){h(E=>({...E,[C]:{ok:!1,error:w?.message||"error"}}))}};return n.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-4",children:[n.jsx("div",{className:"lg:col-span-3",children:n.jsxs(qe,{title:u("project.mcps.title"),description:u("project.mcps.subtitle"),action:n.jsxs(ae,{size:"sm",variant:"primary",onClick:()=>d({kind:"new"}),children:[n.jsx(Ot,{size:14})," ",u("project.mcps.new")]}),children:[r.data?.conflicts?.length?n.jsxs("div",{className:"mb-3 rounded-md border border-amber-500/40 bg-amber-500/10 p-2 text-xs",children:[n.jsx("div",{className:"font-medium",children:u("project.mcps.conflicts",{names:r.data.conflicts.map(C=>C.name).join(", ")})}),n.jsx("ul",{className:"mt-1 space-y-1 text-muted-fg",children:r.data.conflicts.map(C=>n.jsxs("li",{className:"flex gap-2",children:[n.jsx("span",{"aria-hidden":"true",children:"•"}),n.jsx("span",{children:u("project.mcps.conflict_detail",{name:C.name,winner:Dh(C.winner),loser:Dh(C.loser)})})]},`${C.name}-${C.winner}-${C.loser}`))})]}):null,a.isLoading&&n.jsx(tt,{}),!a.isLoading&&(a.data?.length??0)===0&&n.jsx(ut,{children:u("project.mcps.empty")}),n.jsx("ul",{className:"space-y-2 text-sm",children:(a.data||[]).map(C=>{const w=C.source==="apc"||C.source==="runtime"||C.source==="global",E=fb(C.source),R=f===C.name,T=C.enabled!==!1,A=g[C.name],z=A?.tools||[],M=!!b[C.name],D=K9(C),L=C.transport==="http"?vS:DM;return n.jsx("li",{className:"rounded-md border px-3 py-2 transition-colors "+(R?"border-primary/50 bg-primary/5":"border-border bg-muted/30 hover:bg-muted/50"),onClick:()=>p(C.name),role:"button",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsxs("div",{className:"relative mt-0.5 flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-lg border border-border bg-background",children:[n.jsx(L,{size:16,className:"text-muted-fg"}),n.jsx("span",{className:me("absolute -bottom-0.5 -right-0.5 h-2.5 w-2.5 rounded-full border-2 border-card",X9(T,A))})]}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("span",{className:"font-medium",children:C.name}),n.jsx(Be,{tone:Q9[C.source]??"muted",children:Dh(C.source)}),n.jsx("span",{className:"ml-auto text-xs text-muted-fg",children:(C.transport||"stdio").toUpperCase()}),n.jsx("div",{onClick:I=>I.stopPropagation(),children:n.jsx(Dt,{checked:T,onChange:()=>j(C),label:""})}),n.jsx(Ue,{content:u("project.mcps.test_btn"),children:n.jsx(ae,{size:"sm",variant:"ghost",onClick:I=>{I.stopPropagation(),k(C.name)},"aria-label":u("project.mcps.test_btn"),children:A?.busy?n.jsx(_x,{size:13,className:"animate-pulse"}):n.jsx(_x,{size:13})})}),n.jsx(Ue,{content:u("project.mcps.logs_btn"),children:n.jsx(ae,{size:"sm",variant:"ghost",onClick:I=>{I.stopPropagation(),p(C.name)},"aria-label":u("project.mcps.logs_btn"),children:n.jsx($b,{size:13})})}),w&&n.jsx(Ue,{content:u("project.mcps.edit_btn"),children:n.jsx(ae,{size:"sm",variant:"ghost",onClick:I=>{I.stopPropagation(),d({kind:"edit",entry:C})},"aria-label":u("project.mcps.edit_btn"),children:n.jsx(wa,{size:13})})}),w&&n.jsx(ae,{size:"sm",variant:"destructive",onClick:I=>{I.stopPropagation(),S(C.name,E)},children:n.jsx(_n,{size:13})})]}),D&&n.jsx("p",{className:"mt-0.5 truncate font-mono text-xs text-muted-fg",children:D}),A?.ok===!1&&A.error&&n.jsxs("p",{className:"mt-1 flex items-start gap-1 text-xs text-red-400",children:[n.jsx(pS,{size:12,className:"mt-0.5 flex-shrink-0"})," ",n.jsx("span",{className:"break-words",children:A.error})]}),z.length>0&&n.jsxs("div",{className:"mt-1.5",onClick:I=>I.stopPropagation(),children:[n.jsxs("button",{type:"button",onClick:()=>_(I=>({...I,[C.name]:!I[C.name]})),className:"flex items-center gap-1 text-xs text-muted-fg transition-colors hover:text-fg",children:[n.jsx(aa,{size:12})," ",u("project.mcps.tools_count",{n:z.length}),n.jsx(ms,{size:12,className:me("transition-transform",M&&"rotate-180")})]}),M&&n.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[z.slice(0,40).map(I=>n.jsx(Ue,{content:I.description||"—",children:n.jsxs("span",{className:"inline-flex items-center gap-1 rounded border border-border bg-background px-1.5 py-0.5 font-mono text-[10px] text-muted-fg",children:[n.jsx(ya,{size:10})," ",I.name]})},I.name)),z.length>40&&n.jsxs("span",{className:"text-[10px] text-muted-fg",children:["… +",z.length-40]})]})]})]})]})},`${C.source}-${C.name}`)})}),l&&n.jsx(J9,{mode:l,pid:e,varNames:y,onClose:()=>d(null),onSaved:()=>{d(null),a.mutate()},onVarsChanged:()=>i.mutate()})]})}),n.jsx("div",{className:"lg:col-span-1",children:n.jsx(Z9,{pid:e,mcpName:f,runningTest:!!(f&&g[f]?.busy)})})]})}function Z9({pid:e,mcpName:t,runningTest:a}){const[r,i]=x.useState(null),[l,d]=x.useState(null),f=x.useRef(null);x.useEffect(()=>{if(!t){i(null),d(null);return}f.current!==t&&(i(null),d(null),f.current=t);let g=!1;const h=async()=>{try{const y=await qr.logs(e,t);g||(i(y),d(null))}catch(y){g||d(y?.message||"error")}};h();const _=setInterval(h,a?1200:4e3);return()=>{g=!0,clearInterval(_)}},[e,t,a]);const p=x.useRef(null);return x.useEffect(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[r?.events?.length,r?.stderr_tail]),n.jsxs("div",{className:"sticky top-3 flex h-[calc(100vh-7rem)] min-h-[24rem] flex-col rounded-xl border border-border bg-card",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2 text-xs",children:[n.jsx(ya,{size:13,className:"text-muted-fg"}),n.jsx("span",{className:"font-medium",children:u("project.mcps.logs_panel_title")}),t?n.jsx(Be,{tone:"info",children:t}):n.jsxs("span",{className:"text-muted-fg",children:["— ",u("project.mcps.logs_panel_pick")]})]}),n.jsxs("div",{ref:p,className:"flex-1 overflow-auto bg-background/60 px-3 py-2 font-mono text-[11px]",children:[!t&&n.jsx("p",{className:"text-muted-fg",children:u("project.mcps.logs_panel_hint")}),t&&l&&n.jsx("p",{className:"text-red-400",children:l}),t&&!l&&r&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mb-2 text-muted-fg",children:[r.transport.toUpperCase(),r.url?` · ${r.url}`:r.command?` · ${r.command}`:"",r.last_error?` · last_error: ${r.last_error}`:""]}),r.note&&n.jsx("p",{className:"text-muted-fg",children:r.note}),(!r.events||r.events.length===0)&&!r.stderr_tail&&!r.note&&n.jsx("p",{className:"text-muted-fg",children:u("project.mcps.logs_panel_idle")}),r.events?.map((g,h)=>n.jsxs("div",{className:"flex gap-2",children:[n.jsx("span",{className:"text-muted-fg",children:g.ts.slice(11,19)}),n.jsx("span",{className:g.level==="error"?"text-red-400":g.level==="stderr"?"text-amber-400":"text-emerald-400",children:g.level}),n.jsx("span",{className:"flex-1 break-all",children:g.msg})]},h)),r.stderr_tail&&n.jsxs("div",{className:"mt-2 border-t border-border/60 pt-2",children:[n.jsx("div",{className:"mb-1 text-muted-fg",children:"stderr"}),n.jsx("pre",{className:"whitespace-pre-wrap break-all text-amber-300/80",children:r.stderr_tail})]})]})]})]})}function J9({mode:e,pid:t,varNames:a,onClose:r,onSaved:i,onVarsChanged:l}){const d=Xe(),f=e.kind==="edit",p=f?e.entry:null,[g,h]=x.useState(!1),[b,_]=x.useState(p?fb(p.source):"runtime"),[y,S]=x.useState(p?.name||""),[j,k]=x.useState(p?.transport==="http"||p?.url?"http":"stdio"),[C,w]=x.useState(p?.command||""),[E,R]=x.useState(p?.args&&p.args.length?p.args:[""]),[T,A]=x.useState(Aw(p?.env)),[z,M]=x.useState(p?.url||""),[D,L]=x.useState(Aw(p?.headers)),[I,P]=x.useState(p?.enabled!==!1),[B,q]=x.useState(!1),Y=async()=>{if(!y.trim()){d.error(u("project.mcps.name_required"));return}h(!0);try{const U=E.map(X=>X.trim()).filter(Boolean),V=j==="stdio"?{name:y.trim(),command:C.trim(),args:U.length?U:void 0,env:T.length?Mw(T):void 0,enabled:I}:{name:y.trim(),url:z.trim(),headers:D.length?Mw(D):void 0,enabled:I};await qr.add(t,b,V),d.success(u(f?"project.mcps.updated":"project.mcps.added")),i()}catch(U){d.error(U?.message||u("common.error_generic"))}finally{h(!1)}};return n.jsxs(n.Fragment,{children:[n.jsx(Bt,{open:!0,onClose:()=>g?null:r(),title:u(f?"project.mcps.edit_title":"project.mcps.new_title"),description:f?p?.name:u("project.mcps.new_desc"),size:"lg",footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:r,disabled:g,children:u("common.cancel")}),n.jsx(ae,{variant:"primary",onClick:Y,loading:g,children:u(f?"project.mcps.save_btn":"project.mcps.add_btn")})]}),children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(ie,{label:u("project.mcps.scope_label"),children:n.jsx(ct,{value:b,onChange:U=>_(U),options:[{value:"runtime",label:u("project.mcps.scope_runtime"),description:u("project.mcps.scope_runtime_desc")},{value:"shared",label:u("project.mcps.scope_shared"),description:u("project.mcps.scope_shared_desc")},{value:"global",label:u("project.mcps.scope_global"),description:u("project.mcps.scope_global_desc")}]})}),n.jsx(ie,{label:u("project.mcps.transport_label"),children:n.jsx(ct,{value:j,onChange:U=>k(U),options:[{value:"stdio",label:u("project.mcps.transport_stdio"),description:u("project.mcps.transport_stdio_desc")},{value:"http",label:u("project.mcps.transport_http"),description:u("project.mcps.transport_http_desc")}]})})]}),n.jsx(ie,{label:u("project.mcps.name_label"),children:n.jsx(Ce,{value:y,onChange:U=>S(U.target.value),placeholder:u("project.mcps.name_ph"),disabled:f})}),j==="stdio"?n.jsxs(n.Fragment,{children:[n.jsx(ie,{label:u("project.mcps.cmd_label"),children:n.jsx(Ce,{value:C,onChange:U=>w(U.target.value),placeholder:u("project.mcps.cmd_ph")})}),n.jsx(ie,{label:u("project.mcps.args_label"),hint:u("project.mcps.args_hint_tokens"),children:n.jsx(e$,{args:E,onChange:R,varNames:a,onCreateVar:()=>q(!0)})}),n.jsx(ie,{label:u("project.mcps.env_label"),hint:u("project.mcps.env_hint_tokens"),children:n.jsx(zw,{rows:T,onChange:A,keyPlaceholder:"API_KEY",valuePlaceholder:"${var.MY_TOKEN}",varNames:a,onCreateVar:()=>q(!0),emptyLabel:u("project.mcps.env_empty")})})]}):n.jsxs(n.Fragment,{children:[n.jsx(ie,{label:u("project.mcps.url_label"),children:n.jsx(xv,{value:z,onChange:M,placeholder:u("project.mcps.url_ph"),varNames:a,onCreateVar:()=>q(!0)})}),n.jsx(ie,{label:u("project.mcps.headers_label"),hint:u("project.mcps.headers_hint"),children:n.jsx(zw,{rows:D,onChange:L,keyPlaceholder:"Authorization",valuePlaceholder:"Bearer ${var.TOKEN}",varNames:a,onCreateVar:()=>q(!0),emptyLabel:u("project.mcps.headers_empty")})})]}),n.jsx(Dt,{checked:I,onChange:P,label:u("project.mcps.enabled_label")})]})}),B&&n.jsx(t$,{pid:t,onClose:()=>q(!1),onCreated:()=>{q(!1),l()}})]})}function e$({args:e,onChange:t,varNames:a,onCreateVar:r}){const i=(f,p)=>{const g=e.slice();g[f]=p,t(g)},l=f=>t(e.filter((p,g)=>g!==f)),d=()=>t([...e,""]);return n.jsxs("div",{className:"space-y-2",children:[e.map((f,p)=>n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("div",{className:"flex-1",children:n.jsx(xv,{value:f,onChange:g=>i(p,g),placeholder:u("agents_ui.arg_placeholder"),varNames:a,onCreateVar:r})}),n.jsx(ae,{type:"button",size:"sm",variant:"ghost",onClick:()=>l(p),"aria-label":u("agents_ui.remove_arg"),children:n.jsx(_n,{size:13})})]},p)),n.jsxs(ae,{type:"button",size:"sm",variant:"ghost",onClick:d,children:[n.jsx(Ot,{size:12})," ",u("project.mcps.add_arg")]})]})}function t$({pid:e,onClose:t,onCreated:a}){const r=Xe(),i=String(e)==="0",[l,d]=x.useState(""),[f,p]=x.useState(""),[g,h]=x.useState(!1),[b,_]=x.useState(i?"global":"project"),y=async()=>{if(!l.trim()){r.error(u("project.vars.name_required"));return}if(!f){r.error(u("project.vars.value_required"));return}h(!0);try{await Gc.upsert(e,{name:l.trim(),value:f,scope:b}),r.success(u("project.vars.added")),a()}catch(S){r.error(S?.message||u("common.error_generic"))}finally{h(!1)}};return n.jsx(Bt,{open:!0,onClose:()=>g?null:t(),title:u("project.vars.new_title"),description:u("project.vars.new_desc"),size:"sm",footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:t,disabled:g,children:u("common.cancel")}),n.jsx(ae,{variant:"primary",onClick:y,loading:g,children:u("project.vars.add_btn")})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(ie,{label:u("project.vars.scope_label"),children:n.jsx(ct,{value:b,onChange:S=>_(S),options:[...i?[]:[{value:"project",label:u("project.vars.scope_project"),description:u("project.vars.scope_project_desc")}],{value:"global",label:u("project.vars.scope_global"),description:u("project.vars.scope_global_desc")}]})}),n.jsx(ie,{label:u("project.vars.name_label"),hint:u("project.vars.name_hint"),children:n.jsx(Ce,{value:l,onChange:S=>d(S.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",autoFocus:!0})}),n.jsx(ie,{label:u("project.vars.value_label"),hint:u("project.vars.value_hint"),children:n.jsx(Ce,{type:"password",value:f,onChange:S=>p(S.target.value),className:"font-mono text-xs"})})]})})}function fR({icon:e,title:t,description:a,badges:r,rightContent:i,hasTools:l,expanded:d,onToggle:f,children:p}){return n.jsxs("div",{className:"overflow-hidden rounded-xl border border-border bg-card",children:[n.jsxs("button",{type:"button",className:"flex w-full items-center gap-4 p-4 text-left transition-colors hover:bg-muted/40",onClick:f,children:[e,n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("p",{className:"text-sm font-semibold text-foreground",children:t}),r,l&&n.jsx(Ue,{content:"Esta integración expone tools para los agentes",children:n.jsx("span",{children:n.jsx(aa,{className:"h-3 w-3 text-muted-foreground"})})})]}),n.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:a})]}),n.jsxs("div",{className:"flex flex-shrink-0 items-center gap-2",children:[i,n.jsx(eo,{className:me("h-4 w-4 text-muted-foreground transition-transform",d&&"rotate-90")})]})]}),d&&p&&n.jsx("div",{className:"border-t border-border",children:p})]})}function n$({tools:e,isActive:t}){return t?n.jsxs("div",{className:"space-y-2.5 rounded-xl border border-border bg-muted/30 p-3",children:[n.jsx("div",{className:"flex items-center justify-between",children:n.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:u("integrations.tools_for_agents")})}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map(a=>n.jsxs("div",{className:"flex items-center gap-1.5 rounded-lg border border-border bg-background px-2 py-1",children:[n.jsx(aa,{className:"h-2.5 w-2.5 flex-shrink-0 text-muted-foreground"}),n.jsx("span",{className:"font-mono text-[10px] text-foreground",children:a.slug}),n.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"·"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:a.desc})]},a.slug))}),n.jsx("p",{className:"text-[10px] text-muted-foreground/70",children:u("integrations.tools_available_note")})]}):null}function s$({value:e,onChange:t,onEnter:a,placeholder:r,ringClassName:i,btnClassName:l}){const[d,f]=x.useState(!1),[p,g]=x.useState(""),[h,b]=x.useState([]),[_,y]=x.useState(null),[S,j]=x.useState(""),[k,C]=x.useState(!1),w=async R=>{C(!0),j("");try{const T=await zf.dirs(R||"~");g(T.path),t(T.path),y(T.parent),b(T.entries)}catch(T){j(T.message)}finally{C(!1)}},E=async()=>{C(!0);try{const R=await zf.pickDir(u("add_project.picker_prompt"));if("cancelled"in R)return;t(R.path)}catch{f(!0),await w(e||"~")}finally{C(!1)}};return n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{type:"text",placeholder:r,value:e,onChange:R=>t(R.target.value),onKeyDown:R=>R.key==="Enter"&&a?.(),className:me("w-full rounded-lg border border-border bg-background px-3 py-2 font-mono text-xs outline-none placeholder:text-muted-foreground/60",i)}),n.jsxs("button",{type:"button",onClick:E,disabled:k,className:me("flex flex-shrink-0 items-center gap-1.5 rounded-lg border px-3 py-2 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",l),children:[k?n.jsx(Js,{className:"h-3.5 w-3.5 animate-spin"}):n.jsx(Oo,{className:"h-3.5 w-3.5"}),u("add_project.search_btn")]})]}),d&&n.jsxs("div",{className:"rounded-lg border border-border bg-muted/20",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[n.jsx("span",{className:"truncate font-mono text-[10px] text-muted-foreground",children:p||e||"~"}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx("button",{type:"button",onClick:()=>w("~"),disabled:k,className:"rounded p-1 hover:bg-accent disabled:opacity-50",children:n.jsx(yS,{className:"h-3 w-3"})}),n.jsx("button",{type:"button",onClick:()=>_&&w(_),disabled:!_||k,className:"rounded px-1.5 py-0.5 text-[10px] hover:bg-accent disabled:opacity-50",children:".."}),n.jsx("button",{type:"button",onClick:()=>f(!1),disabled:k,className:"rounded p-1 hover:bg-accent disabled:opacity-50",children:n.jsx(gs,{className:"h-3 w-3"})})]})]}),n.jsxs("div",{className:"max-h-56 overflow-y-auto p-2",children:[k&&n.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:[n.jsx(Js,{className:"h-3.5 w-3.5 animate-spin"})," ",u("common.loading")]}),!k&&S&&n.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:u("add_project.browser_unavailable")}),!k&&!S&&h.length===0&&n.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:u("add_project.no_folders")}),!k&&!S&&h.map(R=>n.jsxs("button",{type:"button",onClick:()=>w(R),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:[n.jsx(Go,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),n.jsx("span",{className:"truncate",children:R.split("/").pop()}),n.jsx("span",{className:"ml-auto truncate font-mono text-[10px] text-muted-foreground",children:R})]},R))]})]})]})}const Qs=(e,t)=>u(e,t);function Ow({on:e,onChange:t,disabled:a,accent:r}){return n.jsx("button",{type:"button",role:"switch","aria-checked":e,disabled:a,onClick:()=>t(!e),className:me("relative inline-flex h-5 w-9 flex-shrink-0 items-center rounded-full border transition-colors disabled:cursor-not-allowed disabled:opacity-50",e?me("bg-emerald-500/30",r.border):"border-border bg-muted"),children:n.jsx("span",{className:me("inline-block h-3.5 w-3.5 transform rounded-full bg-foreground transition-transform",e?"translate-x-4":"translate-x-0.5")})})}const Dw={rose:{text:"text-rose-400",border:"border-rose-700/50",hover:"hover:bg-rose-900/20",ring:"focus:border-rose-500/50",wrap:"border-rose-500/30 from-rose-500/20 to-pink-500/20"},slate:{text:"text-slate-200",border:"border-slate-600/60",hover:"hover:bg-slate-700/30",ring:"focus:border-slate-400/60",wrap:"border-slate-500/30 from-slate-500/20 to-slate-700/20"},purple:{text:"text-purple-400",border:"border-purple-700/50",hover:"hover:bg-purple-900/20",ring:"focus:border-purple-500/50",wrap:"border-purple-500/30 from-purple-500/20 to-violet-500/20"}};function a$(e,t){return e==="github"?n.jsx(_S,{className:me("h-6 w-6",t.text)}):e==="asana"?n.jsx(pI,{className:me("h-6 w-6",t.text)}):e==="obsidian"?n.jsx(jE,{className:me("h-6 w-6",t.text)}):n.jsx("span",{className:me("text-lg",t.text),children:"◆"})}function r$({pid:e,scope:t,entry:a}){const r=a.ui,i=Dw[r.accent||"rose"]||Dw.rose,[l,d]=x.useState(!1),[f,p]=x.useState({}),[g,h]=x.useState({}),[b,_]=x.useState(null),[y,S]=x.useState("idle"),[j,k]=x.useState(null),[C,w]=x.useState([]),[E,R]=x.useState(""),[T,A]=x.useState(null),[z,M]=x.useState(null),{data:D,mutate:L,isLoading:I}=$e(`integration-status-${a.slug}-${e}-${t}`,()=>Kn.status(e,a.slug,t),{shouldRetryOnError:!1}),P=D?.status==="active"&&D.is_enabled===!0,B=y==="saving"||y==="validating",q=!P&&C.length===0,Y=r.configFields.filter(G=>G.type==="toggle"),V=r.configFields.filter(G=>G.type!=="toggle").some(G=>!f[G.key]?.trim());async function X(){if(!V){S("saving"),k(null);try{const G={...f};for(const se of Y)G[se.key]===void 0&&(G[se.key]=se.default?"true":"false");await Kn.configure(e,a.slug,t,G),S("validating");const te=await Kn.validate(e,a.slug,t);if(await L(),r.select&&!te[r.select.key]){const pe=(await Kn.action(e,a.slug,r.select.action,t))[r.select.listKey]||[];pe.length>1&&w(pe.map(F=>({value:String(F[r.select.valueKey]),label:String(F[r.select.labelKey])})))}S("done"),p({})}catch(G){k(G instanceof Error?G.message:u("integrations.err_connect")),S("idle")}}}async function Q(){if(!(!E||!r.select)){S("saving"),k(null);try{await Kn.configure(e,a.slug,t,{[r.select.key]:E}),await Kn.validate(e,a.slug,t),await L(),w([]),S("done")}catch(G){k(G instanceof Error?G.message:u("integrations.err_generic")),S("idle")}}}async function W(){k(null);try{await Kn.deactivate(e,a.slug,t),await L()}catch(G){k(G instanceof Error?G.message:u("integrations.err_generic"))}}async function $(G,te){k(null),M(null);try{await Kn.configure(e,a.slug,t,{[G]:te?"true":"false"}),await Kn.validate(e,a.slug,t),await L()}catch(se){k(se instanceof Error?se.message:u("integrations.err_generic"))}}async function K(G){k(null),M(null),A(G);try{const te=await Kn.action(e,a.slug,G,t);typeof te?.count=="number"?M(Qs(`integrations.${a.slug}.actions.${G}_done`,{count:te.count,changed:Number(te.changed??0)})):M(u("integrations.action_done")),await L()}catch(te){k(te instanceof Error?te.message:u("integrations.err_generic"))}finally{A(null)}}const J=I?"…":P?u("integrations.status_active"):D?.status==="error"?u("integrations.status_error"):u("integrations.status_unconfigured");return n.jsx(fR,{icon:n.jsx("div",{className:me("flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-2xl border bg-gradient-to-br",i.wrap),children:a$(a.slug,i)}),title:a.name,description:a.description,hasTools:(a.tools?.length??0)>0,badges:n.jsxs("span",{className:me("flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px]",P?"border-emerald-700 bg-emerald-900/20 text-emerald-400":"border-border bg-muted text-muted-foreground"),children:[n.jsx("span",{className:me("h-1.5 w-1.5 rounded-full",P?"bg-emerald-400":"bg-muted-foreground")}),J]}),expanded:l,onToggle:()=>d(G=>!G),children:n.jsxs("div",{className:"space-y-4 p-4",children:[j&&n.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-red-700/30 bg-red-900/20 px-3 py-2.5 text-xs text-red-300",children:[n.jsx(tM,{className:"h-3.5 w-3.5 flex-shrink-0"}),n.jsx("span",{className:"flex-1",children:j}),n.jsx("button",{onClick:()=>k(null),children:n.jsx(gs,{className:"h-3.5 w-3.5"})})]}),P&&C.length===0&&n.jsxs("div",{className:"space-y-1 rounded-xl border border-emerald-700/30 bg-emerald-900/10 p-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Qf,{className:"h-3.5 w-3.5 text-emerald-400"}),n.jsx("span",{className:"text-xs font-medium text-emerald-300",children:u("integrations.connected")})]}),(r.connectedFields||[]).map(G=>{const te=D?.[G];return te?n.jsxs("p",{className:"pl-5 text-[10px] text-muted-foreground",children:[Qs(`integrations.${a.slug}.connected.${G}`),": ",String(te)]},G):null})]}),P&&C.length===0&&Y.length>0&&n.jsx("div",{className:"space-y-2 rounded-xl border border-border p-3",children:Y.map(G=>n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-[11px] font-medium text-foreground",children:Qs(`integrations.${a.slug}.fields.${G.key}.label`)}),n.jsx("p",{className:"text-[10px] text-muted-foreground",children:Qs(`integrations.${a.slug}.fields.${G.key}.hint`)})]}),n.jsx(Ow,{on:!!D?.[G.key],accent:i,onChange:te=>$(G.key,te)})]},G.key))}),P&&C.length===0&&(r.actions?.length??0)>0&&n.jsxs("div",{className:"space-y-2",children:[z&&n.jsx("p",{className:"text-[11px] text-emerald-400",children:z}),n.jsx("div",{className:"flex flex-wrap gap-2",children:r.actions.map(G=>n.jsxs("button",{onClick:()=>K(G.action),disabled:T===G.action,className:me("flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",i.border,i.text,i.hover),children:[T===G.action?n.jsx(Js,{className:"h-3.5 w-3.5 animate-spin"}):n.jsx(Cs,{className:"h-3.5 w-3.5"}),Qs(`integrations.${a.slug}.actions.${G.action}`)]},G.action))})]}),C.length>1&&r.select&&n.jsxs("div",{className:"space-y-2",children:[n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[Qs(`integrations.${a.slug}.select_label`),":"]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("select",{value:E,onChange:G=>R(G.target.value),className:me("flex-1 rounded-lg border border-border bg-background px-2 py-1.5 text-xs outline-none",i.ring),children:[n.jsx("option",{value:"",children:u("integrations.select_placeholder")}),C.map(G=>n.jsx("option",{value:G.value,children:G.label},G.value))]}),n.jsx("button",{onClick:Q,disabled:!E||B,className:me("rounded-lg border px-3 py-1.5 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",i.border,i.text,i.hover),children:B?n.jsx(Js,{className:"h-3.5 w-3.5 animate-spin"}):u("integrations.confirm")})]})]}),q&&n.jsxs("div",{className:"space-y-3",children:[n.jsx("p",{className:"text-xs font-semibold text-foreground",children:u("integrations.credentials",{name:a.name})}),r.configFields.map(G=>{if(G.type==="toggle"){const te=f[G.key]!==void 0?f[G.key]==="true":!!G.default;return n.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border px-3 py-2",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-[11px] font-medium text-foreground",children:Qs(`integrations.${a.slug}.fields.${G.key}.label`)}),n.jsx("p",{className:"text-[10px] text-muted-foreground",children:Qs(`integrations.${a.slug}.fields.${G.key}.hint`)})]}),n.jsx(Ow,{on:te,accent:i,onChange:se=>p(pe=>({...pe,[G.key]:se?"true":"false"}))})]},G.key)}return n.jsxs("div",{className:"space-y-2",children:[G.help_url&&n.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[n.jsxs("button",{type:"button",onClick:()=>_(te=>te===G.key?null:G.key),className:"flex w-full items-center justify-between px-3 py-2 text-left transition-colors hover:bg-muted/40",children:[n.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[Qs(`integrations.${a.slug}.fields.${G.key}.help_label`)," ·"," ",n.jsxs("a",{href:G.help_url,target:"_blank",rel:"noreferrer",onClick:te=>te.stopPropagation(),className:me("inline-flex items-center gap-0.5 hover:underline",i.text),children:[G.help_url_label," ",n.jsx(Ab,{className:"h-2.5 w-2.5"})]})]}),n.jsx(ms,{className:me("h-3.5 w-3.5 flex-shrink-0 text-muted-foreground transition-transform",b===G.key&&"rotate-180")})]}),b===G.key&&n.jsx("div",{className:"space-y-1.5 border-t border-border px-3 pb-3 pt-2.5",children:Qs(`integrations.${a.slug}.fields.${G.key}.help_steps`).split(`
834
+ `).map((te,se)=>n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsxs("span",{className:me("mt-0.5 flex-shrink-0 font-mono text-[10px]",i.text),children:[se+1,"."]}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:te})]},se))})]}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-1 block text-[10px] text-muted-foreground",children:Qs(`integrations.${a.slug}.fields.${G.key}.label`)}),G.type==="path"?n.jsx(s$,{value:f[G.key]||"",onChange:te=>p(se=>({...se,[G.key]:te})),onEnter:X,placeholder:G.placeholder,ringClassName:i.ring,btnClassName:me(i.border,i.text,i.hover)}):n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:G.type==="password"&&!g[G.key]?"password":"text",placeholder:G.placeholder,value:f[G.key]||"",onChange:te=>p(se=>({...se,[G.key]:te.target.value})),onKeyDown:te=>te.key==="Enter"&&X(),className:me("w-full rounded-lg border border-border bg-background px-3 py-2 font-mono text-xs outline-none placeholder:text-muted-foreground/60",G.type==="password"&&"pr-14",i.ring)}),G.type==="password"&&n.jsxs("button",{type:"button",onClick:()=>h(te=>({...te,[G.key]:!te[G.key]})),className:"absolute right-2.5 top-1/2 flex -translate-y-1/2 items-center gap-0.5 text-[10px] text-muted-foreground transition-colors hover:text-foreground",children:[g[G.key]?n.jsx(Mb,{className:"h-3 w-3"}):n.jsx(Fo,{className:"h-3 w-3"}),g[G.key]?u("integrations.hide"):u("integrations.reveal")]})]})]})]},G.key)}),y==="validating"&&n.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[n.jsx(Js,{className:"h-3.5 w-3.5 animate-spin"})," ",u("integrations.verifying")]}),n.jsx("button",{onClick:X,disabled:V||B,className:me("flex w-full items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",i.border,i.text,i.hover),children:B?n.jsxs(n.Fragment,{children:[n.jsx(Js,{className:"h-3.5 w-3.5 animate-spin"}),u(y==="saving"?"integrations.saving":"integrations.validating")]}):u("integrations.connect")})]}),a.tools&&a.tools.length>0&&n.jsx(n$,{pid:e,tools:a.tools,isActive:P}),P&&n.jsx("div",{className:"flex justify-end border-t border-border pt-2",children:n.jsxs("button",{onClick:W,className:"flex items-center gap-1.5 rounded-lg border border-red-700/50 px-3 py-1.5 text-xs text-red-400 transition-all hover:bg-red-900/20",children:[n.jsx(e4,{className:"h-3.5 w-3.5"})," ",u("integrations.deactivate")]})})]})})}const o$={github:{icon:_S,className:"text-slate-200",wrap:"border-slate-500/30 from-slate-500/20 to-slate-700/20"},whatsapp:{icon:mI,className:"text-[#25D366]",wrap:"border-[#25D366]/30 from-[#25D366]/20 to-[#128C7E]/20"},"local-transcription":{icon:Pb,className:"text-orange-400",wrap:"border-orange-500/30 from-orange-500/20 to-amber-500/20"}};function i$({entry:e}){const[t,a]=x.useState(!1),r=o$[e.slug]||{icon:ep,className:"text-muted-foreground",wrap:"border-border from-muted to-muted"},i=r.icon;return n.jsx(fR,{icon:n.jsx("div",{className:`flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-2xl border bg-gradient-to-br ${r.wrap}`,children:n.jsx(i,{className:`h-6 w-6 ${r.className}`})}),title:e.name,description:e.description,badges:n.jsx("span",{className:"rounded-full border border-border bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:u("integrations.coming_soon")}),expanded:t,onToggle:()=>a(l=>!l),children:n.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:u("integrations.coming_soon_body")})})}const l$=[{value:"plugins",labelKey:"integrations.tab_plugins",icon:ep},{value:"tools",labelKey:"integrations.tab_tools",icon:aa}];function c$({pid:e,scope:t,entry:a}){return a.coming_soon||!a.ui?n.jsx(i$,{entry:a}):n.jsx(r$,{pid:e,scope:t,entry:a})}function u$({pid:e,scope:t}){const{data:a,isLoading:r}=$e(`integrations-catalog-${e}`,()=>Kn.catalog(e));return n.jsxs("div",{className:"space-y-3",children:[n.jsx("p",{className:"text-xs text-muted-foreground",children:u("integrations.plugins_hint")}),r&&n.jsx(tt,{}),(a||[]).map(i=>n.jsx(c$,{pid:e,scope:t,entry:i},i.slug)),n.jsx("div",{className:"rounded-xl border border-dashed border-border p-6 text-center",children:n.jsx("p",{className:"text-sm text-muted-foreground",children:u("integrations.more_soon")})})]})}function d$({pid:e}){const{data:t}=$e(`integrations-catalog-${e}`,()=>Kn.catalog(e)),a=(t||[]).filter(r=>!r.coming_soon&&(r.tools?.length??0)>0).flatMap(r=>(r.tools||[]).map(i=>({...i,plugin:r.name,active:r.status.is_enabled})));return n.jsxs("div",{className:"space-y-3",children:[n.jsx("p",{className:"text-xs text-muted-foreground",children:u("integrations.tools_hint")}),a.length===0?n.jsx(ut,{children:u("integrations.tools_empty")}):n.jsx("ul",{className:"space-y-2",children:a.map(r=>n.jsxs("li",{className:me("rounded-md border border-border bg-muted/30 px-3 py-2",!r.active&&"opacity-55"),children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(aa,{className:"h-3.5 w-3.5 text-muted-foreground"}),n.jsx("span",{className:"font-mono text-xs text-foreground",children:r.slug}),n.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:r.plugin}),n.jsx("span",{className:me("rounded border px-1.5 py-0.5 text-[10px]",r.active?"border-emerald-700/40 bg-emerald-900/20 text-emerald-400":"border-border bg-muted text-muted-foreground"),children:r.active?u("integrations.tool_active"):u("integrations.tool_inactive")})]}),n.jsx("p",{className:"mt-0.5 pl-5 text-[10px] text-muted-foreground",children:r.desc})]},r.slug))})]})}function f$({pid:e}){const t=String(e)==="0",[a,r]=x.useState("plugins"),[i,l]=x.useState(t?"global":"project");return n.jsxs(qe,{title:u("integrations.title"),description:u("integrations.description"),children:[!t&&n.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:u("integrations.scope_label")}),["project","global"].map(d=>n.jsx("button",{onClick:()=>l(d),className:me("rounded-md border px-2.5 py-1 text-xs transition-colors",i===d?"border-primary/50 bg-primary/10 text-foreground":"border-border bg-muted/30 text-muted-foreground hover:bg-muted/50"),children:u(d==="project"?"integrations.scope_project":"integrations.scope_global")},d))]}),n.jsx("div",{className:"mb-4 inline-flex rounded-lg border border-border bg-muted/30 p-0.5",children:l$.map(d=>{const f=d.icon;return n.jsxs("button",{onClick:()=>r(d.value),className:me("flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs transition-colors",a===d.value?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[n.jsx(f,{className:"h-3.5 w-3.5"})," ",u(d.labelKey)]},d.value)})}),a==="plugins"&&n.jsx(u$,{pid:e,scope:i}),a==="tools"&&n.jsx(d$,{pid:e})]})}function p$({pid:e}){const t=Xe(),a=String(e)==="0",[r,i]=x.useState(a?"global":"all"),[l,d]=x.useState(!1),f=$e(`/api/projects/${e}/vars?reveal=${l?1:0}`,()=>Gc.list(e,{reveal:l})),[p,g]=x.useState(null),h=x.useMemo(()=>{if(!f.data)return[];const _=[],y=f.data.project||{},S=f.data.global||{};for(const[j,k]of Object.entries(y))_.push({name:j,scope:"project",masked:k});for(const[j,k]of Object.entries(S))y[j]===void 0&&_.push({name:j,scope:"global",masked:k});return _.filter(j=>r==="all"?!0:j.scope===r).sort((j,k)=>j.name.localeCompare(k.name))},[f.data,r]),b=async(_,y)=>{if(confirm(u("project.vars.delete_confirm",{name:_,scope:y})))try{await Gc.remove(e,_,y),t.success(u("project.vars.removed")),f.mutate()}catch(S){t.error(S?.message||u("common.error_generic"))}};return n.jsxs(qe,{title:u("project.vars.title"),description:u(a?"project.vars.subtitle_base":"project.vars.subtitle_project"),action:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Dt,{checked:l,onChange:d,label:u("project.vars.reveal_all")}),n.jsxs(ae,{size:"sm",variant:"primary",onClick:()=>g({}),children:[n.jsx(Ot,{size:14})," ",u("project.vars.new")]})]}),children:[!a&&n.jsxs("div",{className:"mb-3 flex items-center gap-2 text-xs",children:[n.jsx("span",{className:"text-muted-fg",children:u("project.vars.filter_label")}),n.jsx(Ph,{active:r==="all",onClick:()=>i("all"),children:u("project.vars.filter_all")}),n.jsx(Ph,{active:r==="project",onClick:()=>i("project"),children:u("project.vars.filter_project")}),n.jsx(Ph,{active:r==="global",onClick:()=>i("global"),children:u("project.vars.filter_global")})]}),f.isLoading&&n.jsx(tt,{}),!f.isLoading&&h.length===0&&n.jsx(ut,{children:u("project.vars.empty")}),h.length>0&&n.jsx("ul",{className:"space-y-2 text-sm",children:h.map(_=>n.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsx("span",{className:"font-mono text-xs font-medium",children:_.name}),n.jsx(Be,{tone:_.scope==="project"?"info":"muted",children:_.scope==="project"?u("project.vars.scope_project"):u("project.vars.scope_global")}),n.jsx("span",{className:"ml-2 font-mono text-xs text-muted-fg",children:_.masked}),n.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[n.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>g({name:_.name,scope:_.scope}),"aria-label":u("project.vars.edit_btn"),children:n.jsx(wa,{size:13})}),!(a&&_.scope==="project")&&n.jsx(ae,{size:"sm",variant:"destructive",onClick:()=>b(_.name,_.scope),"aria-label":u("project.vars.delete_btn"),children:n.jsx(_n,{size:13})})]})]},`${_.scope}-${_.name}`))}),n.jsx(m$,{open:p!==null,initial:p||void 0,onClose:()=>g(null),pid:e,isBase:a,onSaved:()=>{g(null),f.mutate()}})]})}function Ph({active:e,onClick:t,children:a}){return n.jsx("button",{type:"button",onClick:t,className:e?"rounded-full border border-primary/50 bg-primary/10 px-2 py-0.5 text-xs":"rounded-full border border-border bg-muted/30 px-2 py-0.5 text-xs hover:bg-muted/60",children:a})}function m$({open:e,onClose:t,pid:a,isBase:r,initial:i,onSaved:l}){const d=Xe(),[f,p]=x.useState(!1),[g,h]=x.useState(!1),[b,_]=x.useState(i?.name||""),[y,S]=x.useState(i?.value||""),[j,k]=x.useState(i?.scope||(r?"global":"project")),C=!!i?.name;x.useEffect(()=>{e&&(_(i?.name||""),S(i?.value||""),k(i?.scope||(r?"global":"project")),h(!1))},[e,i?.name,i?.scope,i?.value,r]);const w=async()=>{if(!b.trim()){d.error(u("project.vars.name_required"));return}if(!y){d.error(u("project.vars.value_required"));return}p(!0);try{await Gc.upsert(a,{name:b.trim(),value:y,scope:j}),d.success(u(C?"project.vars.updated":"project.vars.added")),l()}catch(E){d.error(E?.message||u("common.error_generic"))}finally{p(!1)}};return n.jsx(Bt,{open:e,onClose:()=>f?null:t(),title:u(C?"project.vars.edit_title":"project.vars.new_title"),description:u("project.vars.new_desc"),size:"sm",footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:t,disabled:f,children:u("common.cancel")}),n.jsx(ae,{variant:"primary",onClick:w,loading:f,children:u(C?"project.vars.save_btn":"project.vars.add_btn")})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(ie,{label:u("project.vars.scope_label"),children:n.jsx(ct,{value:j,onChange:E=>k(E),options:[...r?[]:[{value:"project",label:u("project.vars.scope_project"),description:u("project.vars.scope_project_desc")}],{value:"global",label:u("project.vars.scope_global"),description:u("project.vars.scope_global_desc")}]})}),n.jsx(ie,{label:u("project.vars.name_label"),hint:u("project.vars.name_hint"),children:n.jsx(Ce,{value:b,onChange:E=>_(E.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",disabled:C,autoFocus:!C})}),n.jsx(ie,{label:u("project.vars.value_label"),hint:u("project.vars.value_hint"),children:n.jsxs("div",{className:"relative",children:[n.jsx(Ce,{type:g?"text":"password",value:y,onChange:E=>S(E.target.value),placeholder:C?u("project.vars.value_edit_ph"):"",className:"pr-9 font-mono text-xs",autoFocus:C}),n.jsx("button",{type:"button",onClick:()=>h(E=>!E),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-fg hover:text-fg","aria-label":u(g?"project.vars.hide":"project.vars.reveal"),children:g?n.jsx(Mb,{size:14}):n.jsx(Fo,{size:14})})]})})]})})}const bv={get:()=>ne.get("/api/notebook"),put:e=>ne.put("/api/notebook",{body:e})};function g$(e){return e.kind==="notebook"?"notebook":e.kind==="project"?"project":`agent:${e.slug}`}function h$(e){return e.kind==="notebook"?"~/.apx/memory.md":e.kind==="project"?".apc/memory.md":`agents/${e.slug}/memory.md`}function x$(e,t){return t.kind==="notebook"?bv.get().then(a=>a.body):t.kind==="project"?Zn.memory.get(e).then(a=>a.body):an.memory.get(e,t.slug).then(a=>a.body)}function b$(e,t,a){return t.kind==="notebook"?bv.put(a).then(()=>{}):t.kind==="project"?Zn.memory.put(e,a).then(()=>{}):an.memory.put(e,t.slug,a).then(()=>{})}function Lh({active:e,onClick:t,icon:a,iconClass:r,label:i,sub:l}){return n.jsxs("button",{type:"button",onClick:t,className:me("flex w-full items-center gap-2 rounded px-1.5 py-1 text-left text-[13px]",e?"bg-primary/15 text-foreground":"text-foreground/80 hover:bg-accent/40"),children:[n.jsx(a,{className:me("size-3.5 shrink-0",r??"text-muted-foreground")}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:i}),l&&n.jsx("span",{className:"shrink-0 truncate text-[11px] text-muted-foreground",children:l})]})}function _$({pid:e}){const t=Xe(),[a,r]=x.useState({kind:"notebook"}),i=$e("/api/notebook",()=>bv.get()),l=pu(),d=$e(`/api/projects/${e}/agents`,()=>an.list(e)),f=`/api/memory/${e}/${g$(a)}`,p=$e(f,()=>x$(e,a)),g=x.useMemo(()=>{if(p.data===void 0)return null;const _=p.data??"";return{path:h$(a),name:"memory.md",kind:"markdown",size:_.length,modified:"",encoding:"utf8",content:_}},[p.data,a]),h=async _=>{await b$(e,a,_),t.success(u("project.memories.saved")),p.mutate(_,{revalidate:!1})},b=d.data||[];return n.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden rounded-xl border border-border bg-card",children:[n.jsxs("div",{className:"flex w-64 shrink-0 flex-col border-r border-border",children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[n.jsx($c,{className:"size-4 text-muted-foreground"}),n.jsx("span",{className:"flex-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:u("project.memories.sidebar_title")}),n.jsx("button",{type:"button",onClick:()=>{d.mutate(),p.mutate()},className:"text-muted-foreground hover:text-foreground","aria-label":u("common.refresh"),children:n.jsx(Cs,{className:d.isValidating?"size-3.5 animate-spin":"size-3.5"})})]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-1.5",children:[n.jsx("p",{className:"px-1.5 pb-1 pt-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/60",children:u("project.memories.super_agent_group")}),n.jsx(Lh,{active:a.kind==="notebook",onClick:()=>r({kind:"notebook"}),icon:PM,iconClass:"text-emerald-400",label:u("project.memories.notebook_item",{persona:l}),sub:i.data?u("project.memories.tokens",{n:i.data.approx_tokens}):void 0}),n.jsx("p",{className:"px-1.5 pb-1 pt-3 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/60",children:u("project.memories.general_group")}),n.jsx(Lh,{active:a.kind==="project",onClick:()=>r({kind:"project"}),icon:$c,iconClass:"text-sky-500",label:u("project.memories.general_item")}),n.jsx("p",{className:"px-1.5 pb-1 pt-3 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/60",children:u("project.memories.agents_title")}),d.isLoading?n.jsx("div",{className:"flex justify-center py-4",children:n.jsx(bn,{size:14})}):b.length===0?n.jsx("div",{className:"px-1.5 py-2",children:n.jsx(ut,{children:u("project.memories.no_agents")})}):b.map(_=>n.jsx(Lh,{active:a.kind==="agent"&&a.slug===_.slug,onClick:()=>r({kind:"agent",slug:_.slug}),icon:_.is_master?va:rn,iconClass:_.is_master?"text-violet-400":"text-muted-foreground",label:_.slug,sub:_.role||void 0},_.slug))]})]}),n.jsx("div",{className:"flex min-w-0 flex-1 flex-col",children:n.jsx(mv,{file:g,loading:p.isLoading,onSave:h})})]})}function v$({pid:e}){return n.jsx("div",{className:"h-full",children:n.jsx(_$,{pid:e})})}const y$=/\.(html?|jsx|tsx|js)$/i;function j$({pid:e,entry:t,onDeleted:a,onRenamed:r,onRunInTerminal:i,onEditArtifact:l}){const[d,f]=x.useState(!1),[p,g]=x.useState(null),h=Xe(),[b,_]=x.useState(null),[y,S]=x.useState(!1),[j,k]=x.useState(!1),C=y$.test(t.name),[w,E]=x.useState(!1),[R,T]=x.useState(t.name),A=x.useRef(null),[z,M]=x.useState(!1),[D,L]=x.useState(!1),[I,P]=x.useState(!1),B=z?["artifact",e,t.name]:null,q=$e(B,()=>Ws.read(e,t.name),{revalidateOnFocus:!1}),Y=!q.data?.content||q.data.content.startsWith("#!"),U=async G=>{try{await navigator.clipboard.writeText(G),h.info(u("modules_ui.code_copied"))}catch{}},V=async()=>{f(!0),g(null);try{const G=await Ws.run(e,t.name);g(G),G.ok?h.info(u("modules_ui.code_artifact_exit_ok",{ms:G.durationMs??0})):h.error(u("modules_ui.code_artifact_exit_fail",{code:G.exitCode??G.signal??"?",timeout:G.timedOut?u("modules_ui.code_artifact_timeout_suffix"):""}))}catch(G){h.error(G.message)}finally{f(!1)}},X=async()=>{S(!0);try{const G=await Ws.preview(e,t.name);_(G),window.open(G.url,"_blank","noopener,noreferrer")}catch(G){h.error(G.message)}finally{S(!1)}},Q=async()=>{if(b){k(!0);try{const G=await Ws.openTunnel(b.id);_({...b,tunnel:{id:G.id,url:G.url,provider:G.provider}}),window.open(G.url,"_blank","noopener,noreferrer")}catch(G){h.error(G.message)}finally{k(!1)}}},W=async()=>{if(b){try{await Ws.stopPreview(b.id)}catch{}_(null)}},$=async()=>{P(!0);try{await Ws.remove(e,t.name),L(!1),a()}catch(G){h.error(G.message)}finally{P(!1)}},K=()=>{T(t.name),E(!0),requestAnimationFrame(()=>A.current?.select())},J=async()=>{const G=R.trim();if(E(!1),!(!G||G===t.name))try{await Ws.rename(e,t.name,G),r()}catch(te){h.error(te.message)}};return n.jsxs("li",{className:"rounded-md border border-border",children:[n.jsxs("div",{className:"flex w-full items-center gap-2 px-2 py-1.5 text-xs",children:[n.jsx(zb,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),w?n.jsx("input",{ref:A,value:R,onChange:G=>T(G.target.value),onBlur:()=>void J(),onKeyDown:G=>{G.key==="Enter"&&J(),G.key==="Escape"&&E(!1)},autoFocus:!0,className:"min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 font-mono text-xs outline-none focus:ring-1 focus:ring-ring"}):n.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:t.name}),n.jsx(Ue,{content:u("code_module.artifacts_rename"),children:n.jsx("button",{type:"button",onClick:K,className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:n.jsx(wa,{className:"size-3"})})}),n.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[t.size,"b"]})]}),n.jsxs("div",{className:"space-y-2 border-t border-border p-2",children:[n.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5",children:[n.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-[10px] text-muted-foreground",children:t.path}),n.jsx(Ue,{content:u("code_module.artifacts_copy_path"),children:n.jsx("button",{type:"button",onClick:()=>void U(t.path),className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:n.jsx(zo,{className:"size-3"})})})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-1 mt-1",children:[n.jsxs(Xx,{open:z,onOpenChange:M,children:[n.jsx(Ue,{content:u("code_module.artifacts_view"),children:n.jsxs("button",{type:"button",onClick:()=>M(!0),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-blue-500/15 text-blue-700 hover:bg-blue-500/25 dark:text-blue-300",children:[n.jsx(Fo,{className:"size-3"}),u("modules_ui.code_artifact_view_short")]})}),n.jsxs(Qx,{className:"sm:max-w-lg",children:[n.jsx(Wx,{children:n.jsx(Zx,{className:"font-mono text-sm",children:t.name})}),q.isLoading?n.jsx("div",{className:"flex justify-center py-6",children:n.jsx(bn,{size:16})}):n.jsx("pre",{className:"max-h-96 overflow-auto rounded bg-muted/50 p-3 font-mono text-[11px] leading-tight whitespace-pre-wrap break-all",children:q.data?.content??""}),n.jsx(Gk,{showCloseButton:!0})]})]}),l&&n.jsx(Ue,{content:u("code_module.artifacts_edit"),children:n.jsxs("button",{type:"button",onClick:()=>l(t.name),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-violet-500/15 text-violet-700 hover:bg-violet-500/25 dark:text-violet-300",children:[n.jsx(YM,{className:"size-3"}),u("modules_ui.code_artifact_edit_short")]})}),Y&&n.jsx(Ue,{content:u("code_module.artifacts_run"),children:n.jsxs("button",{type:"button",disabled:d,onClick:()=>i?i(`apx artifact run ${t.name}`):void V(),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-emerald-500/15 text-emerald-700 hover:bg-emerald-500/25 disabled:opacity-60 dark:text-emerald-300",children:[d?n.jsx(bn,{size:10}):n.jsx(Ib,{className:"size-3"}),u("code_module.artifacts_run")]})}),C&&n.jsx(Ue,{content:u("code_module.artifacts_preview_hint"),children:n.jsxs("button",{type:"button",disabled:y,onClick:()=>void X(),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-sky-500/15 text-sky-700 hover:bg-sky-500/25 disabled:opacity-60 dark:text-sky-300",children:[y?n.jsx(bn,{size:10}):n.jsx(Ab,{className:"size-3"}),u("code_module.artifacts_preview")]})}),b&&!b.tunnel&&n.jsx(Ue,{content:u("code_module.artifacts_share_hint"),children:n.jsxs("button",{type:"button",disabled:j,onClick:()=>void Q(),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-amber-500/15 text-amber-700 hover:bg-amber-500/25 disabled:opacity-60 dark:text-amber-300",children:[j?n.jsx(bn,{size:10}):n.jsx(VM,{className:"size-3"}),u("code_module.artifacts_share")]})}),n.jsxs(Xx,{open:D,onOpenChange:L,children:[n.jsx(Ue,{content:u("code_module.artifacts_delete"),children:n.jsx("button",{type:"button",onClick:()=>L(!0),className:"ml-auto rounded p-1 text-rose-600 hover:bg-rose-50 dark:text-rose-400 dark:hover:bg-rose-950",children:n.jsx(_n,{className:"size-3"})})}),n.jsxs(Qx,{className:"sm:max-w-sm",children:[n.jsx(Wx,{children:n.jsxs(Zx,{className:"font-mono text-sm",children:[u("code_module.artifacts_delete")," — ",t.name]})}),n.jsx("p",{className:"px-1 text-sm text-muted-foreground",children:u("code_module.artifacts_delete_confirm")}),n.jsxs(Gk,{children:[n.jsx(zL,{render:n.jsx("button",{type:"button",className:"rounded px-3 py-1.5 text-xs font-medium hover:bg-accent"}),children:u("common.cancel")}),n.jsxs("button",{type:"button",onClick:()=>void $(),disabled:I,className:me("inline-flex items-center gap-1.5 rounded px-3 py-1.5 text-xs font-medium",I?"bg-muted text-muted-foreground":"bg-rose-500/15 text-rose-700 hover:bg-rose-500/25 dark:text-rose-300"),children:[I&&n.jsx(bn,{size:10}),u("code_module.delete")]})]})]})]})]}),n.jsxs("div",{className:"mt-1 text-[10px] text-muted-foreground",children:[u("code_module.artifacts_run_hint")," ",n.jsxs("code",{className:"rounded bg-muted px-1 font-mono",children:["apx artifact run ",t.name]})]}),b&&n.jsxs("div",{className:"space-y-1 rounded border border-sky-500/30 bg-sky-500/5 p-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"shrink-0 text-[10px] font-medium text-muted-foreground",children:u("code_module.artifacts_preview_local")}),n.jsx("a",{href:b.url,target:"_blank",rel:"noopener noreferrer",className:"min-w-0 flex-1 truncate font-mono text-[10px] text-sky-700 underline hover:text-sky-900 dark:text-sky-300",children:b.url}),n.jsx(Ue,{content:u("code_module.artifacts_copy_url"),children:n.jsx("button",{type:"button",onClick:()=>void U(b.url),className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:n.jsx(zo,{className:"size-3"})})}),n.jsx(Ue,{content:u("code_module.artifacts_stop_preview"),children:n.jsx("button",{type:"button",onClick:()=>void W(),className:"shrink-0 rounded p-0.5 text-rose-600 hover:bg-rose-50 dark:text-rose-400 dark:hover:bg-rose-950",children:n.jsx(Bb,{className:"size-3"})})})]}),b.tunnel&&n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"shrink-0 text-[10px] font-medium text-amber-700 dark:text-amber-300",children:u("code_module.artifacts_preview_public")}),n.jsx("a",{href:b.tunnel.url,target:"_blank",rel:"noopener noreferrer",className:"min-w-0 flex-1 truncate font-mono text-[10px] text-amber-700 underline hover:text-amber-900 dark:text-amber-300",children:b.tunnel.url}),n.jsx("span",{className:"shrink-0 font-mono text-[9px] text-muted-foreground",children:b.tunnel.provider}),n.jsx(Ue,{content:u("code_module.artifacts_copy_url"),children:n.jsx("button",{type:"button",onClick:()=>void U(b.tunnel.url),className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:n.jsx(zo,{className:"size-3"})})})]})]}),p&&n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[n.jsx("span",{className:me("rounded px-1.5 py-0.5 font-mono",p.ok?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":"bg-rose-500/15 text-rose-700 dark:text-rose-300"),children:u("modules_ui.code_artifact_exit_badge",{code:p.exitCode??p.signal??"?"})}),p.timedOut&&n.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:u("modules_ui.code_artifact_timeout")}),p.truncated&&n.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:u("modules_ui.code_artifact_truncated")}),n.jsxs("span",{className:"font-mono text-muted-foreground",children:[p.durationMs,"ms"]})]}),p.stdout&&n.jsx("pre",{className:"max-h-32 overflow-auto rounded bg-background/60 p-2 text-[10px] leading-tight",children:p.stdout}),p.stderr&&n.jsx("pre",{className:"max-h-32 overflow-auto rounded bg-rose-500/5 p-2 text-[10px] leading-tight text-rose-700 dark:text-rose-300",children:p.stderr})]})]})]})}function pR({pid:e,onRunInTerminal:t,onEditArtifact:a}){const r=$e(e?["artifacts",e]:null,()=>Ws.list(e)),i=r.data||[];return n.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-artifacts-tab",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[n.jsx("span",{className:"text-[11px] text-muted-foreground",children:i.length>0?u("code_module.artifacts_count",{n:i.length}):""}),n.jsx(Ue,{content:u("code_module.reload"),children:n.jsx("button",{type:"button",onClick:()=>void r.mutate(),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.isLoading?n.jsx(bn,{size:12}):n.jsx(Cs,{className:"size-3"})})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:i.length===0?n.jsx(ut,{children:u("code_module.artifacts_none")}):n.jsx("ul",{className:"space-y-1.5",children:i.map(l=>n.jsx(j$,{pid:e,entry:l,onDeleted:()=>void r.mutate(),onRenamed:()=>void r.mutate(),onRunInTerminal:t,onEditArtifact:a},l.name))})})]})}function k$({pid:e}){const t=Sn(),a=r=>{const i=new URLSearchParams({pid:e,...r}).toString();t(`/m/code?${i}`)};return n.jsx(qe,{title:u("project.artifacts.title"),description:u("project.artifacts.subtitle"),fullHeight:!0,className:"min-h-[24rem]",children:n.jsx(pR,{pid:e,onRunInTerminal:r=>a({cmd:r}),onEditArtifact:r=>a({edit:r})})})}function w$({pid:e}){const t=Xe(),a=$e(`/api/projects/${e}/organization`,()=>Gr.get(e)),[r,i]=x.useState(null),[l,d]=x.useState(null),[f,p]=x.useState(null),g=()=>void a.mutate(),h=a.data?.areas??[],b=a.data?.roles??[],_=S=>b.filter(j=>j.area===S),y=async()=>{f&&(f.kind==="area"?await Gr.removeArea(e,f.slug):await Gr.removeRole(e,f.slug),t.success(u("common.deleted")),g())};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs(qe,{title:u("structure.title"),description:u("structure.subtitle"),action:n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(ae,{size:"sm",variant:"secondary","data-testid":"structure-new-area",onClick:()=>i({}),children:[n.jsx(Ot,{className:"size-3.5"}),u("structure.new_area")]}),n.jsxs(ae,{size:"sm",variant:"primary",onClick:()=>d({}),children:[n.jsx(Ot,{className:"size-3.5"}),u("structure.new_role")]})]}),children:[n.jsxs("div",{className:"mb-4 flex items-start gap-2 rounded-lg border border-sky-500/20 bg-sky-500/5 px-3 py-2 text-[13px] text-muted-foreground",children:[n.jsx(Jf,{className:"mt-0.5 size-4 shrink-0 text-sky-500"}),n.jsx("span",{children:u("structure.info")})]}),a.isLoading?n.jsx(tt,{}):h.length===0&&b.length===0?n.jsx(ut,{children:u("structure.empty")}):n.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:[h.map(S=>n.jsxs("div",{className:"group rounded-lg border border-border bg-card/50 p-3",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(xS,{className:"mt-0.5 size-4 shrink-0 text-emerald-500"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"truncate text-sm font-semibold",children:S.name}),n.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:S.slug})]}),S.goal&&n.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:S.goal})]}),n.jsxs("div",{className:"flex shrink-0 gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[n.jsx("button",{type:"button",onClick:()=>i({editing:S}),className:"text-muted-foreground hover:text-foreground","aria-label":u("common.edit"),children:n.jsx(wa,{className:"size-3.5"})}),n.jsx("button",{type:"button",onClick:()=>p({kind:"area",slug:S.slug,name:S.name}),className:"text-muted-foreground hover:text-red-500","aria-label":u("common.delete"),children:n.jsx(_n,{className:"size-3.5"})})]})]}),n.jsxs("div",{className:"mt-3 border-t border-border/60 pt-2",children:[n.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[u("structure.roles")," (",_(S.slug).length,")"]}),n.jsxs("button",{type:"button",onClick:()=>d({presetArea:S.slug}),className:"text-[11px] text-sky-500 hover:text-sky-400",children:["+ ",u("structure.add_role")]})]}),n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[_(S.slug).map(j=>n.jsx(Pw,{role:j,onEdit:()=>d({editing:j}),onDelete:()=>p({kind:"role",slug:j.slug,name:j.name})},j.slug)),_(S.slug).length===0&&n.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:u("structure.no_roles")})]})]})]},S.slug)),_(null).length>0&&n.jsxs("div",{className:"rounded-lg border border-dashed border-border bg-card/30 p-3",children:[n.jsxs("div",{className:"mb-2 flex items-center gap-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[n.jsx(Nb,{className:"size-3.5"}),u("structure.general_roles")]}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:_(null).map(S=>n.jsx(Pw,{role:S,onEdit:()=>d({editing:S}),onDelete:()=>p({kind:"role",slug:S.slug,name:S.name})},S.slug))})]})]})]}),n.jsx(qE,{open:!!r,onClose:()=>i(null),pid:e,editing:r?.editing,onSaved:g}),n.jsx(HE,{open:!!l,onClose:()=>d(null),pid:e,areas:h,editing:l?.editing,presetArea:l?.presetArea,onSaved:g}),n.jsx(YE,{open:!!f,onClose:()=>p(null),onConfirm:y,title:f?.kind==="area"?u("structure.delete_area"):u("structure.delete_role"),description:f?.kind==="area"?u("structure.delete_area_desc",{name:f?.name??""}):u("structure.delete_role_desc",{name:f?.name??""}),confirmLabel:u("common.delete")})]})}function Pw({role:e,onEdit:t,onDelete:a}){return n.jsxs("span",{className:"group/chip inline-flex items-center gap-1 rounded-md border border-border bg-background px-1.5 py-0.5 text-[11px]",children:[n.jsx(Nb,{className:"size-3 text-muted-foreground"}),n.jsx("span",{children:e.name}),n.jsx("button",{type:"button",onClick:t,className:"opacity-0 transition-opacity group-hover/chip:opacity-100 text-muted-foreground hover:text-foreground","aria-label":u("common.edit"),children:n.jsx(wa,{className:"size-2.5"})}),n.jsx("button",{type:"button",onClick:a,className:"opacity-0 transition-opacity group-hover/chip:opacity-100 text-muted-foreground hover:text-red-500","aria-label":u("common.delete"),children:n.jsx(_n,{className:"size-2.5"})})]})}function S$(e){switch(e){case"markdown":return{Icon:Wf,color:"text-sky-500"};case"text":return{Icon:fM,color:"text-amber-500"};case"image":return{Icon:vx,color:"text-pink-500"};default:return{Icon:hS,color:"text-muted-foreground"}}}function C$(e){const t=e.split("/"),a=[];for(let r=1;r<t.length;r++)a.push(t.slice(0,r).join("/"));return a}function mR({node:e,depth:t,selectedPath:a,expanded:r,toggle:i,onSelect:l,onDelete:d}){const f=e.type==="dir",p=r.has(e.path),g=a===e.path,{Icon:h,color:b}=f?{Icon:p?Go:bS,color:"text-muted-foreground"}:S$(e.kind);return n.jsxs("div",{children:[n.jsxs("div",{className:me("group flex items-center gap-1 rounded px-1.5 py-1 text-[13px] cursor-pointer",g?"bg-primary/15 text-foreground":"hover:bg-accent/40 text-foreground/80"),style:{paddingLeft:t*12+6},onClick:()=>f?i(e.path):l(e),children:[f?p?n.jsx(ms,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(eo,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx("span",{className:"w-3.5 shrink-0"}),n.jsx(h,{className:me("size-3.5 shrink-0",b)}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.name}),d&&!f&&n.jsx("button",{type:"button",onClick:_=>{_.stopPropagation(),d(e)},className:"opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-red-500","aria-label":`delete ${e.name}`,children:n.jsx(_n,{className:"size-3.5"})})]}),f&&p&&e.children?.map(_=>n.jsx(mR,{node:_,depth:t+1,selectedPath:a,expanded:r,toggle:i,onSelect:l,onDelete:d},_.path))]})}function N$({nodes:e,selectedPath:t,onSelect:a,onDelete:r,className:i}){const[l,d]=x.useState(()=>new Set);x.useEffect(()=>{t&&d(p=>{const g=new Set(p);for(const h of C$(t))g.add(h);return g})},[t]);const f=p=>d(g=>{const h=new Set(g);return h.has(p)?h.delete(p):h.add(p),h});return n.jsx("div",{className:me("select-none",i),children:e.map(p=>n.jsx(mR,{node:p,depth:0,selectedPath:t,expanded:l,toggle:f,onSelect:a,onDelete:r},p.path))})}function E$({open:e,onClose:t,pid:a,scope:r,onCreated:i}){const l=Xe(),[d,f]=x.useState(""),[p,g]=x.useState(!1),h=async()=>{let b=d.trim().replace(/^\/+/,"");if(b){/\.[a-z0-9]+$/i.test(b)||(b+=".md"),g(!0);try{await Nc.write(a,b,"",r),l.success(u("files.created")),f(""),i(b)}catch(_){l.error(_ instanceof Error?_.message:String(_))}finally{g(!1)}}};return n.jsx(Bt,{open:e,onClose:t,title:u("files.new_doc"),description:u("files.new_doc_hint"),footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:t,children:u("common.cancel")}),n.jsx(ae,{variant:"primary","data-testid":"new-file-create",onClick:()=>void h(),loading:p,disabled:!d.trim(),children:u("files.create")})]}),children:n.jsx(ie,{label:u("files.path_label"),hint:u("files.path_example"),children:n.jsx(Ce,{autoFocus:!0,"data-testid":"new-file-path",value:d,onChange:b=>f(b.target.value),onKeyDown:b=>{b.key==="Enter"&&h()},placeholder:"cases/onboarding/spec.md"})})})}function gR({pid:e,scope:t,editable:a=!1,emptyHint:r}){const i=Xe(),[l,d]=x.useState(null),[f,p]=x.useState(!1),g=`/api/projects/${e}/fs/tree?scope=${t}`,h=$e(g,()=>Nc.tree(e,t)),b=l?`/api/projects/${e}/fs/file?scope=${t}&path=${l}`:null,_=$e(b,()=>l?Nc.read(e,l,t):null),y=E=>d(E.path),S=a?async E=>{l&&(await Nc.write(e,l,E,t),i.success(u("files.saved")),_.mutate())}:void 0,j=a?async E=>{await Nc.remove(e,E.path,t),l===E.path&&d(null),i.success(u("files.deleted")),h.mutate()}:void 0,k=E=>{p(!1),d(E),h.mutate()},C=h.data?.tree??[],w=!h.isLoading&&C.length===0;return n.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden rounded-xl border border-border bg-card",children:[n.jsxs("div",{className:"flex w-64 shrink-0 flex-col border-r border-border",children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[n.jsx(Go,{className:"size-4 text-muted-foreground"}),n.jsx("span",{className:"flex-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:u(t==="docs"?"files.docs_label":"files.files_label")}),a&&n.jsx("button",{type:"button","data-testid":"docs-new",onClick:()=>p(!0),className:"text-muted-foreground hover:text-foreground","aria-label":u("files.new_doc"),title:u("files.new_doc"),children:n.jsx(bx,{className:"size-4"})}),n.jsx("button",{type:"button",onClick:()=>void h.mutate(),className:"text-muted-foreground hover:text-foreground","aria-label":u("common.refresh"),children:n.jsx(Cs,{className:h.isValidating?"size-3.5 animate-spin":"size-3.5"})})]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-1.5",children:[h.isLoading?n.jsx("div",{className:"flex justify-center py-6",children:n.jsx(bn,{size:14})}):w?n.jsx("div",{className:"p-3",children:n.jsx(ut,{children:n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{children:r??u("files.empty")}),a&&n.jsxs(ae,{size:"sm",variant:"secondary",onClick:()=>p(!0),children:[n.jsx(bx,{className:"size-3.5"}),u("files.new_doc")]})]})})}):n.jsx(N$,{nodes:C,selectedPath:l,onSelect:y,onDelete:j}),h.data?.truncated&&n.jsx("p",{className:"px-2 py-1 text-[10px] text-muted-foreground/60",children:u("files.truncated")})]})]}),n.jsx("div",{className:"flex min-w-0 flex-1 flex-col",children:n.jsx(mv,{file:_.data??null,loading:!!b&&_.isLoading,onSave:S})}),a&&n.jsx(E$,{open:f,onClose:()=>p(!1),pid:e,scope:t,onCreated:k})]})}function R$({pid:e}){return n.jsx("div",{className:"h-full",children:n.jsx(gR,{pid:e,scope:"docs",editable:!0,emptyHint:u("files.docs_empty")})})}function T$({pid:e}){return n.jsx("div",{className:"h-full",children:n.jsx(gR,{pid:e,scope:"project"})})}const Ih="default";function A$(e){const t=e.replace(/\/+$/,"").split("/");return t[t.length-1]||e}function hR(e){return e==="builtin"?{label:u("skills_page.source_builtin"),tone:"info"}:e==="project"?{label:u("skills_page.source_project"),tone:"success"}:{label:u("skills_page.source_global"),tone:"muted"}}function $h(e){const t=[],a=/(\*\*[^*]+\*\*|`[^`]+`)/g;let r=0,i,l=0;for(;i=a.exec(e);){i.index>r&&t.push(e.slice(r,i.index));const d=i[0];d.startsWith("**")?t.push(n.jsx("strong",{children:d.slice(2,-2)},l++)):t.push(n.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-[0.85em]",children:d.slice(1,-1)},l++)),r=i.index+d.length}return r<e.length&&t.push(e.slice(r)),t}function M$(e){const t=e.split(`
835
+ `),a=[];let r=0,i=0;for(;r<t.length;){const l=t[r];if(l.trim().startsWith("```")){const p=[];for(r++;r<t.length&&!t[r].trim().startsWith("```");)p.push(t[r]),r++;r++,a.push(n.jsx("pre",{className:"my-2 overflow-x-auto rounded-md border border-border bg-muted/50 p-3 text-xs",children:n.jsx("code",{children:p.join(`
836
+ `)})},i++));continue}const d=l.match(/^(#{1,4})\s+(.*)$/);if(d){const p=d[1].length,g=p===1?"mt-4 mb-1 text-lg font-semibold":p===2?"mt-3 mb-1 text-base font-semibold":"mt-2 mb-0.5 text-sm font-semibold";a.push(n.jsx("div",{className:g,children:$h(d[2])},i++)),r++;continue}if(/^\s*[-*]\s+/.test(l)){const p=[];for(;r<t.length&&/^\s*[-*]\s+/.test(t[r]);)p.push(n.jsx("li",{children:$h(t[r].replace(/^\s*[-*]\s+/,""))},p.length)),r++;a.push(n.jsx("ul",{className:"my-1 list-disc space-y-0.5 pl-5 text-sm",children:p},i++));continue}if(l.trim()===""){r++;continue}const f=[];for(;r<t.length&&t[r].trim()!==""&&!/^(#{1,4})\s/.test(t[r])&&!/^\s*[-*]\s+/.test(t[r])&&!t[r].trim().startsWith("```");)f.push(t[r]),r++;a.push(n.jsx("p",{className:"my-1.5 text-sm leading-relaxed",children:$h(f.join(" "))},i++))}return a}function z$(e){return new Promise((t,a)=>{const r=new FileReader;r.onload=()=>t(String(r.result).replace(/^data:.*;base64,/,"")),r.onerror=()=>a(new Error("read failed")),r.readAsDataURL(e)})}function xR({scope:e,selectable:t=!1}){const a=Xe(),[r,i]=x.useState(e??Ih),l=e??r,d=l===Ih?void 0:l,[f,p]=x.useState(!1),[g,h]=x.useState(null),[b,_]=x.useState("preview"),[y,S]=x.useState(!1),[j,k]=x.useState(!1),C=x.useRef(null),{data:w}=$e(t?"/api/projects":null,()=>Zn.list()),E=x.useMemo(()=>[{value:Ih,label:u("skills_page.scope_super_agent")},...(w??[]).map(V=>({value:V.path,label:V.name||A$(V.path)}))],[w]),{data:R,mutate:T,isLoading:A}=$e(["/api/skills",l],()=>Us.list(d)),z=x.useMemo(()=>R?.skills??[],[R]),M=z.filter(V=>V.enabled!==!1).length,D=g&&z.some(V=>V.slug===g)?g:z[0]?.slug??null,{data:L}=$e(D?["/skill-detail",l,D]:null,()=>Us.detail(D,d)),I=async(V,X)=>{p(!0);try{await Us.setEnabled({slug:V,enabled:X,scope:l}),await T()}catch(Q){a.error(u("skills_page.toggle_failed",{msg:Q.message}))}finally{p(!1)}},P=async V=>{if(window.confirm(u("skills_page.delete_confirm",{slug:V}))){p(!0);try{await Us.remove(V,d),a.success(u("skills_page.deleted_ok",{slug:V})),g===V&&h(null),await T()}catch(X){a.error(u("skills_page.delete_failed",{msg:X.message}))}finally{p(!1)}}},B=async(V,X)=>{a.success(X),h(V),await T()},q=async(V,X,Q)=>{await Us.create({slug:V,description:X,body:Q,project_path:d}),await B(V,u("skills_page.created_ok",{slug:V}))},Y=async V=>{const X=await Us.importRepo({url:V,project_path:d});await B(X.slug,u("skills_page.imported_ok",{slug:X.slug}))},U=async V=>{if(V){p(!0);try{const X=await z$(V),Q=await Us.importZip({data:X,project_path:d});await B(Q.slug,u("skills_page.imported_ok",{slug:Q.slug}))}catch(X){a.error(u("skills_page.import_failed",{msg:X.message}))}finally{p(!1),C.current&&(C.current.value="")}}};return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t?n.jsx("div",{className:"w-64",children:n.jsx(ct,{value:l,onChange:V=>{i(V),h(null)},options:E,placeholder:u("skills_page.scope_ph")})}):null,n.jsx(Be,{tone:"muted",children:u("skills_page.count_label",{n:z.length,on:M})})]}),n.jsxs(I_,{children:[n.jsxs($_,{disabled:f,className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground hover:opacity-90 disabled:opacity-50",children:[n.jsx(Ot,{size:15})," ",u("skills_page.add_menu")," ",n.jsx(ms,{size:14})]}),n.jsxs(B_,{align:"end",sideOffset:6,className:"w-72",children:[n.jsxs(uf,{onClick:()=>S(!0),children:[n.jsx($M,{size:15,className:"text-muted-fg"}),n.jsx(Bh,{title:u("skills_page.add_online"),hint:u("skills_page.add_online_hint")})]}),n.jsxs(uf,{onClick:()=>C.current?.click(),children:[n.jsx(NS,{size:15,className:"text-muted-fg"}),n.jsx(Bh,{title:u("skills_page.add_zip"),hint:u("skills_page.add_zip_hint")})]}),n.jsxs(uf,{onClick:()=>k(!0),children:[n.jsx(tu,{size:15,className:"text-muted-fg"}),n.jsx(Bh,{title:u("skills_page.add_repo"),hint:u("skills_page.add_repo_hint")})]})]})]}),n.jsx("input",{ref:C,type:"file",accept:".zip",className:"hidden",onChange:V=>U(V.target.files?.[0])})]}),A||!R?n.jsx(tt,{}):n.jsxs("div",{className:"grid min-h-[62vh] gap-4 lg:grid-cols-[20rem_1fr]",children:[n.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card",children:n.jsx("ul",{className:"max-h-[62vh] divide-y divide-border overflow-y-auto",children:z.length===0?n.jsx("li",{className:"px-3 py-4 text-sm text-muted-fg",children:u("skills_page.empty")}):z.map(V=>n.jsx(O$,{skill:V,active:V.slug===D,busy:f,onSelect:()=>h(V.slug),onToggle:X=>I(V.slug,X)},V.slug))})}),n.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border bg-card",children:D?L?n.jsxs("div",{className:"flex h-full max-h-[62vh] flex-col",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border px-5 py-4",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("code",{className:"text-sm font-semibold",children:L.slug}),(()=>{const V=hR(L.source);return n.jsx(Be,{tone:V.tone,children:V.label})})(),L.private&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-fg",children:[n.jsx(kS,{size:11})," ",u("skills_page.private_badge")]})]}),L.description&&n.jsx("p",{className:"mt-1 text-sm text-muted-fg",children:L.description}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-6 gap-y-1 text-xs text-muted-fg",children:[n.jsxs("span",{children:[u("skills_page.added_by"),": ",n.jsx("span",{className:"text-foreground",children:L.private?u("skills_page.by_apx"):u("skills_page.by_you")})]}),n.jsxs("span",{children:[u("skills_page.activator"),": ",n.jsx("span",{className:"text-foreground",children:u("skills_page.activator_value")})]})]})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[(L.source==="global"||L.source==="project")&&n.jsx(Ue,{content:u("skills_page.delete_btn"),children:n.jsx(ae,{variant:"ghost",size:"sm",disabled:f,onClick:()=>P(L.slug),"aria-label":u("skills_page.delete_btn"),children:n.jsx(_n,{size:14})})}),n.jsx(Dt,{checked:L.private?!0:L.enabled,disabled:f||L.private,onChange:V=>I(L.slug,V),label:L.private||L.enabled?u("skills_page.on"):u("skills_page.off")})]})]}),n.jsxs("div",{className:"flex items-center gap-1 border-b border-border px-4 py-2",children:[n.jsx(Lw,{active:b==="preview",onClick:()=>_("preview"),icon:Wf,label:u("skills_page.tab_preview")}),n.jsx(Lw,{active:b==="source",onClick:()=>_("source"),icon:mS,label:u("skills_page.tab_source")})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-4",children:b==="preview"?n.jsx("div",{className:"prose-none",children:M$(L.body||"")}):n.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words text-xs leading-relaxed text-muted-fg",children:L.body})})]}):n.jsx("div",{className:"p-6",children:n.jsx(tt,{})}):n.jsx("div",{className:"grid h-full place-items-center p-8 text-sm text-muted-fg",children:u("skills_page.select_a_skill")})})]}),n.jsx(D$,{open:y,onClose:()=>S(!1),onCreate:q}),n.jsx(P$,{open:j,onClose:()=>k(!1),onImport:Y})]})}function Bh({title:e,hint:t}){return n.jsxs("span",{className:"flex min-w-0 flex-col leading-tight",children:[n.jsx("span",{className:"font-medium",children:e}),n.jsx("span",{className:"text-[11px] text-muted-fg",children:t})]})}function Lw({active:e,onClick:t,icon:a,label:r}){return n.jsxs("button",{type:"button",onClick:t,className:`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition ${e?"bg-accent text-foreground":"text-muted-fg hover:text-foreground"}`,children:[n.jsx(a,{size:13})," ",r]})}function O$({skill:e,active:t,busy:a,onSelect:r,onToggle:i}){const l=hR(e.source),d=e.private?!0:e.enabled!==!1;return n.jsx("li",{children:n.jsxs("div",{className:`flex items-center gap-2 px-3 py-2.5 ${t?"bg-accent/50":"hover:bg-accent/25"}`,children:[n.jsxs("button",{type:"button",onClick:r,className:"min-w-0 flex-1 text-left",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("code",{className:"truncate text-[13px] font-medium",children:e.slug}),e.private&&n.jsx(kS,{size:10,className:"shrink-0 text-muted-fg"})]}),n.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5",children:[n.jsx(Be,{tone:l.tone,children:l.label}),e.overridden&&n.jsx(Be,{tone:"warning",children:u("skills_page.overridden_badge")})]})]}),n.jsx(Dt,{checked:d,disabled:a||e.private,onChange:i})]})})}function D$({open:e,onClose:t,onCreate:a}){const r=Xe(),[i,l]=x.useState(""),[d,f]=x.useState(""),[p,g]=x.useState(""),[h,b]=x.useState(!1),_=/^[a-z0-9][a-z0-9-]*$/.test(i),y=()=>{l(""),f(""),g("")},S=async()=>{if(_){b(!0);try{await a(i,d,p),y(),t()}catch(j){r.error(u("skills_page.create_failed",{msg:j.message}))}finally{b(!1)}}};return n.jsx(Bt,{open:e,onClose:t,title:u("skills_page.create_dialog_title"),description:u("skills_page.add_desc"),size:"lg",footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:t,disabled:h,children:u("skills_page.cancel")}),n.jsxs(ae,{variant:"primary",onClick:S,disabled:h||!_,loading:h,children:[n.jsx(Ot,{size:14})," ",u("skills_page.add_btn")]})]}),children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[n.jsx(ie,{label:u("skills_page.add_slug_label"),children:n.jsx(Ce,{value:i,placeholder:u("skills_page.add_slug_ph"),disabled:h,onChange:j=>l(j.target.value.toLowerCase())})}),n.jsx(ie,{label:u("skills_page.add_desc_label"),children:n.jsx(Ce,{value:d,placeholder:u("skills_page.add_desc_ph"),disabled:h,onChange:j=>f(j.target.value)})})]}),n.jsx(ie,{label:u("skills_page.add_body_label"),children:n.jsx(un,{value:p,placeholder:u("skills_page.add_body_ph"),disabled:h,rows:10,onChange:j=>g(j.target.value)})})]})})}function P$({open:e,onClose:t,onImport:a}){const r=Xe(),[i,l]=x.useState(""),[d,f]=x.useState(!1),p=/^(https?:\/\/|git@|ssh:\/\/|git:\/\/)\S+$/.test(i.trim()),g=async()=>{if(p){f(!0);try{await a(i.trim()),l(""),t()}catch(h){r.error(u("skills_page.import_failed",{msg:h.message}))}finally{f(!1)}}};return n.jsx(Bt,{open:e,onClose:t,title:u("skills_page.repo_dialog_title"),size:"md",footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:t,disabled:d,children:u("skills_page.cancel")}),n.jsxs(ae,{variant:"primary",onClick:g,disabled:d||!p,loading:d,children:[n.jsx(tu,{size:14})," ",u("skills_page.import_btn")]})]}),children:n.jsx(ie,{label:u("skills_page.repo_url_label"),hint:u("skills_page.repo_url_hint"),children:n.jsx(Ce,{value:i,placeholder:u("skills_page.repo_url_ph"),disabled:d,onChange:h=>l(h.target.value),onKeyDown:h=>{h.key==="Enter"&&g()}})})})}function L$({pid:e}){const{project:t}=fu(e),a=e==="0"?"default":t?.path;return a?n.jsx(xR,{scope:a}):n.jsx(tt,{})}function I$(){const e=Sn(),t=ns(),{pid:a=""}=sS(),{project:r}=fu(a),{collapsed:i,toggle:l}=H_(Dn.sidebarCollapsed+".project"),d=String(a)==="0",{data:f}=$e(`integrations-catalog-${a}`,()=>Kn.catalog(a),{shouldRetryOnError:!1}),p=f?.find(y=>y.slug==="obsidian"),g=p?.status?.status==="active"&&!!p?.status?.is_enabled,h=x.useMemo(()=>{const y=g?n.jsx(jE,{className:"size-3 text-purple-400"}):void 0,S=!d&&r?.kind==="company";return[d?{title:u("base.nav_general"),items:[{key:"workspaces",label:u("base.workspaces_title"),icon:XA},{key:"models",label:u("settings.tabs.engines"),icon:Tb},{key:"agent-defaults",label:u("base.defaults_title"),icon:rn}]}:null,{title:u("project.sections.workspace"),items:[{key:"",label:u("project.nav.overview"),icon:NM},...S?[{key:"structure",label:u("project.nav.structure"),icon:WA}]:[],{key:"agents",label:u("project.nav.agents"),icon:rn},{key:"memories",label:u("project.nav.memories"),icon:$c,mark:y},{key:"skills",label:u("skills_page.title"),icon:sa},{key:"artifacts",label:u("project.nav.artifacts"),icon:zb}]},{title:u("base.nav_activity"),items:[{key:"chat",label:u("project.nav.chat"),icon:nu},{key:"sessions",label:u("base.sessions_title"),icon:wM},{key:"logs",label:u("project.nav.logs"),icon:$b}]},d?null:{title:u("project.sections.content"),items:[{key:"docs",label:u("project.nav.docs"),icon:Wf},{key:"files",label:u("project.nav.files"),icon:Ob}]},{title:u("project.sections.automation"),items:[{key:"routines",label:u("project.nav.routines"),icon:Do},{key:"tasks",label:u("project.nav.tasks"),icon:xl},{key:"commitments",label:u("project.nav.commitments"),icon:jM},{key:"mcps",label:u("project.nav.mcps"),icon:ep},{key:"integrations",label:"Integrations",icon:ZA},{key:"vars",label:u("project.nav.vars"),icon:jS}]},{title:u("project.sections.config"),items:[{key:"config",label:u("project.nav.config"),icon:np}]}].filter(Boolean)},[d,r?.kind,g]),b=t.pathname.replace(`/p/${a}`,"").replace(/^\//,"").split("/")[0];if(!r)return n.jsx(wE,{testId:"screen-project-not-found",mood:"confused",message:u("project.not_found",{pid:a}),action:n.jsx(lr,{variant:"outline",onClick:()=>e("/"),children:u("not_found.home")})});const _=y=>{const S=y?`/p/${a}/${y}`:`/p/${a}`;e(S)};return n.jsx(yE,{sections:h,active:b,onChange:_,collapsed:i,onToggleCollapse:l,contentClassName:"w-full space-y-6 py-6 pt-3 pr-6 pl-1",testId:`project-tab-${b||"overview"}`,children:n.jsxs(iS,{children:[n.jsx(At,{index:!0,element:n.jsx(fw,{pid:a})}),n.jsx(At,{path:"workspaces",element:n.jsx(r7,{})}),n.jsx(At,{path:"models",element:n.jsx(PE,{})}),n.jsx(At,{path:"agent-defaults",element:n.jsx(T7,{})}),n.jsx(At,{path:"sessions",element:n.jsx(P7,{pid:a})}),n.jsx(At,{path:"logs",element:n.jsx(f7,{pid:a})}),n.jsx(At,{path:"config",element:n.jsx(e9,{pid:a})}),n.jsx(At,{path:"telegram",element:n.jsx(UE,{pid:a})}),n.jsx(At,{path:"agents",element:n.jsx(j9,{pid:a})}),n.jsx(At,{path:"agents/:slug",element:n.jsx(c9,{pid:a})}),n.jsx(At,{path:"structure",element:n.jsx(w$,{pid:a})}),n.jsx(At,{path:"docs",element:n.jsx(R$,{pid:a})}),n.jsx(At,{path:"files",element:n.jsx(T$,{pid:a})}),n.jsx(At,{path:"memories",element:n.jsx(v$,{pid:a})}),n.jsx(At,{path:"skills",element:n.jsx(L$,{pid:a})}),n.jsx(At,{path:"routines",element:n.jsx(L9,{pid:a})}),n.jsx(At,{path:"tasks",element:d?n.jsx(L7,{}):n.jsx($9,{pid:a})}),n.jsx(At,{path:"commitments",element:n.jsx(I7,{pid:d?void 0:a})}),n.jsx(At,{path:"mcps",element:n.jsx(W9,{pid:a})}),n.jsx(At,{path:"integrations",element:n.jsx(f$,{pid:a})}),n.jsx(At,{path:"artifacts",element:n.jsx(k$,{pid:a})}),n.jsx(At,{path:"vars",element:n.jsx(p$,{pid:a})}),n.jsx(At,{path:"threads",element:n.jsx(oA,{to:`/p/${a}/chat`,replace:!0})}),n.jsx(At,{path:"chat",element:n.jsx(mE,{pid:a})}),n.jsx(At,{path:"*",element:n.jsx(fw,{pid:a})})]})})}function $$({value:e,onChange:t,options:a,placeholder:r,className:i}){const l=w=>a.find(E=>E.value===w)?.label??w,[d,f]=x.useState(!1),[p,g]=x.useState(l(e)),h=x.useRef(null),b=x.useRef(null),[_,y]=x.useState(null);x.useEffect(()=>{g(l(e))},[e,a]),x.useLayoutEffect(()=>{if(!d)return;const w=()=>{const E=h.current;if(!E)return;const R=E.getBoundingClientRect();y({top:R.bottom+4,left:R.left,width:R.width})};return w(),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[d]),x.useEffect(()=>{if(!d)return;const w=E=>{const R=E.target;h.current?.contains(R)||b.current?.contains(R)||(g(l(e)),f(!1))};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[d,e,a]);const S=p.trim().toLowerCase(),j=p===l(e),k=S&&!j?a.filter(w=>w.label.toLowerCase().includes(S)||w.value.toLowerCase().includes(S)):a,C=w=>{t(w.value),g(w.label),f(!1)};return n.jsxs("div",{ref:h,className:me("relative",i),children:[n.jsxs("div",{className:"flex items-center gap-1 rounded-lg border border-input bg-transparent px-2.5 transition-colors focus-within:border-ring focus-within:ring-1 focus-within:ring-ring dark:bg-input/30 dark:hover:bg-input/50",children:[n.jsx("input",{value:p,placeholder:r,onChange:w=>{g(w.target.value),f(!0)},onFocus:()=>f(!0),className:"w-full bg-transparent py-1.5 text-sm outline-none placeholder:text-muted-fg/60"}),n.jsx("button",{type:"button",tabIndex:-1,onClick:()=>f(w=>!w),className:"shrink-0 text-muted-fg hover:text-foreground",children:n.jsx(ms,{className:"size-4"})})]}),d&&k.length>0&&_&&Gs.createPortal(n.jsx("ul",{ref:b,style:{position:"fixed",top:_.top,left:_.left,width:_.width},className:"z-[1000] max-h-60 overflow-y-auto rounded-lg bg-popover p-1 shadow-md ring-1 ring-foreground/10",children:k.map(w=>n.jsx("li",{children:n.jsx("button",{type:"button",onMouseDown:E=>{E.preventDefault(),C(w)},className:me("flex w-full items-center rounded-md px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-fg",w.value===e&&"bg-accent/50"),children:n.jsx("span",{className:"truncate font-mono text-xs",children:w.label})})},w.value))}),document.body)]})}const B$=["es","en","pt","fr","it","de","ca","gl","eu","nl","sv","no","da","fi","is","pl","cs","sk","sl","hr","sr","uk","ru","bg","ro","hu","el","tr","ar","he","fa","hi","bn","ta","ur","id","ms","vi","th","ko","ja","zh"];function U$(e){return e&&e.charAt(0).toLocaleUpperCase()+e.slice(1)}function q$(){const e=q_();let t=null;try{t=new Intl.DisplayNames([e],{type:"language"})}catch{t=null}return B$.map(a=>{const r=t?.of(a);return{value:a,label:r?U$(r):a}}).sort((a,r)=>a.label.localeCompare(r.label,e))}const H$=["UTC","America/Argentina/Buenos_Aires","America/Sao_Paulo","America/New_York","America/Los_Angeles","America/Mexico_City","Europe/London","Europe/Madrid","Europe/Berlin","Asia/Tokyo","Asia/Shanghai","Australia/Sydney"];function V$(){try{const e=Intl.supportedValuesOf;if(typeof e=="function")return e("timeZone")}catch{}return H$}function Iw(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function F$(e,t){try{const a=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).formatToParts(t).find(l=>l.type==="timeZoneName")?.value??"GMT",r=/GMT([+-])(\d{1,2})(?::(\d{2}))?/.exec(a);return r?(r[1]==="-"?-1:1)*(parseInt(r[2],10)*60+(r[3]?parseInt(r[3],10):0)):0}catch{return 0}}function G$(e){const t=e<0?"-":"+",a=Math.abs(e),r=String(Math.floor(a/60)).padStart(2,"0"),i=String(a%60).padStart(2,"0");return`GMT${t}${r}:${i}`}let ef=null;function Y$(){if(ef)return ef;const e=new Date;return ef=V$().map(t=>({value:t,label:t,off:F$(t,e)})).sort((t,a)=>t.off-a.off||t.value.localeCompare(a.value)).map(({value:t,off:a})=>({value:t,label:`(${G$(a)}) ${t}`})),ef}function K$(){const e=Xe(),{identity:t,isLoading:a,save:r}=Y_(),[i,l]=x.useState({}),[d,f]=x.useState(!1),p=x.useMemo(()=>Y$(),[]);if(x.useEffect(()=>{l({...t,timezone:t?.timezone||Iw()})},[t]),a)return n.jsx(tt,{});const g=async()=>{f(!0);try{await r({owner_name:i.owner_name,owner_context:i.owner_context,language:i.language,timezone:i.timezone}),e.success(u("settings.identity.saved"))}catch(h){e.error(h.message)}finally{f(!1)}};return n.jsxs(qe,{title:u("settings.identity.title"),description:u("settings.identity.subtitle"),children:[t?null:n.jsx(ut,{children:u("common.none_yet")}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(ie,{label:u("settings.identity.owner_name"),children:n.jsx(Ce,{value:i.owner_name||"",onChange:h=>l({...i,owner_name:h.target.value})})}),n.jsx(ie,{label:u("settings.identity.language"),children:n.jsx(ct,{value:i.language||"es",onChange:h=>l({...i,language:h}),options:q$()})}),n.jsx(ie,{label:u("settings.identity.timezone"),hint:u("settings.identity.timezone_hint"),children:n.jsx($$,{value:i.timezone||Iw(),onChange:h=>l({...i,timezone:h}),options:p})})]}),n.jsx("div",{className:"mt-3",children:n.jsx(ie,{label:u("settings.identity.owner_context"),hint:u("settings.identity.owner_context_hint"),children:n.jsx(un,{rows:3,value:i.owner_context||"",onChange:h=>l({...i,owner_context:h.target.value})})})}),n.jsx("div",{className:"mt-4",children:n.jsx(ae,{variant:"primary",loading:d,onClick:g,children:u("common.save")})})]})}function X$(){const e=Xe(),t=Sn(),{superAgent:a,isLoading:r,mutate:i}=OE(),{patch:l}=fr(),{identity:d,save:f}=Y_(),[p,g]=x.useState(!0),[h,b]=x.useState(""),[_,y]=x.useState(""),[S,j]=x.useState("permiso"),[k,C]=x.useState(!1);if(x.useEffect(()=>{a&&(g(!!a.enabled),b(a.system||""),j(a.permission_mode||"permiso"))},[a]),x.useEffect(()=>{y(d.personality||"")},[d.personality]),r||!a)return n.jsx(tt,{});const w=async()=>{C(!0);try{await l({"super_agent.enabled":p,"super_agent.system":h,"super_agent.permission_mode":S},["super_agent.name"]),await f({personality:_}),e.success(u("settings.super_agent.saved")),i()}catch(E){e.error(E.message)}finally{C(!1)}};return n.jsx(qe,{title:u("settings.super_agent.title"),description:u("settings.super_agent.behavior_subtitle"),children:n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"flex items-center gap-3",children:n.jsx(Dt,{checked:p,onChange:g,label:u("settings.super_agent.enabled_label")})}),n.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 p-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-sm font-medium",children:u("settings.super_agent.model_active")}),n.jsx("div",{className:"truncate font-mono text-xs text-muted-fg",children:a.model||"—"})]}),n.jsxs(ae,{size:"sm",variant:"secondary",onClick:()=>t("/p/0/models"),children:[n.jsx(Tb,{size:13})," ",u("settings.super_agent.model_configure")]})]}),n.jsx(ie,{label:u("settings.super_agent.permission_mode"),children:n.jsx(ct,{value:S,onChange:j,options:Hb.map(E=>({value:E,label:E}))})}),n.jsx(ie,{label:u("settings.super_agent.personality"),children:n.jsx(un,{rows:2,value:_,onChange:E=>y(E.target.value)})}),n.jsx(ie,{label:u("settings.super_agent.system"),hint:u("settings.super_agent.system_hint"),children:n.jsx(un,{rows:6,className:"font-mono text-xs",value:h,onChange:E=>b(E.target.value),placeholder:u("settings.super_agent.system_ph")})}),n.jsx(ae,{variant:"primary",loading:k,onClick:w,children:u("common.save")})]})})}const Ji={list:()=>ne.get("/api/profiles"),get:e=>ne.get(`/api/profiles/${encodeURIComponent(e)}`),doctor:e=>ne.get(`/api/profiles/doctor${e?`?id=${encodeURIComponent(e)}`:""}`),install:(e,t=!1)=>ne.post("/api/profiles/install",{source:e,force:t}),use:(e,t=!1)=>ne.post("/api/profiles/use",{id:e,force:t}),off:()=>ne.post("/api/profiles/off",{}),setConfig:(e,t)=>ne.patch("/api/profiles/config",{values:e,id:t}),uninstall:e=>ne.del(`/api/profiles/${encodeURIComponent(e)}`)};function Q$(){const{data:e,error:t,isLoading:a,mutate:r}=$e("/api/profiles",()=>Ji.list());return{active:e?.active??null,profiles:e?.profiles??[],error:t,isLoading:a,mutate:r}}function W$(e){const{data:t,error:a,isLoading:r,mutate:i}=$e(e?`/api/profiles/${e}`:null,()=>Ji.get(e));return{profile:t,error:a,isLoading:r,mutate:i}}function Z$(e){const{data:t,error:a,isLoading:r,mutate:i}=$e(e?`/api/profiles/doctor?id=${e}`:"/api/profiles/doctor",()=>Ji.doctor(e||void 0));return{doctor:t,error:a,isLoading:r,mutate:i}}function J$(e){return/(^|_)schedule$/.test(e)||/_cron$/.test(e)}function eB(){const e=Xe(),{active:t,profiles:a,isLoading:r,mutate:i}=Q$(),[l,d]=x.useState(null),f=l??t??a[0]?.id??null,{profile:p,mutate:g}=W$(f),{doctor:h,mutate:b}=Z$(t),[_,y]=x.useState({}),[S,j]=x.useState(!1),[k,C]=x.useState(!1);x.useEffect(()=>{if(!p)return;const D={};for(const[L,I]of Object.entries(p.config||{}))D[L]=String(I??"");y(D)},[p?.id,p?.config]);const w=async()=>{await Promise.all([i(),g(),b()])};if(r)return n.jsx(tt,{});const E=async(D,L)=>{j(!0);try{const I=await Ji.use(D,L);for(const P of I.warnings||[])e.error(P);await w(),e.success(u("settings.profile.activated"))}catch(I){e.error(I.message)}finally{j(!1)}},R=async()=>{j(!0);try{await Ji.off(),await w(),e.success(u("settings.profile.deactivated"))}catch(D){e.error(D.message)}finally{j(!1),C(!1)}},T=async()=>{if(p){j(!0);try{const D=await Ji.setConfig(_,p.id);await w();const L=D.routines?.installed?.length??0;e.success(L>0?u("settings.profile.saved_with_routines"):u("settings.profile.saved"))}catch(D){e.error(D.message)}finally{j(!1)}}},A=p?.schema?.properties||{},z=!!p?.budget&&!!p?.tokens&&p.tokens>p.budget,M=!!p?.active;return n.jsxs("div",{className:"flex flex-col gap-4","data-testid":"profile-panel",children:[n.jsxs(qe,{title:u("settings.profile.title"),description:u("settings.profile.subtitle"),children:[n.jsxs("div",{"data-testid":"profile-vanilla-hint",className:"mb-3 flex items-start gap-2 rounded-md border border-border bg-muted/40 p-3 text-sm",children:[n.jsx(Jf,{size:16,className:"mt-0.5 shrink-0 opacity-70"}),n.jsx("span",{children:u(t?"settings.profile.active_hint":"settings.profile.vanilla_hint")})]}),a.length?n.jsx("div",{className:"grid gap-2 lg:grid-cols-2",children:a.map(D=>n.jsxs("button",{"data-testid":`profile-row-${D.id}`,type:"button",onClick:()=>d(D.id),className:`flex items-start justify-between gap-3 rounded-md border p-3 text-left transition ${D.id===f?"border-primary bg-muted/40":"border-border hover:bg-muted/20"}`,children:[n.jsxs("span",{className:"min-w-0",children:[n.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("span",{className:"font-medium",children:D.name}),n.jsx(Be,{children:D.source}),D.active?n.jsx(Be,{tone:"success",children:u("settings.profile.active")}):null]}),D.description?n.jsx("span",{className:"mt-0.5 block text-sm opacity-70",children:D.description}):null]}),n.jsx("span",{className:"shrink-0 text-xs opacity-60",children:D.version?`v${D.version}`:""})]},D.id))}):n.jsx(ut,{children:u("settings.profile.none_available")}),p?n.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-3",children:[n.jsx(Dt,{checked:!!p.active,disabled:S,label:p.active?u("settings.profile.on"):u("settings.profile.off"),onChange:D=>{D?E(p.id,!!t):C(!0)}}),!p.active&&t?n.jsx("span",{className:"text-xs opacity-60",children:u("settings.profile.replaces_active")}):null,n.jsxs("span",{className:"text-xs opacity-60",children:[u("settings.profile.token_cost"),": ~",p.tokens??0,p.budget?` / ${p.budget}`:"",z?` — ${u("settings.profile.over_budget")}`:""]})]}):null]}),n.jsxs("div",{className:"grid items-start gap-4 xl:grid-cols-2",children:[n.jsx(qe,{title:u("settings.profile.settings_title"),description:u("settings.profile.settings_subtitle"),children:Object.keys(A).length?n.jsxs(n.Fragment,{children:[M?null:n.jsx("p",{className:"mb-3 text-sm opacity-60",children:u("settings.profile.settings_locked")}),n.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:Object.entries(A).map(([D,L])=>n.jsx(ie,{label:L.title||D,hint:L.description,children:J$(D)?n.jsx(lR,{value:_[D]??String(L.default??""),onChange:I=>y({..._,[D]:I}),disabled:!M}):L.enum?n.jsx(ct,{value:_[D]??String(L.default??""),onChange:I=>y({..._,[D]:I}),options:L.enum.map(I=>({value:String(I),label:String(I)})),disabled:!M}):n.jsx(Ce,{value:_[D]??"",disabled:!M,onChange:I=>y({..._,[D]:I.target.value})})},D))}),n.jsx("div",{className:"mt-4",children:n.jsx(ae,{variant:"primary",loading:S,disabled:!M,onClick:T,children:u("common.save")})})]}):n.jsx(ut,{children:u("settings.profile.no_settings")})}),n.jsxs("div",{className:"flex flex-col gap-4",children:[n.jsx(qe,{title:u("settings.profile.doctor_title"),description:h?.summary||"",children:h?.checks?.length?n.jsx("ul",{className:"flex flex-col gap-2",children:h.checks.map((D,L)=>n.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[n.jsx(Ub,{size:16,className:`mt-0.5 shrink-0 ${D.level==="error"?"text-red-500":"text-amber-500"}`}),n.jsxs("span",{className:"min-w-0",children:[n.jsxs("span",{className:"opacity-60",children:["[",D.label,"]"]})," ",D.detail,D.fix?n.jsx("code",{className:"mt-1 block overflow-x-auto rounded bg-muted px-1.5 py-0.5 text-xs",children:D.fix}):null]})]},L))}):n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[n.jsx(Qf,{size:16,className:"text-emerald-500"}),u(t?"settings.profile.doctor_clean":"settings.profile.doctor_vanilla")]})}),n.jsx(qe,{title:u("settings.profile.preview_title"),description:p?.active?u("settings.profile.preview_subtitle"):u("settings.profile.preview_inactive"),children:n.jsx("pre",{"data-testid":"profile-preview",className:`max-h-[32rem] overflow-auto whitespace-pre-wrap rounded-md border border-border bg-muted/30 p-3 text-xs leading-relaxed ${p?.active?"":"opacity-60"}`,children:p?.preview||u("settings.profile.preview_empty")})})]})]}),n.jsx(Bt,{open:k,onClose:()=>C(!1),title:u("settings.profile.deactivate_title"),footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{onClick:()=>C(!1),children:u("common.cancel")}),n.jsx(ae,{variant:"destructive",loading:S,onClick:R,children:u("settings.profile.deactivate")})]}),children:u("settings.profile.deactivate_confirm")})]})}const Hf={list:(e=50)=>ne.get(`/api/nudges?limit=${e}`),policy:()=>ne.get("/api/nudges/policy"),setPolicy:e=>ne.put("/api/nudges/policy",e),feedback:(e,t,a="")=>ne.post(`/api/nudges/${encodeURIComponent(e)}/feedback`,{useful:t,note:a})};function tB(e=50){const{data:t,error:a,isLoading:r,mutate:i}=$e(`/api/nudges?limit=${e}`,()=>Hf.list(e));return{entries:t?.data??[],stats:t?.meta?.stats,error:a,isLoading:r,mutate:i}}function nB(){const{data:e,error:t,isLoading:a,mutate:r}=$e("/api/nudges/policy",()=>Hf.policy());return{policy:e?.policy,source:e?.source??[],userOverrides:e?.user_overrides??{},error:t,isLoading:a,mutate:r}}function sB(){const e=Xe(),{policy:t,source:a,isLoading:r,mutate:i}=nB(),{entries:l,stats:d,mutate:f}=tB(30),[p,g]=x.useState(null),[h,b]=x.useState(!1);if(x.useEffect(()=>{t&&g({...t})},[t]),r||!p)return n.jsx(tt,{});const _=async()=>{b(!0);try{await Hf.setPolicy(p),await i(),e.success(u("settings.nudge.saved"))}catch(k){e.error(k.message)}finally{b(!1)}},y=async(k,C)=>{try{await Hf.feedback(k,C),await f()}catch(w){e.error(w.message)}},S=(k,C,w)=>n.jsx(ie,{label:C,hint:w,children:n.jsx(Ce,{type:"number",min:0,value:String(p[k]??0),disabled:!p.enabled,onChange:E=>g({...p,[k]:Number(E.target.value)||0})})}),j=p.daily_max>0?Math.max(0,p.daily_max-(d?.today??0)):"∞";return n.jsxs("div",{className:"flex flex-col gap-4","data-testid":"nudge-panel",children:[n.jsxs(qe,{title:u("settings.nudge.title"),description:u("settings.nudge.subtitle"),children:[n.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-md border border-border bg-muted/40 p-3 text-sm",children:[n.jsx(Jf,{size:16,className:"mt-0.5 shrink-0 opacity-70"}),n.jsxs("span",{children:[p.enabled?u("settings.nudge.on_hint").replace("{{sent}}",String(d?.today??0)).replace("{{left}}",String(j)):u("settings.nudge.off_hint"),a.length?n.jsxs("span",{className:"ml-1 opacity-60",children:["(",u("settings.nudge.source"),": ",a.join(" → "),")"]}):null]})]}),n.jsx("div",{className:"mb-4",children:n.jsx(Dt,{checked:p.enabled,onChange:k=>g({...p,enabled:k}),label:u("settings.nudge.enabled")})}),n.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[S("daily_max",u("settings.nudge.daily_max"),u("settings.nudge.daily_max_hint")),n.jsx(ie,{label:u("settings.nudge.quiet_hours"),hint:u("settings.nudge.quiet_hours_hint"),children:n.jsx(Ce,{value:p.quiet_hours??"",placeholder:"22:00-07:30",disabled:!p.enabled,onChange:k=>g({...p,quiet_hours:k.target.value})})}),S("cooldown_minutes",u("settings.nudge.cooldown")),S("project_cooldown_minutes",u("settings.nudge.project_cooldown")),S("kind_cooldown_minutes",u("settings.nudge.kind_cooldown"))]}),n.jsxs("div",{className:"mt-3",children:[n.jsx(Dt,{checked:p.critical_bypasses_budget,onChange:k=>g({...p,critical_bypasses_budget:k}),label:u("settings.nudge.critical_bypass"),disabled:!p.enabled}),n.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground/70",children:u("settings.nudge.critical_bypass_hint")})]}),n.jsx("div",{className:"mt-4",children:n.jsx(ae,{variant:"primary",loading:h,onClick:_,children:u("common.save")})})]}),n.jsx(qe,{title:u("settings.nudge.log_title"),description:u("settings.nudge.log_subtitle"),children:l.length?n.jsx("ul",{className:"flex flex-col gap-2","data-testid":"nudge-log",children:l.map(k=>n.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/20 p-2.5 text-sm",children:[n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[n.jsx(Be,{children:k.kind}),n.jsx("span",{className:"text-xs opacity-55",children:String(k.at).replace("T"," ").slice(0,16)}),k.bypassed_budget?n.jsx(Be,{tone:"warning",children:u("settings.nudge.bypass")}):null]}),n.jsx("span",{className:"mt-1 block line-clamp-2 opacity-80",children:k.preview})]}),n.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[n.jsx("button",{type:"button","aria-label":u("settings.nudge.useful"),onClick:()=>y(k.id,!0),className:`rounded p-1.5 transition hover:bg-muted ${k.feedback?.useful===!0?"text-emerald-500":"opacity-40"}`,children:n.jsx(QM,{size:14})}),n.jsx("button",{type:"button","aria-label":u("settings.nudge.noise"),onClick:()=>y(k.id,!1),className:`rounded p-1.5 transition hover:bg-muted ${k.feedback?.useful===!1?"text-red-500":"opacity-40"}`,children:n.jsx(XM,{size:14})})]})]},k.id))}):n.jsx(ut,{children:u("settings.nudge.log_empty")})})]})}const Uh={providers:()=>ne.get("/api/embeddings/providers"),test:(e={})=>ne.post("/api/embeddings/test",e),reindex:()=>ne.post("/api/embeddings/reindex",{})},aB=()=>[{value:"auto",label:u("memory_panel.provider_auto")},{value:"ollama",label:u("memory_panel.provider_ollama")},{value:"gemini",label:u("memory_panel.provider_gemini")},{value:"openai",label:u("memory_panel.provider_openai")},{value:"tf",label:u("memory_panel.provider_tf")}],rB=()=>[{value:"chain",label:u("memory_panel.mode_chain")},{value:"single",label:u("memory_panel.mode_single")}],$w=e=>e.startsWith("***");function oB(){const e=Xe(),{config:t,isLoading:a,patch:r}=fr(),{data:i,mutate:l}=$e("/api/embeddings/providers",()=>Uh.providers()),[d,f]=x.useState(!1),[p,g]=x.useState(null);if(a)return n.jsx(tt,{});const h=t.memory||{},b=h.embeddings||{},_=i?.configured_provider||b.provider||"auto",y=i?.mode||b.mode||"chain",S=i?.engines||[],j=async w=>{f(!0);try{await r(w),await l()}catch(E){e.error(u("memory_panel.save_failed",{msg:E.message}))}finally{f(!1)}},k=async()=>{f(!0),g(null);try{const w=await Uh.test({});g(`${w.embedder} · dim ${w.dim} · ${w.ms}ms`),e.success(u("memory_panel.test_ok",{embedder:w.embedder}))}catch(w){e.error(u("memory_panel.test_failed",{msg:w.message}))}finally{f(!1)}},C=async()=>{f(!0);try{const w=await Uh.reindex();e.success(u("memory_panel.reindexed",{indexed:w.indexed,cleared:w.cleared}))}catch(w){e.error(u("memory_panel.reindex_failed",{msg:w.message}))}finally{f(!1)}};return n.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[n.jsx(qe,{title:u("memory_panel.embeddings_title"),description:u("memory_panel.embeddings_desc"),children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(ie,{label:u("memory_panel.provider_label"),hint:u("memory_panel.provider_hint"),children:n.jsx(ct,{value:_,onChange:w=>j({"memory.embeddings.provider":w}),options:aB(),disabled:d,className:"max-w-xl"})}),n.jsx(ie,{label:u("memory_panel.mode_label"),hint:u("memory_panel.mode_hint"),children:n.jsx(ct,{value:y,onChange:w=>j({"memory.embeddings.mode":w}),options:rB(),disabled:d,className:"max-w-md"})}),n.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:S.map(w=>n.jsxs(Be,{tone:w.available?"success":"muted",children:[w.id,": ",w.available?u("memory_panel.available"):u("memory_panel.unavailable")]},w.id))}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[n.jsxs(ae,{variant:"secondary",onClick:k,loading:d,children:[n.jsx(sa,{size:14})," ",u("memory_panel.test_btn")]}),n.jsxs(ae,{variant:"secondary",onClick:C,loading:d,children:[n.jsx(gS,{size:14})," ",u("memory_panel.reindex_btn")]}),p&&n.jsx("span",{className:"text-sm text-muted-foreground",children:p})]})]})}),n.jsxs(qe,{title:u("memory_panel.ollama_title"),description:u("memory_panel.ollama_desc"),children:[n.jsx(ie,{label:u("memory_panel.model_label"),children:n.jsx(Ce,{defaultValue:b.ollama?.model||"nomic-embed-text",placeholder:"nomic-embed-text",disabled:d,onBlur:w=>{const E=w.target.value.trim();E&&E!==b.ollama?.model&&j({"memory.embeddings.ollama.model":E})},className:"max-w-md"})}),n.jsx(ie,{label:u("memory_panel.base_url_label"),hint:u("memory_panel.ollama_base_url_hint"),children:n.jsx(Ce,{defaultValue:b.ollama?.base_url||"",placeholder:"http://localhost:11434",disabled:d,onBlur:w=>j({"memory.embeddings.ollama.base_url":w.target.value.trim()}),className:"max-w-md"})})]}),n.jsxs(qe,{title:u("memory_panel.openai_title"),description:u("memory_panel.openai_desc"),children:[n.jsx(ie,{label:u("memory_panel.model_label"),children:n.jsx(Ce,{defaultValue:b.openai?.model||"text-embedding-3-small",placeholder:"text-embedding-3-small",disabled:d,onBlur:w=>{const E=w.target.value.trim();E&&E!==b.openai?.model&&j({"memory.embeddings.openai.model":E})},className:"max-w-md"})}),n.jsx(ie,{label:u("memory_panel.api_key_label"),hint:u("memory_panel.openai_key_hint"),children:n.jsx(Ce,{type:"password",defaultValue:b.openai?.api_key||"",placeholder:"sk-…",disabled:d,onBlur:w=>{const E=w.target.value;E&&!$w(E)&&j({"memory.embeddings.openai.api_key":E})},className:"max-w-md"})})]}),n.jsxs(qe,{title:u("memory_panel.gemini_title"),description:u("memory_panel.gemini_desc"),children:[n.jsx(ie,{label:u("memory_panel.model_label"),children:n.jsx(Ce,{defaultValue:b.gemini?.model||"text-embedding-004",placeholder:"text-embedding-004",disabled:d,onBlur:w=>{const E=w.target.value.trim();E&&E!==b.gemini?.model&&j({"memory.embeddings.gemini.model":E})},className:"max-w-md"})}),n.jsx(ie,{label:u("memory_panel.api_key_label"),hint:u("memory_panel.gemini_key_hint"),children:n.jsx(Ce,{type:"password",defaultValue:b.gemini?.api_key||"",placeholder:"AIza…",disabled:d,onBlur:w=>{const E=w.target.value;E&&!$w(E)&&j({"memory.embeddings.gemini.api_key":E})},className:"max-w-md"})})]}),n.jsxs(qe,{title:u("memory_panel.compaction_title"),description:u("memory_panel.compaction_desc"),children:[n.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[n.jsx(ie,{label:u("memory_panel.threshold_label"),hint:u("memory_panel.threshold_hint"),children:n.jsx(Ce,{type:"number",min:1,defaultValue:h.compact_threshold??60,placeholder:"60",disabled:d,onBlur:w=>{const E=parseInt(w.target.value,10);Number.isFinite(E)&&E>0&&E!==h.compact_threshold&&j({"memory.compact_threshold":E})},className:"max-w-[10rem]"})}),n.jsx(ie,{label:u("memory_panel.keep_recent_label"),hint:u("memory_panel.keep_recent_hint"),children:n.jsx(Ce,{type:"number",min:1,defaultValue:h.keep_recent??40,placeholder:"40",disabled:d,onBlur:w=>{const E=parseInt(w.target.value,10);Number.isFinite(E)&&E>0&&E!==h.keep_recent&&j({"memory.keep_recent":E})},className:"max-w-[10rem]"})})]}),n.jsx(ie,{label:u("memory_panel.compact_model_label"),hint:u("memory_panel.compact_model_hint"),children:n.jsx(Ce,{defaultValue:h.compact_model||"ollama:gemma4:31b-cloud",placeholder:"ollama:gemma4:31b-cloud",disabled:d,onBlur:w=>{const E=w.target.value.trim();E&&E!==h.compact_model&&j({"memory.compact_model":E})},className:"max-w-md"})}),n.jsx(ie,{label:u("memory_panel.compact_fallback_label"),hint:u("memory_panel.compact_fallback_hint"),children:n.jsx(Ce,{defaultValue:h.compact_fallback_model||"",placeholder:u("memory_panel.compact_fallback_ph"),disabled:d,onBlur:w=>{const E=w.target.value.trim();E!==(h.compact_fallback_model||"")&&j({"memory.compact_fallback_model":E})},className:"max-w-md"})})]})]})}function iB(){return[{key:"load_threshold",label:u("settings_ui.knob_load_threshold"),hint:u("settings_ui.knob_load_threshold_hint"),step:.01,min:0,max:1},{key:"hint_threshold",label:u("settings_ui.knob_hint_threshold"),hint:u("settings_ui.knob_hint_threshold_hint"),step:.01,min:0,max:1},{key:"margin",label:u("settings_ui.knob_margin"),hint:u("settings_ui.knob_margin_hint"),step:.01,min:0,max:1},{key:"max_loaded",label:u("settings_ui.knob_max_loaded"),hint:u("settings_ui.knob_max_loaded_hint"),step:1,min:0,max:5},{key:"max_hints",label:u("settings_ui.knob_max_hints"),hint:u("settings_ui.knob_max_hints_hint"),step:1,min:0,max:8},{key:"prompt_floor",label:u("settings_ui.knob_prompt_floor"),hint:u("settings_ui.knob_prompt_floor_hint"),step:1,min:0,max:40},{key:"body_char_cap",label:u("settings_ui.knob_body_char_cap"),hint:u("settings_ui.knob_body_char_cap_hint"),step:500,min:500,max:2e4}]}function lB(){const e=Xe(),{data:t,mutate:a,isLoading:r}=$e("/api/skills/inspector",()=>Us.inspector()),[i,l]=x.useState(!1),[d,f]=x.useState(""),[p,g]=x.useState(null);if(r||!t)return n.jsx(tt,{});const h=t.config,b=t.index,_=async j=>{l(!0);try{await Us.updateInspector(j),await a()}catch(k){e.error(u("settings_ui.could_not_save",{msg:k.message}))}finally{l(!1)}},y=async(j=!1)=>{l(!0);try{const k=await Us.index({force:j});e.success(u("settings_ui.indexed_with",{embedder:k.embedder,dim:k.dim,added:k.changed.added,refreshed:k.changed.refreshed,removed:k.changed.removed})),await a()}catch(k){e.error(u("settings_ui.index_failed",{msg:k.message}))}finally{l(!1)}},S=async()=>{if(d.trim()){l(!0),g(null);try{const j=await Us.inspect(d.trim());g(j.trace)}catch(j){e.error(u("settings_ui.dry_run_failed",{msg:j.message}))}finally{l(!1)}}};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"grid gap-6 lg:grid-cols-2 lg:items-start",children:[n.jsx(qe,{title:u("settings_ui.inspector_title"),description:u("settings_ui.inspector_desc"),children:n.jsxs("div",{className:"space-y-4",children:[n.jsx(ie,{label:u("settings_ui.enable_inspector"),hint:u("settings_ui.enable_inspector_hint"),children:n.jsx(Dt,{checked:h.enabled,disabled:i,onChange:j=>_({enabled:j}),label:h.enabled?u("settings_ui.on"):u("settings_ui.off")})}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[n.jsx(Be,{tone:b.count>0?"success":"warning",children:u("settings_ui.index_count",{n:b.count})}),n.jsx(Be,{tone:"muted",children:b.embedder||u("settings_ui.not_indexed")}),b.dim?n.jsx(Be,{tone:"muted",children:u("settings_ui.dim",{dim:b.dim})}):null,b.updated_at?n.jsx("span",{className:"text-xs text-muted-foreground",children:u("settings_ui.updated_at",{date:new Date(b.updated_at).toLocaleString()})}):null]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[n.jsxs(ae,{variant:"secondary",onClick:()=>y(!1),loading:i,children:[n.jsx(Cs,{size:14})," ",u("settings_ui.reindex")]}),n.jsxs(ae,{variant:"secondary",onClick:()=>y(!0),loading:i,children:[n.jsx(Cs,{size:14})," ",u("settings_ui.reindex_forced")]}),n.jsx("span",{className:"text-xs text-muted-foreground",children:u("settings_ui.embedder_source")})]})]})}),n.jsx(qe,{title:u("settings_ui.test_title"),description:u("settings_ui.test_desc"),children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx(Ce,{value:d,placeholder:u("settings_ui.test_placeholder"),disabled:i,onChange:j=>f(j.target.value),onKeyDown:j=>{j.key==="Enter"&&S()},className:"max-w-xl flex-1"}),n.jsxs(ae,{variant:"primary",onClick:S,loading:i,children:[n.jsx(JM,{size:14})," ",u("settings_ui.test_btn")]})]}),p&&n.jsxs("div",{className:"rounded-md border border-border/60 bg-muted/30 p-3 text-sm",children:[n.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[n.jsx(sa,{size:14,className:"text-muted-foreground"}),n.jsx("span",{className:"text-muted-foreground",children:p.embedder||"—"}),p.jit?n.jsx(Be,{tone:"warning",children:u("settings_ui.jit_empty_index")}):null,p.reason&&!p.loaded?.length&&!p.hinted?.length?n.jsx(Be,{tone:"muted",children:p.reason}):null]}),p.loaded?.length?n.jsxs("div",{className:"mb-1",children:[n.jsxs("span",{className:"text-muted-foreground",children:[u("settings_ui.loaded_label")," "]}),p.loaded.map(j=>n.jsx(Be,{tone:"success",className:"mr-1",children:j},j))]}):null,p.hinted?.length?n.jsxs("div",{className:"mb-1",children:[n.jsxs("span",{className:"text-muted-foreground",children:[u("settings_ui.suggested_label")," "]}),p.hinted.map(j=>n.jsx(Be,{tone:"info",className:"mr-1",children:j},j))]}):null,p.scored?.length?n.jsx("div",{className:"mt-2 space-y-0.5 font-mono text-xs text-muted-foreground",children:p.scored.map(j=>n.jsxs("div",{children:[j.sim.toFixed(3)," ",j.slug]},j.slug))}):null]})]})})]}),n.jsx(qe,{title:u("settings_ui.thresholds_title"),description:u("settings_ui.thresholds_desc"),children:n.jsx("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 xl:grid-cols-4",children:iB().map(j=>n.jsx(ie,{label:j.label,hint:j.hint,children:n.jsx(Ce,{type:"number",step:j.step,min:j.min,max:j.max,defaultValue:String(h[j.key]),disabled:i,onBlur:k=>{const C=Number(k.target.value);Number.isFinite(C)&&C!==h[j.key]&&_({[j.key]:C})},className:"max-w-[12rem]"})},j.key))})})]})}function cB(){const[e,t]=Vo(),a=e.get("tab")==="rag"?"rag":"manager",r=i=>{const l=new URLSearchParams(e);l.set("tab",i),t(l,{replace:!0})};return n.jsxs("div",{className:"space-y-5",children:[n.jsxs("div",{className:"flex items-center gap-1 border-b border-border",children:[n.jsx(Bw,{active:a==="manager",onClick:()=>r("manager"),icon:sa,label:u("skills_page.manager_tab")}),n.jsx(Bw,{active:a==="rag",onClick:()=>r("rag"),icon:FM,label:u("skills_page.rag_tab")})]}),a==="manager"?n.jsx(xR,{selectable:!0}):n.jsx(lB,{})]})}function Bw({active:e,onClick:t,icon:a,label:r}){return n.jsxs("button",{type:"button",onClick:t,className:`-mb-px inline-flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm font-medium transition ${e?"border-foreground text-foreground":"border-transparent text-muted-fg hover:text-foreground"}`,children:[n.jsx(a,{size:15})," ",r]})}function uB(){const e=Xe(),{config:t,isLoading:a,patch:r,mutate:i}=fr(),l=t.telegram?.channels||[],d=Math.max(0,l.findIndex(T=>T.name==="default")),f=l[d],[p,g]=x.useState(!0),[h,b]=x.useState(1500),[_,y]=x.useState(!0),[S,j]=x.useState(""),[k,C]=x.useState(""),[w,E]=x.useState(!1);if(x.useEffect(()=>{g(!!t.telegram?.enabled),b(Number(t.telegram?.poll_interval_ms||1500)),y(!!t.telegram?.respond_with_engine),j(""),C(f?.chat_id||"")},[t,f?.chat_id]),a)return n.jsx(tt,{});const R=async()=>{E(!0);try{const T=l.slice(),A={name:"default",chat_id:k,respond_with_engine:_,...S?{bot_token:S}:{}};l.length===0?T.push(A):T[d]={...f,...A},await r({"telegram.enabled":p,"telegram.poll_interval_ms":h,"telegram.respond_with_engine":_,"telegram.channels":T}),e.success(u("settings.telegram_global.saved")),i(),j("")}catch(T){e.error(T.message)}finally{E(!1)}};return n.jsx(qe,{title:u("settings.telegram_global.title"),description:u("settings.telegram_global.subtitle"),children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Dt,{checked:p,onChange:g,label:u("settings.telegram_global.enabled")}),n.jsx(Dt,{checked:_,onChange:y,label:u("settings.telegram_global.respond_with_engine")})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(ie,{label:u("settings.telegram_global.bot_token"),hint:f?.bot_token?`…${$o(f.bot_token)??""} ${u("telegram_ui.secret_set_replace")}`:u("telegram_ui.bot_token_hint_short"),children:n.jsx(Ce,{type:"password",value:S,onChange:T=>j(T.target.value),placeholder:f?.bot_token?`…${$o(f.bot_token)??""} ${u("telegram_ui.secret_already_set")}`:""})}),n.jsx(ie,{label:u("settings.telegram_global.chat_id"),children:n.jsx(Ce,{value:k,onChange:T=>C(T.target.value),placeholder:"889721252"})}),n.jsx(ie,{label:u("settings.telegram_global.poll_interval"),children:n.jsx(Ce,{type:"number",value:String(h),onChange:T=>b(Number(T.target.value)||1500)})})]}),n.jsx(ae,{variant:"primary",loading:w,onClick:R,children:u("common.save")})]})})}function dB(){const e=Xe(),{channels:t,isLoading:a,mutate:r}=Z_(),{contacts:i}=J_(),[l,d]=x.useState(null),[f,p]=x.useState(null),g=new Map;for(const b of i)g.set(String(b.user_id),b.name||`@${b.username||b.user_id}`);const h=async b=>{if(confirm(u("telegram_channels.delete_confirm",{name:b})))try{await Pn.channels.remove(b),e.success(u("telegram_channels.removed")),r()}catch(_){e.error(_.message)}};return n.jsxs(qe,{title:u("telegram_channels.title"),description:u("telegram_channels.desc"),action:n.jsxs(ae,{size:"sm",onClick:()=>d({name:""}),children:[n.jsx(Ot,{size:14})," ",u("telegram_channels.new_btn")]}),children:[a&&n.jsx(tt,{}),!a&&t.length===0&&n.jsx(ut,{children:u("telegram_channels.empty")}),n.jsx("ul",{className:"space-y-2 text-sm",children:t.map(b=>{const _=b.owner_user_id!=null?g.get(String(b.owner_user_id))||u("telegram_ui.user_id_fallback",{id:b.owner_user_id}):u("telegram_channels.no_owner");return n.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("span",{className:"font-medium",children:b.name}),n.jsxs("div",{className:"flex items-center gap-2",children:[b.project&&n.jsxs(Be,{tone:"success",children:["project = ",b.project]}),n.jsxs(ae,{size:"sm",variant:"ghost",onClick:()=>p(b),children:[n.jsx(Sa,{size:13})," ",u("admin.telegram_send_test")]}),n.jsx(ae,{size:"sm",variant:"secondary",onClick:()=>d(b),children:u("common.edit")}),n.jsx(ae,{size:"sm",variant:"destructive",onClick:()=>h(b.name),children:u("common.delete")})]})]}),n.jsxs("div",{className:"mt-1 grid grid-cols-2 gap-2 text-xs text-muted-fg",children:[n.jsxs("span",{children:["chat_id: ",b.chat_id||"—"]}),n.jsxs("span",{children:["bot_token: ",b.bot_token?`…${$o(b.bot_token)??""}`:"—"]}),n.jsxs("span",{children:["route_to_agent: ",b.route_to_agent||u("telegram_ui.default_apx")]}),n.jsxs("span",{children:["engine: ",b.respond_with_engine?u("telegram_ui.yes"):u("telegram_ui.no")]}),n.jsxs("span",{className:"col-span-2",children:[u("telegram_channels.owner_label")," ",_]})]})]},b.name)})}),n.jsx(QN,{channel:l,onClose:()=>d(null),onSaved:()=>{d(null),r()}}),n.jsx(WN,{channel:f,onClose:()=>p(null)})]})}const Uw=new Set(["owner","guest"]);function fB(){const e=Xe(),{roles:t,mutate:a,isLoading:r}=J_(),[i,l]=x.useState(""),[d,f]=x.useState(""),[p,g]=x.useState(!1),[h,b]=x.useState(!1),_=async()=>{const j=i.trim();if(!j){e.error(u("telegram_roles.name_required"));return}if(Uw.has(j)){e.error(u("telegram_roles.builtin_error",{name:j}));return}b(!0);try{const k=p?"*":d.split(",").map(C=>C.trim()).filter(Boolean);await Pn.roles.set(j,k),e.success(u("telegram_roles.saved",{name:j})),l(""),f(""),g(!1),a()}catch(k){e.error(k.message)}finally{b(!1)}},y=async j=>{if(confirm(u("telegram_roles.delete_confirm",{name:j})))try{await Pn.roles.remove(j),e.success(u("telegram_roles.removed")),a()}catch(k){e.error(k.message)}},S=Object.entries(t);return n.jsxs(qe,{title:u("telegram_roles.title"),description:u("telegram_roles.desc"),children:[r&&n.jsx(tt,{}),S.length===0&&!r&&n.jsx(ut,{children:u("telegram_roles.empty")}),S.length>0&&n.jsx("ul",{className:"space-y-2 text-sm",children:S.map(([j,k])=>{const C=Uw.has(j),w=k?.tools==="*"?u("telegram_roles.tools_all"):Array.isArray(k?.tools)&&k.tools.length>0?k.tools.join(", "):u("telegram_roles.tools_none");return n.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("span",{className:"font-medium",children:j}),C&&n.jsx(Be,{tone:"info",children:u("telegram_roles.builtin")})]}),!C&&n.jsx(ae,{size:"sm",variant:"destructive",onClick:()=>y(j),children:u("telegram_roles.delete_btn")})]}),n.jsxs("div",{className:"mt-1 text-xs text-muted-fg",children:[u("telegram_contacts.tools_label")," ",w]})]},j)})}),n.jsxs("div",{className:"mt-4 space-y-3 rounded-md border border-dashed border-border p-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[n.jsx(Ot,{size:14})," ",u("telegram_roles.new_title")]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(ie,{label:u("telegram_roles.name_label"),children:n.jsx(Ce,{value:i,onChange:j=>l(j.target.value),placeholder:u("telegram_roles.name_ph")})}),n.jsx(ie,{label:u("telegram_roles.tools_label"),hint:u("telegram_roles.tools_hint"),children:n.jsx(Ce,{value:d,onChange:j=>f(j.target.value),disabled:p,placeholder:u("telegram_roles.tools_ph")})})]}),n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx(Dt,{checked:p,onChange:g,label:u("telegram_roles.full_access")}),n.jsx(ae,{variant:"primary",loading:h,onClick:_,children:u("telegram_roles.save_btn")})]})]})]})}const bR="apx.settings.telegramTab";function pB(){if(typeof window>"u")return"default";const e=window.localStorage.getItem(bR);return e==="channels"||e==="contacts"||e==="roles"||e==="default"?e:"default"}function mB(){const[e,t]=x.useState("default");x.useEffect(()=>{t(pB())},[]);const a=r=>{const i=r==="channels"||r==="contacts"||r==="roles"||r==="default"?r:"default";t(i);try{window.localStorage.setItem(bR,i)}catch{}};return n.jsxs(Dp,{value:e,onValueChange:a,className:"w-full",children:[n.jsxs(Pp,{children:[n.jsx(qs,{value:"default",children:u("settings.telegram_global.title")}),n.jsx(qs,{value:"channels",children:u("telegram_channels.title")}),n.jsx(qs,{value:"contacts",children:u("telegram_contacts.title")}),n.jsx(qs,{value:"roles",children:u("telegram_roles.title")})]}),n.jsx(fs,{value:"default",className:"mt-4",children:n.jsx(uB,{})}),n.jsx(fs,{value:"channels",className:"mt-4",children:n.jsx(dB,{})}),n.jsx(fs,{value:"contacts",className:"mt-4",children:n.jsx(ZN,{})}),n.jsx(fs,{value:"roles",className:"mt-4",children:n.jsx(fB,{})})]})}function gB(){const{data:e,error:t,isLoading:a,mutate:r}=$e("/api/pair/list",()=>cl.list(),{refreshInterval:sp.pairList});return{clients:e?.clients||[],error:t,isLoading:a,mutate:r}}var Bi={},qh,qw;function hB(){return qw||(qw=1,qh=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),qh}var Hh={},Br={},Hw;function Wo(){if(Hw)return Br;Hw=1;let e;const t=[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];return Br.getSymbolSize=function(r){if(!r)throw new Error('"version" cannot be null or undefined');if(r<1||r>40)throw new Error('"version" should be in range from 1 to 40');return r*4+17},Br.getSymbolTotalCodewords=function(r){return t[r]},Br.getBCHDigit=function(a){let r=0;for(;a!==0;)r++,a>>>=1;return r},Br.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');e=r},Br.isKanjiModeEnabled=function(){return typeof e<"u"},Br.toSJIS=function(r){return e(r)},Br}var Vh={},Vw;function _v(){return Vw||(Vw=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(a){if(typeof a!="string")throw new Error("Param is not a string");switch(a.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 new Error("Unknown EC Level: "+a)}}e.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},e.from=function(r,i){if(e.isValid(r))return r;try{return t(r)}catch{return i}}})(Vh)),Vh}var Fh,Fw;function xB(){if(Fw)return Fh;Fw=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const a=Math.floor(t/8);return(this.buffer[a]>>>7-t%8&1)===1},put:function(t,a){for(let r=0;r<a;r++)this.putBit((t>>>a-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const a=Math.floor(this.length/8);this.buffer.length<=a&&this.buffer.push(0),t&&(this.buffer[a]|=128>>>this.length%8),this.length++}},Fh=e,Fh}var Gh,Gw;function bB(){if(Gw)return Gh;Gw=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,a,r,i){const l=t*this.size+a;this.data[l]=r,i&&(this.reservedBit[l]=!0)},e.prototype.get=function(t,a){return this.data[t*this.size+a]},e.prototype.xor=function(t,a,r){this.data[t*this.size+a]^=r},e.prototype.isReserved=function(t,a){return this.reservedBit[t*this.size+a]},Gh=e,Gh}var Yh={},Yw;function _B(){return Yw||(Yw=1,(function(e){const t=Wo().getSymbolSize;e.getRowColCoords=function(r){if(r===1)return[];const i=Math.floor(r/7)+2,l=t(r),d=l===145?26:Math.ceil((l-13)/(2*i-2))*2,f=[l-7];for(let p=1;p<i-1;p++)f[p]=f[p-1]-d;return f.push(6),f.reverse()},e.getPositions=function(r){const i=[],l=e.getRowColCoords(r),d=l.length;for(let f=0;f<d;f++)for(let p=0;p<d;p++)f===0&&p===0||f===0&&p===d-1||f===d-1&&p===0||i.push([l[f],l[p]]);return i}})(Yh)),Yh}var Kh={},Kw;function vB(){if(Kw)return Kh;Kw=1;const e=Wo().getSymbolSize,t=7;return Kh.getPositions=function(r){const i=e(r);return[[0,0],[i-t,0],[0,i-t]]},Kh}var Xh={},Xw;function yB(){return Xw||(Xw=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(i){return i!=null&&i!==""&&!isNaN(i)&&i>=0&&i<=7},e.from=function(i){return e.isValid(i)?parseInt(i,10):void 0},e.getPenaltyN1=function(i){const l=i.size;let d=0,f=0,p=0,g=null,h=null;for(let b=0;b<l;b++){f=p=0,g=h=null;for(let _=0;_<l;_++){let y=i.get(b,_);y===g?f++:(f>=5&&(d+=t.N1+(f-5)),g=y,f=1),y=i.get(_,b),y===h?p++:(p>=5&&(d+=t.N1+(p-5)),h=y,p=1)}f>=5&&(d+=t.N1+(f-5)),p>=5&&(d+=t.N1+(p-5))}return d},e.getPenaltyN2=function(i){const l=i.size;let d=0;for(let f=0;f<l-1;f++)for(let p=0;p<l-1;p++){const g=i.get(f,p)+i.get(f,p+1)+i.get(f+1,p)+i.get(f+1,p+1);(g===4||g===0)&&d++}return d*t.N2},e.getPenaltyN3=function(i){const l=i.size;let d=0,f=0,p=0;for(let g=0;g<l;g++){f=p=0;for(let h=0;h<l;h++)f=f<<1&2047|i.get(g,h),h>=10&&(f===1488||f===93)&&d++,p=p<<1&2047|i.get(h,g),h>=10&&(p===1488||p===93)&&d++}return d*t.N3},e.getPenaltyN4=function(i){let l=0;const d=i.data.length;for(let p=0;p<d;p++)l+=i.data[p];return Math.abs(Math.ceil(l*100/d/5)-10)*t.N4};function a(r,i,l){switch(r){case e.Patterns.PATTERN000:return(i+l)%2===0;case e.Patterns.PATTERN001:return i%2===0;case e.Patterns.PATTERN010:return l%3===0;case e.Patterns.PATTERN011:return(i+l)%3===0;case e.Patterns.PATTERN100:return(Math.floor(i/2)+Math.floor(l/3))%2===0;case e.Patterns.PATTERN101:return i*l%2+i*l%3===0;case e.Patterns.PATTERN110:return(i*l%2+i*l%3)%2===0;case e.Patterns.PATTERN111:return(i*l%3+(i+l)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}e.applyMask=function(i,l){const d=l.size;for(let f=0;f<d;f++)for(let p=0;p<d;p++)l.isReserved(p,f)||l.xor(p,f,a(i,p,f))},e.getBestMask=function(i,l){const d=Object.keys(e.Patterns).length;let f=0,p=1/0;for(let g=0;g<d;g++){l(g),e.applyMask(g,i);const h=e.getPenaltyN1(i)+e.getPenaltyN2(i)+e.getPenaltyN3(i)+e.getPenaltyN4(i);e.applyMask(g,i),h<p&&(p=h,f=g)}return f}})(Xh)),Xh}var tf={},Qw;function _R(){if(Qw)return tf;Qw=1;const e=_v(),t=[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],a=[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];return tf.getBlocksCount=function(i,l){switch(l){case e.L:return t[(i-1)*4+0];case e.M:return t[(i-1)*4+1];case e.Q:return t[(i-1)*4+2];case e.H:return t[(i-1)*4+3];default:return}},tf.getTotalCodewordsCount=function(i,l){switch(l){case e.L:return a[(i-1)*4+0];case e.M:return a[(i-1)*4+1];case e.Q:return a[(i-1)*4+2];case e.H:return a[(i-1)*4+3];default:return}},tf}var Qh={},kc={},Ww;function jB(){if(Ww)return kc;Ww=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let r=1;for(let i=0;i<255;i++)e[i]=r,t[r]=i,r<<=1,r&256&&(r^=285);for(let i=255;i<512;i++)e[i]=e[i-255]})(),kc.log=function(r){if(r<1)throw new Error("log("+r+")");return t[r]},kc.exp=function(r){return e[r]},kc.mul=function(r,i){return r===0||i===0?0:e[t[r]+t[i]]},kc}var Zw;function kB(){return Zw||(Zw=1,(function(e){const t=jB();e.mul=function(r,i){const l=new Uint8Array(r.length+i.length-1);for(let d=0;d<r.length;d++)for(let f=0;f<i.length;f++)l[d+f]^=t.mul(r[d],i[f]);return l},e.mod=function(r,i){let l=new Uint8Array(r);for(;l.length-i.length>=0;){const d=l[0];for(let p=0;p<i.length;p++)l[p]^=t.mul(i[p],d);let f=0;for(;f<l.length&&l[f]===0;)f++;l=l.slice(f)}return l},e.generateECPolynomial=function(r){let i=new Uint8Array([1]);for(let l=0;l<r;l++)i=e.mul(i,new Uint8Array([1,t.exp(l)]));return i}})(Qh)),Qh}var Wh,Jw;function wB(){if(Jw)return Wh;Jw=1;const e=kB();function t(a){this.genPoly=void 0,this.degree=a,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(r){this.degree=r,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(r){if(!this.genPoly)throw new Error("Encoder not initialized");const i=new Uint8Array(r.length+this.degree);i.set(r);const l=e.mod(i,this.genPoly),d=this.degree-l.length;if(d>0){const f=new Uint8Array(this.degree);return f.set(l,d),f}return l},Wh=t,Wh}var Zh={},Jh={},ex={},e2;function vR(){return e2||(e2=1,ex.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),ex}var fa={},t2;function yR(){if(t2)return fa;t2=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let a="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";a=a.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+a+`)(?:.|[\r
837
+ ]))+`;fa.KANJI=new RegExp(a,"g"),fa.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),fa.BYTE=new RegExp(r,"g"),fa.NUMERIC=new RegExp(e,"g"),fa.ALPHANUMERIC=new RegExp(t,"g");const i=new RegExp("^"+a+"$"),l=new RegExp("^"+e+"$"),d=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return fa.testKanji=function(p){return i.test(p)},fa.testNumeric=function(p){return l.test(p)},fa.testAlphanumeric=function(p){return d.test(p)},fa}var n2;function Zo(){return n2||(n2=1,(function(e){const t=vR(),a=yR();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(l,d){if(!l.ccBits)throw new Error("Invalid mode: "+l);if(!t.isValid(d))throw new Error("Invalid version: "+d);return d>=1&&d<10?l.ccBits[0]:d<27?l.ccBits[1]:l.ccBits[2]},e.getBestModeForData=function(l){return a.testNumeric(l)?e.NUMERIC:a.testAlphanumeric(l)?e.ALPHANUMERIC:a.testKanji(l)?e.KANJI:e.BYTE},e.toString=function(l){if(l&&l.id)return l.id;throw new Error("Invalid mode")},e.isValid=function(l){return l&&l.bit&&l.ccBits};function r(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+i)}}e.from=function(l,d){if(e.isValid(l))return l;try{return r(l)}catch{return d}}})(Jh)),Jh}var s2;function SB(){return s2||(s2=1,(function(e){const t=Wo(),a=_R(),r=_v(),i=Zo(),l=vR(),d=7973,f=t.getBCHDigit(d);function p(_,y,S){for(let j=1;j<=40;j++)if(y<=e.getCapacity(j,S,_))return j}function g(_,y){return i.getCharCountIndicator(_,y)+4}function h(_,y){let S=0;return _.forEach(function(j){const k=g(j.mode,y);S+=k+j.getBitsLength()}),S}function b(_,y){for(let S=1;S<=40;S++)if(h(_,S)<=e.getCapacity(S,y,i.MIXED))return S}e.from=function(y,S){return l.isValid(y)?parseInt(y,10):S},e.getCapacity=function(y,S,j){if(!l.isValid(y))throw new Error("Invalid QR Code version");typeof j>"u"&&(j=i.BYTE);const k=t.getSymbolTotalCodewords(y),C=a.getTotalCodewordsCount(y,S),w=(k-C)*8;if(j===i.MIXED)return w;const E=w-g(j,y);switch(j){case i.NUMERIC:return Math.floor(E/10*3);case i.ALPHANUMERIC:return Math.floor(E/11*2);case i.KANJI:return Math.floor(E/13);case i.BYTE:default:return Math.floor(E/8)}},e.getBestVersionForData=function(y,S){let j;const k=r.from(S,r.M);if(Array.isArray(y)){if(y.length>1)return b(y,k);if(y.length===0)return 1;j=y[0]}else j=y;return p(j.mode,j.getLength(),k)},e.getEncodedBits=function(y){if(!l.isValid(y)||y<7)throw new Error("Invalid QR Code version");let S=y<<12;for(;t.getBCHDigit(S)-f>=0;)S^=d<<t.getBCHDigit(S)-f;return y<<12|S}})(Zh)),Zh}var tx={},a2;function CB(){if(a2)return tx;a2=1;const e=Wo(),t=1335,a=21522,r=e.getBCHDigit(t);return tx.getEncodedBits=function(l,d){const f=l.bit<<3|d;let p=f<<10;for(;e.getBCHDigit(p)-r>=0;)p^=t<<e.getBCHDigit(p)-r;return(f<<10|p)^a},tx}var nx={},sx,r2;function NB(){if(r2)return sx;r2=1;const e=Zo();function t(a){this.mode=e.NUMERIC,this.data=a.toString()}return t.getBitsLength=function(r){return 10*Math.floor(r/3)+(r%3?r%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){let i,l,d;for(i=0;i+3<=this.data.length;i+=3)l=this.data.substr(i,3),d=parseInt(l,10),r.put(d,10);const f=this.data.length-i;f>0&&(l=this.data.substr(i),d=parseInt(l,10),r.put(d,f*3+1))},sx=t,sx}var ax,o2;function EB(){if(o2)return ax;o2=1;const e=Zo(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function a(r){this.mode=e.ALPHANUMERIC,this.data=r}return a.getBitsLength=function(i){return 11*Math.floor(i/2)+6*(i%2)},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(i){let l;for(l=0;l+2<=this.data.length;l+=2){let d=t.indexOf(this.data[l])*45;d+=t.indexOf(this.data[l+1]),i.put(d,11)}this.data.length%2&&i.put(t.indexOf(this.data[l]),6)},ax=a,ax}var rx,i2;function RB(){if(i2)return rx;i2=1;const e=Zo();function t(a){this.mode=e.BYTE,typeof a=="string"?this.data=new TextEncoder().encode(a):this.data=new Uint8Array(a)}return t.getBitsLength=function(r){return r*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(a){for(let r=0,i=this.data.length;r<i;r++)a.put(this.data[r],8)},rx=t,rx}var ox,l2;function TB(){if(l2)return ox;l2=1;const e=Zo(),t=Wo();function a(r){this.mode=e.KANJI,this.data=r}return a.getBitsLength=function(i){return i*13},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(r){let i;for(i=0;i<this.data.length;i++){let l=t.toSJIS(this.data[i]);if(l>=33088&&l<=40956)l-=33088;else if(l>=57408&&l<=60351)l-=49472;else throw new Error("Invalid SJIS character: "+this.data[i]+`
838
+ Make sure your charset is UTF-8`);l=(l>>>8&255)*192+(l&255),r.put(l,13)}},ox=a,ox}var ix={exports:{}},c2;function AB(){return c2||(c2=1,(function(e){var t={single_source_shortest_paths:function(a,r,i){var l={},d={};d[r]=0;var f=t.PriorityQueue.make();f.push(r,0);for(var p,g,h,b,_,y,S,j,k;!f.empty();){p=f.pop(),g=p.value,b=p.cost,_=a[g]||{};for(h in _)_.hasOwnProperty(h)&&(y=_[h],S=b+y,j=d[h],k=typeof d[h]>"u",(k||j>S)&&(d[h]=S,f.push(h,S),l[h]=g))}if(typeof i<"u"&&typeof d[i]>"u"){var C=["Could not find a path from ",r," to ",i,"."].join("");throw new Error(C)}return l},extract_shortest_path_from_predecessor_list:function(a,r){for(var i=[],l=r;l;)i.push(l),a[l],l=a[l];return i.reverse(),i},find_path:function(a,r,i){var l=t.single_source_shortest_paths(a,r,i);return t.extract_shortest_path_from_predecessor_list(l,i)},PriorityQueue:{make:function(a){var r=t.PriorityQueue,i={},l;a=a||{};for(l in r)r.hasOwnProperty(l)&&(i[l]=r[l]);return i.queue=[],i.sorter=a.sorter||r.default_sorter,i},default_sorter:function(a,r){return a.cost-r.cost},push:function(a,r){var i={value:a,cost:r};this.queue.push(i),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(ix)),ix.exports}var u2;function MB(){return u2||(u2=1,(function(e){const t=Zo(),a=NB(),r=EB(),i=RB(),l=TB(),d=yR(),f=Wo(),p=AB();function g(C){return unescape(encodeURIComponent(C)).length}function h(C,w,E){const R=[];let T;for(;(T=C.exec(E))!==null;)R.push({data:T[0],index:T.index,mode:w,length:T[0].length});return R}function b(C){const w=h(d.NUMERIC,t.NUMERIC,C),E=h(d.ALPHANUMERIC,t.ALPHANUMERIC,C);let R,T;return f.isKanjiModeEnabled()?(R=h(d.BYTE,t.BYTE,C),T=h(d.KANJI,t.KANJI,C)):(R=h(d.BYTE_KANJI,t.BYTE,C),T=[]),w.concat(E,R,T).sort(function(z,M){return z.index-M.index}).map(function(z){return{data:z.data,mode:z.mode,length:z.length}})}function _(C,w){switch(w){case t.NUMERIC:return a.getBitsLength(C);case t.ALPHANUMERIC:return r.getBitsLength(C);case t.KANJI:return l.getBitsLength(C);case t.BYTE:return i.getBitsLength(C)}}function y(C){return C.reduce(function(w,E){const R=w.length-1>=0?w[w.length-1]:null;return R&&R.mode===E.mode?(w[w.length-1].data+=E.data,w):(w.push(E),w)},[])}function S(C){const w=[];for(let E=0;E<C.length;E++){const R=C[E];switch(R.mode){case t.NUMERIC:w.push([R,{data:R.data,mode:t.ALPHANUMERIC,length:R.length},{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.ALPHANUMERIC:w.push([R,{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.KANJI:w.push([R,{data:R.data,mode:t.BYTE,length:g(R.data)}]);break;case t.BYTE:w.push([{data:R.data,mode:t.BYTE,length:g(R.data)}])}}return w}function j(C,w){const E={},R={start:{}};let T=["start"];for(let A=0;A<C.length;A++){const z=C[A],M=[];for(let D=0;D<z.length;D++){const L=z[D],I=""+A+D;M.push(I),E[I]={node:L,lastCount:0},R[I]={};for(let P=0;P<T.length;P++){const B=T[P];E[B]&&E[B].node.mode===L.mode?(R[B][I]=_(E[B].lastCount+L.length,L.mode)-_(E[B].lastCount,L.mode),E[B].lastCount+=L.length):(E[B]&&(E[B].lastCount=L.length),R[B][I]=_(L.length,L.mode)+4+t.getCharCountIndicator(L.mode,w))}}T=M}for(let A=0;A<T.length;A++)R[T[A]].end=0;return{map:R,table:E}}function k(C,w){let E;const R=t.getBestModeForData(C);if(E=t.from(w,R),E!==t.BYTE&&E.bit<R.bit)throw new Error('"'+C+'" cannot be encoded with mode '+t.toString(E)+`.
839
+ Suggested mode is: `+t.toString(R));switch(E===t.KANJI&&!f.isKanjiModeEnabled()&&(E=t.BYTE),E){case t.NUMERIC:return new a(C);case t.ALPHANUMERIC:return new r(C);case t.KANJI:return new l(C);case t.BYTE:return new i(C)}}e.fromArray=function(w){return w.reduce(function(E,R){return typeof R=="string"?E.push(k(R,null)):R.data&&E.push(k(R.data,R.mode)),E},[])},e.fromString=function(w,E){const R=b(w,f.isKanjiModeEnabled()),T=S(R),A=j(T,E),z=p.find_path(A.map,"start","end"),M=[];for(let D=1;D<z.length-1;D++)M.push(A.table[z[D]].node);return e.fromArray(y(M))},e.rawSplit=function(w){return e.fromArray(b(w,f.isKanjiModeEnabled()))}})(nx)),nx}var d2;function zB(){if(d2)return Hh;d2=1;const e=Wo(),t=_v(),a=xB(),r=bB(),i=_B(),l=vB(),d=yB(),f=_R(),p=wB(),g=SB(),h=CB(),b=Zo(),_=MB();function y(A,z){const M=A.size,D=l.getPositions(z);for(let L=0;L<D.length;L++){const I=D[L][0],P=D[L][1];for(let B=-1;B<=7;B++)if(!(I+B<=-1||M<=I+B))for(let q=-1;q<=7;q++)P+q<=-1||M<=P+q||(B>=0&&B<=6&&(q===0||q===6)||q>=0&&q<=6&&(B===0||B===6)||B>=2&&B<=4&&q>=2&&q<=4?A.set(I+B,P+q,!0,!0):A.set(I+B,P+q,!1,!0))}}function S(A){const z=A.size;for(let M=8;M<z-8;M++){const D=M%2===0;A.set(M,6,D,!0),A.set(6,M,D,!0)}}function j(A,z){const M=i.getPositions(z);for(let D=0;D<M.length;D++){const L=M[D][0],I=M[D][1];for(let P=-2;P<=2;P++)for(let B=-2;B<=2;B++)P===-2||P===2||B===-2||B===2||P===0&&B===0?A.set(L+P,I+B,!0,!0):A.set(L+P,I+B,!1,!0)}}function k(A,z){const M=A.size,D=g.getEncodedBits(z);let L,I,P;for(let B=0;B<18;B++)L=Math.floor(B/3),I=B%3+M-8-3,P=(D>>B&1)===1,A.set(L,I,P,!0),A.set(I,L,P,!0)}function C(A,z,M){const D=A.size,L=h.getEncodedBits(z,M);let I,P;for(I=0;I<15;I++)P=(L>>I&1)===1,I<6?A.set(I,8,P,!0):I<8?A.set(I+1,8,P,!0):A.set(D-15+I,8,P,!0),I<8?A.set(8,D-I-1,P,!0):I<9?A.set(8,15-I-1+1,P,!0):A.set(8,15-I-1,P,!0);A.set(D-8,8,1,!0)}function w(A,z){const M=A.size;let D=-1,L=M-1,I=7,P=0;for(let B=M-1;B>0;B-=2)for(B===6&&B--;;){for(let q=0;q<2;q++)if(!A.isReserved(L,B-q)){let Y=!1;P<z.length&&(Y=(z[P]>>>I&1)===1),A.set(L,B-q,Y),I--,I===-1&&(P++,I=7)}if(L+=D,L<0||M<=L){L-=D,D=-D;break}}}function E(A,z,M){const D=new a;M.forEach(function(q){D.put(q.mode.bit,4),D.put(q.getLength(),b.getCharCountIndicator(q.mode,A)),q.write(D)});const L=e.getSymbolTotalCodewords(A),I=f.getTotalCodewordsCount(A,z),P=(L-I)*8;for(D.getLengthInBits()+4<=P&&D.put(0,4);D.getLengthInBits()%8!==0;)D.putBit(0);const B=(P-D.getLengthInBits())/8;for(let q=0;q<B;q++)D.put(q%2?17:236,8);return R(D,A,z)}function R(A,z,M){const D=e.getSymbolTotalCodewords(z),L=f.getTotalCodewordsCount(z,M),I=D-L,P=f.getBlocksCount(z,M),B=D%P,q=P-B,Y=Math.floor(D/P),U=Math.floor(I/P),V=U+1,X=Y-U,Q=new p(X);let W=0;const $=new Array(P),K=new Array(P);let J=0;const G=new Uint8Array(A.buffer);for(let oe=0;oe<P;oe++){const _e=oe<q?U:V;$[oe]=G.slice(W,W+_e),K[oe]=Q.encode($[oe]),W+=_e,J=Math.max(J,_e)}const te=new Uint8Array(D);let se=0,pe,F;for(pe=0;pe<J;pe++)for(F=0;F<P;F++)pe<$[F].length&&(te[se++]=$[F][pe]);for(pe=0;pe<X;pe++)for(F=0;F<P;F++)te[se++]=K[F][pe];return te}function T(A,z,M,D){let L;if(Array.isArray(A))L=_.fromArray(A);else if(typeof A=="string"){let Y=z;if(!Y){const U=_.rawSplit(A);Y=g.getBestVersionForData(U,M)}L=_.fromString(A,Y||40)}else throw new Error("Invalid data");const I=g.getBestVersionForData(L,M);if(!I)throw new Error("The amount of data is too big to be stored in a QR Code");if(!z)z=I;else if(z<I)throw new Error(`
840
+ The chosen QR Code version cannot contain this amount of data.
841
+ Minimum version required to store current data is: `+I+`.
842
+ `);const P=E(z,M,L),B=e.getSymbolSize(z),q=new r(B);return y(q,z),S(q),j(q,z),C(q,M,0),z>=7&&k(q,z),w(q,P),isNaN(D)&&(D=d.getBestMask(q,C.bind(null,q,M))),d.applyMask(D,q),C(q,M,D),{modules:q,version:z,errorCorrectionLevel:M,maskPattern:D,segments:L}}return Hh.create=function(z,M){if(typeof z>"u"||z==="")throw new Error("No input text");let D=t.M,L,I;return typeof M<"u"&&(D=t.from(M.errorCorrectionLevel,t.M),L=g.from(M.version),I=d.from(M.maskPattern),M.toSJISFunc&&e.setToSJISFunction(M.toSJISFunc)),T(z,L,D,I)},Hh}var lx={},cx={},f2;function jR(){return f2||(f2=1,(function(e){function t(a){if(typeof a=="number"&&(a=a.toString()),typeof a!="string")throw new Error("Color should be defined as hex string");let r=a.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+a);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(l){return[l,l]}))),r.length===6&&r.push("F","F");const i=parseInt(r.join(""),16);return{r:i>>24&255,g:i>>16&255,b:i>>8&255,a:i&255,hex:"#"+r.slice(0,6).join("")}}e.getOptions=function(r){r||(r={}),r.color||(r.color={});const i=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,l=r.width&&r.width>=21?r.width:void 0,d=r.scale||4;return{width:l,scale:l?4:d,margin:i,color:{dark:t(r.color.dark||"#000000ff"),light:t(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},e.getScale=function(r,i){return i.width&&i.width>=r+i.margin*2?i.width/(r+i.margin*2):i.scale},e.getImageWidth=function(r,i){const l=e.getScale(r,i);return Math.floor((r+i.margin*2)*l)},e.qrToImageData=function(r,i,l){const d=i.modules.size,f=i.modules.data,p=e.getScale(d,l),g=Math.floor((d+l.margin*2)*p),h=l.margin*p,b=[l.color.light,l.color.dark];for(let _=0;_<g;_++)for(let y=0;y<g;y++){let S=(_*g+y)*4,j=l.color.light;if(_>=h&&y>=h&&_<g-h&&y<g-h){const k=Math.floor((_-h)/p),C=Math.floor((y-h)/p);j=b[f[k*d+C]?1:0]}r[S++]=j.r,r[S++]=j.g,r[S++]=j.b,r[S]=j.a}}})(cx)),cx}var p2;function OB(){return p2||(p2=1,(function(e){const t=jR();function a(i,l,d){i.clearRect(0,0,l.width,l.height),l.style||(l.style={}),l.height=d,l.width=d,l.style.height=d+"px",l.style.width=d+"px"}function r(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(l,d,f){let p=f,g=d;typeof p>"u"&&(!d||!d.getContext)&&(p=d,d=void 0),d||(g=r()),p=t.getOptions(p);const h=t.getImageWidth(l.modules.size,p),b=g.getContext("2d"),_=b.createImageData(h,h);return t.qrToImageData(_.data,l,p),a(b,g,h),b.putImageData(_,0,0),g},e.renderToDataURL=function(l,d,f){let p=f;typeof p>"u"&&(!d||!d.getContext)&&(p=d,d=void 0),p||(p={});const g=e.render(l,d,p),h=p.type||"image/png",b=p.rendererOpts||{};return g.toDataURL(h,b.quality)}})(lx)),lx}var ux={},m2;function DB(){if(m2)return ux;m2=1;const e=jR();function t(i,l){const d=i.a/255,f=l+'="'+i.hex+'"';return d<1?f+" "+l+'-opacity="'+d.toFixed(2).slice(1)+'"':f}function a(i,l,d){let f=i+l;return typeof d<"u"&&(f+=" "+d),f}function r(i,l,d){let f="",p=0,g=!1,h=0;for(let b=0;b<i.length;b++){const _=Math.floor(b%l),y=Math.floor(b/l);!_&&!g&&(g=!0),i[b]?(h++,b>0&&_>0&&i[b-1]||(f+=g?a("M",_+d,.5+y+d):a("m",p,0),p=0,g=!1),_+1<l&&i[b+1]||(f+=a("h",h),h=0)):p++}return f}return ux.render=function(l,d,f){const p=e.getOptions(d),g=l.modules.size,h=l.modules.data,b=g+p.margin*2,_=p.color.light.a?"<path "+t(p.color.light,"fill")+' d="M0 0h'+b+"v"+b+'H0z"/>':"",y="<path "+t(p.color.dark,"stroke")+' d="'+r(h,g,p.margin)+'"/>',S='viewBox="0 0 '+b+" "+b+'"',k='<svg xmlns="http://www.w3.org/2000/svg" '+(p.width?'width="'+p.width+'" height="'+p.width+'" ':"")+S+' shape-rendering="crispEdges">'+_+y+`</svg>
843
+ `;return typeof f=="function"&&f(null,k),k},ux}var g2;function PB(){if(g2)return Bi;g2=1;const e=hB(),t=zB(),a=OB(),r=DB();function i(l,d,f,p,g){const h=[].slice.call(arguments,1),b=h.length,_=typeof h[b-1]=="function";if(!_&&!e())throw new Error("Callback required as last argument");if(_){if(b<2)throw new Error("Too few arguments provided");b===2?(g=f,f=d,d=p=void 0):b===3&&(d.getContext&&typeof g>"u"?(g=p,p=void 0):(g=p,p=f,f=d,d=void 0))}else{if(b<1)throw new Error("Too few arguments provided");return b===1?(f=d,d=p=void 0):b===2&&!d.getContext&&(p=f,f=d,d=void 0),new Promise(function(y,S){try{const j=t.create(f,p);y(l(j,d,p))}catch(j){S(j)}})}try{const y=t.create(f,p);g(null,l(y,d,p))}catch(y){g(y)}}return Bi.create=t.create,Bi.toCanvas=i.bind(null,a.render),Bi.toDataURL=i.bind(null,a.renderToDataURL),Bi.toString=i.bind(null,function(l,d,f){return r.render(l,f)}),Bi}var LB=PB();const IB=xb(LB);function $B({value:e,size:t=200}){const[a,r]=x.useState(null);return x.useEffect(()=>{let i=!0;return IB.toDataURL(e,{margin:2,width:t*2,errorCorrectionLevel:"M"}).then(l=>{i&&r(l)}).catch(()=>{i&&r(null)}),()=>{i=!1}},[e,t]),n.jsx("div",{className:"grid place-items-center rounded-lg bg-white p-3",style:{width:t+24,height:t+24},children:a?n.jsx("img",{src:a,width:t,height:t,alt:"QR"}):n.jsx("div",{className:"size-full animate-pulse rounded bg-muted"})})}function BB(e){return e.find(t=>!t.includes("127.0.0.1")&&!t.includes("localhost"))||e[0]||window.location.origin}function UB({open:e,onClose:t,onPaired:a}){const r=Xe(),[i,l]=x.useState(null),[d,f]=x.useState(null),[p,g]=x.useState(0),[h,b]=x.useState(!1),_=x.useRef(null),y=x.useCallback(async()=>{l(null),f(null),b(!1);try{const w=await cl.init();l(w),g(Math.round((w.ttl_ms||9e4)/1e3))}catch(w){w instanceof du&&w.status===403?f(u("settings.devices_pair_localhost_only")):f(w.message)}},[]);x.useEffect(()=>{e?y():(l(null),f(null),b(!1))},[e,y]),x.useEffect(()=>{if(!i||h||p<=0)return;const w=window.setTimeout(()=>g(E=>E-1),1e3);return()=>window.clearTimeout(w)},[i,p,h]),x.useEffect(()=>{if(!e||!i||h)return;let w=!0;const E=async()=>{try{const R=await cl.status(i.pairing_id);if(!w)return;if(R.status==="confirmed"){b(!0),r.success(u("settings.devices_pair_done")),a(),window.setTimeout(()=>{w&&t()},900);return}if(R.status==="expired"||R.status==="unknown"){g(0);return}}catch{}_.current=window.setTimeout(E,1500)};return _.current=window.setTimeout(E,1500),()=>{w=!1,_.current&&window.clearTimeout(_.current)}},[e,i,h,t,a,r]);const S=!!i&&!h&&p<=0,j=i?BB(i.lan_urls):"",k=i?`${j}/#pair=${i.pairing_id}`:"",C=async(w,E)=>{try{await navigator.clipboard.writeText(w),r.success(E)}catch{r.error(w)}};return n.jsxs(Bt,{open:e,onClose:t,title:u("settings.devices_pair_title"),description:u("settings.devices_pair_desc"),footer:n.jsx(ae,{variant:"secondary",onClick:t,children:u("common.close")}),children:[d&&n.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:d}),!d&&!i&&n.jsxs("div",{className:"flex items-center gap-2 py-8 text-sm text-muted-fg",children:[n.jsx(bn,{})," ",u("common.loading")]}),!d&&i&&n.jsxs("div",{className:"flex flex-col items-center gap-4",children:[n.jsx("div",{className:S?"opacity-40":"",children:n.jsx($B,{value:k,size:196})}),h?n.jsx("p",{className:"text-sm font-medium text-emerald-500",children:u("settings.devices_pair_done")}):S?n.jsxs("div",{className:"flex flex-col items-center gap-2",children:[n.jsx("p",{className:"text-sm text-muted-fg",children:u("settings.devices_pair_expired")}),n.jsx(ae,{variant:"primary",onClick:()=>void y(),children:u("settings.devices_pair_regen")})]}):n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-center text-xs text-muted-fg",children:u("settings.devices_pair_scan")}),n.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[n.jsx(bn,{size:12}),n.jsx("span",{children:u("settings.devices_pair_waiting")}),n.jsxs("span",{className:"tabular-nums",children:["· ",u("settings.devices_pair_expires",{s:p})]})]}),n.jsxs("div",{className:"w-full space-y-3 border-t border-border pt-3",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("p",{className:"text-xs text-muted-fg",children:u("settings.devices_pair_link")}),n.jsxs("div",{className:"flex items-stretch gap-2",children:[n.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-xs",children:k}),n.jsx(Ue,{content:u("settings.devices_pair_copy"),children:n.jsx(ae,{size:"sm",variant:"secondary",onClick:()=>C(k,u("settings.devices_pair_copied")),children:n.jsx(zo,{size:14})})})]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsx("p",{className:"text-xs text-muted-fg",children:u("settings.devices_pair_code")}),n.jsxs("div",{className:"flex items-stretch gap-2",children:[n.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-center text-sm",children:i.pairing_id}),n.jsx(Ue,{content:u("settings.devices_pair_copy"),children:n.jsx(ae,{size:"sm",variant:"secondary",onClick:()=>C(i.pairing_id,u("settings.devices_pair_copied_code")),children:n.jsx(zo,{size:14})})})]})]})]})]})]})]})}function qB(){const e=Xe(),{clients:t,isLoading:a,mutate:r}=gB(),[i,l]=x.useState(!1),[d,f]=x.useState(""),p=async h=>{if(confirm(u("settings.devices_revoke_confirm",{id:h})))try{await cl.revoke(h),e.success(u("settings.devices_revoke_success")),r()}catch(b){e.error(b.message)}},g=()=>{const h=d.trim();if(h){Ao(h);try{localStorage.setItem(Dn.token,h)}catch{}f(""),e.success(u("settings.token_saved"))}};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs(qe,{title:u("settings.devices"),description:u("settings.devices_sub"),action:n.jsxs(ae,{size:"sm",variant:"primary",onClick:()=>l(!0),children:[n.jsx(UM,{size:14})," ",u("settings.devices_pair_btn")]}),children:[a&&n.jsx(tt,{}),!a&&t.length===0&&n.jsx(ut,{children:u("settings.devices_empty")}),t.length>0&&n.jsx("ul",{className:"space-y-2 text-sm",children:t.map(h=>n.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsx("span",{className:"font-medium",children:h.label||h.id}),n.jsx(Be,{tone:h.kind==="web"?"info":h.kind==="deck"?"success":"muted",children:h.kind}),n.jsxs("span",{className:"font-mono text-xs text-muted-fg",children:["…",h.token_suffix]}),n.jsxs("span",{className:"ml-auto text-xs text-muted-fg",children:[u("settings.devices_last_seen")," ",h.last_seen?new Date(h.last_seen).toLocaleString():u("settings.devices_never")]}),n.jsx(ae,{size:"sm",variant:"destructive",onClick:()=>p(h.id),children:u("settings.devices_revoke")})]},h.id))}),n.jsx(UB,{open:i,onClose:()=>l(!1),onPaired:()=>r()})]}),n.jsxs(qe,{title:u("settings.token"),description:u("settings.token_sub"),children:[n.jsx(ie,{label:u("settings_ui.bearer_label"),children:n.jsx(Ce,{type:"password",placeholder:G_()?u("settings.token_active"):u("settings.token_paste"),value:d,onChange:h=>f(h.target.value),className:"font-mono",onKeyDown:h=>{h.key==="Enter"&&g()}})}),n.jsx("div",{className:"mt-2",children:n.jsx(ae,{variant:"primary",onClick:g,children:u("common.save")})})]})]})}const HB=[{key:"daemon",label:"Daemon",description:"~/.apx/config.json. General APX config.",fields:[{path:"port",label:"Port",kind:"number",placeholder:"7430"},{path:"host",label:"Host",placeholder:"127.0.0.1"},{path:"log_level",label:"Log level",placeholder:"info"},{path:"user.language",label:"Language",placeholder:"en"},{path:"user.locale",label:"Locale",placeholder:"en-US"},{path:"user.timezone",label:"Timezone",placeholder:"America/Argentina/Salta"}]},{key:"super-agent",label:"Super-agent",fields:[{path:"super_agent.enabled",label:"Super-agent enabled",kind:"boolean"},{path:"super_agent.model",label:"Model",placeholder:"gemini:gemini-2.5-flash"},{path:"super_agent.permission_mode",label:"Permission mode",kind:"select",options:Hb.map(e=>({value:e,label:e}))},{path:"super_agent.system",label:"Extra prompt",kind:"textarea"}]},{key:"telegram",label:"Telegram",fields:[{path:"telegram.enabled",label:"Polling enabled",kind:"boolean"},{path:"telegram.poll_interval_ms",label:"Poll interval ms",kind:"number",placeholder:"1500"},{path:"telegram.respond_with_engine",label:"Respond with engine",kind:"boolean"},{path:"telegram.route_to_agent",label:"Route to agent",placeholder:"master"},{path:"telegram.channels.0.chat_id",label:"Default chat ID"},{path:"telegram.channels.0.bot_token",label:"Default bot token",kind:"password"}]},{key:"engines",label:"Engines",fields:[{path:"engines.anthropic.api_key",label:"Anthropic API key",kind:"password"},{path:"engines.openai.api_key",label:"OpenAI API key",kind:"password"},{path:"engines.openai.base_url",label:"OpenAI base URL",placeholder:"https://api.openai.com/v1"},{path:"engines.groq.api_key",label:"Groq API key",kind:"password"},{path:"engines.groq.base_url",label:"Groq base URL",placeholder:"https://api.groq.com/openai/v1"},{path:"engines.openrouter.api_key",label:"OpenRouter API key",kind:"password"},{path:"engines.openrouter.base_url",label:"OpenRouter base URL",placeholder:"https://openrouter.ai/api/v1"},{path:"engines.gemini.api_key",label:"Gemini API key",kind:"password"},{path:"engines.ollama.base_url",label:"Ollama URL",placeholder:"http://localhost:11434"}]}];function VB(){const{config:e,isLoading:t,patch:a,mutate:r}=fr();if(t)return n.jsx(tt,{});const i=async l=>{const d={};for(const[f,p]of Object.entries(pv(l)))ps(p)||(d[f]=p);await a(d),r()};return n.jsx(qe,{title:u("global_config.title"),description:u("settings_ui.global_config_desc"),children:n.jsx(pf,{sections:HB,source:e,jsonTitle:"~/.apx/config.json",jsonDescription:u("settings_ui.global_json_desc"),onSaveFields:async(l,d)=>{await a(l,d),r()},onSaveJson:i})})}function FB(){const e=Xe(),{health:t,isUp:a}=XN(),r=async()=>{try{await ll.reload(),e.success(u("settings.advanced.reload_success"))}catch(i){e.error(i.message)}};return n.jsxs("div",{className:"space-y-6",children:[n.jsx(qe,{title:u("daemon.version"),action:n.jsx(ae,{size:"sm",onClick:r,children:u("common.reload")}),children:n.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[n.jsx(dx,{label:u("daemon.version"),value:t?.version||"—"}),n.jsx(dx,{label:u("daemon.uptime"),value:t?`${t.uptime_s}s`:"—"}),n.jsx(dx,{label:u("daemon.status"),value:u(a?"daemon.running":"daemon.down"),ok:a})]})}),n.jsx(VB,{})]})}function dx({label:e,value:t,ok:a}){return n.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),n.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[a!==void 0&&n.jsx(mu,{ok:a}),n.jsx("span",{children:t})]})]})}function GB(){const{preference:e,set:t}=Vb(),[a,r]=x.useState(q_()),i=l=>{kN(l),r(l),window.location.reload()};return n.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[n.jsx(qe,{title:u("settings.appearance"),children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ae,{variant:e==="light"?"primary":"secondary",onClick:()=>t("light"),children:u("settings.light_mode")}),n.jsx(ae,{variant:e==="dark"?"primary":"secondary",onClick:()=>t("dark"),children:u("settings.dark_mode")}),n.jsx(ae,{variant:e==="system"?"primary":"secondary",onClick:()=>t("system"),children:u("settings.system_mode")})]})}),n.jsx(qe,{title:u("settings.language"),children:n.jsx("div",{className:"flex items-center gap-2",children:wN.map(l=>n.jsx(ae,{variant:a===l.value?"primary":"secondary",onClick:()=>i(l.value),children:l.label},l.value))})})]})}function YB({className:e,...t}){return n.jsx("kbd",{"data-slot":"kbd",className:St("pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",e),...t})}const pb=typeof navigator<"u"&&/mac/i.test(navigator.platform||"");function KB(e){return(pb?{CommandOrControl:"⌘ Cmd",CmdOrCtrl:"⌘ Cmd",Command:"⌘ Cmd",Cmd:"⌘ Cmd",Super:"⌘ Cmd",Meta:"⌘ Cmd",Control:"⌃ Ctrl",Ctrl:"⌃ Ctrl",Option:"⌥ Opt",Alt:"⌥ Opt",Shift:"⇧ Shift"}:{CommandOrControl:"Ctrl",CmdOrCtrl:"Ctrl",Control:"Ctrl",Ctrl:"Ctrl",Command:"Win",Cmd:"Win",Super:"Win",Meta:"Win",Option:"Alt",Alt:"Alt",Shift:"Shift"})[e]??e}function XB(e){return(e||"").split("+").map(t=>t.trim()).filter(Boolean)}function QB(e){const t=e.code;if(/^(Shift|Control|Alt|Meta|OS)(Left|Right)?$/.test(t))return null;let a;if((a=t.match(/^Key([A-Z])$/))||(a=t.match(/^Digit(\d)$/))||(a=t.match(/^Numpad(\d)$/))||(a=t.match(/^(F\d{1,2})$/))||(a=t.match(/^Arrow(Up|Down|Left|Right)$/)))return a[1];const r={Space:"Space",Enter:"Enter",Tab:"Tab",Backspace:"Backspace",Delete:"Delete",Home:"Home",End:"End",PageUp:"PageUp",PageDown:"PageDown",Insert:"Insert",Minus:"-",Equal:"=",BracketLeft:"[",BracketRight:"]",Backslash:"\\",Semicolon:";",Quote:"'",Comma:",",Period:".",Slash:"/",Backquote:"`"};return r[t]?r[t]:e.key&&e.key.length===1?e.key.toUpperCase():null}function WB(e){const t=QB(e);if(!t)return null;const a=[];(pb?e.metaKey:e.ctrlKey)&&a.push("CommandOrControl"),pb&&e.ctrlKey&&a.push("Control"),e.altKey&&a.push("Alt"),e.shiftKey&&a.push("Shift");const r=a.length>0,i=/^F\d{1,2}$/.test(t);return!r&&!i?null:(a.push(t),a.join("+"))}function ZB({value:e,onChange:t,disabled:a,className:r,trailing:i}){const[l,d]=x.useState(!1),f=x.useRef(null);x.useEffect(()=>{if(!l)return;const g=h=>{if(h.preventDefault(),h.stopPropagation(),h.key==="Escape"){d(!1);return}const b=WB(h);b&&(t(b),d(!1))};return window.addEventListener("keydown",g,!0),()=>window.removeEventListener("keydown",g,!0)},[l,t]);const p=XB(e);return n.jsxs("div",{className:me("flex h-9 w-full max-w-md items-center rounded-md border border-border bg-transparent transition",l&&"ring-2 ring-ring",a&&"opacity-50",r),children:[n.jsxs("button",{ref:f,type:"button",disabled:a,onClick:()=>d(g=>!g),onBlur:()=>d(!1),"aria-label":u("modules_ui.desktop_shortcut_record"),className:"flex h-full min-w-0 flex-1 items-center gap-1.5 rounded-l-md px-3 text-sm outline-none hover:bg-muted/40 focus-visible:bg-muted/40",children:[l?n.jsx("span",{className:"text-muted-fg",children:u("modules_ui.desktop_shortcut_recording")}):p.length?n.jsx("span",{className:"flex min-w-0 flex-wrap items-center gap-1",children:p.map((g,h)=>n.jsxs("span",{className:"flex items-center gap-1",children:[h>0&&n.jsx("span",{className:"text-xs text-muted-fg",children:"+"}),n.jsx(YB,{className:"h-6 min-w-6 border border-border bg-muted px-1.5 text-[13px] font-semibold text-fg shadow-sm",children:KB(g)})]},h))}):n.jsx("span",{className:"text-muted-fg",children:u("modules_ui.desktop_shortcut_record")}),n.jsx("span",{className:"ml-auto whitespace-nowrap pl-2 text-xs text-muted-fg",children:u(l?"modules_ui.desktop_shortcut_esc":"modules_ui.desktop_shortcut_change")})]}),i?n.jsx("div",{className:"flex h-full items-center border-l border-border px-1",children:i}):null]})}const Vi={status:()=>ne.get("/api/desktop/status"),start:()=>ne.post("/api/desktop/start",{}),stop:()=>ne.post("/api/desktop/stop",{}),restart:()=>ne.post("/api/desktop/restart",{}),autostartGet:()=>ne.get("/api/desktop/autostart"),autostartSet:e=>ne.post("/api/desktop/autostart",{enable:e})};function JB(e=30){return ne.get(`/api/messages/global?channel=desktop&limit=${e}`)}function kR({showConfigLink:e=!1}){const t=Xe(),{data:a,isLoading:r,mutate:i}=$e("/api/desktop/status",()=>Vi.status(),{refreshInterval:5e3}),l=!!a?.running,[d,f]=x.useState(null),p=async(_,y)=>{f(_);try{await y()}catch(S){t.error(S.message)}finally{f(null),setTimeout(()=>i(),1200)}},g=()=>p("start",async()=>{const _=await Vi.start();t.success(_.already?u("modules_ui.desktop_start_already"):u("modules_ui.desktop_start_done"))}),h=()=>p("stop",async()=>{const _=await Vi.stop();t.success(_.stopped?u("modules_ui.desktop_stop_done"):u("modules_ui.desktop_stop_none"))}),b=()=>p("restart",async()=>{(await Vi.restart()).reloaded>0?t.success(u("modules_ui.desktop_restart_done")):t.info(u("modules_ui.desktop_restart_none"))});return n.jsx(qe,{title:u("desktop_screen.status_title"),description:u("modules_ui.desktop_status_desc"),action:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ae,{variant:"primary",size:"sm",onClick:g,loading:d==="start",disabled:l||d!==null&&d!=="start",children:u("modules_ui.desktop_start")}),n.jsx(ae,{variant:"secondary",size:"sm",onClick:h,loading:d==="stop",disabled:!l||d!==null&&d!=="stop",children:u("modules_ui.desktop_stop")}),n.jsx(ae,{variant:"secondary",size:"sm",onClick:b,loading:d==="restart",disabled:!l||d!==null&&d!=="restart",title:u("modules_ui.desktop_restart_hint"),children:u("modules_ui.desktop_restart")}),e&&n.jsx(Kf,{to:"/settings/desktop",children:n.jsxs(ae,{size:"sm",variant:"ghost",children:[n.jsx(np,{size:14})," ",u("desktop_screen.open_config")]})})]}),children:r?n.jsx(tt,{}):n.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",children:[n.jsx(mu,{ok:l}),n.jsx("span",{className:"font-medium",children:u(l?"modules_ui.desktop_running":"modules_ui.desktop_stopped")}),n.jsx("button",{type:"button",onClick:()=>i(),className:"text-xs text-muted-fg underline-offset-2 hover:underline",children:u("modules_ui.desktop_refresh")}),n.jsxs("span",{className:"text-xs text-muted-fg",children:["(",u("modules_ui.desktop_from_terminal")," ",n.jsx(Hk,{children:"apx desktop start"})," · ",n.jsx(Hk,{children:"apx desktop --debug"}),")"]})]})})}const eU="CommandOrControl+G",tU=()=>[{value:"left",label:u("modules_ui.desktop_pos_left")},{value:"center",label:u("modules_ui.desktop_pos_center")},{value:"right",label:u("modules_ui.desktop_pos_right")}],nU=()=>[{value:"system",label:u("modules_ui.desktop_theme_system")},{value:"light",label:u("modules_ui.desktop_theme_light")},{value:"dark",label:u("modules_ui.desktop_theme_dark")}];function sU(){const e=Xe(),{config:t,isLoading:a,patch:r}=fr(),i=t,l=i.desktop?.shortcut||i.overlay?.shortcut||eU,d=i.desktop?.enabled!==!1,f=i.desktop?.theme||"system",p=i.desktop?.position||"right",{data:g,mutate:h}=$e("/api/desktop/autostart",()=>Vi.autostartGet()),[b,_]=x.useState(l),[y,S]=x.useState(!1),[j,k]=x.useState(!1);x.useEffect(()=>_(l),[l]);const C=async()=>{const R=b.trim();if(!(!R||R===l)){S(!0);try{await r({"desktop.shortcut":R}),e.success(u("modules_ui.desktop_shortcut_saved"))}catch(T){e.error(T.message)}finally{S(!1)}}},w=async(R,T,A)=>{S(!0);try{await r({[R]:T}),e.success(A)}catch(z){e.error(z.message)}finally{S(!1)}},E=async R=>{k(!0);try{await Vi.autostartSet(R),await h(),e.success(u(R?"modules_ui.desktop_autostart_on":"modules_ui.desktop_autostart_off"))}catch(T){e.error(T.message)}finally{k(!1)}};return n.jsxs("div",{className:"space-y-6","data-testid":"settings-desktop",children:[n.jsx(kR,{}),n.jsx(qe,{title:u("desktop_screen.autostart_title"),description:u("modules_ui.desktop_autostart_desc"),children:g?n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx(Dt,{checked:g.enabled,onChange:E,disabled:j,label:g.enabled?u("common.enabled"):u("common.disabled")}),n.jsx("span",{className:"text-xs text-muted-fg",children:u("modules_ui.desktop_platform",{platform:g.platform})})]}):n.jsx(tt,{})}),n.jsx(qe,{title:u("desktop_screen.shortcut_title"),description:u("modules_ui.desktop_shortcut_desc"),children:a?n.jsx(tt,{}):n.jsx(ie,{label:u("modules_ui.desktop_accelerator"),hint:u("modules_ui.desktop_accelerator_hint"),children:n.jsx(ZB,{value:b,onChange:_,disabled:y,trailing:n.jsx(ae,{variant:"primary",size:"sm",onClick:C,loading:y,disabled:!b.trim()||b.trim()===l,children:u("common.save")})})})}),n.jsx(qe,{title:u("desktop_screen.appearance_title"),description:u("modules_ui.desktop_appearance_desc"),children:a?n.jsx(tt,{}):n.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[n.jsx(ie,{label:u("modules_ui.desktop_theme"),hint:u("modules_ui.desktop_restart_apply"),children:n.jsx(ct,{value:f,onChange:R=>w("desktop.theme",R,u("modules_ui.desktop_theme_set",{value:R})),options:nU(),disabled:y})}),n.jsx(ie,{label:u("modules_ui.desktop_position"),hint:u("modules_ui.desktop_position_hint"),children:n.jsx(ct,{value:p,onChange:R=>w("desktop.position",R,u("modules_ui.desktop_position_set",{value:R})),options:tU(),disabled:y})})]})}),n.jsx(qe,{title:u("desktop_screen.activation_title"),description:u("modules_ui.desktop_activation_desc"),children:a?n.jsx(tt,{}):n.jsxs("div",{className:"space-y-3",children:[n.jsx(Dt,{checked:d,onChange:R=>w("desktop.enabled",R,u(R?"modules_ui.desktop_enabled_toast":"modules_ui.desktop_disabled_toast")),disabled:y,label:u(d?"modules_ui.desktop_plugin_on":"modules_ui.desktop_plugin_off")}),n.jsxs("p",{className:"text-xs text-muted-fg",children:[u("modules_ui.desktop_stt_engine")," ",n.jsx(Kf,{to:"/settings/voice",className:"font-medium text-fg underline underline-offset-2",children:u("nav.modules.voice")})," ",u("modules_ui.desktop_stt_engine_suffix")]})]})})]})}function aU({engines:e,order:t,onToggleEnabled:a,onToggleEmotions:r,onReorder:i,onConfigure:l,onRemove:d,onAddNew:f,busy:p}){const g=e.filter(y=>y.id!=="mock"),h=new Map(g.map(y=>[y.id,y])),b=[...t.filter(y=>h.has(y)),...g.map(y=>y.id).filter(y=>!t.includes(y))],_=(y,S)=>{const j=b.indexOf(y),k=j+S;if(j<0||k<0||k>=b.length)return;const C=[...b];[C[j],C[k]]=[C[k],C[j]],i(C)};return n.jsxs("div",{className:"space-y-2",children:[b.map((y,S)=>{const j=h.get(y),k=Of[y],C=j.custom?j.label||y:k?.name||y,w=j.custom?j.note||u("voice_ui.custom_note"):k?.note||"";return n.jsxs("div",{"data-testid":`voice-provider-${y}`,className:me("flex items-center gap-3 rounded-lg border px-3 py-2.5 border-border",!j.enabled&&"opacity-60"),children:[n.jsxs("div",{className:"flex flex-col",children:[n.jsx("button",{type:"button",onClick:()=>_(y,-1),disabled:p||S===0,"aria-label":u("voice_ui.move_up"),"data-testid":`voice-provider-${y}-up`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:n.jsx(Eb,{className:"size-3.5"})}),n.jsx("button",{type:"button",onClick:()=>_(y,1),disabled:p||S===b.length-1,"aria-label":u("voice_ui.move_down"),"data-testid":`voice-provider-${y}-down`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:n.jsx(ms,{className:"size-3.5"})})]}),n.jsx(mu,{ok:j.available?!0:j.configured?!1:null}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-sm font-medium",children:C}),j.custom&&n.jsx(Be,{tone:"info",children:u("voice_ui.badge_custom")}),k?.local&&n.jsx(Be,{tone:"info",children:u("voice_ui.badge_local")}),j.available?n.jsx(Be,{tone:"success",children:u("voice_ui.badge_available")}):j.configured?n.jsx(Be,{tone:"warning",children:u("voice_ui.badge_unavailable")}):n.jsx(Be,{tone:"muted",children:u("voice_ui.badge_not_configured")})]}),n.jsx("div",{className:"truncate text-xs text-muted-fg",children:w})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[j.emotionsApplicable&&n.jsx("button",{type:"button",onClick:()=>r(y,!j.emotionsOn),disabled:p,title:u("voice_ui.emotions_hint"),"data-testid":`voice-provider-${y}-emotions`,className:me("rounded-md border px-2 py-1 text-xs font-medium transition-colors disabled:opacity-50",j.emotionsOn?"border-emerald-500/50 bg-emerald-500/10 text-emerald-300":"border-border text-muted-fg hover:text-fg"),children:u("voice_ui.emotions_short")}),n.jsx(Dt,{checked:j.enabled,onChange:E=>a(y,E),disabled:p}),n.jsxs(ae,{size:"sm",variant:"secondary",onClick:()=>l(y),"data-testid":`voice-provider-${y}-config`,children:[n.jsx(HM,{className:"size-3.5"})," ",u("voice_ui.configure")]}),j.custom&&n.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>d(y),disabled:p,"aria-label":u("voice_ui.remove"),"data-testid":`voice-provider-${y}-remove`,children:n.jsx(_n,{className:"size-3.5"})})]})]},y)}),n.jsxs("button",{type:"button",onClick:f,disabled:p,"data-testid":"voice-provider-add",className:"flex w-full items-center justify-center gap-2 rounded-lg border border-dashed border-border px-3 py-2.5 text-sm text-muted-fg transition-colors hover:border-emerald-500/50 hover:text-fg disabled:opacity-50",children:[n.jsx(Ot,{className:"size-4"})," ",u("voice_ui.add_provider")]})]})}function Nn(e){return typeof e=="string"?e:e==null?"":String(e)}function rU(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function h2({on:e,setOn:t,tags:a,setTags:r}){return n.jsxs("div",{className:"rounded-md border border-border/60 p-3 space-y-2",children:[n.jsx(Dt,{checked:e,onChange:t,label:u("voice_ui.emotions_label")}),n.jsx("p",{className:"text-xs text-muted-fg",children:u("voice_ui.emotions_hint")}),e&&n.jsx(ie,{label:u("voice_ui.emotions_tags_label"),hint:u("voice_ui.emotions_tags_hint"),children:n.jsx(Ce,{value:a,onChange:i=>r(i.target.value),placeholder:KP.join(", ")})})]})}function oU({open:e,providerId:t,config:a,onClose:r,onSave:i}){const[l,d]=x.useState(!1),[f,p]=x.useState(null),[g,h]=x.useState(""),[b,_]=x.useState({}),[y,S]=x.useState(!1),[j,k]=x.useState(""),[C,w]=x.useState(!1);if(x.useEffect(()=>{if(!e||!t)return;p(null),h("");const P=a||{},B=P.emotions;if(S(!!B?.enabled),k(Array.isArray(B?.tags)?B.tags.join(", "):""),w(!1),t==="__new__"||t.startsWith("custom:")){const Y=P;_({label:Nn(Y.label),base_url:Nn(Y.base_url),model:Nn(Y.model),voice:Nn(Y.voice),format:Nn(Y.format),style:Nn(Y.style),temperature:Nn(Y.temperature)})}else if(t==="piper"){const Y=P;_({bin:Nn(Y.bin),model:Nn(Y.model),speaker:Nn(Y.speaker)})}else if(t==="elevenlabs"){const Y=P;_({model:Nn(Y.model),voice_id:Nn(Y.voice_id),output_format:Nn(Y.output_format)})}else if(t==="openai"){const Y=P;_({model:Nn(Y.model)||"tts-1",voice:Nn(Y.voice)||"alloy",format:Nn(Y.format)||"mp3"})}else if(t==="gemini"){const Y=P;_({model:Nn(Y.model),voice:Nn(Y.voice)||"Kore",style:Nn(Y.style)})}else _({})},[e,t,a]),!t)return null;const E=t==="__new__",R=E||t.startsWith("custom:"),T=Of[t],A=P=>_(B=>({...B,...P})),z=t!=="piper"&&t!=="mock",M=z&&ps(a?.api_key),D=M?u("voice_ui.api_key_set",{suffix:$o(a?.api_key)??""}):u("voice_ui.api_key_label"),L=E?u("voice_ui.new_provider"):R?b.label||t.slice(7):T?.name||t,I=async()=>{d(!0),p(null);try{const P=E?rU(b.label):R?t.slice(7):"";if(R){if(!b.label.trim())throw new Error(u("voice_ui.err_label_required"));if(!b.base_url.trim())throw new Error(u("voice_ui.err_base_url_required"));if(!P)throw new Error(u("voice_ui.err_label_required"))}const B=R?`voice.tts.custom.${P}`:`voice.tts.${t}`,q={},Y=[],U=(V,X)=>{X.trim()?q[`${B}.${V}`]=X.trim():Y.push(`${B}.${V}`)};if(R?(q[`${B}.label`]=b.label.trim(),q[`${B}.base_url`]=b.base_url.trim(),U("style",b.style),b.temperature.trim()&&!Number.isNaN(Number(b.temperature))?q[`${B}.temperature`]=Number(b.temperature):Y.push(`${B}.temperature`),U("model",b.model),U("voice",b.voice)):t==="piper"?(U("bin",b.bin),U("model",b.model),b.speaker.trim()?q[`${B}.speaker`]=b.speaker.trim():Y.push(`${B}.speaker`)):t==="elevenlabs"?(U("model",b.model),U("voice_id",b.voice_id),U("output_format",b.output_format)):t==="openai"?(U("model",b.model),U("voice",b.voice),U("format",b.format)):t==="gemini"&&(U("model",b.model),U("voice",b.voice),U("style",b.style)),R||t==="gemini"){q[`${B}.emotions.enabled`]=y;const V=j.split(",").map(X=>X.trim().toLowerCase()).filter(Boolean);V.length?q[`${B}.emotions.tags`]=V:Y.push(`${B}.emotions.tags`)}z&&g.trim()&&(q[`${B}.api_key`]=g.trim()),await i({set:q,unset:Y}),r()}catch(P){p(P.message||u("voice_ui.err_save"))}finally{d(!1)}};return n.jsx(Bt,{open:e,onClose:r,title:u("voice_screen.configure_provider",{name:L}),description:R?u("voice_ui.custom_desc"):T?.note,size:"md",footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:r,disabled:l,children:u("common.cancel")}),n.jsx(ae,{variant:"primary",onClick:I,loading:l,"data-testid":"voice-provider-save",children:u("common.save")})]}),children:n.jsxs("div",{className:"space-y-3",children:[t==="piper"&&n.jsxs(n.Fragment,{children:[n.jsx(ie,{label:u("voice_ui.piper_bin_label"),hint:u("voice_ui.piper_bin_hint"),children:n.jsx(Ce,{value:b.bin,onChange:P=>A({bin:P.target.value}),placeholder:"piper"})}),n.jsx(ie,{label:u("voice_ui.piper_model_label"),hint:u("voice_ui.piper_model_hint"),children:n.jsx(Ce,{value:b.model,onChange:P=>A({model:P.target.value}),placeholder:"/abs/path/voice.onnx"})}),n.jsx(ie,{label:u("voice_ui.piper_speaker_label"),hint:u("voice_ui.piper_speaker_hint"),children:n.jsx(Ce,{value:b.speaker,onChange:P=>A({speaker:P.target.value}),placeholder:"0"})})]}),t==="elevenlabs"&&n.jsxs(n.Fragment,{children:[n.jsx(ie,{label:u("voice_ui.api_key_label"),hint:M?u("voice_ui.api_key_keep_hint"):u("voice_ui.api_key_secret_hint",{env:"ELEVENLABS_API_KEY"}),children:n.jsx(Ce,{type:"password",autoComplete:"new-password",value:g,onChange:P=>h(P.target.value),placeholder:D})}),n.jsx(ie,{label:u("voice_ui.model_label"),children:n.jsx(ct,{value:b.model||"",onChange:P=>A({model:P}),options:GP.map(P=>({value:P,label:P})),placeholder:"eleven_multilingual_v2"})}),n.jsx(ie,{label:u("voice_ui.voice_id_label"),hint:u("voice_ui.voice_id_hint"),children:n.jsx(Ce,{value:b.voice_id,onChange:P=>A({voice_id:P.target.value}),placeholder:"EXAVITQu4vr4xnSDxMaL"})}),n.jsx(ie,{label:u("voice_ui.output_format_label"),children:n.jsx(Ce,{value:b.output_format,onChange:P=>A({output_format:P.target.value}),placeholder:"mp3_44100_128"})})]}),t==="openai"&&n.jsxs(n.Fragment,{children:[n.jsx(ie,{label:u("voice_ui.api_key_label"),hint:M?u("voice_ui.api_key_keep_hint"):u("voice_ui.api_key_reuse_hint",{engine:"engines.openai.api_key",env:"OPENAI_API_KEY"}),children:n.jsx(Ce,{type:"password",autoComplete:"new-password",value:g,onChange:P=>h(P.target.value),placeholder:D})}),n.jsx(ie,{label:u("voice_ui.model_label"),children:n.jsx(ct,{value:b.model||"tts-1",onChange:P=>A({model:P}),options:YP.map(P=>({value:P,label:P}))})}),n.jsx(ie,{label:u("voice_ui.voice_label"),children:n.jsx(ct,{value:b.voice||"alloy",onChange:P=>A({voice:P}),options:VP.map(P=>({value:P,label:P}))})}),n.jsx(ie,{label:u("voice_ui.format_label"),children:n.jsx(ct,{value:b.format||"mp3",onChange:P=>A({format:P}),options:["mp3","opus","aac","flac","wav"].map(P=>({value:P,label:P}))})})]}),R&&n.jsxs(n.Fragment,{children:[n.jsx(ie,{label:u("voice_ui.label_label"),hint:u("voice_ui.label_hint"),children:n.jsx(Ce,{value:b.label,onChange:P=>A({label:P.target.value}),placeholder:"QVox"})}),n.jsx(ie,{label:u("voice_ui.base_url_req_label"),hint:u("voice_ui.base_url_req_hint"),children:n.jsx(Ce,{value:b.base_url,onChange:P=>A({base_url:P.target.value}),placeholder:"http://127.0.0.1:5111/v1"})}),n.jsx(ie,{label:u("voice_ui.api_key_label"),hint:u(M?"voice_ui.api_key_keep_hint":"voice_ui.api_key_optional_hint"),children:n.jsx(Ce,{type:"password",autoComplete:"new-password",value:g,onChange:P=>h(P.target.value),placeholder:D})}),n.jsx(ie,{label:u("voice_ui.style_label"),hint:u("voice_ui.openai_style_hint"),children:n.jsx(un,{rows:2,value:b.style||"",onChange:P=>A({style:P.target.value}),placeholder:u("voice_ui.style_ph")})}),n.jsx(ie,{label:u("voice_ui.temperature_label"),hint:u("voice_ui.temperature_hint"),children:n.jsx(Ce,{value:b.temperature,onChange:P=>A({temperature:P.target.value}),inputMode:"decimal",placeholder:"0.7"})}),n.jsx(h2,{on:y,setOn:S,tags:j,setTags:k}),n.jsxs("div",{children:[n.jsxs("button",{type:"button",onClick:()=>w(P=>!P),className:"text-xs text-muted-fg hover:text-fg",children:[C?"▾ ":"▸ ",u("voice_ui.advanced")]}),C&&n.jsxs("div",{className:"mt-2 space-y-3",children:[n.jsx(ie,{label:u("voice_ui.model_label"),hint:u("voice_ui.custom_model_hint"),children:n.jsx(Ce,{value:b.model,onChange:P=>A({model:P.target.value}),placeholder:u("voice_ui.custom_optional_ph")})}),n.jsx(ie,{label:u("voice_ui.voice_label"),hint:u("voice_ui.custom_voice_hint"),children:n.jsx(Ce,{value:b.voice,onChange:P=>A({voice:P.target.value}),placeholder:u("voice_ui.custom_optional_ph")})})]})]})]}),t==="gemini"&&n.jsxs(n.Fragment,{children:[n.jsx(ie,{label:u("voice_ui.api_key_label"),hint:M?u("voice_ui.api_key_keep_hint"):u("voice_ui.api_key_reuse_hint",{engine:"engines.gemini.api_key",env:"GEMINI_API_KEY"}),children:n.jsx(Ce,{type:"password",autoComplete:"new-password",value:g,onChange:P=>h(P.target.value),placeholder:D})}),n.jsx(ie,{label:u("voice_ui.model_label"),hint:u("voice_ui.gemini_model_hint"),children:n.jsx(Ce,{value:b.model,onChange:P=>A({model:P.target.value}),placeholder:"gemini-2.5-flash-preview-tts"})}),n.jsx(ie,{label:u("voice_ui.voice_label"),children:n.jsx(ct,{value:b.voice||"Kore",onChange:P=>A({voice:P}),options:FP.map(P=>({value:P,label:P}))})}),n.jsx(ie,{label:u("voice_ui.style_label"),hint:u("voice_ui.style_hint"),children:n.jsx(un,{rows:2,value:b.style||"",onChange:P=>A({style:P.target.value}),placeholder:u("voice_ui.style_ph")})}),n.jsx(h2,{on:y,setOn:S,tags:j,setTags:k})]}),t==="mock"&&n.jsx("p",{className:"text-sm text-muted-fg",children:u("voice_ui.mock_desc")}),f&&n.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:f})]})})}function iU(){const e=x.useRef(null),t=x.useRef(null),[a,r]=x.useState(!1),[i,l]=x.useState(!1),d=x.useCallback(()=>{t.current&&(URL.revokeObjectURL(t.current),t.current=null)},[]);x.useEffect(()=>()=>{e.current&&(e.current.pause(),e.current=null),d()},[d]);const f=x.useCallback(async g=>{l(!0);try{d();const h=await QP(g);t.current=h,e.current||(e.current=new Audio);const b=e.current;b.src=h,b.onended=()=>r(!1),b.onerror=()=>r(!1),await b.play(),r(!0)}finally{l(!1)}},[d]),p=x.useCallback(()=>{e.current&&(e.current.pause(),e.current.currentTime=0),r(!1)},[]);return{play:f,stop:p,playing:a,loading:i}}function lU({engines:e,defaultProvider:t,mode:a}){const r=Xe(),{play:i,stop:l,playing:d,loading:f}=iU(),[p,g]=x.useState(u("voice_ui.test_default_text")),[h,b]=x.useState(""),[_,y]=x.useState(!1),[S,j]=x.useState(null),C=[{value:"",label:a==="single"&&t&&t!=="auto"?u("voice_ui.test_default_engine",{name:Of[t]?.name||t}):u("voice_ui.test_default_chain")},...e.filter(E=>E.id!=="mock").map(E=>({value:E.id,label:E.custom?E.label||E.id:Of[E.id]?.name||E.id,disabled:!E.available}))],w=async()=>{const E=p.trim();if(!E){r.error(u("voice_ui.test_empty_error"));return}y(!0);try{const R=await Df.say({text:E,provider:h||void 0});j(R),await i(R.audio_path)}catch(R){r.error(R.message||u("voice_ui.test_synth_error"))}finally{y(!1)}};return n.jsxs("div",{className:"space-y-3",children:[n.jsx(ie,{label:u("voice_ui.test_engine_label"),hint:u("voice_ui.test_engine_hint"),children:n.jsx(ct,{value:h,onChange:b,options:C})}),n.jsx(ie,{label:u("voice_ui.test_text_label"),children:n.jsx(un,{rows:2,value:p,onChange:E=>g(E.target.value),placeholder:u("voice_ui.test_text_ph"),"data-testid":"voice-test-input"})}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(ae,{variant:"primary",onClick:w,loading:_,disabled:f,"data-testid":"voice-test-say",children:[n.jsx(ZM,{className:"size-4"})," ",u("voice_ui.say_this")]}),d?n.jsxs(ae,{variant:"secondary",onClick:l,"data-testid":"voice-test-stop",children:[n.jsx(Bb,{className:"size-4"})," ",u("voice_ui.stop")]}):S?n.jsxs(ae,{variant:"secondary",onClick:()=>i(S.audio_path),loading:f,"data-testid":"voice-test-replay",children:[n.jsx(Ib,{className:"size-4"})," ",u("voice_ui.replay")]}):null,S&&n.jsxs("span",{className:"text-xs text-muted-fg",children:[u("voice_ui.engine_result"),": ",n.jsx("strong",{children:S.provider}),S.duration_s?` · ${S.duration_s.toFixed(1)}s`:""]})]})]})}const x2={metal:{label:"Metal",cls:"text-emerald-400 border-emerald-500/40 bg-emerald-500/10"},cuda:{label:"CUDA",cls:"text-lime-400 border-lime-500/40 bg-lime-500/10"},rocm:{label:"Vulkan / ROCm",cls:"text-orange-400 border-orange-500/40 bg-orange-500/10"},none:{label:"CPU",cls:"text-muted-fg border-border bg-muted"}};function b2({gpu:e}){const t=x2[e]??x2.none;return n.jsx("span",{className:`inline-flex items-center rounded-md border px-1.5 py-0.5 text-[11px] font-medium ${t.cls}`,children:t.label})}function cU(e){return e.backend==="mlx"?"Metal · mlx-whisper":e.backend==="faster"?(e.device==="cuda"?"CUDA":"CPU")+" · faster-whisper":e.backend}const uU=()=>[{value:"auto",label:u("voice_ui.stt_provider_auto")},{value:"local",label:u("voice_ui.stt_provider_local")},{value:"openai",label:u("voice_ui.stt_provider_openai")},{value:"custom",label:u("voice_ui.stt_provider_custom")}],_2=()=>[{value:"auto",label:u("voice_ui.lang_auto")},{value:"es",label:u("voice_ui.lang_es")},{value:"en",label:u("voice_ui.lang_en")},{value:"pt",label:u("voice_ui.lang_pt")},{value:"fr",label:u("voice_ui.lang_fr")},{value:"it",label:u("voice_ui.lang_it")},{value:"de",label:u("voice_ui.lang_de")}];function dU({config:e,onPatch:t,busy:a}){const[r,i]=x.useState(null);x.useEffect(()=>{let B=!0;return Df.sttHardware().then(q=>{B&&i(q)}).catch(()=>{}),()=>{B=!1}},[]);const l=e.provider||"auto",d=e.local||{},f=e.openai||{},p=e.custom||{},g=d.model||"small",h=d.language||"auto",b=l==="auto"||l==="local",_=(B,q,Y)=>{const U=Y.trim();U!==(q||"").trim()&&t({[B]:U})},y=(B,q)=>{const Y=q.trim();!Y||ps(Y)||t({[B]:Y})},S=B=>ps(B)?u("voice_ui.api_key_set",{suffix:$o(B)??""}):u("voice_ui.api_key_label"),j=d.backend||"auto",k=r?.hardware.gpu||"none",C=j==="auto"?r?.recommended.backend||"faster":j,w=C==="mlx",E=w?"metal":C==="faster"&&k==="cuda"?"cuda":"none",R=()=>{const B=[{value:"auto",label:u("voice_ui.stt_backend_auto")}];return k==="metal"&&B.push({value:"mlx",label:"Metal — mlx-whisper"}),B.push({value:"faster",label:k==="cuda"?"CUDA — faster-whisper":"CPU — faster-whisper"}),B},[T,A]=x.useState([]);x.useEffect(()=>{let B=!0;return Df.sttModels(C).then(q=>{B&&A(q.models)}).catch(()=>{B&&A([])}),()=>{B=!1}},[C]);const z=B=>`${B.id} · ${B.downloaded?"✓ "+B.size:B.size}`,M=()=>T.length?T.map(B=>({value:w?B.repo:B.id,label:z(B)})):XP.map(B=>({value:B,label:B})),D=w?d.mlx_model||r?.recommended.model||"":g,L=w?"transcription.local.mlx_model":"transcription.local.model",I=T.find(B=>(w?B.repo:B.id)===D),P=!!I&&!I.downloaded;return n.jsxs("div",{className:"space-y-3",children:[r&&n.jsxs("div",{className:"rounded-lg border border-border bg-muted px-3 py-2 text-sm",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsxs("span",{className:"text-muted-fg",children:[u("voice_ui.stt_hw_label"),":"]}),n.jsx(b2,{gpu:r.hardware.gpu}),n.jsx("span",{className:"font-medium text-fg",children:r.hardware.gpuName||r.hardware.platform}),r.hardware.mem_gb?n.jsxs("span",{className:"text-muted-fg",children:["· ",r.hardware.mem_gb," GB",r.hardware.unified_memory?" unified":""]}):null]}),n.jsxs("div",{className:"mt-1 text-xs text-muted-fg",children:[u("voice_ui.stt_hw_recommended"),":"," ",n.jsx("span",{className:"text-fg",children:r.recommended.model})," ","(",cU(r.recommended),")",r.recommended.limited?` — ${u("voice_ui.stt_hw_limited")}`:""]})]}),n.jsx(ie,{label:u("voice_ui.stt_engine_label"),hint:u("voice_ui.stt_engine_hint"),children:n.jsx(ct,{value:l,onChange:B=>t({"transcription.provider":B}),options:uU(),disabled:a,className:"max-w-md"})}),b&&n.jsxs("div",{className:"space-y-3",children:[n.jsx(ie,{label:u("voice_ui.stt_backend_label"),hint:u("voice_ui.stt_backend_hint"),children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ct,{value:j,onChange:B=>t({"transcription.local.backend":B}),options:R(),disabled:a,className:"max-w-xs"}),n.jsx(b2,{gpu:E})]})}),n.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[n.jsx(ie,{label:u("voice_ui.stt_model_label"),hint:P?u("voice_ui.stt_model_needs_download",{size:I.size}):u("voice_ui.stt_model_hint"),children:n.jsx(ct,{value:D,onChange:B=>t({[L]:B}),options:M(),disabled:a})}),n.jsx(ie,{label:u("voice_ui.stt_language_label"),hint:u("voice_ui.stt_language_hint"),children:n.jsx(ct,{value:h,onChange:B=>t({"transcription.local.language":B}),options:_2(),disabled:a})})]})]}),l==="openai"&&n.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[n.jsx(ie,{label:u("voice_ui.api_key_label"),hint:ps(f.api_key)?u("voice_ui.api_key_keep_hint"):u("voice_ui.api_key_reuse_hint",{engine:"engines.openai.api_key",env:"OPENAI_API_KEY"}),children:n.jsx(Ce,{type:"password",autoComplete:"new-password",defaultValue:"",placeholder:S(f.api_key),onBlur:B=>y("transcription.openai.api_key",B.target.value),disabled:a})}),n.jsx(ie,{label:u("voice_ui.stt_openai_model_label"),hint:u("voice_ui.stt_openai_model_hint"),children:n.jsx(Ce,{defaultValue:f.model||"",placeholder:"whisper-1",onBlur:B=>_("transcription.openai.model",f.model,B.target.value),disabled:a})})]}),l==="custom"&&n.jsxs("div",{className:"space-y-3",children:[n.jsx(ie,{label:u("voice_ui.stt_custom_baseurl_label"),hint:u("voice_ui.stt_custom_baseurl_hint"),children:n.jsx(Ce,{defaultValue:p.base_url||"",placeholder:"http://localhost:8000/v1",onBlur:B=>_("transcription.custom.base_url",p.base_url,B.target.value),disabled:a})}),n.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[n.jsx(ie,{label:u("voice_ui.stt_custom_model_label"),hint:u("voice_ui.stt_custom_model_hint"),children:n.jsx(Ce,{defaultValue:p.model||"",placeholder:"mlx-community/whisper-large-v3-turbo",onBlur:B=>_("transcription.custom.model",p.model,B.target.value),disabled:a})}),n.jsx(ie,{label:u("voice_ui.stt_language_label"),hint:u("voice_ui.stt_language_hint"),children:n.jsx(ct,{value:p.language||"auto",onChange:B=>t({"transcription.custom.language":B}),options:_2(),disabled:a})})]}),n.jsx(ie,{label:u("voice_ui.api_key_label"),hint:u("voice_ui.stt_custom_key_hint"),children:n.jsx(Ce,{type:"password",autoComplete:"new-password",defaultValue:"",placeholder:S(p.api_key),onBlur:B=>y("transcription.custom.api_key",B.target.value),disabled:a})})]})]})}function fU(){const e=Xe(),{config:t,isLoading:a,patch:r,mutate:i}=fr(),{data:l,isLoading:d,error:f,mutate:p}=$e("/api/tts/providers",()=>Df.providers()),[g,h]=x.useState(null),[b,_]=x.useState(!1),y=t,S=y.voice?.tts||{},j=y.transcription||{},k=l?.configured_provider||S.provider||"auto",C=l?.mode||S.mode||"chain",w=l?.order||[],E=(l?.engines||[]).map(I=>{if(!(!!I.custom||I.id==="gemini"))return I;const B=I.custom?S.custom?.[I.id.slice(7)]:S.gemini;return{...I,emotionsApplicable:!0,emotionsOn:!!B?.emotions?.enabled}}),R=x.useMemo(()=>!g||g==="__new__"?{}:g.startsWith("custom:")?S.custom?.[g.slice(7)]||{}:S[g]||{},[g,S]),T=async(I,P)=>{_(!0);try{const B=I.startsWith("custom:")?`voice.tts.custom.${I.slice(7)}.enabled`:`voice.tts.${I}.enabled`;await r({[B]:P}),await p()}catch(B){e.error(B.message)}finally{_(!1)}},A=async(I,P)=>{_(!0);try{const B=I.startsWith("custom:")?`voice.tts.custom.${I.slice(7)}.emotions.enabled`:`voice.tts.${I}.emotions.enabled`;await r({[B]:P}),await p(),await i()}catch(B){e.error(B.message)}finally{_(!1)}},z=async I=>{_(!0);try{await r({"voice.tts.order":I}),await p()}catch(P){e.error(P.message)}finally{_(!1)}},M=async({set:I,unset:P})=>{await r(I,P.length?P:void 0),await p(),await i(),e.success(u("voice_ui.toast_config_saved"))},D=async I=>{if(I.startsWith("custom:")&&window.confirm(u("voice_ui.remove_confirm"))){_(!0);try{const P=I.slice(7);await r({"voice.tts.order":w.filter(B=>B!==I)},[`voice.tts.custom.${P}`]),await p(),await i(),e.success(u("voice_ui.toast_provider_removed"))}catch(P){e.error(P.message)}finally{_(!1)}}},L=async(I,P)=>{try{await r(I,P),e.success(u("voice_ui.toast_transcription_updated"))}catch(B){e.error(B.message)}};return n.jsxs("div",{"data-testid":"screen-voice",children:[n.jsxs("div",{className:"grid gap-6 xl:grid-cols-2",children:[n.jsx(qe,{title:u("voice_screen.providers_title"),description:u("voice_ui.providers_desc"),children:d||a?n.jsx(tt,{}):f?n.jsx(ut,{children:u("voice_ui.providers_load_error",{msg:f.message})}):n.jsx(aU,{engines:E,order:w,onToggleEnabled:T,onToggleEmotions:A,onReorder:z,onConfigure:I=>h(I),onRemove:D,onAddNew:()=>h("__new__"),busy:b})}),n.jsxs("div",{className:"space-y-6",children:[n.jsx(qe,{title:u("voice_screen.test_title"),description:u("voice_ui.test_desc"),children:n.jsx(lU,{engines:E,defaultProvider:k,mode:C})}),n.jsx(qe,{title:u("voice_screen.stt_title"),description:u("voice_ui.stt_desc"),children:a?n.jsx(tt,{}):n.jsx(dU,{config:j,onPatch:L})})]})]}),n.jsx(oU,{open:!!g,providerId:g,config:R,onClose:()=>h(null),onSave:M})]})}function pU(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}function mU({manifest:e}){const t=e.daemon,a=e.safety;return n.jsxs("div",{"data-testid":"deck-daemon-card",className:"rounded-xl border border-border bg-muted/10 px-4 py-3 text-xs",children:[n.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[n.jsxs("span",{className:"font-semibold text-foreground",children:[t.name," ",n.jsxs("span",{className:"font-normal text-muted-fg",children:["v",t.version]})]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"size-2 rounded-full bg-emerald-500"}),n.jsx("span",{className:"text-muted-fg",children:u("modules_ui.deck_daemon_active",{uptime:pU(t.uptime_s)})})]})]}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsxs("span",{className:"text-muted-fg",children:[t.host,":",t.port]}),n.jsx("span",{className:"text-muted-fg",children:"·"}),n.jsxs("span",{className:"text-muted-fg",children:[u("modules_ui.deck_daemon_started")," ",new Date(t.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),n.jsxs("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[a.direct_shell===!1&&n.jsx(Be,{tone:"success",children:u("modules_ui.deck_safety_no_shell")}),a.arbitrary_commands===!1&&n.jsx(Be,{tone:"success",children:u("modules_ui.deck_safety_no_arbitrary")}),a.dangerous_actions_require_confirmation&&n.jsx(Be,{tone:"info",children:u("modules_ui.deck_safety_confirm")})]})]})}function gU(e){return e==="available"?"success":e==="configured"?"info":"muted"}function hU(e){return e==="available"?"activo":e==="configured"?"configurado":e==="disabled"?"deshabilitado":"sin configurar"}function xU(e){return e==="voice"?"warning":e==="plugin"?"info":"muted"}function bU({widget:e,onToggle:t}){const a=e.source==="external",[r,i]=x.useState(!1),l=e.user_enabled===!0,d=async f=>{if(!(!t||r)){i(!0);try{await t(f)}finally{i(!1)}}};return n.jsxs("li",{"data-testid":`deck-widget-${e.id}`,className:me("flex items-center gap-3 rounded-lg border px-3 py-2.5 text-sm transition-colors",a?"border-border bg-muted/20 hover:border-muted-fg/30":"border-border/50 bg-muted/10"),children:[n.jsx(Ue,{content:e.source==="apx"?u("deck_screen.widget_native"):u("deck_screen.widget_external"),children:n.jsx("span",{className:me("size-2 shrink-0 rounded-full",e.source==="apx"?"bg-emerald-500":"bg-sky-400")})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"font-medium",children:e.title}),n.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:e.desktop})]}),n.jsx(Be,{tone:xU(e.kind),children:e.kind}),n.jsx(Be,{tone:gU(e.status),children:hU(e.status)}),a?n.jsx("span",{"data-testid":`deck-widget-toggle-${e.id}`,children:n.jsx(Dt,{checked:l,onChange:d,disabled:r||!t})}):n.jsx("span",{className:"w-9 shrink-0","aria-hidden":!0})]})}function _U({desktop:e,widgets:t,onToggle:a}){return t.length===0?null:n.jsxs("div",{"data-testid":`deck-desktop-${e.id}`,className:"space-y-1.5",children:[n.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-fg",children:e.title}),n.jsx("ul",{className:"space-y-1.5",children:t.map(r=>n.jsx(bU,{widget:r,onToggle:r.source==="external"?i=>a(r.id,i):void 0},r.id))})]})}function vU(){Xe();const{data:e,error:t,isLoading:a,mutate:r}=$e("/api/deck/manifest",()=>PN.manifest(),{refreshInterval:3e4}),i=async(h,b)=>{},l=e?.deck.desktops??[],d=e?.deck.widgets??[],f=l.map(h=>({desktop:h,widgets:d.filter(b=>b.desktop===h.id)})),g=d.filter(h=>h.source==="external").filter(h=>h.user_enabled===!0).length;return n.jsxs("div",{className:"relative min-h-full","data-testid":"screen-deck",children:[n.jsxs("div",{className:"mx-auto max-w-4xl space-y-6 p-6 pointer-events-none select-none blur-[2px] opacity-60","aria-hidden":!0,inert:!0,children:[e&&n.jsx(mU,{manifest:e}),n.jsxs(qe,{title:u("deck_screen.widgets_title"),description:a?u("modules_ui.deck_loading_manifest"):t?u("modules_ui.deck_manifest_error"):u("modules_ui.deck_widgets_summary",{count:d.length,enabled:g}),action:n.jsx(Ue,{content:u("deck_screen.reload_manifest"),children:n.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>r(),disabled:a,"aria-label":u("deck_screen.reload_manifest"),children:n.jsx(Cs,{size:14,className:a?"animate-spin":""})})}),children:[a&&n.jsx(tt,{label:u("modules_ui.deck_loading_manifest_full")}),!a&&t&&n.jsxs(ut,{children:[u("modules_ui.deck_manifest_load_failed")," ",n.jsx("button",{type:"button",className:"ml-1 underline",onClick:()=>r(),children:u("modules_ui.deck_retry")})]}),!a&&!t&&d.length===0&&n.jsx(ut,{children:u("modules_ui.deck_no_widgets")}),!a&&!t&&d.length>0&&n.jsx("div",{className:"space-y-5","data-testid":"deck-desktop-list",children:f.filter(h=>h.widgets.length>0).map(h=>n.jsx(_U,{desktop:h.desktop,widgets:h.widgets,onToggle:i},h.desktop.id))})]}),e?.apx&&n.jsx(qe,{title:u("deck_screen.context_title"),description:u("modules_ui.deck_context_desc"),children:n.jsxs("div",{className:"space-y-2 text-sm","data-testid":"deck-apx-context",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-muted-fg",children:u("modules_ui.deck_active_project")}),n.jsx("span",{className:"font-medium",children:e.apx.active_project?e.apx.active_project.name:u("modules_ui.deck_none")})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-muted-fg",children:u("modules_ui.deck_registered_projects")}),n.jsx("span",{className:"font-medium",children:e.apx.projects.length})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-muted-fg",children:u("modules_ui.deck_active_plugins")}),n.jsx("span",{className:"font-medium",children:Object.keys(e.apx.plugins).join(", ")||"—"})]})]})})]}),n.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center p-6 backdrop-blur-[1px]",role:"dialog","aria-modal":"true","aria-labelledby":"deck-coming-soon-title","data-testid":"deck-coming-soon",children:n.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border bg-card/95 p-8 text-center shadow-2xl",children:[n.jsx("div",{className:"mx-auto mb-4 flex size-12 items-center justify-center rounded-full bg-muted",children:n.jsx(iM,{className:"size-6 text-muted-fg"})}),n.jsx("span",{className:"inline-block rounded-full bg-muted px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted-fg",children:u("deck_screen.preview_badge")}),n.jsx("h2",{id:"deck-coming-soon-title",className:"mt-3 text-lg font-semibold",children:u("deck_screen.preview_title")}),n.jsx("p",{className:"mt-2 text-sm text-muted-fg",children:u("deck_screen.preview_body")})]})})]})}const yU=[{title:u("settings.account_section"),items:[{key:"identity",label:u("settings.tabs.identity"),icon:qb}]},{title:u("settings.super_agent_section"),items:[{key:"super_agent",label:u("settings.tabs.super_agent"),icon:rn},{key:"profile",label:u("settings.tabs.profile"),icon:SM},{key:"nudge",label:u("settings.tabs.nudge"),icon:YA}]},{title:u("settings.knowledge_section"),items:[{key:"engines",label:u("settings.tabs.engines"),icon:Tb},{key:"memory",label:"Memory (RAG)",icon:gS},{key:"skills",label:u("skills_page.title"),icon:sa}]},{title:u("settings.channels_section"),items:[{key:"telegram",label:u("settings.tabs.telegram"),icon:Sa},{key:"devices",label:u("settings.tabs.devices"),icon:GM}]},{title:u("settings.modules_section"),items:[{key:"voice",label:u("nav.modules.voice"),icon:Pb},{key:"desktop",label:u("nav.modules.desktop"),icon:Lb},{key:"deck",label:u("nav.modules.deck"),icon:EM},{key:"web",label:u("nav.modules.web"),icon:vS}]},{title:u("settings.advanced_section"),items:[{key:"advanced",label:u("settings.tabs.advanced"),icon:$b}]}],jU=new Set(["engines","telegram","memory","skills","web","voice","profile"]),kU={identity:()=>n.jsx(K$,{}),super_agent:()=>n.jsx(X$,{}),profile:()=>n.jsx(eB,{}),nudge:()=>n.jsx(sB,{}),engines:()=>n.jsx(PE,{}),memory:()=>n.jsx(oB,{}),skills:()=>n.jsx(cB,{}),telegram:()=>n.jsx(mB,{}),devices:()=>n.jsx(qB,{}),voice:()=>n.jsx(fU,{}),deck:()=>n.jsx(vU,{}),desktop:()=>n.jsx(sU,{}),web:()=>n.jsx(GB,{}),advanced:()=>n.jsx(FB,{})};function wU(){const e=Sn(),t=ns(),a=SU(t.pathname),r=kU[a],{collapsed:i,toggle:l}=H_(Dn.sidebarCollapsed+".settings");return n.jsx(yE,{sections:yU,active:a,onChange:d=>e(d==="identity"?"/settings":`/settings/${CU(d)}`),collapsed:i,onToggleCollapse:l,contentClassName:`w-full ${jU.has(a)?"":"mx-auto max-w-3xl"} space-y-6 py-6 pt-3 pr-6 pl-4`,testId:`settings-tab-${a}`,children:n.jsx(r,{})})}function SU(e){switch(e.split("/").filter(Boolean)[1]||"identity"){case"super-agent":return"super_agent";case"profile":return"profile";case"nudge":return"nudge";case"engines":return"engines";case"memory":return"memory";case"skills":return"skills";case"telegram":return"telegram";case"devices":return"devices";case"voice":return"voice";case"deck":return"deck";case"desktop":return"desktop";case"web":return"web";case"appearance":return"web";case"config":case"advanced":return"advanced";default:return"identity"}}function CU(e){return e==="super_agent"?"super-agent":e==="advanced"?"config":e}function NU(){const{data:e,isLoading:t,mutate:a}=$e("/api/messages/global?channel=desktop",()=>JB(40),{refreshInterval:8e3});return n.jsx("div",{className:"mx-auto max-w-3xl space-y-6 p-6","data-testid":"screen-desktop",children:n.jsxs("div",{className:"space-y-6",children:[n.jsx("div",{children:n.jsx(kR,{showConfigLink:!0})}),n.jsx("div",{children:n.jsx(qe,{title:u("desktop_screen.last_conv_title"),description:u("modules_ui.desktop_last_conv_desc"),action:n.jsx("button",{type:"button",onClick:()=>a(),className:"text-xs text-muted-fg underline-offset-2 hover:underline",children:u("modules_ui.desktop_refresh")}),children:n.jsx(EU,{messages:e||[],loading:t})})})]})})}function EU({messages:e,loading:t}){const a=x.useMemo(()=>TU(e),[e]);return t?n.jsx(tt,{}):e.length?n.jsx("div",{className:"space-y-3 max-h-[560px] overflow-y-auto pr-1",children:a.slice().reverse().map((r,i)=>n.jsx("div",{className:"rounded-lg border border-border bg-card/40 p-3",children:r.map((l,d)=>n.jsx(RU,{m:l},d))},i))}):n.jsx(ut,{children:u("modules_ui.desktop_no_messages")})}function RU({m:e}){const t=e.direction==="in",a=AU(e.ts);return n.jsxs("div",{className:"py-1",children:[n.jsxs("div",{className:"flex items-baseline gap-2 text-[11px] text-muted-fg",children:[n.jsx("span",{className:"font-semibold",children:u(t?"modules_ui.desktop_you":"modules_ui.desktop_roby")}),n.jsx("span",{children:a})]}),n.jsx("div",{className:"mt-0.5 text-sm leading-snug whitespace-pre-wrap "+(t?"text-muted-fg":"text-fg"),children:(e.body||"").trim()||n.jsx("span",{className:"italic opacity-50",children:u("modules_ui.desktop_empty_msg")})})]})}function TU(e){const t=[];for(const a of e)a.direction==="in"||!t.length?t.push([a]):t[t.length-1].push(a);return t}function AU(e){try{const t=new Date(e);return t.toDateString()===new Date().toDateString()?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):t.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return""}}function MU(e,t){const a=getComputedStyle(e),r=parseFloat(a.fontSize);return t*r}function zU(e,t){const a=getComputedStyle(e.ownerDocument.documentElement),r=parseFloat(a.fontSize);return t*r}function OU(e){return e/100*window.innerHeight}function DU(e){return e/100*window.innerWidth}function PU(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function Mc({groupSize:e,panelElement:t,styleProp:a}){let r;const[i,l]=PU(a);switch(l){case"%":{r=i/100*e;break}case"px":{r=i;break}case"rem":{r=zU(t,i);break}case"em":{r=MU(t,i);break}case"vh":{r=OU(i);break}case"vw":{r=DU(i);break}}return r}function ts(e){return parseFloat(e.toFixed(3))}function fl({group:e}){const{orientation:t,panels:a}=e;return a.reduce((r,i)=>(r+=t==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,r),0)}function mb(e){const{panels:t}=e,a=fl({group:e});return a===0?t.map(r=>({groupResizeBehavior:r.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:r.panelConstraints.disabled,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:i,panelConstraints:l}=r;let d=0;if(l.collapsedSize!==void 0){const h=Mc({groupSize:a,panelElement:i,styleProp:l.collapsedSize});d=ts(h/a*100)}let f;if(l.defaultSize!==void 0){const h=Mc({groupSize:a,panelElement:i,styleProp:l.defaultSize});f=ts(h/a*100)}let p=0;if(l.minSize!==void 0){const h=Mc({groupSize:a,panelElement:i,styleProp:l.minSize});p=ts(h/a*100)}let g=100;if(l.maxSize!==void 0){const h=Mc({groupSize:a,panelElement:i,styleProp:l.maxSize});g=ts(h/a*100)}return{groupResizeBehavior:l.groupResizeBehavior,collapsedSize:d,collapsible:l.collapsible===!0,defaultSize:f,disabled:l.disabled,minSize:p,maxSize:g,panelId:r.id}})}function Gt(e,t="Assertion error"){if(!e)throw Error(t)}function gb(e,t){return Array.from(t).sort(e==="horizontal"?LU:IU)}function LU(e,t){const a=e.element.offsetLeft-t.element.offsetLeft;return a!==0?a:e.element.offsetWidth-t.element.offsetWidth}function IU(e,t){const a=e.element.offsetTop-t.element.offsetTop;return a!==0?a:e.element.offsetHeight-t.element.offsetHeight}function wR(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function SR(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function $U({orientation:e,rects:t,targetRect:a}){const r={x:a.x+a.width/2,y:a.y+a.height/2};let i,l=Number.MAX_VALUE;for(const d of t){const{x:f,y:p}=SR(r,d),g=e==="horizontal"?f:p;g<l&&(l=g,i=d)}return Gt(i,"No rect found"),i}let nf;function BU(){return nf===void 0&&(typeof matchMedia=="function"?nf=!!matchMedia("(pointer:coarse)").matches:nf=!1),nf}function CR(e){const{element:t,orientation:a,panels:r,separators:i}=e,l=gb(a,Array.from(t.children).filter(wR).map(S=>({element:S}))).map(({element:S})=>S),d=[];let f=!1,p=!1,g=-1,h=-1,b=0,_,y=[];{let S=-1;for(const j of l)j.hasAttribute("data-panel")&&(S++,j.hasAttribute("data-disabled")||(b++,g===-1&&(g=S),h=S))}if(b>1){let S=-1;for(const j of l)if(j.hasAttribute("data-panel")){S++;const k=r.find(C=>C.element===j);if(k){if(_){const C=_.element.getBoundingClientRect(),w=j.getBoundingClientRect();let E;if(p){const R=a==="horizontal"?new DOMRect(C.right,C.top,0,C.height):new DOMRect(C.left,C.bottom,C.width,0),T=a==="horizontal"?new DOMRect(w.left,w.top,0,w.height):new DOMRect(w.left,w.top,w.width,0);switch(y.length){case 0:{E=[R,T];break}case 1:{const A=y[0],z=$U({orientation:a,rects:[C,w],targetRect:A.element.getBoundingClientRect()});E=[A,z===C?T:R];break}default:{E=y;break}}}else y.length?E=y:E=[a==="horizontal"?new DOMRect(C.right,w.top,w.left-C.right,w.height):new DOMRect(w.left,C.bottom,w.width,w.top-C.bottom)];for(const R of E){let T="width"in R?R:R.element.getBoundingClientRect();const A=BU()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(T.width<A){const M=A-T.width;T=new DOMRect(T.x-M/2,T.y,T.width+M,T.height)}if(T.height<A){const M=A-T.height;T=new DOMRect(T.x,T.y-M/2,T.width,T.height+M)}const z=S<=g||S>h;!f&&!z&&d.push({group:e,groupSize:fl({group:e}),panels:[_,k],separator:"width"in R?void 0:R,rect:T}),f=!1}}p=!1,_=k,y=[]}}else if(j.hasAttribute("data-separator")){j.ariaDisabled!==null&&(f=!0);const k=i.find(C=>C.element===j);k?y.push(k):(_=void 0,y=[])}else p=!0}return d}class NR{#e={};addListener(t,a){const r=this.#e[t];return r===void 0?this.#e[t]=[a]:r.includes(a)||r.push(a),()=>{this.removeListener(t,a)}}emit(t,a){const r=this.#e[t];if(r!==void 0)if(r.length===1)r[0].call(null,a);else{let i=!1,l=null;const d=Array.from(r);for(let f=0;f<d.length;f++){const p=d[f];try{p.call(null,a)}catch(g){l===null&&(i=!0,l=g)}}if(i)throw l}}removeAllListeners(){this.#e={}}removeListener(t,a){const r=this.#e[t];if(r!==void 0){const i=r.indexOf(a);i>=0&&r.splice(i,1)}}}let el={cursorFlags:0,state:"inactive"};const vv=new NR;function Uo(){return el}function UU(e){return vv.addListener("change",e)}function qU(e){const t=el,a={...el};a.cursorFlags=e,el=a,vv.emit("change",{prev:t,next:a})}function tl(e){const t=el;el=e,vv.emit("change",{prev:t,next:e})}const HU=e=>e,fx=()=>{},ER=1,RR=2,TR=4,AR=8,v2=3,y2=12;let sf;function j2(){return sf===void 0&&(sf=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(sf=!0)),sf}function VU({cursorFlags:e,groups:t,state:a}){let r=0,i=0;switch(a){case"active":case"hover":t.forEach(l=>{if(!l.mutableState.disableCursor)switch(l.orientation){case"horizontal":{r++;break}case"vertical":{i++;break}}})}if(!(r===0&&i===0)){switch(a){case"active":{if(e&&j2()){const l=(e&ER)!==0,d=(e&RR)!==0,f=(e&TR)!==0,p=(e&AR)!==0;if(l)return f?"se-resize":p?"ne-resize":"e-resize";if(d)return f?"sw-resize":p?"nw-resize":"w-resize";if(f)return"s-resize";if(p)return"n-resize"}break}}return j2()?r>0&&i>0?"move":r>0?"ew-resize":"ns-resize":r>0&&i>0?"grab":r>0?"col-resize":"row-resize"}}const k2=new WeakMap;function yv(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:a}=k2.get(e)??{};a===void 0&&(a=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(a):e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]));const r=Uo();switch(r.state){case"active":case"hover":{const i=VU({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(d=>d.group),state:r.state}),l=`*, *:hover {cursor: ${i} !important; }`;if(t===l)return;t=l,i?a.cssRules.length===0?a.insertRule(l):a.replaceSync(l):a.cssRules.length===1&&a.deleteRule(0);break}case"inactive":{t=void 0,a.cssRules.length===1&&a.deleteRule(0);break}}k2.set(e,{prevStyle:t,styleSheet:a})}let ba=new Map;const MR=new NR;function FU(e){ba=new Map(ba),ba.delete(e)}function w2(e,t){for(const[a]of ba)if(a.id===e)return a}function Kr(e,t){for(const[a,r]of ba)if(a.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function ro(){return ba}function jv(e,t){return MR.addListener("groupChange",a=>{a.group.id===e&&t(a)})}function cr(e,t,a){const r=ba.get(e);ba=new Map(ba),ba.set(e,t),MR.emit("groupChange",{group:e,isUserInteraction:a?.isUserInteraction===!0,prev:r,next:t})}function zR(e){const t=Uo(),a=ro();let r=!1;switch(t.state){case"active":tl({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(yv(e),r=!0,t.hitRegions.forEach(i=>{if(!a.has(i.group))return;const l=Kr(i.group.id,!0);cr(i.group,l,{isUserInteraction:!0})}))}return r}function S2(e){e.defaultPrevented||zR(e.currentTarget)}function GU(e,t,a){let r,i={x:1/0,y:1/0};for(const l of t){const d=SR(a,l.rect);switch(e){case"horizontal":{d.x<=i.x&&(r=l,i=d);break}case"vertical":{d.y<=i.y&&(r=l,i=d);break}}}return r?{distance:i,hitRegion:r}:void 0}function YU(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function KU(e,t){if(e===t)throw new Error("Cannot compare node with itself");const a={a:E2(e),b:E2(t)};let r;for(;a.a.at(-1)===a.b.at(-1);)r=a.a.pop(),a.b.pop();Gt(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:N2(C2(a.a)),b:N2(C2(a.b))};if(i.a===i.b){const l=r.childNodes,d={a:a.a.at(-1),b:a.b.at(-1)};let f=l.length;for(;f--;){const p=l[f];if(p===d.a)return 1;if(p===d.b)return-1}}return Math.sign(i.a-i.b)}const XU=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function QU(e){const t=getComputedStyle(OR(e)??e).display;return t==="flex"||t==="inline-flex"}function WU(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||QU(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||XU.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function C2(e){let t=e.length;for(;t--;){const a=e[t];if(Gt(a,"Missing node"),WU(a))return a}return null}function N2(e){return e&&Number(getComputedStyle(e).zIndex)||0}function E2(e){const t=[];for(;e;)t.push(e),e=OR(e);return t}function OR(e){const{parentNode:t}=e;return YU(t)?t.host:t}function ZU(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function JU({groupElement:e,hitRegion:t,pointerEventTarget:a}){if(!wR(a)||a.contains(e)||e.contains(a))return!0;if(KU(a,e)>0){let r=a;for(;r;){if(r.contains(e))return!0;if(ZU(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function kv(e,t){const a=[];return t.forEach((r,i)=>{if(i.disabled)return;const l=CR(i),d=GU(i.orientation,l,{x:e.clientX,y:e.clientY});d&&d.distance.x<=0&&d.distance.y<=0&&JU({groupElement:i.element,hitRegion:d.hitRegion.rect,pointerEventTarget:e.target})&&a.push(d.hitRegion)}),a}function eq(e,t){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a++)if(e[a]!=t[a])return!1;return!0}function Qn(e,t,a=0){return Math.abs(ts(e)-ts(t))<=a}function ma(e,t){return Qn(e,t)?0:e>t?1:-1}function Fi({overrideDisabledPanels:e,panelConstraints:t,prevSize:a,size:r}){const{collapsedSize:i=0,collapsible:l,disabled:d,maxSize:f=100,minSize:p=0}=t;if(d&&!e)return a;if(ma(r,p)<0)if(l){const g=(i+p)/2;ma(r,g)<0?r=i:r=p}else r=p;return r=Math.min(f,r),r=ts(r),r}function Qc({delta:e,initialLayout:t,panelConstraints:a,pivotIndices:r,prevLayout:i,trigger:l}){if(Qn(e,0))return t;const d=l==="imperative-api",f=Object.values(t),p=Object.values(i),g=[...f],[h,b]=r;Gt(h!=null,"Invalid first pivot index"),Gt(b!=null,"Invalid second pivot index");let _=0;switch(l){case"keyboard":{{const j=e<0?b:h,k=a[j];Gt(k,`Panel constraints not found for index ${j}`);const{collapsedSize:C=0,collapsible:w,minSize:E=0}=k;if(w){const R=f[j];if(Gt(R!=null,`Previous layout not found for panel index ${j}`),Qn(R,C)){const T=E-R;ma(T,Math.abs(e))>0&&(e=e<0?0-T:T)}}}{const j=e<0?h:b,k=a[j];Gt(k,`No panel constraints found for index ${j}`);const{collapsedSize:C=0,collapsible:w,minSize:E=0}=k;if(w){const R=f[j];if(Gt(R!=null,`Previous layout not found for panel index ${j}`),Qn(R,E)){const T=R-C;ma(T,Math.abs(e))>0&&(e=e<0?0-T:T)}}}break}default:{const j=e<0?b:h,k=a[j];Gt(k,`Panel constraints not found for index ${j}`);const C=f[j],{collapsible:w,collapsedSize:E,minSize:R}=k;if(w&&ma(C,R)<0)if(e>0){const T=R-E,A=T/2,z=C+e;ma(z,R)<0&&(e=ma(e,A)<=0?0:T)}else{const T=R-E,A=100-T/2,z=C-e;ma(z,R)<0&&(e=ma(100+e,A)>0?0:-T)}break}}{const j=e<0?1:-1;let k=e<0?b:h,C=0;for(;;){const E=f[k];Gt(E!=null,`Previous layout not found for panel index ${k}`);const R=Fi({overrideDisabledPanels:d,panelConstraints:a[k],prevSize:E,size:100})-E;if(C+=R,k+=j,k<0||k>=a.length)break}const w=Math.min(Math.abs(e),Math.abs(C));e=e<0?0-w:w}{let j=e<0?h:b;for(;j>=0&&j<a.length;){const k=Math.abs(e)-Math.abs(_),C=f[j];Gt(C!=null,`Previous layout not found for panel index ${j}`);const w=C-k,E=Fi({overrideDisabledPanels:d,panelConstraints:a[j],prevSize:C,size:w});if(!Qn(C,E)&&(_+=C-E,g[j]=E,_.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?j--:j++}}if(eq(p,g))return i;{const j=e<0?b:h,k=f[j];Gt(k!=null,`Previous layout not found for panel index ${j}`);const C=k+_,w=Fi({overrideDisabledPanels:d,panelConstraints:a[j],prevSize:k,size:C});if(g[j]=w,!Qn(w,C)){let E=C-w,R=e<0?b:h;for(;R>=0&&R<a.length;){const T=g[R];Gt(T!=null,`Previous layout not found for panel index ${R}`);const A=T+E,z=Fi({overrideDisabledPanels:d,panelConstraints:a[R],prevSize:T,size:A});if(Qn(T,z)||(E-=z-T,g[R]=z),Qn(E,0))break;e>0?R--:R++}}}const y=Object.values(g).reduce((j,k)=>k+j,0);if(!Qn(y,100,.1))return i;const S=Object.keys(i);return g.reduce((j,k,C)=>(j[S[C]]=k,j),{})}function qo(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const a in e)if(t[a]===void 0||ma(e[a],t[a])!==0)return!1;return!0}function Ho({layout:e,panelConstraints:t}){const a=Object.values(e),r=[...a],i=r.reduce((f,p)=>f+p,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(f=>`${f}%`).join(", ")}`);if(!Qn(i,100)&&r.length>0)for(let f=0;f<t.length;f++){const p=r[f];Gt(p!=null,`No layout data found for index ${f}`);const g=100/i*p;r[f]=g}let l=0;for(let f=0;f<t.length;f++){const p=a[f];Gt(p!=null,`No layout data found for index ${f}`);const g=r[f];Gt(g!=null,`No layout data found for index ${f}`);const h=Fi({overrideDisabledPanels:!0,panelConstraints:t[f],prevSize:p,size:g});g!=h&&(l+=g-h,r[f]=h)}if(!Qn(l,0))for(let f=0;f<t.length;f++){const p=r[f];Gt(p!=null,`No layout data found for index ${f}`);const g=p+l,h=Fi({overrideDisabledPanels:!0,panelConstraints:t[f],prevSize:p,size:g});if(p!==h&&(l-=h-p,r[f]=h,Qn(l,0)))break}const d=Object.keys(e);return r.reduce((f,p,g)=>(f[d[g]]=p,f),{})}function DR({groupId:e,panelId:t}){const a=()=>{const p=ro();for(const[g,{defaultLayoutDeferred:h,derivedPanelConstraints:b,layout:_,groupSize:y,separatorToPanels:S}]of p)if(g.id===e)return{defaultLayoutDeferred:h,derivedPanelConstraints:b,group:g,groupSize:y,layout:_,separatorToPanels:S};throw Error(`Group ${e} not found`)},r=()=>{const p=a().derivedPanelConstraints.find(g=>g.panelId===t);if(p!==void 0)return p;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const p=a().group.panels.find(g=>g.id===t);if(p!==void 0)return p;throw Error(`Layout not found for Panel ${t}`)},l=()=>{const p=a().layout[t];if(p!==void 0)return p;throw Error(`Layout not found for Panel ${t}`)},d=({nextSize:p,panels:g,prevLayout:h,derivedPanelConstraints:b})=>{const _=l(),y=g.findIndex(k=>k.id===t),S=y===0,j=y===g.length-1;if(j&&p<_&&(S||g.slice(0,y).every((k,C)=>{const w=b[C];return w?.collapsible&&Qn(w.collapsedSize,h[w.panelId])}))){const k=g.slice(0,y).reduce((C,w)=>C+h[w.id],0);return{...h,[t]:ts(100-k)}}return Qc({delta:j?_-p:p-_,initialLayout:h,panelConstraints:b,pivotIndices:j?[y-1,y]:[y,y+1],prevLayout:h,trigger:"imperative-api"})},f=p=>{const g=l();if(p===g)return;const{defaultLayoutDeferred:h,derivedPanelConstraints:b,group:_,groupSize:y,layout:S,separatorToPanels:j}=a(),k=d({nextSize:p,panels:_.panels,prevLayout:S,derivedPanelConstraints:b}),C=Ho({layout:k,panelConstraints:b});qo(S,C)||cr(_,{defaultLayoutDeferred:h,derivedPanelConstraints:b,groupSize:y,layout:C,separatorToPanels:j})};return{collapse:()=>{const{collapsible:p,collapsedSize:g}=r(),{mutableValues:h}=i(),b=l();p&&b!==g&&(h.expandToSize=b,f(g))},expand:()=>{const{collapsible:p,collapsedSize:g,minSize:h}=r(),{mutableValues:b}=i(),_=l();if(p&&_===g){let y=b.expandToSize??h;y===0&&(y=1),f(y)}},getSize:()=>{const{group:p}=a(),g=l(),{element:h}=i(),b=p.orientation==="horizontal"?h.offsetWidth:h.offsetHeight;return{asPercentage:g,inPixels:b}},isCollapsed:()=>{const{collapsible:p,collapsedSize:g}=r(),h=l();return p&&Qn(g,h)},resize:p=>{const{group:g}=a(),{element:h}=i(),b=fl({group:g}),_=Mc({groupSize:b,panelElement:h,styleProp:p}),y=ts(_/b*100);f(y)}}}function R2(e){if(e.defaultPrevented)return;const t=ro();kv(e,t).forEach(a=>{if(a.separator&&!a.separator.disableDoubleClick){const r=a.panels.find(i=>i.panelConstraints.defaultSize!==void 0);if(r){const i=r.panelConstraints.defaultSize,l=DR({groupId:a.group.id,panelId:r.id});l&&i!==void 0&&(l.resize(i),e.preventDefault())}}})}function mf(e){const t=ro();for(const[a]of t)if(a.separators.some(r=>r.element===e))return a;throw Error("Could not find parent Group for separator element")}function PR({groupId:e}){const t=()=>{const a=ro();for(const[r,i]of a)if(r.id===e)return{group:r,...i};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:a,layout:r}=t();return a?{}:r},setLayout(a){const{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:l,groupSize:d,layout:f,separatorToPanels:p}=t(),g=Ho({layout:a,panelConstraints:i});return r?f:(qo(f,g)||cr(l,{defaultLayoutDeferred:r,derivedPanelConstraints:i,groupSize:d,layout:g,separatorToPanels:p}),g)}}}function Ro(e,t){const a=mf(e),r=Kr(a.id,!0),i=a.separators.find(h=>h.element===e);Gt(i,"Matching separator not found");const l=r.separatorToPanels.get(i);Gt(l,"Matching panels not found");const d=l.map(h=>a.panels.indexOf(h)),f=PR({groupId:a.id}).getLayout(),p=Qc({delta:t,initialLayout:f,panelConstraints:r.derivedPanelConstraints,pivotIndices:d,prevLayout:f,trigger:"keyboard"}),g=Ho({layout:p,panelConstraints:r.derivedPanelConstraints});qo(f,g)||cr(a,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:g,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function T2(e){if(e.defaultPrevented)return;const t=e.currentTarget,a=mf(t);if(!a.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),a.orientation==="vertical"&&Ro(t,5);break}case"ArrowLeft":{e.preventDefault(),a.orientation==="horizontal"&&Ro(t,-5);break}case"ArrowRight":{e.preventDefault(),a.orientation==="horizontal"&&Ro(t,5);break}case"ArrowUp":{e.preventDefault(),a.orientation==="vertical"&&Ro(t,-5);break}case"End":{e.preventDefault(),Ro(t,100);break}case"Enter":{e.preventDefault();const r=mf(t),i=Kr(r.id,!0),{derivedPanelConstraints:l,layout:d,separatorToPanels:f}=i,p=r.separators.find(_=>_.element===t);Gt(p,"Matching separator not found");const g=f.get(p);Gt(g,"Matching panels not found");const h=g[0],b=l.find(_=>_.panelId===h.id);if(Gt(b,"Panel metadata not found"),b.collapsible){const _=d[h.id],y=b.collapsedSize===_?r.mutableState.expandedPanelSizes[h.id]??b.minSize:b.collapsedSize;Ro(t,y-_)}break}case"F6":{e.preventDefault();const r=mf(t).separators.map(d=>d.element),i=Array.from(r).findIndex(d=>d===e.currentTarget);Gt(i!==null,"Index not found");const l=e.shiftKey?i>0?i-1:r.length-1:i+1<r.length?i+1:0;r[l].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),Ro(t,-100);break}}}function A2(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=ro(),a=kv(e,t),r=new Map;let i=!1;a.forEach(l=>{l.separator&&(i||(i=!0,l.separator.element.focus({focusVisible:!1,preventScroll:!0})));const d=t.get(l.group);d&&r.set(l.group,d.layout)}),tl({cursorFlags:0,hitRegions:a,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),a.length&&e.preventDefault()}function LR({document:e,event:t,hitRegions:a,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:l,prevCursorFlags:d}){let f=0;a.forEach(g=>{const{group:h,groupSize:b}=g,{orientation:_,panels:y}=h,{disableCursor:S}=h.mutableState;let j=0;l?_==="horizontal"?j=(t.clientX-l.x)/b*100:j=(t.clientY-l.y)/b*100:_==="horizontal"?j=t.clientX<0?-100:100:j=t.clientY<0?-100:100;const k=r.get(h),C=i.get(h);if(!k||!C)return;const{defaultLayoutDeferred:w,derivedPanelConstraints:E,groupSize:R,layout:T,separatorToPanels:A}=C;if(E&&T&&A){const z=Qc({delta:j,initialLayout:k,panelConstraints:E,pivotIndices:g.panels.map(M=>y.indexOf(M)),prevLayout:T,trigger:"mouse-or-touch"});if(qo(z,T)){if(j!==0&&!S)switch(_){case"horizontal":{f|=j<0?ER:RR;break}case"vertical":{f|=j<0?TR:AR;break}}}else cr(g.group,{defaultLayoutDeferred:w,derivedPanelConstraints:E,groupSize:R,layout:z,separatorToPanels:A})}});let p=0;t.movementX===0?p|=d&v2:p|=f&v2,t.movementY===0?p|=d&y2:p|=f&y2,qU(p),yv(e)}function M2(e){const t=ro(),a=Uo();switch(a.state){case"active":LR({document:e.currentTarget,event:e,hitRegions:a.hitRegions,initialLayoutMap:a.initialLayoutMap,mountedGroups:t,prevCursorFlags:a.cursorFlags})}}function z2(e){if(e.defaultPrevented)return;const t=Uo(),a=ro();switch(t.state){case"active":{if(e.buttons===0){tl({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(r=>{if(!a.has(r.group))return;const i=Kr(r.group.id,!0);cr(r.group,i,{isUserInteraction:!0})});return}for(const r of t.hitRegions)if(r.separator){const{element:i}=r.separator;i.hasPointerCapture?.(e.pointerId)||i.setPointerCapture?.(e.pointerId)}LR({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:a,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const r=kv(e,a);r.length===0?t.state!=="inactive"&&tl({cursorFlags:0,state:"inactive"}):tl({cursorFlags:0,hitRegions:r,state:"hover"}),yv(e.currentTarget);break}}}function O2(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Uo().state){case"hover":tl({cursorFlags:0,state:"inactive"})}}function D2(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||zR(e.currentTarget)&&e.preventDefault()}function P2(e){let t=0,a=0;const r={};for(const l of e)if(l.defaultSize!==void 0){t++;const d=ts(l.defaultSize);a+=d,r[l.panelId]=d}else r[l.panelId]=void 0;const i=e.length-t;if(i!==0){const l=ts((100-a)/i);for(const d of e)d.defaultSize===void 0&&(r[d.panelId]=l)}return r}function tq(e,t,a){if(!a[0])return;const r=e.panels.find(p=>p.element===t);if(!r||!r.onResize)return;const i=fl({group:e}),l=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,d=r.mutableValues.prevSize,f={asPercentage:ts(l/i*100),inPixels:l};r.mutableValues.prevSize=f,r.onResize(f,r.id,d)}function nq(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const a in e)if(e[a]!==t[a])return!1;return!0}function sq(e,t){return e.length!==t.length?!1:e.every((a,r)=>nq(a,t[r]))}function aq({group:e,nextGroupSize:t,prevGroupSize:a,prevLayout:r}){if(a<=0||t<=0||a===t)return r;let i=0,l=0,d=!1;const f=new Map,p=[];for(const b of e.panels){const _=r[b.id]??0;switch(b.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{d=!0;const y=_/100*a,S=ts(y/t*100);f.set(b.id,S),i+=S;break}case"preserve-relative-size":default:{p.push(b.id),l+=_;break}}}if(!d||p.length===0)return r;const g=100-i,h={...r};if(f.forEach((b,_)=>{h[_]=b}),l>0)for(const b of p){const _=r[b]??0;h[b]=ts(_/l*g)}else{const b=ts(g/p.length);for(const _ of p)h[_]=b}return h}function rq(e,t){const a=e.map(i=>i.id),r=Object.keys(t);if(a.length!==r.length)return!1;for(const i of a)if(!r.includes(i))return!1;return!0}const Ui=new Map;function oq(e){let t=!0;Gt(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const a=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,l=new a(S=>{for(const j of S){const{borderBoxSize:k,target:C}=j;if(C===e.element){if(t){const w=fl({group:e});if(w===0)return;const E=Kr(e.id);if(!E)return;const R=mb(e),T=E.defaultLayoutDeferred?P2(R):E.layout,A=aq({group:e,nextGroupSize:w,prevGroupSize:E.groupSize,prevLayout:T}),z=Ho({layout:A,panelConstraints:R});if(!E.defaultLayoutDeferred&&qo(E.layout,z)&&sq(E.derivedPanelConstraints,R)&&E.groupSize===w)continue;cr(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:R,groupSize:w,layout:z,separatorToPanels:E.separatorToPanels})}}else tq(e,C,k)}});l.observe(e.element),e.panels.forEach(S=>{Gt(!r.has(S.id),`Panel ids must be unique; id "${S.id}" was used more than once`),r.add(S.id),S.onResize&&l.observe(S.element)});const d=fl({group:e}),f=mb(e),p=e.panels.map(({id:S})=>S).join(",");let g=e.mutableState.defaultLayout;g&&(rq(e.panels,g)||(g=void 0));const h=e.mutableState.layouts[p]??g??P2(f),b=Ho({layout:h,panelConstraints:f}),_=e.element.ownerDocument;Ui.set(_,(Ui.get(_)??0)+1);const y=new Map;return CR(e).forEach(S=>{S.separator&&y.set(S.separator,S.panels)}),cr(e,{defaultLayoutDeferred:d===0,derivedPanelConstraints:f,groupSize:d,layout:b,separatorToPanels:y}),e.separators.forEach(S=>{Gt(!i.has(S.id),`Separator ids must be unique; id "${S.id}" was used more than once`),i.add(S.id),S.element.addEventListener("keydown",T2)}),Ui.get(_)===1&&(_.addEventListener("contextmenu",S2,!0),_.addEventListener("dblclick",R2,!0),_.addEventListener("pointerdown",A2,!0),_.addEventListener("pointerleave",M2),_.addEventListener("pointermove",z2),_.addEventListener("pointerout",O2),_.addEventListener("pointerup",D2,!0)),function(){t=!1,Ui.set(_,Math.max(0,(Ui.get(_)??0)-1)),FU(e),e.separators.forEach(S=>{S.element.removeEventListener("keydown",T2)}),Ui.get(_)||(_.removeEventListener("contextmenu",S2,!0),_.removeEventListener("dblclick",R2,!0),_.removeEventListener("pointerdown",A2,!0),_.removeEventListener("pointerleave",M2),_.removeEventListener("pointermove",z2),_.removeEventListener("pointerout",O2),_.removeEventListener("pointerup",D2,!0)),l.disconnect()}}function iq(){const[e,t]=x.useState({}),a=x.useCallback(()=>t({}),[]);return[e,a]}function wv(e){const t=x.useId();return`${e??t}`}const Jo=typeof window<"u"?x.useLayoutEffect:x.useEffect;function Lc(e){const t=x.useRef(e);return Jo(()=>{t.current=e},[e]),x.useCallback((...a)=>t.current?.(...a),[t])}function Sv(...e){return Lc(t=>{e.forEach(a=>{if(a)switch(typeof a){case"function":{a(t);break}case"object":{a.current=t;break}}})})}function Cv(e){const t=x.useRef({...e});return Jo(()=>{for(const a in e)t.current[a]=e[a]},[e]),t.current}const IR=x.createContext(null);function lq(e,t){const a=x.useRef({getLayout:()=>({}),setLayout:HU});x.useImperativeHandle(t,()=>a.current,[]),Jo(()=>{Object.assign(a.current,PR({groupId:e}))})}function hb({children:e,className:t,defaultLayout:a,disableCursor:r,disabled:i,elementRef:l,groupRef:d,id:f,onLayoutChange:p,onLayoutChanged:g,orientation:h="horizontal",resizeTargetMinimumSize:b={coarse:20,fine:10},style:_,...y}){const S=x.useRef({onLayoutChange:{},onLayoutChanged:{}}),j=Lc(I=>{qo(S.current.onLayoutChange,I)||(S.current.onLayoutChange=I,p?.(I))}),k=Lc((I,P)=>{qo(S.current.onLayoutChanged,I)||(S.current.onLayoutChanged=I,g?.(I,{isUserInteraction:P}))}),C=wv(f),w=x.useRef(null),[E,R]=iq(),T=x.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:b,separators:[]}),A=Sv(w,l);lq(C,d);const z=Lc((I,P)=>{const B=Uo(),q=w2(I),Y=Kr(I);if(Y){let U=!1;switch(B.state){case"active":{U=B.hitRegions.some(V=>V.group===q);break}}return{flexGrow:Y.layout[P]??1,pointerEvents:U?"none":void 0}}if(a?.[P])return{flexGrow:a?.[P]}}),M=Cv({defaultLayout:a,disableCursor:r}),D=x.useMemo(()=>({get disableCursor(){return!!M.disableCursor},getPanelStyles:z,id:C,orientation:h,registerPanel:I=>{const P=T.current;return P.panels=gb(h,[...P.panels,I]),R(),()=>{P.panels=P.panels.filter(B=>B!==I),R()}},registerSeparator:I=>{const P=T.current;return P.separators=gb(h,[...P.separators,I]),R(),()=>{P.separators=P.separators.filter(B=>B!==I),R()}},updatePanelProps:(I,{disabled:P})=>{const B=T.current.panels.find(U=>U.id===I);B&&(B.panelConstraints.disabled=P);const q=w2(C),Y=Kr(C);q&&Y&&cr(q,{...Y,derivedPanelConstraints:mb(q)})},updateSeparatorProps:(I,{disabled:P,disableDoubleClick:B})=>{const q=T.current.separators.find(Y=>Y.id===I);q&&(q.disabled=P,q.disableDoubleClick=B)}}),[z,C,R,h,M]),L=x.useRef(null);return Jo(()=>{const I=w.current;if(I===null)return;const P=T.current;let B;if(M.defaultLayout!==void 0&&Object.keys(M.defaultLayout).length===P.panels.length){B={};for(const W of P.panels){const $=M.defaultLayout[W.id];$!==void 0&&(B[W.id]=$)}}const q={disabled:!!i,element:I,id:C,mutableState:{defaultLayout:B,disableCursor:!!M.disableCursor,expandedPanelSizes:T.current.lastExpandedPanelSizes,layouts:T.current.layouts},orientation:h,panels:P.panels,resizeTargetMinimumSize:P.resizeTargetMinimumSize,separators:P.separators};L.current=q;const Y=oq(q),{defaultLayoutDeferred:U,derivedPanelConstraints:V,layout:X}=Kr(q.id,!0);!U&&V.length>0&&(j(X),k(X,!1));const Q=jv(C,W=>{const{defaultLayoutDeferred:$,derivedPanelConstraints:K,layout:J}=W.next;if($||K.length===0)return;const G=q.panels.map(({id:se})=>se).join(",");q.mutableState.layouts[G]=J,K.forEach(se=>{if(se.collapsible){const{layout:pe}=W.prev??{};if(pe){const F=Qn(se.collapsedSize,J[se.panelId]),oe=Qn(se.collapsedSize,pe[se.panelId]);F&&!oe&&(q.mutableState.expandedPanelSizes[se.panelId]=pe[se.panelId])}}});const te=Uo().state!=="active";j(J),te&&k(J,W.isUserInteraction)});return()=>{L.current=null,Y(),Q()}},[i,C,k,j,h,E,M]),x.useEffect(()=>{const I=L.current;I&&(I.mutableState.defaultLayout=a,I.mutableState.disableCursor=!!r)}),n.jsx(IR.Provider,{value:D,children:n.jsx("div",{...y,className:t,"data-group":!0,"data-testid":C,id:C,ref:A,style:{height:"100%",width:"100%",overflow:"hidden",..._,display:"flex",flexDirection:h==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:h==="horizontal"?"pan-y":"pan-x"},children:e})})}hb.displayName="Group";function Nv(){const e=x.useContext(IR);return Gt(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function cq(e,t){const{id:a}=Nv(),r=x.useRef({collapse:fx,expand:fx,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:fx});x.useImperativeHandle(t,()=>r.current,[]),Jo(()=>{Object.assign(r.current,DR({groupId:a,panelId:e}))})}function To({children:e,className:t,collapsedSize:a="0%",collapsible:r=!1,defaultSize:i,disabled:l,elementRef:d,groupResizeBehavior:f="preserve-relative-size",id:p,maxSize:g="100%",minSize:h="0%",onResize:b,panelRef:_,style:y,...S}){const j=!!p,k=wv(p),C=Cv({disabled:l}),w=x.useRef(null),E=Sv(w,d),{getPanelStyles:R,id:T,orientation:A,registerPanel:z,updatePanelProps:M}=Nv(),D=b!==null,L=Lc((q,Y,U)=>{b?.(q,p,U)});Jo(()=>{const q=w.current;if(q!==null){const Y={element:q,id:k,idIsStable:j,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:D?L:void 0,panelConstraints:{groupResizeBehavior:f,collapsedSize:a,collapsible:r,defaultSize:i,disabled:C.disabled,maxSize:g,minSize:h}};return z(Y)}},[f,a,r,i,D,k,j,g,h,L,z,C]),x.useEffect(()=>{M(k,{disabled:l})},[l,k,M]),cq(k,_);const I=()=>{const q=R(T,k);if(q)return JSON.stringify(q)},P=x.useSyncExternalStore(q=>jv(T,q),I,I);let B;return P?B=JSON.parse(P):i!==void 0?B={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:B={flexGrow:1},n.jsx("div",{...S,"data-disabled":l||void 0,"data-panel":!0,"data-testid":k,id:k,ref:E,style:{...uq,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...B},children:n.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...y,touchAction:A==="horizontal"?"pan-y":"pan-x"},children:e})})}To.displayName="Panel";const uq={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function dq({layout:e,panelConstraints:t,panelId:a,panelIndex:r}){let i,l;const d=e[a],f=t.find(p=>p.panelId===a);if(f){const p=f.maxSize,g=f.collapsible?f.collapsedSize:f.minSize,h=[r,r+1];l=Ho({layout:Qc({delta:g-d,initialLayout:e,panelConstraints:t,pivotIndices:h,prevLayout:e}),panelConstraints:t})[a],i=Ho({layout:Qc({delta:p-d,initialLayout:e,panelConstraints:t,pivotIndices:h,prevLayout:e}),panelConstraints:t})[a]}return{valueControls:a,valueMax:i,valueMin:l,valueNow:d}}function Ev({children:e,className:t,disabled:a,disableDoubleClick:r,elementRef:i,id:l,style:d,...f}){const p=wv(l),g=Cv({disabled:a,disableDoubleClick:r}),[h,b]=x.useState({}),[_,y]=x.useState("inactive"),[S,j]=x.useState(!1),k=x.useRef(null),C=Sv(k,i),{disableCursor:w,id:E,orientation:R,registerSeparator:T,updateSeparatorProps:A}=Nv(),z=R==="horizontal"?"vertical":"horizontal";Jo(()=>{const L=k.current;if(L!==null){const I={disabled:g.disabled,disableDoubleClick:g.disableDoubleClick,element:L,id:p},P=T(I),B=UU(Y=>{y(Y.next.state!=="inactive"&&Y.next.hitRegions.some(U=>U.separator===I)?Y.next.state:"inactive")}),q=jv(E,Y=>{const{derivedPanelConstraints:U,layout:V,separatorToPanels:X}=Y.next,Q=X.get(I);if(Q){const W=Q[0],$=Q.indexOf(W);b(dq({layout:V,panelConstraints:U,panelId:W.id,panelIndex:$}))}});return()=>{B(),q(),P()}}},[E,p,T,g]),x.useEffect(()=>{A(p,{disabled:a,disableDoubleClick:r})},[a,r,p,A]);let M;a&&!w&&(M="not-allowed");let D;if(a)D="disabled";else switch(_){case"active":{D="active";break}default:S?D="focus":D=_}return n.jsx("div",{...f,"aria-controls":h.valueControls,"aria-disabled":a||void 0,"aria-orientation":z,"aria-valuemax":h.valueMax,"aria-valuemin":h.valueMin,"aria-valuenow":h.valueNow,children:e,className:t,"data-separator":D,"data-testid":p,id:p,onBlur:()=>j(!1),onFocus:()=>j(!0),ref:C,role:"separator",style:{flexBasis:"auto",cursor:M,...d,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:a?void 0:0})}Ev.displayName="Separator";function fq({projects:e,value:t,onChange:a,disabled:r}){const i=e.map(l=>{const d=l.path?.split("/").filter(Boolean).pop()||u("modules_ui.code_project_fallback",{id:l.id});return{value:String(l.id),label:l.name||d,icon:hM,description:l.path}});return n.jsx("div",{className:"w-full","data-testid":"code-project-select",children:n.jsx(ct,{value:t,onChange:a,options:i,placeholder:u("modules_ui.code_pick_project_ph"),disabled:r})})}function pq({sessions:e,activeId:t,busy:a,onSelect:r,onCreate:i,onRename:l,onDelete:d}){return n.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-session-list",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:u("code_module.sessions")}),n.jsx(Ue,{content:u("code_module.new_session"),children:n.jsxs("button",{type:"button",onClick:i,disabled:a,"data-testid":"code-new-session",className:"flex items-center gap-1 rounded-md border border-border px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50",children:[n.jsx(Ot,{className:"size-3"})," ",u("code_module.new_session")]})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 pb-2",children:e.length===0?n.jsx("div",{className:"p-2",children:n.jsx(ut,{children:u("code_module.no_sessions")})}):n.jsx("ul",{className:"space-y-0.5",children:e.map(f=>n.jsxs("li",{className:"group/item relative",children:[n.jsxs("button",{type:"button",onClick:()=>r(f.id),className:me("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left text-xs transition-colors",f.id===t?"bg-accent text-accent-fg":"text-foreground/80 hover:bg-accent/50"),children:[n.jsx(Db,{className:"mt-0.5 size-3.5 shrink-0 opacity-60"}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate font-medium",children:f.title}),n.jsxs("span",{className:"block truncate text-[10px] text-muted-foreground",children:[f.mode," · ",f.messageCount," msg",f.model?` · ${f.model}`:""]})]})]}),n.jsxs("div",{className:"absolute right-1 top-1 hidden items-center gap-0.5 group-hover/item:flex",children:[n.jsx(Ue,{content:u("code_module.rename"),children:n.jsx("button",{type:"button",onClick:()=>l(f.id,f.title),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-foreground",children:n.jsx(wa,{className:"size-3"})})}),n.jsx(Ue,{content:u("code_module.delete"),children:n.jsx("button",{type:"button",onClick:()=>d(f.id),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-rose-500",children:n.jsx(_n,{className:"size-3"})})})]})]},f.id))})})]})}function mq({mode:e,onChange:t,disabled:a}){const r=(i,l,d,f)=>n.jsx(Ue,{content:d,children:n.jsxs("button",{type:"button",disabled:a,"data-testid":`code-mode-${i}`,"aria-pressed":e===i,onClick:()=>t(i),className:me("flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors disabled:opacity-50",e===i?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[n.jsx(f,{className:"size-3.5"})," ",l]})});return n.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border border-border bg-muted/60 p-0.5",children:[r("build",u("code_module.mode_build"),u("code_module.mode_build_hint"),yM),r("plan",u("code_module.mode_plan"),u("code_module.mode_plan_hint"),aM)]})}function gq({value:e,onValueChange:t,onSubmit:a,onStop:r,busy:i,disabled:l,mode:d,onModeChange:f,model:p,onModelChange:g}){return n.jsx(ev,{value:e,onValueChange:t,onSubmit:a,onStop:r,busy:i,disabled:l,placeholder:u("code_module.placeholder"),minRows:1,maxRows:6,footer:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(mq,{mode:d,onChange:f,disabled:i}),n.jsx(tv,{value:p,onChange:g,disabled:i})]})})}function px(e,t){let a=0;for(const r of e.parts||[])r.kind==="text"&&t.text&&(a+=r.text.length),r.kind==="tool"&&t.tool&&(r.args&&(a+=JSON.stringify(r.args).length),r.result!==void 0&&(a+=JSON.stringify(r.result).length));return Math.ceil(a/4)}function hq(e){let t=null,a=0,r=0;for(const d of e)d.role==="user"?a++:r++,d.role==="assistant"&&d.usage&&(t={input:d.usage.input_tokens,output:d.usage.output_tokens,model:d.model});const i=t?.input??0,l=t?.output??0;return{model:t?.model??null,input:i,output:l,total:i+l,hasUsage:!!t,messages:e.length,userMsgs:a,assistantMsgs:r}}function xq(e){let t=0,a=0,r=0;for(const d of e)d.role==="user"?t+=px(d,{text:!0}):a+=px(d,{text:!0}),r+=px(d,{tool:!0});const i=t+a+r||1,l=(d,f)=>({key:d,tokens:f,percent:Math.round(f/i*100)});return[l("user",t),l("assistant",a),l("tool",r)].filter(d=>d.tokens>0)}const L2={user:"bg-emerald-500",assistant:"bg-sky-500",tool:"bg-amber-500"};function Ka({label:e,value:t}){return n.jsxs("div",{className:"flex items-baseline justify-between gap-2 py-0.5",children:[n.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:e}),n.jsx("span",{className:"min-w-0 truncate text-right font-mono text-xs text-foreground",children:t})]})}function I2(e){if(!e)return"";const t=new Date(e),a=r=>String(r).padStart(2,"0");return`${a(t.getDate())} ${t.toLocaleString("es",{month:"short"})} ${t.getFullYear()}, ${a(t.getHours())}:${a(t.getMinutes())}`}function bq({turns:e,session:t}){const a=x.useMemo(()=>hq(e),[e]),r=x.useMemo(()=>xq(e),[e]);return e.length===0?n.jsx("div",{className:"p-3",children:n.jsx(ut,{children:u("code_module.ctx_none")})}):n.jsxs("div",{className:"space-y-1 p-3","data-testid":"code-context-tab",children:[n.jsx(Ka,{label:u("code_module.ctx_model"),value:a.model||u("modules_ui.code_ctx_auto")}),t?.mode&&n.jsx(Ka,{label:u("modules_ui.code_ctx_mode"),value:t.mode}),t?.agentSlug&&n.jsx(Ka,{label:u("modules_ui.code_ctx_agent"),value:t.agentSlug}),n.jsx(Ka,{label:u("code_module.ctx_messages"),value:u("modules_ui.code_ctx_msgs_value",{user:a.userMsgs,assistant:a.assistantMsgs})}),n.jsx(Ka,{label:u("code_module.ctx_input"),value:a.input.toLocaleString()}),n.jsx(Ka,{label:u("code_module.ctx_output"),value:a.output.toLocaleString()}),n.jsx(Ka,{label:u("modules_ui.code_ctx_tokens_total"),value:(a.input+a.output).toLocaleString()}),t?.createdAt&&n.jsx(Ka,{label:u("modules_ui.code_ctx_created"),value:I2(t.createdAt)}),t?.updatedAt&&n.jsx(Ka,{label:u("modules_ui.code_ctx_activity"),value:I2(t.updatedAt)}),n.jsx("hr",{className:"border-border my-2"}),n.jsxs("div",{children:[n.jsx("div",{className:"mb-1 text-[11px] font-semibold text-muted-foreground",children:u("code_module.ctx_breakdown")}),r.length>0?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex h-2.5 w-full overflow-hidden rounded-full bg-muted",children:r.map(i=>n.jsx(Ue,{content:`${i.key}: ${i.tokens} (${i.percent}%)`,children:n.jsx("div",{className:L2[i.key],style:{width:`${i.percent}%`}})},i.key))}),n.jsx("ul",{className:"mt-2 space-y-1",children:r.map(i=>n.jsxs("li",{className:"flex items-center gap-2 text-[11px]",children:[n.jsx("span",{className:`size-2 rounded-full ${L2[i.key]}`}),n.jsx("span",{className:"flex-1 text-foreground/80",children:u(`code_module.seg_${i.key}`)}),n.jsxs("span",{className:"font-mono text-muted-foreground",children:[i.tokens," · ",i.percent,"%"]})]},i.key))})]}):n.jsx("p",{className:"text-[11px] text-muted-foreground",children:u("code_module.ctx_none")})]})]})}function _q(e){const t=[];for(const a of(e||"").split(`
844
+ `))a.startsWith("diff --git")||a.startsWith("index ")||a.startsWith("--- ")||a.startsWith("+++ ")||a.startsWith("new file")||a.startsWith("deleted file")||a.startsWith("similarity index")||a.startsWith("rename ")||(a.startsWith("@@")?t.push({kind:"hunk",text:a}):a.startsWith("+")?t.push({kind:"add",text:a.slice(1)}):a.startsWith("-")?t.push({kind:"del",text:a.slice(1)}):t.push({kind:"ctx",text:a.replace(/^ /,"")}));for(;t.length&&t[t.length-1].kind==="ctx"&&t[t.length-1].text==="";)t.pop();return t}function vq({patch:e}){const t=x.useMemo(()=>_q(e),[e]);return t.length?n.jsx("pre",{className:"overflow-x-auto rounded-md border border-border bg-background/60 font-mono text-[11px] leading-relaxed",children:n.jsx("code",{className:"block",children:t.map((a,r)=>n.jsxs("div",{className:me("px-2 whitespace-pre",a.kind==="add"&&"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",a.kind==="del"&&"bg-rose-500/10 text-rose-600 dark:text-rose-400",a.kind==="hunk"&&"bg-muted/60 text-muted-foreground",a.kind==="ctx"&&"text-foreground/70"),children:[n.jsx("span",{className:"select-none opacity-50",children:a.kind==="add"?"+":a.kind==="del"?"-":" "}),a.text]},r))})}):null}const yq={added:bx,modified:bf,deleted:gM},jq={added:"text-emerald-600 dark:text-emerald-400",modified:"text-amber-600 dark:text-amber-400",deleted:"text-rose-600 dark:text-rose-400"};function kq({file:e}){const[t,a]=x.useState(!1),r=yq[e.status];return n.jsxs("li",{className:"rounded-md border border-border",children:[n.jsxs("button",{type:"button",onClick:()=>a(i=>!i),className:"flex w-full items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-accent/40",children:[n.jsx(eo,{className:me("size-3 shrink-0 transition-transform",t&&"rotate-90")}),n.jsx(r,{className:me("size-3.5 shrink-0",jq[e.status])}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:e.path}),n.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[e.additions!=null&&n.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400",children:["+",e.additions]}),e.deletions!=null&&n.jsxs("span",{className:"ml-1 text-rose-600 dark:text-rose-400",children:["-",e.deletions]})]})]}),t&&n.jsx("div",{className:"border-t border-border p-1.5",children:n.jsx(vq,{patch:e.patch})})]})}function wq({changes:e,loading:t,onRefresh:a}){const r=e?.files||[];return n.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-changes-tab",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[n.jsx("span",{className:"text-[11px] text-muted-foreground",children:r.length>0?u("code_module.changes_files",{n:r.length}):""}),n.jsx(Ue,{content:u("code_module.reload"),children:n.jsx("button",{type:"button",onClick:a,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:t?n.jsx(bn,{size:12}):n.jsx(Cs,{className:"size-3"})})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:e&&!e.git?n.jsx(ut,{children:u("code_module.changes_no_git")}):r.length===0?n.jsx(ut,{children:u("code_module.changes_none")}):n.jsx("ul",{className:"space-y-1.5",children:r.map(i=>n.jsx(kq,{file:i},i.path))})})]})}const Sq=[{value:"context",icon:Zf,label:"tab_context"},{value:"changes",icon:vM,label:"tab_changes"},{value:"artifacts",icon:LM,label:"tab_artifacts"}];function Cq({pid:e,turns:t,changes:a,changesLoading:r,onRefreshChanges:i,session:l,onRunInTerminal:d,onEditArtifact:f}){const[p,g]=x.useState("context"),h=a?.files.length||0;return n.jsxs(Dp,{value:p,onValueChange:g,className:"flex h-full flex-col gap-0","data-testid":"code-side-panel",children:[n.jsx("div",{className:"shrink-0 border-b border-border px-2 py-2",children:n.jsx(Pp,{variant:"line",className:"w-full",children:Sq.map(({value:b,icon:_,label:y})=>{const S=p===b,j=u(`code_module.${y}`);return n.jsx(Ue,{content:j,children:n.jsxs(qs,{value:b,className:S?"flex-1 min-w-0":"w-8 shrink-0",children:[n.jsx(_,{className:"size-3.5 shrink-0"}),S&&n.jsx("span",{className:"truncate text-xs",children:j}),b==="changes"&&h>0&&n.jsx("span",{className:"ml-0.5 rounded-full bg-muted px-1 text-[10px] text-muted-foreground leading-none py-0.5",children:h})]})},b)})})}),n.jsx(fs,{value:"context",className:"min-h-0 flex-1 overflow-y-auto",children:n.jsx(bq,{turns:t,session:l})}),n.jsx(fs,{value:"changes",className:"min-h-0 flex-1 overflow-hidden",children:n.jsx(wq,{changes:a,loading:r,onRefresh:i})}),n.jsx(fs,{value:"artifacts",className:"min-h-0 flex-1 overflow-hidden",children:n.jsx(pR,{pid:e,onRunInTerminal:d,onEditArtifact:f})})]})}function Nq(e){const t=[];for(const r of e){const i=r.split("/").filter(Boolean);let l=t,d="";for(let f=0;f<i.length;f++){d=d?`${d}/${i[f]}`:i[f];const p=f===i.length-1;let g=l.find(h=>h.name===i[f]);g||(g={name:i[f],path:d,type:p?"file":"dir",children:p?void 0:[]},l.push(g)),p||(l=g.children)}}const a=r=>(r.forEach(i=>{i.children&&(i.children=a(i.children))}),r.sort((i,l)=>i.type!==l.type?i.type==="dir"?-1:1:i.name.localeCompare(l.name)));return a(t)}function $R({node:e,depth:t,onOpenFile:a,openDirs:r,toggleDir:i}){const l=e.type==="dir",d=l&&r.has(e.path);return n.jsxs("li",{children:[n.jsxs("button",{type:"button",onClick:()=>l?i(e.path):a(e.path),style:{paddingLeft:`${t*12+6}px`},className:me("flex w-full items-center gap-1.5 py-0.5 pr-2 text-left text-[11px] rounded transition-colors","hover:bg-accent/40",l?"text-foreground/80":"text-foreground/70"),children:[l?n.jsxs(n.Fragment,{children:[n.jsx(eo,{className:me("size-3 shrink-0 transition-transform",d&&"rotate-90")}),d?n.jsx(Go,{className:"size-3.5 shrink-0 text-amber-400"}):n.jsx(bS,{className:"size-3.5 shrink-0 text-amber-400"})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"size-3 shrink-0"}),n.jsx(hS,{className:"size-3.5 shrink-0 text-sky-400"})]}),n.jsx("span",{className:"truncate",children:e.name})]}),l&&d&&e.children&&e.children.length>0&&n.jsx("ul",{children:e.children.map(f=>n.jsx($R,{node:f,depth:t+1,onOpenFile:a,openDirs:r,toggleDir:i},f.path))})]})}function Eq({pid:e,projectPath:t,className:a,onOpenFile:r}){const[i,l]=x.useState([]),[d,f]=x.useState(!1),[p,g]=x.useState(!1),[h,b]=x.useState(()=>new Set),_=x.useCallback(async()=>{f(!0);try{const w=(await ne.post("/api/run",{cmd:"find . -type f -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/dist/*' -not -path '*/.claude/*' | sed 's|^\\./||' | sort | head -500",project:e})).stdout.split(`
845
+ `).map(E=>E.trim()).filter(Boolean);l(w),g(!0)}catch{g(!0)}finally{f(!1)}},[e]);x.useEffect(()=>{b(new Set),_()},[_]);const y=x.useCallback(C=>{b(w=>{const E=new Set(w);return E.has(C)?E.delete(C):E.add(C),E})},[]),S=x.useCallback(()=>{b(new Set)},[]),j=Nq(i),k=h.size>0;return n.jsxs("div",{className:me("flex h-full flex-col",a),"data-testid":"code-file-tree",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border px-3 py-2",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Archivos"}),n.jsxs("div",{className:"flex items-center gap-0.5",children:[n.jsx(Ue,{content:u("code_module.tree_collapse_all"),children:n.jsx("button",{type:"button",onClick:S,disabled:!k,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40 disabled:hover:bg-transparent",children:n.jsx(eM,{className:"size-3"})})}),n.jsx(Ue,{content:u("code_module.reload"),children:n.jsx("button",{type:"button",onClick:()=>void _(),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:d?n.jsx(bn,{size:12}):n.jsx(Cs,{className:"size-3"})})})]})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto py-1",children:p?j.length===0?n.jsx("div",{className:"p-3",children:n.jsx(ut,{children:"Sin archivos"})}):n.jsx("ul",{children:j.map(C=>n.jsx($R,{node:C,depth:0,onOpenFile:r??(()=>{}),openDirs:h,toggleDir:y},C.path))}):n.jsx("div",{className:"flex justify-center pt-6",children:n.jsx(bn,{size:14})})})]})}function Rq({path:e,content:t,loading:a,onSave:r}){const i=typeof r=="function",[l,d]=x.useState(t),[f,p]=x.useState(!1);x.useEffect(()=>{d(t)},[t]);const g=i&&l!==t,h=async()=>{if(!(!r||!g)){p(!0);try{await r(l)}finally{p(!1)}}};return n.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/40","data-testid":"code-file-viewer",children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5",children:[n.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",children:[e,g&&n.jsx("span",{className:"ml-1 text-amber-400",children:"•"})]}),i&&n.jsxs(n.Fragment,{children:[n.jsx(Ue,{content:u("code_module.discard_changes"),children:n.jsxs("button",{type:"button",onClick:()=>d(t),disabled:!g||f,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40",children:[n.jsx(hl,{className:"size-3"}),"Descartar"]})}),n.jsx(Ue,{content:u("code_module.save_shortcut_hint"),children:n.jsxs("button",{type:"button",onClick:()=>void h(),disabled:!g||f,className:me("inline-flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-medium transition-colors",g&&!f?"bg-emerald-500/15 text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300":"bg-muted text-muted-foreground"),children:[f?n.jsx(bn,{size:10}):n.jsx(tp,{className:"size-3"}),"Guardar"]})})]})]}),a?n.jsx("div",{className:"flex flex-1 items-center justify-center",children:n.jsx(bn,{size:16})}):i?n.jsx("textarea",{value:l,onChange:b=>d(b.target.value),onKeyDown:b=>{(b.metaKey||b.ctrlKey)&&b.key==="s"&&(b.preventDefault(),h())},className:"min-h-0 flex-1 resize-none bg-transparent p-3 font-mono text-[12px] leading-[1.6] text-foreground/90 outline-none",spellCheck:!1}):n.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:n.jsx("table",{className:"w-full border-collapse font-mono text-[12px] leading-[1.6]",children:n.jsx("tbody",{children:t.split(`
846
+ `).map((b,_)=>n.jsxs("tr",{className:"hover:bg-accent/20",children:[n.jsx("td",{className:"w-12 select-none border-r border-border/30 px-3 py-0 text-right align-top text-[10px] text-muted-foreground/40","aria-hidden":"true",children:_+1}),n.jsx("td",{className:"px-4 py-0 align-top text-foreground/90 whitespace-pre",children:b||" "})]},_))})})})]})}function Tq({pid:e,className:t,initCmd:a,onClose:r}){const[i,l]=x.useState([]),[d,f]=x.useState(""),[p,g]=x.useState(!1),[h,b]=x.useState([]),[_,y]=x.useState(-1),S=x.useRef(null),j=x.useRef(null);x.useEffect(()=>{S.current?.scrollIntoView({behavior:"smooth"})},[i]),x.useEffect(()=>{a&&(f(a),setTimeout(()=>j.current?.focus(),50))},[a]);const k=async w=>{const E=w.trim();if(E){b(R=>[E,...R.slice(0,49)]),y(-1),l(R=>[...R,{type:"cmd",text:`$ ${E}`}]),g(!0);try{const R=await ne.post("/api/run",{cmd:E,project:e});R.stdout&&l(T=>[...T,{type:"out",text:R.stdout}]),R.stderr&&l(T=>[...T,{type:"err",text:R.stderr}])}catch(R){l(T=>[...T,{type:"err",text:String(R.message)}])}finally{g(!1)}}},C=w=>{if(w.key==="Enter")k(d),f("");else if(w.key==="ArrowUp"){w.preventDefault();const E=Math.min(_+1,h.length-1);y(E),f(h[E]??"")}else if(w.key==="ArrowDown"){w.preventDefault();const E=Math.max(_-1,-1);y(E),f(E===-1?"":h[E]??"")}};return n.jsxs("div",{className:me("flex h-full min-h-0 flex-col bg-card/60",t),"data-testid":"code-terminal",children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1",children:[n.jsx(ya,{className:"size-3 text-muted-foreground"}),n.jsx("span",{className:"flex-1 text-[11px] text-muted-foreground",children:"Terminal"}),n.jsx(Ue,{content:u("code_module.terminal_clear"),children:n.jsx("button",{type:"button",onClick:()=>l([]),className:"rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:n.jsx(dM,{className:"size-3"})})}),n.jsx(Ue,{content:u("code_module.terminal_close"),children:n.jsx("button",{type:"button",onClick:()=>r?.(),className:"rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:n.jsx(gs,{className:"size-3"})})})]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-1 font-mono text-[11px] leading-snug cursor-text",onClick:()=>j.current?.focus(),children:[i.map((w,E)=>n.jsx("div",{className:me("whitespace-pre-wrap break-all",w.type==="cmd"&&"text-emerald-400",w.type==="err"&&"text-rose-400",w.type==="out"&&"text-foreground/90"),children:w.text},E)),n.jsx("div",{ref:S})]}),n.jsxs("div",{className:"flex shrink-0 items-center border-t border-border px-3 py-1",children:[n.jsx("span",{className:"mr-2 text-[11px] text-emerald-400 font-mono",children:"$"}),n.jsx("input",{ref:j,value:d,onChange:w=>f(w.target.value),onKeyDown:C,disabled:p,placeholder:p?"ejecutando…":"comando…",className:"flex-1 bg-transparent font-mono text-[11px] text-foreground outline-none placeholder:text-muted-foreground/50 disabled:opacity-50",spellCheck:!1,autoComplete:"off"})]})]})}const wc="super-agent";function mx(){return n.jsx(Ev,{className:"relative z-10 w-px shrink-0 cursor-col-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function Aq(){return n.jsx(Ev,{className:"relative z-10 h-px shrink-0 cursor-row-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function Mq(){const e=Xe(),t=$e("/api/projects",()=>Zn.list()),a=x.useMemo(()=>t.data||[],[t.data]),[r,i]=x.useState(""),[l,d]=x.useState(null),[f,p]=x.useState(wc),[g,h]=x.useState([]),[b,_]=x.useState(""),[y,S]=x.useState(!1),[j,k]=x.useState(!0),[C,w]=x.useState(!0),[E,R]=x.useState(!1),[T,A]=x.useState(""),[z,M]=x.useState(!1),D=x.useRef(null),[L,I]=Vo(),P=x.useRef(!1),[B,q]=x.useState([]),[Y,U]=x.useState("chat"),V=x.useCallback(je=>{R(!0),A(je)},[]);x.useEffect(()=>{!r&&a.length&&i(String(a[0].id))},[r,a]);const X=$e(r?["code-sessions",r]:null,()=>Ya.sessions.list(r)),Q=$e(r?["agents",r]:null,()=>an.list(r)),W=$e(r&&l?["code-session",r,l]:null,()=>Ya.sessions.get(r,l)),$=$e(r&&l?["code-changes",r,l]:null,()=>Ya.changes(r,l));x.useEffect(()=>{const je=X.data||[];!l&&je.length&&d(je[0].id),l&&je.length&&!je.some(ze=>ze.id===l)&&d(je[0]?.id??null)},[X.data,l]),x.useEffect(()=>{W.data&&p(W.data.agentSlug||wc)},[W.data]),x.useEffect(()=>{y||(W.data?h(W.data.messages||[]):l||h([]))},[W.data,l,y]),x.useEffect(()=>()=>D.current?.abort(),[]);const K=W.data,J=K?.mode==="plan"?"plan":"build",G=K?.model||"",te=je=>{je===r||y||(i(je),d(null),h([]))},se=je=>{y||je===l||(d(je),h([]))},pe=async()=>{if(!(!r||y))try{const je=await Ya.sessions.create(r,{title:u("code_module.untitled"),agentSlug:f!==wc?f:null});await X.mutate(),d(je.id),h([])}catch(je){e.error(je.message)}},F=async(je,ze)=>{const Ye=window.prompt(u("code_module.rename"),ze);if(!(!Ye||Ye===ze))try{await Ya.sessions.update(r,je,{title:Ye}),await X.mutate(),je===l&&await W.mutate()}catch(Ze){e.error(Ze.message)}},oe=async je=>{if(!y&&window.confirm(u("code_module.delete_confirm")))try{await Ya.sessions.remove(r,je),je===l&&(d(null),h([])),await X.mutate()}catch(ze){e.error(ze.message)}},_e=async je=>{if(p(je),!!l)try{await Ya.sessions.update(r,l,{agentSlug:je!==wc?je:null}),await Promise.all([W.mutate(),X.mutate()])}catch(ze){e.error(ze.message)}},le=x.useCallback(async je=>{if(l)try{await Ya.sessions.update(r,l,je),await Promise.all([W.mutate(),X.mutate()])}catch(ze){e.error(ze.message)}},[r,l,W,X,e]),be=()=>{D.current?.abort(),S(!1)},ke=je=>h(ze=>{const Ye=[...ze],Ze=Ye[Ye.length-1];return Ze&&Ze.role==="assistant"&&(Ye[Ye.length-1]=je(Ze)),Ye}),Re=async je=>{const ze=(je??b).trim();if(!ze||y||!r||!l)return;const Ye=new Date().toISOString();h(Rt=>[...Rt,{role:"user",parts:[{kind:"text",text:ze}],ts:Ye},{role:"assistant",parts:[],ts:Ye,pending:!0}]),_(""),S(!0);const Ze=new AbortController;D.current=Ze;const ft=Rt=>{if(Rt.type==="error"){e.error(Rt.error||u("modules_ui.code_stream_error"));return}ke(Qt=>nv(Qt,Rt))};try{await Ya.stream(r,l,{prompt:ze},ft,Ze.signal),ke(Rt=>({...Rt,pending:!1}))}catch(Rt){Ze.signal.aborted?ke(Qt=>({...Qt,pending:!1,parts:[...Qt.parts,{kind:"text",text:u("code_module.stopped")}]})):(e.error(Rt.message),h(Qt=>Qt.filter((ot,Lt)=>Lt!==Qt.length-1)))}finally{D.current===Ze&&(D.current=null),S(!1),W.mutate(),X.mutate(),$.mutate()}},Ae=async je=>{try{await navigator.clipboard.writeText(je),e.info(u("modules_ui.code_copied"))}catch{}},Ie=x.useCallback(je=>{U(je),q(ze=>ze.some(Ye=>Ye.path===je)?ze:[...ze,{path:je,content:"",loading:!0}]),ne.post("/run",{cmd:`cat "${je}"`,project:r}).then(ze=>{const Ye=ze.stdout||ze.stderr||u("modules_ui.code_file_empty");q(Ze=>Ze.map(ft=>ft.path===je?{...ft,content:Ye,loading:!1}:ft))}).catch(ze=>{q(Ye=>Ye.map(Ze=>Ze.path===je?{...Ze,content:u("modules_ui.code_file_error",{msg:ze.message}),loading:!1}:Ze))})},[r]),Oe=x.useCallback(je=>{q(ze=>ze.filter(Ye=>Ye.path!==je)),U(ze=>ze===je?"chat":ze)},[]),Te=x.useCallback(je=>{const ze=`artifacts/${je}`;U(ze),q(Ye=>Ye.some(Ze=>Ze.path===ze)?Ye:[...Ye,{path:ze,content:"",loading:!0,artifactName:je}]),Ws.read(r,je).then(Ye=>{q(Ze=>Ze.map(ft=>ft.path===ze?{...ft,content:Ye.content,loading:!1}:ft))}).catch(Ye=>{q(Ze=>Ze.map(ft=>ft.path===ze?{...ft,content:u("modules_ui.code_file_error",{msg:Ye.message}),loading:!1}:ft))})},[r]);x.useEffect(()=>{if(P.current)return;const je=L.get("pid"),ze=L.get("cmd"),Ye=L.get("edit");if(!(!je||!ze&&!Ye)){if(String(r)!==String(je)){i(String(je));return}P.current=!0,Ye&&Te(Ye),ze&&V(ze.endsWith(" ")?ze:ze+" "),I({},{replace:!0})}},[L,r,Te,V,I]);const Ee=x.useCallback(async(je,ze)=>{const Ye=B.find(Ze=>Ze.path===je);if(Ye?.artifactName)try{await Ws.write(r,Ye.artifactName,ze),q(Ze=>Ze.map(ft=>ft.path===je?{...ft,content:ze}:ft)),e.info(u("modules_ui.code_saved"))}catch(Ze){e.error(Ze.message)}},[B,r,e]),Me=!t.isLoading&&a.length>0,De=x.useMemo(()=>{const je=[{value:wc,label:u("modules_ui.code_super_agent"),icon:rn,description:u("modules_ui.code_super_agent_desc")}],ze=(Q.data||[]).map(Ye=>({value:Ye.slug,label:Ye.slug,icon:rn,description:Ye.description||Ye.role||void 0}));return[...je,...ze]},[Q.data]),He=x.useMemo(()=>g,[g]),Qe=x.useMemo(()=>X.data?.find(je=>je.id===l)?.title||"",[X.data,l]),ge=x.useMemo(()=>a.find(je=>String(je.id)===r),[a,r]);uI(Qe);const[de,Le]=x.useState(null),ye=y?null:rE(g),Ne=ye&&ye.turnKey!==de,We=je=>{Re(je)},Ge=x.useCallback(()=>k(je=>!je),[]),it=x.useCallback(()=>M(je=>!je),[]),Tt=x.useCallback(()=>R(je=>!je),[]),_t=x.useCallback(()=>w(je=>!je),[]),Ct=x.useMemo(()=>l?n.jsx("div",{className:"flex items-center gap-0.5",children:[{Icon:SS,open:j,toggle:Ge,title:u("modules_ui.code_panel_sessions")},{Icon:Ob,open:z,toggle:it,title:u("modules_ui.code_panel_tree")},{Icon:ya,open:E,toggle:Tt,title:u("modules_ui.code_panel_terminal")},{Icon:IM,open:C,toggle:_t,title:u("modules_ui.code_panel_context")}].map(({Icon:je,open:ze,toggle:Ye,title:Ze})=>n.jsx(Ue,{content:Ze,children:n.jsx("button",{type:"button",onClick:Ye,"data-active":ze,className:"rounded p-1 text-muted-fg transition-colors hover:bg-accent hover:text-accent-fg data-[active=true]:bg-accent data-[active=true]:text-accent-fg",children:n.jsx(je,{className:"size-3.5"})})},Ze))}):null,[l,j,z,E,C,Ge,it,Tt,_t]);return fI(Ct),n.jsx("div",{className:"flex h-full min-h-0 flex-col","data-testid":"screen-code",children:t.isLoading?n.jsx(tt,{}):Me?n.jsxs(hb,{orientation:"vertical",id:"code-layout-v",className:"min-h-0 flex-1",children:[n.jsx(To,{id:"top",defaultSize:E?"55%":"100%",minSize:"20%",children:n.jsxs(hb,{orientation:"horizontal",id:"code-layout",className:"h-full",children:[j&&n.jsxs(n.Fragment,{children:[n.jsx(To,{id:"left",defaultSize:"14%",minSize:"8%",children:n.jsxs("aside",{className:"flex h-full flex-col",children:[n.jsx("div",{className:"shrink-0 border-b border-border p-2",children:n.jsx(fq,{projects:a,value:r,onChange:te,disabled:y})}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:n.jsx(pq,{sessions:X.data||[],activeId:l,busy:y,onSelect:se,onCreate:pe,onRename:F,onDelete:oe})}),n.jsx("div",{className:"shrink-0 border-t border-border p-2",children:n.jsx(ct,{value:f,onChange:_e,options:De,disabled:y,showIcon:!0})})]})}),n.jsx(mx,{})]}),z&&n.jsxs(n.Fragment,{children:[n.jsx(To,{id:"tree",defaultSize:"13%",minSize:"8%",children:n.jsx("div",{className:"h-full",children:n.jsx(Eq,{pid:r,projectPath:ge?.path,onOpenFile:Ie})})}),n.jsx(mx,{})]}),n.jsx(To,{id:"main",defaultSize:"50%",minSize:"20%",children:n.jsxs("div",{className:"flex h-full flex-col",children:[B.length>0&&n.jsxs("div",{className:"flex shrink-0 items-center gap-0 overflow-x-auto border-b border-border",children:[n.jsxs("button",{type:"button",onClick:()=>U("chat"),"data-active":Y==="chat",className:"flex shrink-0 items-center gap-1.5 border-r border-border px-3 py-2 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-accent/40 data-[active=true]:text-foreground",children:[n.jsx(Db,{className:"size-3 shrink-0"}),u("modules_ui.code_chat_tab")]}),B.map(je=>{const ze=je.path.split("/").pop()??je.path,Ye=Y===je.path;return n.jsxs("div",{"data-active":Ye,className:"group flex shrink-0 items-center gap-1 border-r border-border px-2 py-2 text-[11px] text-muted-foreground transition-colors hover:bg-accent/40 data-[active=true]:text-foreground",children:[n.jsx(Ue,{content:je.path,children:n.jsx("button",{type:"button",onClick:()=>U(je.path),className:"min-w-0 max-w-[140px] truncate font-mono",children:ze})}),n.jsx(Ue,{content:u("code_module.close"),children:n.jsx("button",{type:"button",onClick:()=>Oe(je.path),className:"shrink-0 rounded p-0.5 opacity-60 hover:bg-accent hover:opacity-100",children:n.jsx(gs,{className:"size-2.5"})})})]},je.path)})]}),Y==="chat"?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"code-transcript",children:l?g.length?n.jsx(sv,{msgs:g,onCopy:Ae}):n.jsx("div",{className:"grid h-full place-items-center p-6",children:n.jsx(ut,{children:u("code_module.empty_chat")})}):n.jsx("div",{className:"grid h-full place-items-center p-6",children:n.jsx(ut,{children:u("code_module.pick_project")})})}),Ne&&ye&&n.jsx(aE,{turnKey:ye.turnKey,questions:ye.questions,onSubmit:We,onDismiss:()=>Le(ye.turnKey),disabled:y})]}):n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:(()=>{const je=B.find(ze=>ze.path===Y);return je?n.jsx(Rq,{path:je.path,content:je.content,loading:je.loading,onSave:je.artifactName?ze=>Ee(je.path,ze):void 0}):null})()}),n.jsx("div",{className:"shrink-0 border-t border-border p-2","data-testid":"code-input",children:n.jsx(gq,{value:b,onValueChange:_,onSubmit:()=>void Re(),onStop:be,busy:y,disabled:!l,mode:J,onModeChange:je=>void le({mode:je}),model:G,onModelChange:je=>void le({model:je||null})})})]})}),C&&n.jsxs(n.Fragment,{children:[n.jsx(mx,{}),n.jsx(To,{id:"right",defaultSize:"22%",minSize:"15%",children:n.jsx("aside",{className:"flex h-full flex-col",children:n.jsx(Cq,{pid:r,turns:He,changes:$.data,changesLoading:$.isLoading,onRefreshChanges:()=>void $.mutate(),session:W.data?{title:W.data.title,mode:W.data.mode,createdAt:W.data.createdAt,updatedAt:W.data.updatedAt,agentSlug:W.data.agentSlug??null}:null,onRunInTerminal:V,onEditArtifact:Te})})})]})]})}),E&&r&&n.jsxs(n.Fragment,{children:[n.jsx(Aq,{}),n.jsx(To,{id:"terminal",defaultSize:"45%",minSize:"10%",maxSize:"80%",children:n.jsx(Tq,{pid:r,initCmd:T,onClose:Tt,className:"h-full"})})]})]}):n.jsx("div",{className:"grid flex-1 place-items-center",children:n.jsx(ut,{children:u("code_module.no_projects")})})})}function zq({open:e,onClose:t}){const{mutate:a}=zN(),r=Sn(),i=Xe(),[l,d]=x.useState(""),[f,p]=x.useState(!1),[g,h]=x.useState(""),[b,_]=x.useState([]),[y,S]=x.useState(null),[j,k]=x.useState(""),[C,w]=x.useState(!1),[E,R]=x.useState(!1),T=async(M,D=!1)=>{w(!0),k("");try{const L=await zf.dirs(M||"~");h(L.path),d(L.path),S(L.parent),_(L.entries)}catch(L){const I=L.message;k(I),D||i.error(I)}finally{w(!1)}};x.useEffect(()=>{e||(d(""),p(!1),h(""),_([]),S(null),k(""))},[e]);const A=async()=>{w(!0);try{const M=await zf.pickDir(u("add_project.picker_prompt"));if("cancelled"in M)return;d(M.path);return}catch{p(!0),await T(l||"~")}finally{w(!1)}},z=async()=>{const M=l.trim();if(!M){i.error(u("add_project.path_required"));return}R(!0);try{const D=await Zn.register(M);i.success(u("add_project.registered",{id:D.id})),await a("/api/projects"),t(),r(`/p/${D.id}`)}catch(D){i.error(D.message)}finally{R(!1)}};return n.jsx(Bt,{open:e,onClose:t,title:u("add_project.title"),description:u("add_project.subtitle"),footer:n.jsxs(n.Fragment,{children:[n.jsx(ae,{variant:"ghost",onClick:t,disabled:E,children:u("common.cancel")}),n.jsx(ae,{variant:"primary",onClick:z,loading:E,children:u("add_project.register")})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(ie,{label:u("add_project.path_label"),hint:u("add_project.path_hint"),children:n.jsxs("div",{className:"flex gap-2",children:[n.jsx(Ce,{autoFocus:!0,placeholder:u("add_project.path_placeholder"),value:l,onChange:M=>d(M.target.value),onKeyDown:M=>{M.key==="Enter"&&z()}}),n.jsxs(ae,{onClick:A,disabled:C,children:[n.jsx(Oo,{size:14})," ",u("add_project.search_btn")]})]})}),f&&n.jsxs("div",{className:"rounded-md border border-border bg-muted/20",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[n.jsx("span",{className:"truncate font-mono text-xs text-muted-fg",children:g||l||"~"}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>T("~"),disabled:C,children:n.jsx(yS,{size:13})}),n.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>y&&T(y),disabled:!y||C,children:".."}),n.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>p(!1),disabled:C,children:n.jsx(gs,{size:13})})]})]}),n.jsxs("div",{className:"max-h-64 overflow-y-auto p-2",children:[C&&n.jsx(tt,{}),!C&&j&&n.jsx(ut,{children:u("add_project.browser_unavailable")}),!C&&!j&&b.length===0&&n.jsx(ut,{children:u("add_project.no_folders")}),!C&&!j&&b.map(M=>n.jsxs("button",{type:"button",onClick:()=>T(M),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-accent",children:[n.jsx(Go,{size:14,className:"text-muted-fg"}),n.jsx("span",{className:"truncate",children:M.split("/").pop()}),n.jsx("span",{className:"ml-auto truncate font-mono text-[10px] text-muted-fg",children:M})]},M))]})]})]})})}function Oq({onPaired:e}){const[t,a]=x.useState(""),[r,i]=x.useState(Dq()),[l,d]=x.useState(!1),[f,p]=x.useState(null);async function g(){const h=t.trim();if(!h){p(u("pairing.err_required"));return}d(!0),p(null);try{const b=await cl.confirm({pairing_id:h,label:r.trim()||void 0});Ao(b.token);try{localStorage.setItem(Dn.token,b.token)}catch{}e()}catch(b){p(Pq(b)),d(!1)}}return n.jsx("div",{className:"flex min-h-[100dvh] w-full items-center justify-center overflow-y-auto bg-background p-4 text-foreground",children:n.jsxs("div",{className:"my-auto w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-sm",children:[n.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[n.jsx("div",{className:"grid size-10 place-items-center rounded-lg bg-primary/10 text-primary",children:n.jsx(jS,{size:20})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-base font-semibold",children:u("pairing.title")}),n.jsx("p",{className:"text-xs text-muted-fg",children:u("pairing.subtitle")})]})]}),n.jsxs("ol",{className:"mb-5 space-y-1.5 rounded-lg bg-muted/50 p-3 text-xs text-muted-fg",children:[n.jsx("li",{className:"font-medium text-foreground",children:u("pairing.steps_title")}),n.jsxs("li",{children:["1. ",u("pairing.step_1")]}),n.jsxs("li",{children:["2. ",u("pairing.step_2")]}),n.jsxs("li",{children:["3. ",u("pairing.step_3")]})]}),n.jsxs("form",{className:"space-y-3",onSubmit:h=>{h.preventDefault(),g()},children:[n.jsx(ie,{label:u("pairing.code_label"),children:n.jsx(Ce,{value:t,onChange:h=>a(h.target.value),placeholder:u("pairing.code_ph"),spellCheck:!1,autoComplete:"off"})}),n.jsx(ie,{label:u("pairing.label_label"),hint:u("pairing.revoke_hint"),children:n.jsx(Ce,{value:r,onChange:h=>i(h.target.value),placeholder:u("pairing.label_ph")})}),f&&n.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:f}),n.jsx(ae,{type:"submit",variant:"primary",size:"md",loading:l,className:"w-full justify-center",children:u(l?"pairing.linking":"pairing.submit")})]})]})})}function Dq(){const e=navigator.userAgent;return/iPhone|iPad/.test(e)?"iPhone":/Android/.test(e)?"Android":/Mac/.test(e)?"Mac":/Windows/.test(e)?"Windows PC":/Linux/.test(e)?"Linux":"browser"}function Pq(e){if(e instanceof du){if(e.status===410)return u("pairing.err_expired");if(e.status===404||e.status===409)return u("pairing.err_unknown")}return u("pairing.err_generic")}function Lq({...e}){return n.jsx(GN,{"data-slot":"sheet",...e})}function Iq({...e}){return n.jsx(FN,{"data-slot":"sheet-portal",...e})}function $q({className:e,...t}){return n.jsx(UN,{"data-slot":"sheet-overlay",className:St("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",e),...t})}function Bq({className:e,children:t,side:a="right",showCloseButton:r=!0,...i}){return n.jsxs(Iq,{children:[n.jsx($q,{}),n.jsxs(VN,{"data-slot":"sheet-content","data-side":a,className:St("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",e),...i,children:[t,r&&n.jsxs(Tp,{"data-slot":"sheet-close",render:n.jsx(lr,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[n.jsx(gs,{}),n.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Uq({className:e,...t}){return n.jsx("div",{"data-slot":"sheet-header",className:St("flex flex-col gap-0.5 p-4",e),...t})}function qq({className:e,...t}){return n.jsx(YN,{"data-slot":"sheet-title",className:St("font-heading text-base font-medium text-foreground",e),...t})}function Hq({className:e,...t}){return n.jsx(qN,{"data-slot":"sheet-description",className:St("text-sm text-muted-foreground",e),...t})}function Vq({value:e,projectPath:t,onPick:a}){const r=Fq(e),i=r?Gq(e):"",{data:l}=$e(r?["/api/skills",t||""]:null,()=>Us.list(t)),d=l?.skills||[],f=x.useMemo(()=>{const p=i.toLowerCase();return p?d.filter(g=>g.slug.toLowerCase().includes(p)).slice(0,8):d.slice(0,8)},[d,i]);return!r||f.length===0?null:n.jsxs("div",{className:"rounded-xl border border-border bg-popover/95 text-sm shadow-md backdrop-blur",children:[n.jsx("ul",{role:"listbox",className:"max-h-64 overflow-y-auto py-1",children:f.map(p=>n.jsx("li",{children:n.jsxs("button",{type:"button",onClick:()=>a(p.slug),className:"flex w-full items-start gap-2 px-3 py-1.5 text-left hover:bg-accent hover:text-accent-foreground",children:[n.jsxs("code",{className:"rounded bg-muted px-1.5 py-0.5 text-[11px]",children:["/",p.slug]}),n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:p.description})]})},p.slug))}),n.jsx("div",{className:"border-t border-border px-3 py-1.5 text-[10px] text-muted-foreground",children:"Type a name to filter · click to insert · the skill body will be loaded for this turn."})]})}function Fq(e){return!!e.match(/^\s*\/([A-Za-z0-9_-]*)$/)}function Gq(e){const t=e.match(/^\s*\/([A-Za-z0-9_-]*)$/);return t?t[1]:""}function Yq(){try{const e=localStorage.getItem(Dn.robyChat);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(a=>a&&Array.isArray(a.parts)&&!a.pending):[]}catch{return[]}}function Kq({open:e,onOpenChange:t}){const a=pu(),r=Xe(),[i,l]=x.useState(Yq),[d,f]=x.useState(""),[p,g]=x.useState(!1),[h,b]=x.useState(""),_=x.useRef(null);x.useEffect(()=>{const w=i.filter(E=>!E.pending);try{w.length?localStorage.setItem(Dn.robyChat,JSON.stringify(w)):localStorage.removeItem(Dn.robyChat)}catch{}},[i]);const y=()=>{if(!p){l([]),f("");try{localStorage.removeItem(Dn.robyChat)}catch{}}};x.useEffect(()=>()=>_.current?.abort(),[]),x.useEffect(()=>{const w=E=>{const R=E.detail?.prompt;typeof R=="string"&&(t(!0),f(R))};return window.addEventListener("apx:roby-prompt",w),()=>window.removeEventListener("apx:roby-prompt",w)},[t]);const S=()=>{_.current?.abort(),g(!1)},j=w=>l(E=>{const R=[...E],T=R[R.length-1];return T?.role==="assistant"&&(R[R.length-1]=w(T)),R}),k=async()=>{const w=d.trim();if(!w||p)return;const E=new Date().toISOString(),R=i.filter(M=>!M.pending).map(M=>({role:M.role,content:tb(M)}));l(M=>[...M,{role:"user",parts:[{kind:"text",text:w}],ts:E},{role:"assistant",parts:[],ts:E,pending:!0}]),f(""),g(!0);const T=new AbortController;_.current=T;let A=!1;const z=M=>{if(M?.type==="error"){A=!0,r.error(M.error||"error"),l(D=>{const L=[...D],I=L[L.length-1];return I?.role==="assistant"&&I.pending&&L.pop(),L});return}j(D=>nv(D,M))};try{await DN.stream(0,{prompt:w,previousMessages:R,model:h||void 0,channel:"web_sidebar"},z,T.signal),j(M=>({...M,pending:!1}))}catch(M){T.signal.aborted?j(D=>({...D,pending:!1,parts:[...D.parts,{kind:"text",text:u("project.chat.stopped_marker")}]})):A||(r.error(M.message),l(D=>{const L=[...D],I=L[L.length-1];return I?.role==="assistant"&&I.pending&&L.pop(),L}))}finally{_.current===T&&(_.current=null),g(!1)}},C=async w=>{try{await navigator.clipboard.writeText(w),r.info(u("project.chat.copied"))}catch{}};return n.jsx(Lq,{open:e,onOpenChange:t,children:n.jsxs(Bq,{side:"right",className:"flex w-full flex-col gap-0 p-0 sm:max-w-xl data-[side=right]:sm:max-w-xl",children:[n.jsxs(Uq,{className:"pr-12",children:[n.jsxs(qq,{className:"flex items-center gap-2",children:[n.jsx(rn,{size:18})," ",u("superagent.title",{persona:a}),n.jsx("span",{className:"text-xs font-normal text-muted-fg",children:u("superagent.badge")})]}),n.jsx(Hq,{children:u("superagent.desc")})]}),n.jsx("div",{className:"flex-1 overflow-y-auto",children:i.length===0?n.jsx("p",{className:"mt-6 text-center text-sm text-muted-fg",children:u("superagent.empty",{persona:a})}):n.jsx(sv,{msgs:i,onCopy:C})}),n.jsx(sE,{msgs:i}),n.jsxs("div",{className:"border-t border-border p-3",children:[n.jsx("div",{className:"mb-1.5",children:n.jsx(Vq,{value:d,onPick:w=>f(`/${w} `)})}),n.jsx(ev,{value:d,onValueChange:f,onSubmit:()=>void k(),onStop:S,busy:p,placeholder:u("superagent.placeholder"),footer:n.jsx(tv,{value:h,onChange:b,disabled:p})}),n.jsx("div",{className:"mt-1.5 flex justify-end",children:n.jsxs(lr,{size:"xs",variant:"ghost",onClick:y,disabled:p||i.length===0,children:[n.jsx(Ot,{className:"size-3"})," ",u("superagent.new_chat")]})})]})]})})}function Xq(){const e=navigator.userAgent;return/iPhone|iPad/.test(e)?"iPhone":/Android/.test(e)?"Android":/Mac/.test(e)?"Mac":/Windows/.test(e)?"Windows PC":/Linux/.test(e)?"Linux":"browser"}const $2=new Map;function Qq(e){const t=$2.get(e);if(t)return t;const a=cl.confirm({pairing_id:e,label:Xq(),kind:"web"});return $2.set(e,a),a}function Wq(){const[e,t]=x.useState({status:"loading"}),[a,r]=x.useState(0),i=x.useCallback(()=>{t({status:"loading"}),r(l=>l+1)},[]);return x.useEffect(()=>{let l=!1;return(async()=>{try{const h=await fetch("/api/health");if(!h.ok)throw new Error(`HTTP ${h.status}`)}catch(h){l||t({status:"error",reason:String(h)});return}const d=window.location.hash.replace(/^#/,""),f=new URLSearchParams(d),p=f.get("pair");if(p)try{const h=await Qq(p);Ao(h.token);try{localStorage.setItem(Dn.token,h.token)}catch{}history.replaceState(null,"",window.location.pathname+window.location.search),t({status:"ok"});return}catch{}const g=f.get("token");if(g){Ao(g);try{localStorage.setItem(Dn.token,g)}catch{}history.replaceState(null,"",window.location.pathname+window.location.search)}else try{const h=localStorage.getItem(Dn.token);h&&Ao(h)}catch{}try{const h=await fetch("/api/admin/web-token");if(h.ok){const b=await h.json();if(b?.token){Ao(b.token);try{localStorage.setItem(Dn.token,b.token)}catch{}}}}catch{}if(!G_()){l||t({status:"unpaired"});return}try{await ne.get("/api/projects"),l||t({status:"ok"})}catch(h){if(h instanceof du&&(h.status===401||h.status===403)){Ao(null);try{localStorage.removeItem(Dn.token)}catch{}l||t({status:"unpaired"})}else l||t({status:"error",reason:String(h)})}})(),()=>{l=!0}},[a]),{...e,reload:i}}function Zq(){const e=Wq();return e.status==="loading"?n.jsx(B2,{text:u("daemon.connecting")}):e.status==="error"?n.jsx(B2,{mood:"sad",text:u("daemon.unreachable"),sub:`${u("daemon.unreachable_hint")}
847
+
848
+ ${e.reason}`}):e.status==="unpaired"?n.jsx(Oq,{onPaired:e.reload}):n.jsx(UL,{children:n.jsx(Z6,{delay:0,children:n.jsx(Jq,{})})})}function Jq(){const e=Sn(),t=ns(),[a,r]=Vo(),{theme:i,toggle:l}=Vb(),d=a.get("action")==="add-project",[f,p]=x.useState(!1),g=()=>{const b=new URLSearchParams(a);b.delete("action"),r(b,{replace:!0})},h=()=>{const b=new URLSearchParams(a);b.set("action","add-project"),r(b)};return n.jsx(oI,{children:n.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground","data-testid":"app-shell",children:[n.jsx(JP,{onSelect:b=>e(b),onOpenRoby:()=>p(!0),onOpenAddProject:h}),n.jsxs("main",{className:"m-2 flex min-w-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card shadow-sm",children:[n.jsx(eH,{onToggleTheme:l,isDark:i==="dark",pathname:t.pathname}),n.jsx("div",{className:"flex-1 overflow-y-auto",children:n.jsxs(iS,{children:[n.jsx(At,{path:"/",element:n.jsx(FL,{})}),n.jsx(At,{path:"/m/inbox",element:n.jsx(rI,{})}),n.jsx(At,{path:"/settings/*",element:n.jsx(wU,{})}),n.jsx(At,{path:"/m/desktop/*",element:n.jsx(NU,{})}),n.jsx(At,{path:"/m/code/*",element:n.jsx(Mq,{})}),n.jsx(At,{path:"/p/:pid/*",element:n.jsx(I$,{})}),n.jsx(At,{path:"*",element:n.jsx(rH,{})})]})})]}),n.jsx(zq,{open:d,onClose:g}),n.jsx(Kq,{open:f,onOpenChange:p})]})})}function eH({onToggleTheme:e,isDark:t,pathname:a}){const{projects:r}=Xo(),i=cI(),l=a.split("/").filter(Boolean),d=l[0]==="p"?r.find(S=>String(S.id)===l[1]):void 0,f=l[0]==="settings"?sH(l[1]):l[0]==="p"?aH(l[2]):"",p=l[0]==="p"&&l[1]==="0",g=d?.name||d?.path?.split("/").pop()||u("nav.project"),h=a==="/"?u("topbar.breadcrumb_root"):l[0]==="settings"?[u("topbar.breadcrumb_root"),u("nav.settings"),f].filter(Boolean).join(" › "):l[0]==="m"?[u("topbar.breadcrumb_root"),nH(l[1]),i].filter(Boolean).join(" › "):l[0]==="p"?p?[u("topbar.breadcrumb_root"),u("topbar.breadcrumb_base"),f].filter(Boolean).join(" › "):[u("topbar.breadcrumb_root"),u("topbar.breadcrumb_projects"),g,f].filter(Boolean).join(" › "):u("topbar.breadcrumb_root"),b=a==="/"?"":l[0]==="settings"?u("settings.subtitle"):l[0]==="p"?p?u("base.subtitle"):d?`${LN(d.kind)} · ${d.path}`:"":"",_=iI(),y=dI();return n.jsxs("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-border/50 px-3",children:[_&&n.jsx(lP,{collapsed:_.collapsed,onToggle:_.toggle}),n.jsxs("span",{className:"min-w-0 flex-1 truncate text-[11px] tracking-wide text-muted-fg",children:[h,b&&n.jsxs("span",{className:"text-muted-fg/50",children:[" · ",b]})]}),y,n.jsx(tH,{}),n.jsx(Ue,{content:u(t?"topbar.light":"topbar.dark"),children:n.jsx("button",{type:"button","data-testid":"theme-toggle",onClick:e,className:"shrink-0 rounded-md p-1.5 text-muted-fg hover:bg-accent hover:text-accent-fg",children:t?n.jsx(KM,{size:14}):n.jsx(OM,{size:14})})})]})}function tH(){const e=q_(),t=a=>{a!==e&&(kN(a),window.location.reload())};return n.jsxs(I_,{children:[n.jsxs($_,{"data-testid":"lang-menu",title:u("topbar.lang_toggle"),className:"flex shrink-0 items-center gap-1 rounded-md p-1.5 text-muted-fg hover:bg-accent hover:text-accent-fg",children:[n.jsx(CM,{size:14}),n.jsx("span",{className:"text-[11px] font-medium uppercase",children:e})]}),n.jsx(B_,{align:"end",children:n.jsx(eP,{value:e,onValueChange:a=>t(a),children:wN.map(a=>n.jsx(tP,{value:a.value,children:a.label},a.value))})})]})}function nH(e){switch(e){case"desktop":return u("nav.modules.desktop");case"code":return u("nav.modules.code");default:return e||""}}function sH(e){switch(e){case"super-agent":return u("settings.tabs.super_agent");case"engines":return u("settings.tabs.engines");case"telegram":return u("settings.tabs.telegram");case"devices":return u("settings.tabs.devices");case"voice":return u("nav.modules.voice");case"deck":return u("nav.modules.deck");case"desktop":return u("nav.modules.desktop");case"appearance":return u("settings.appearance");case"config":case"advanced":return u("settings.tabs.advanced");case"identity":default:return e||""}}function aH(e){switch(e){case"chat":return u("project.nav.chat");case"telegram":return u("project.nav.telegram");case"agents":return u("project.nav.agents");case"routines":return u("project.nav.routines");case"tasks":return u("project.nav.tasks");case"mcps":return u("project.nav.mcps");case"artifacts":return u("project.nav.artifacts");case"config":return u("project.nav.config");case"workspaces":return u("base.workspaces_title");case"models":return u("settings.tabs.engines");case"agent-defaults":return u("base.defaults_title");case"sessions":return u("base.sessions_title");case"logs":return u("project.nav.logs");case"memories":return u("project.nav.memories");default:return""}}function B2({text:e,sub:t,mood:a="happy"}){return n.jsx("div",{className:"grid h-screen w-screen place-items-center bg-background text-foreground",children:n.jsxs("div",{className:"flex flex-col items-center text-center",children:[n.jsx(kE,{mood:a,className:"mb-4 text-xs"}),n.jsx("div",{className:"text-foreground",children:e}),t&&n.jsx("pre",{className:"mt-2 max-w-xl whitespace-pre-wrap text-sm text-muted-fg",children:t})]})})}function rH(){const e=Sn();return n.jsx(wE,{testId:"screen-not-found",mood:"confused",title:u("not_found.title"),titleClassName:"text-7xl",message:u("not_found.message"),action:n.jsx(lr,{variant:"outline",onClick:()=>e("/"),children:u("not_found.home")})})}b7();l3.createRoot(document.getElementById("root")).render(n.jsx(Zc.StrictMode,{children:n.jsx(MA,{children:n.jsx(s4,{children:n.jsx(Zq,{})})})}));
849
+ //# sourceMappingURL=index-CvEoGtTf.js.map