@agentprojectcontext/apx 1.25.0 → 1.27.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +42 -12
- package/skills/apx/SKILL.md +50 -119
- package/skills/apx-agency-agents/SKILL.md +141 -0
- package/skills/apx-agent/SKILL.md +100 -0
- package/skills/apx-mcp/SKILL.md +114 -0
- package/skills/apx-mcp-builder/SKILL.md +186 -0
- package/skills/apx-project/SKILL.md +100 -0
- package/skills/apx-routine/SKILL.md +138 -0
- package/skills/apx-runtime/SKILL.md +115 -0
- package/skills/apx-sessions/SKILL.md +281 -0
- package/skills/apx-skill-builder/SKILL.md +149 -0
- package/skills/apx-task/SKILL.md +95 -0
- package/skills/apx-telegram/SKILL.md +115 -0
- package/skills/apx-voice/SKILL.md +135 -0
- package/src/core/agent/constants.js +3 -0
- package/src/core/agent/ghost-guard.js +24 -0
- package/src/core/agent/index.js +35 -0
- package/src/core/agent/model-router.js +257 -0
- package/src/core/agent/prompt-builder.js +313 -0
- package/src/core/agent/prompts/channels/api.md +7 -0
- package/src/core/agent/prompts/channels/cli.md +6 -0
- package/src/core/agent/prompts/channels/code.md +20 -0
- package/src/core/agent/prompts/channels/deck.md +6 -0
- package/src/core/agent/prompts/channels/desktop.md +24 -0
- package/src/core/agent/prompts/channels/routine.md +9 -0
- package/src/core/agent/prompts/channels/telegram.md +9 -0
- package/src/core/agent/prompts/channels/terminal.md +16 -0
- package/src/core/agent/prompts/channels/web.md +7 -0
- package/src/core/agent/prompts/channels/web_sidebar.md +7 -0
- package/src/core/agent/prompts/modes/voice.md +4 -0
- package/src/core/agent/prompts/super-agent-base.md +42 -0
- package/src/core/agent/pseudo-tools.js +40 -0
- package/src/core/agent/retry.js +85 -0
- package/src/core/agent/run-agent.js +423 -0
- package/src/core/agent/self-memory.js +155 -0
- package/src/{daemon → core/agent}/tool-call-parser.js +83 -10
- package/src/core/agent/tools-overlap.js +66 -0
- package/src/core/apc-skill-sync.js +97 -0
- package/src/core/code-sessions-store.js +150 -0
- package/src/core/config.js +473 -11
- package/src/core/desktop/autostart.js +162 -0
- package/src/core/engines/_health.js +63 -0
- package/src/{daemon → core}/engines/anthropic.js +16 -0
- package/src/core/engines/gemini.js +168 -0
- package/src/core/engines/groq.js +8 -0
- package/src/{daemon → core}/engines/index.js +3 -1
- package/src/{daemon → core}/engines/mock.js +22 -0
- package/src/{daemon → core}/engines/ollama.js +35 -0
- package/src/core/engines/openai-compatible.js +145 -0
- package/src/core/engines/openai.js +8 -0
- package/src/core/engines/openrouter.js +8 -0
- package/src/core/git-baseline.js +147 -0
- package/src/core/identity.js +21 -0
- package/src/core/logging.js +1 -1
- package/src/core/mcp/index.js +14 -0
- package/src/{daemon/mcp-runner.js → core/mcp/runner.js} +18 -6
- package/src/core/mcp/sources.js +246 -0
- package/src/core/memory/active-threads.js +124 -0
- package/src/core/memory/broker.js +144 -0
- package/src/core/memory/compactor.js +186 -0
- package/src/core/memory/embed-engines/gemini.js +62 -0
- package/src/core/memory/embed-engines/index.js +148 -0
- package/src/core/memory/embed-engines/ollama.js +55 -0
- package/src/core/memory/embed-engines/openai.js +64 -0
- package/src/core/memory/embed-engines/tf.js +20 -0
- package/src/core/memory/embeddings.js +132 -0
- package/src/core/memory/index.js +161 -0
- package/src/core/memory/indexer.js +257 -0
- package/src/core/memory/store.js +231 -0
- package/src/core/messages-store.js +143 -25
- package/src/core/parser.js +78 -16
- package/src/core/scaffold.js +175 -79
- package/src/core/tasks-store.js +264 -0
- package/src/core/telegram-identity.js +126 -0
- package/src/core/tools/index.js +6 -0
- package/src/core/voice/engines/elevenlabs.js +96 -0
- package/src/core/voice/engines/gemini.js +148 -0
- package/src/core/voice/engines/index.js +144 -0
- package/src/core/voice/engines/mock.js +59 -0
- package/src/core/voice/engines/openai.js +82 -0
- package/src/core/voice/engines/piper.js +93 -0
- package/src/core/voice/index.js +3 -0
- package/src/core/voice/tts.js +89 -0
- package/src/{daemon → host/daemon}/apc-runtime-context.js +1 -1
- package/src/host/daemon/api/admin-config.js +159 -0
- package/src/host/daemon/api/admin.js +72 -0
- package/src/host/daemon/api/agents.js +284 -0
- package/src/host/daemon/api/artifacts.js +52 -0
- package/src/host/daemon/api/code.js +351 -0
- package/src/host/daemon/api/config.js +104 -0
- package/src/host/daemon/api/connections.js +42 -0
- package/src/host/daemon/api/conversations.js +161 -0
- package/src/host/daemon/api/deck.js +511 -0
- package/src/host/daemon/api/desktop.js +71 -0
- package/src/host/daemon/api/embeddings.js +65 -0
- package/src/host/daemon/api/engines.js +80 -0
- package/src/host/daemon/api/exec.js +193 -0
- package/src/host/daemon/api/health.js +10 -0
- package/src/host/daemon/api/identity.js +36 -0
- package/src/host/daemon/api/mcps.js +205 -0
- package/src/host/daemon/api/messages.js +83 -0
- package/src/host/daemon/api/pairing.js +194 -0
- package/src/host/daemon/api/plugins.js +19 -0
- package/src/host/daemon/api/projects.js +35 -0
- package/src/host/daemon/api/routines.js +84 -0
- package/src/host/daemon/api/run.js +55 -0
- package/src/host/daemon/api/runtimes.js +219 -0
- package/src/host/daemon/api/sessions-search.js +177 -0
- package/src/host/daemon/api/sessions.js +115 -0
- package/src/host/daemon/api/shared.js +217 -0
- package/src/host/daemon/api/super-agent.js +208 -0
- package/src/host/daemon/api/tasks.js +118 -0
- package/src/host/daemon/api/telegram.js +325 -0
- package/src/host/daemon/api/tools.js +21 -0
- package/src/host/daemon/api/top-level.js +131 -0
- package/src/host/daemon/api/transcribe.js +35 -0
- package/src/host/daemon/api/tts.js +44 -0
- package/src/host/daemon/api/voice.js +519 -0
- package/src/host/daemon/api/web.js +123 -0
- package/src/host/daemon/api.js +152 -0
- package/src/{daemon → host/daemon}/compact.js +1 -1
- package/src/{daemon → host/daemon}/db.js +19 -5
- package/src/{daemon/overlay-ws.js → host/daemon/desktop-ws.js} +7 -7
- package/src/host/daemon/engine-sessions.js +245 -0
- package/src/{daemon → host/daemon}/index.js +27 -10
- package/src/{daemon/plugins/overlay.js → host/daemon/plugins/desktop.js} +36 -28
- package/src/{daemon → host/daemon}/plugins/index.js +2 -2
- package/src/{daemon → host/daemon}/plugins/telegram.js +165 -33
- package/src/{daemon → host/daemon}/project-config.js +31 -7
- package/src/{daemon → host/daemon}/routines.js +27 -8
- package/src/{daemon → host/daemon}/skills-loader.js +4 -2
- package/src/{daemon → host/daemon}/smoke.js +9 -5
- package/src/{daemon → host/daemon}/super-agent-tools/helpers.js +1 -1
- package/src/host/daemon/super-agent-tools/index.js +157 -0
- package/src/{daemon → host/daemon}/super-agent-tools/registry-bridge.js +1 -1
- package/src/{daemon → host/daemon}/super-agent-tools/tools/add-project.js +2 -2
- package/src/{daemon → host/daemon}/super-agent-tools/tools/ask-questions.js +4 -0
- package/src/{daemon → host/daemon}/super-agent-tools/tools/call-agent.js +5 -2
- package/src/{daemon → host/daemon}/super-agent-tools/tools/call-runtime.js +117 -8
- package/src/host/daemon/super-agent-tools/tools/create-task.js +52 -0
- package/src/{daemon → host/daemon}/super-agent-tools/tools/import-agent.js +2 -3
- package/src/{daemon → host/daemon}/super-agent-tools/tools/list-agents.js +1 -1
- package/src/host/daemon/super-agent-tools/tools/list-tasks.js +52 -0
- package/src/{daemon → host/daemon}/super-agent-tools/tools/list-vault-agents.js +1 -1
- package/src/host/daemon/super-agent-tools/tools/read-self-memory.js +21 -0
- package/src/host/daemon/super-agent-tools/tools/remember.js +40 -0
- package/src/{daemon → host/daemon}/super-agent-tools/tools/search-messages.js +1 -1
- package/src/host/daemon/super-agent-tools/tools/search-sessions.js +134 -0
- package/src/{daemon → host/daemon}/super-agent-tools/tools/send-telegram.js +2 -2
- package/src/{daemon → host/daemon}/super-agent-tools/tools/set-identity.js +1 -1
- package/src/{daemon → host/daemon}/super-agent-tools/tools/set-permission-mode.js +1 -1
- package/src/{daemon → host/daemon}/super-agent-tools/tools/tail-messages.js +1 -1
- package/src/host/daemon/super-agent.js +129 -0
- package/src/host/daemon/token-store.js +118 -0
- package/src/host/daemon/tool-call-parser.js +2 -0
- package/src/{daemon → host/daemon}/transcription.js +1 -1
- package/src/{daemon → host/daemon}/wakeup.js +2 -2
- package/src/interfaces/cli/claude-permissions.js +33 -0
- package/src/{cli → interfaces/cli}/commands/agent.js +43 -8
- package/src/{cli → interfaces/cli}/commands/command.js +1 -1
- package/src/{cli → interfaces/cli}/commands/config.js +1 -1
- package/src/{cli → interfaces/cli}/commands/daemon.js +67 -0
- package/src/interfaces/cli/commands/desktop.js +335 -0
- package/src/interfaces/cli/commands/exec.js +92 -0
- package/src/{cli → interfaces/cli}/commands/identity.js +6 -63
- package/src/{cli → interfaces/cli}/commands/init.js +1 -1
- package/src/{cli → interfaces/cli}/commands/mcp.js +69 -10
- package/src/{cli → interfaces/cli}/commands/memory.js +2 -2
- package/src/interfaces/cli/commands/model.js +136 -0
- package/src/interfaces/cli/commands/pair.js +170 -0
- package/src/interfaces/cli/commands/project-config.js +131 -0
- package/src/{cli → interfaces/cli}/commands/project.js +1 -1
- package/src/{cli → interfaces/cli}/commands/search.js +1 -1
- package/src/interfaces/cli/commands/session.js +892 -0
- package/src/interfaces/cli/commands/sessions.js +997 -0
- package/src/{cli → interfaces/cli}/commands/setup.js +98 -4
- package/src/{cli → interfaces/cli}/commands/skills.js +117 -9
- package/src/{cli → interfaces/cli}/commands/status.js +9 -1
- package/src/{cli → interfaces/cli}/commands/sys.js +96 -17
- package/src/interfaces/cli/commands/task.js +179 -0
- package/src/interfaces/cli/commands/telegram.js +366 -0
- package/src/{cli → interfaces/cli}/commands/update.js +1 -1
- package/src/interfaces/cli/commands/voice.js +258 -0
- package/src/{cli → interfaces/cli}/http.js +6 -2
- package/src/{cli → interfaces/cli}/index.js +955 -63
- package/src/interfaces/cli/postinstall.js +34 -0
- package/src/interfaces/desktop/assets/app-icon-180.png +0 -0
- package/src/interfaces/desktop/assets/app-icon-32.png +0 -0
- package/src/interfaces/desktop/assets/app-icon.png +0 -0
- package/src/interfaces/desktop/assets/apx-logo.png +0 -0
- package/src/interfaces/desktop/assets/superagent.png +0 -0
- package/src/interfaces/desktop/assets/tray-icon.png +0 -0
- package/src/interfaces/desktop/index.html +18 -0
- package/src/interfaces/desktop/main.js +652 -0
- package/src/interfaces/desktop/preload.js +48 -0
- package/src/interfaces/desktop/renderer.js +1006 -0
- package/src/interfaces/desktop/style.css +400 -0
- package/src/{mcp → interfaces/mcp-server}/index.js +2 -2
- package/src/interfaces/tui/_shims/util-which.ts +53 -0
- package/src/{tui → interfaces/tui}/app.tsx +2 -2
- package/src/{tui → interfaces/tui}/component/prompt/index.tsx +4 -1
- package/src/{tui → interfaces/tui}/context/sdk-apx.tsx +84 -16
- package/src/interfaces/tui/context/sync-apx.tsx +398 -0
- package/src/interfaces/tui/routes/session/index.tsx +368 -0
- package/src/interfaces/tui/routes/session/message-actions.tsx +58 -0
- package/src/interfaces/tui/routes/session/sidebar-apx.tsx +114 -0
- package/src/{tui → interfaces/tui}/tsconfig.json +1 -0
- package/src/{tui → interfaces/tui}/util/clipboard.ts +1 -1
- package/src/interfaces/web/README.md +102 -0
- package/src/interfaces/web/coming-soon.html +65 -0
- package/src/interfaces/web/components.json +25 -0
- package/src/interfaces/web/dist/assets/index-BDUsA6L6.css +1 -0
- package/src/interfaces/web/dist/assets/index-CfWyjPBa.js +548 -0
- package/src/interfaces/web/dist/assets/index-CfWyjPBa.js.map +1 -0
- package/src/interfaces/web/dist/favicon/dark/android-chrome-192x192.png +0 -0
- package/src/interfaces/web/dist/favicon/dark/android-chrome-512x512.png +0 -0
- package/src/interfaces/web/dist/favicon/dark/apple-touch-icon.png +0 -0
- package/src/interfaces/web/dist/favicon/dark/favicon-16x16.png +0 -0
- package/src/interfaces/web/dist/favicon/dark/favicon-32x32.png +0 -0
- package/src/interfaces/web/dist/favicon/dark/favicon-48x48.png +0 -0
- package/src/interfaces/web/dist/favicon/dark/favicon.ico +0 -0
- package/src/interfaces/web/dist/favicon/dark/favicon.webp +0 -0
- package/src/interfaces/web/dist/favicon/dark/site.webmanifest +18 -0
- package/src/interfaces/web/dist/favicon/white/android-chrome-192x192.png +0 -0
- package/src/interfaces/web/dist/favicon/white/android-chrome-512x512.png +0 -0
- package/src/interfaces/web/dist/favicon/white/apple-touch-icon.png +0 -0
- package/src/interfaces/web/dist/favicon/white/favicon-16x16.png +0 -0
- package/src/interfaces/web/dist/favicon/white/favicon-32x32.png +0 -0
- package/src/interfaces/web/dist/favicon/white/favicon-48x48.png +0 -0
- package/src/interfaces/web/dist/favicon/white/favicon.ico +0 -0
- package/src/interfaces/web/dist/favicon/white/favicon.webp +0 -0
- package/src/interfaces/web/dist/favicon/white/site.webmanifest +18 -0
- package/src/interfaces/web/dist/index.html +27 -0
- package/src/interfaces/web/dist/logo/logo_dark.webp +0 -0
- package/src/interfaces/web/dist/logo/logo_only_dark.webp +0 -0
- package/src/interfaces/web/dist/logo/logo_only_white.webp +0 -0
- package/src/interfaces/web/dist/logo/logo_vertical_dark.webp +0 -0
- package/src/interfaces/web/dist/logo/logo_vertical_white.webp +0 -0
- package/src/interfaces/web/dist/logo/logo_white.webp +0 -0
- package/src/interfaces/web/dist/modules/superagent.png +0 -0
- package/src/interfaces/web/index.html +26 -0
- package/src/interfaces/web/package-lock.json +4253 -0
- package/src/interfaces/web/package.json +55 -0
- package/src/interfaces/web/playwright.config.ts +45 -0
- package/src/interfaces/web/pnpm-lock.yaml +2946 -0
- package/src/interfaces/web/public/favicon/dark/android-chrome-192x192.png +0 -0
- package/src/interfaces/web/public/favicon/dark/android-chrome-512x512.png +0 -0
- package/src/interfaces/web/public/favicon/dark/apple-touch-icon.png +0 -0
- package/src/interfaces/web/public/favicon/dark/favicon-16x16.png +0 -0
- package/src/interfaces/web/public/favicon/dark/favicon-32x32.png +0 -0
- package/src/interfaces/web/public/favicon/dark/favicon-48x48.png +0 -0
- package/src/interfaces/web/public/favicon/dark/favicon.ico +0 -0
- package/src/interfaces/web/public/favicon/dark/favicon.webp +0 -0
- package/src/interfaces/web/public/favicon/dark/site.webmanifest +18 -0
- package/src/interfaces/web/public/favicon/white/android-chrome-192x192.png +0 -0
- package/src/interfaces/web/public/favicon/white/android-chrome-512x512.png +0 -0
- package/src/interfaces/web/public/favicon/white/apple-touch-icon.png +0 -0
- package/src/interfaces/web/public/favicon/white/favicon-16x16.png +0 -0
- package/src/interfaces/web/public/favicon/white/favicon-32x32.png +0 -0
- package/src/interfaces/web/public/favicon/white/favicon-48x48.png +0 -0
- package/src/interfaces/web/public/favicon/white/favicon.ico +0 -0
- package/src/interfaces/web/public/favicon/white/favicon.webp +0 -0
- package/src/interfaces/web/public/favicon/white/site.webmanifest +18 -0
- package/src/interfaces/web/public/logo/logo_dark.webp +0 -0
- package/src/interfaces/web/public/logo/logo_only_dark.webp +0 -0
- package/src/interfaces/web/public/logo/logo_only_white.webp +0 -0
- package/src/interfaces/web/public/logo/logo_vertical_dark.webp +0 -0
- package/src/interfaces/web/public/logo/logo_vertical_white.webp +0 -0
- package/src/interfaces/web/public/logo/logo_white.webp +0 -0
- package/src/interfaces/web/public/modules/superagent.png +0 -0
- package/src/interfaces/web/src/App.tsx +199 -0
- package/src/interfaces/web/src/components/AddProjectDialog.tsx +121 -0
- package/src/interfaces/web/src/components/ModelCombobox.tsx +96 -0
- package/src/interfaces/web/src/components/RobyBubble.tsx +213 -0
- package/src/interfaces/web/src/components/Section.tsx +44 -0
- package/src/interfaces/web/src/components/TelegramChannelDialog.tsx +97 -0
- package/src/interfaces/web/src/components/TelegramSendDialog.tsx +48 -0
- package/src/interfaces/web/src/components/Toast.tsx +84 -0
- package/src/interfaces/web/src/components/UiSelect.tsx +74 -0
- package/src/interfaces/web/src/components/chat/Composer.tsx +43 -0
- package/src/interfaces/web/src/components/chat/ContextBar.tsx +111 -0
- package/src/interfaces/web/src/components/chat/MessageBubble.tsx +95 -0
- package/src/interfaces/web/src/components/chat/MessageList.tsx +35 -0
- package/src/interfaces/web/src/components/chat/ModelPicker.tsx +145 -0
- package/src/interfaces/web/src/components/chat/ToolCall.tsx +141 -0
- package/src/interfaces/web/src/components/code/CodeChangesTab.tsx +87 -0
- package/src/interfaces/web/src/components/code/CodeComposer.tsx +87 -0
- package/src/interfaces/web/src/components/code/CodeContextTab.tsx +83 -0
- package/src/interfaces/web/src/components/code/CodeProjectPicker.tsx +39 -0
- package/src/interfaces/web/src/components/code/CodeSessionList.tsx +97 -0
- package/src/interfaces/web/src/components/code/CodeSidePanel.tsx +44 -0
- package/src/interfaces/web/src/components/code/CodeToolTrail.tsx +29 -0
- package/src/interfaces/web/src/components/code/DiffView.tsx +67 -0
- package/src/interfaces/web/src/components/common/Qr.tsx +27 -0
- package/src/interfaces/web/src/components/common/TabLayout.tsx +46 -0
- package/src/interfaces/web/src/components/common/TabNav.tsx +113 -0
- package/src/interfaces/web/src/components/config/ConfigTabsEditor.tsx +202 -0
- package/src/interfaces/web/src/components/config/GlobalConfigEditor.tsx +42 -0
- package/src/interfaces/web/src/components/config/global-config-sections.ts +60 -0
- package/src/interfaces/web/src/components/config/project-config-sections.ts +58 -0
- package/src/interfaces/web/src/components/deck/DaemonCard.tsx +58 -0
- package/src/interfaces/web/src/components/deck/DesktopGroup.tsx +33 -0
- package/src/interfaces/web/src/components/deck/WidgetRow.tsx +100 -0
- package/src/interfaces/web/src/components/layout/Logo.tsx +59 -0
- package/src/interfaces/web/src/components/layout/ProjectAvatar.tsx +116 -0
- package/src/interfaces/web/src/components/layout/ProjectSidebar.tsx +151 -0
- package/src/interfaces/web/src/components/settings/AdvancedPanel.tsx +45 -0
- package/src/interfaces/web/src/components/settings/AppearancePanel.tsx +72 -0
- package/src/interfaces/web/src/components/settings/DefaultRouterCard.tsx +232 -0
- package/src/interfaces/web/src/components/settings/DevicesPanel.tsx +60 -0
- package/src/interfaces/web/src/components/settings/EnginesPanel.tsx +127 -0
- package/src/interfaces/web/src/components/settings/IdentityPanel.tsx +69 -0
- package/src/interfaces/web/src/components/settings/MemoryPanel.tsx +226 -0
- package/src/interfaces/web/src/components/settings/PairDeviceDialog.tsx +175 -0
- package/src/interfaces/web/src/components/settings/SuperAgentPanel.tsx +93 -0
- package/src/interfaces/web/src/components/settings/TelegramChannelsPanel.tsx +90 -0
- package/src/interfaces/web/src/components/settings/TelegramContactsPanel.tsx +101 -0
- package/src/interfaces/web/src/components/settings/TelegramGlobalPanel.tsx +100 -0
- package/src/interfaces/web/src/components/settings/TelegramRolesPanel.tsx +108 -0
- package/src/interfaces/web/src/components/settings/TelegramSettingsTabs.tsx +55 -0
- package/src/interfaces/web/src/components/settings/providers/ProviderCard.tsx +95 -0
- package/src/interfaces/web/src/components/settings/providers/ProviderModal.tsx +405 -0
- package/src/interfaces/web/src/components/settings/providers/typeStyles.ts +155 -0
- package/src/interfaces/web/src/components/settings/providers/types.ts +26 -0
- package/src/interfaces/web/src/components/ui/accordion.tsx +72 -0
- package/src/interfaces/web/src/components/ui/alert-dialog.tsx +187 -0
- package/src/interfaces/web/src/components/ui/alert.tsx +76 -0
- package/src/interfaces/web/src/components/ui/aspect-ratio.tsx +22 -0
- package/src/interfaces/web/src/components/ui/avatar.tsx +107 -0
- package/src/interfaces/web/src/components/ui/badge.tsx +52 -0
- package/src/interfaces/web/src/components/ui/breadcrumb.tsx +125 -0
- package/src/interfaces/web/src/components/ui/button-group.tsx +87 -0
- package/src/interfaces/web/src/components/ui/button.tsx +58 -0
- package/src/interfaces/web/src/components/ui/calendar.tsx +221 -0
- package/src/interfaces/web/src/components/ui/card.tsx +103 -0
- package/src/interfaces/web/src/components/ui/carousel.tsx +242 -0
- package/src/interfaces/web/src/components/ui/chart.tsx +371 -0
- package/src/interfaces/web/src/components/ui/chat-input.tsx +122 -0
- package/src/interfaces/web/src/components/ui/checkbox.tsx +29 -0
- package/src/interfaces/web/src/components/ui/collapsible.tsx +19 -0
- package/src/interfaces/web/src/components/ui/combobox.tsx +295 -0
- package/src/interfaces/web/src/components/ui/command.tsx +196 -0
- package/src/interfaces/web/src/components/ui/context-menu.tsx +271 -0
- package/src/interfaces/web/src/components/ui/dialog.tsx +158 -0
- package/src/interfaces/web/src/components/ui/direction.tsx +4 -0
- package/src/interfaces/web/src/components/ui/drawer.tsx +134 -0
- package/src/interfaces/web/src/components/ui/dropdown-menu.tsx +266 -0
- package/src/interfaces/web/src/components/ui/empty.tsx +104 -0
- package/src/interfaces/web/src/components/ui/field.tsx +236 -0
- package/src/interfaces/web/src/components/ui/hover-card.tsx +51 -0
- package/src/interfaces/web/src/components/ui/input-group.tsx +158 -0
- package/src/interfaces/web/src/components/ui/input-otp.tsx +85 -0
- package/src/interfaces/web/src/components/ui/input.tsx +20 -0
- package/src/interfaces/web/src/components/ui/item.tsx +201 -0
- package/src/interfaces/web/src/components/ui/kbd.tsx +26 -0
- package/src/interfaces/web/src/components/ui/label.tsx +20 -0
- package/src/interfaces/web/src/components/ui/menubar.tsx +280 -0
- package/src/interfaces/web/src/components/ui/native-select.tsx +61 -0
- package/src/interfaces/web/src/components/ui/navigation-menu.tsx +168 -0
- package/src/interfaces/web/src/components/ui/pagination.tsx +130 -0
- package/src/interfaces/web/src/components/ui/popover.tsx +88 -0
- package/src/interfaces/web/src/components/ui/progress.tsx +83 -0
- package/src/interfaces/web/src/components/ui/radio-group.tsx +36 -0
- package/src/interfaces/web/src/components/ui/resizable.tsx +50 -0
- package/src/interfaces/web/src/components/ui/scroll-area.tsx +53 -0
- package/src/interfaces/web/src/components/ui/select.tsx +201 -0
- package/src/interfaces/web/src/components/ui/separator.tsx +23 -0
- package/src/interfaces/web/src/components/ui/sheet.tsx +138 -0
- package/src/interfaces/web/src/components/ui/sidebar.tsx +723 -0
- package/src/interfaces/web/src/components/ui/skeleton.tsx +13 -0
- package/src/interfaces/web/src/components/ui/slider.tsx +52 -0
- package/src/interfaces/web/src/components/ui/sonner.tsx +49 -0
- package/src/interfaces/web/src/components/ui/spinner.tsx +10 -0
- package/src/interfaces/web/src/components/ui/switch.tsx +30 -0
- package/src/interfaces/web/src/components/ui/table.tsx +116 -0
- package/src/interfaces/web/src/components/ui/tabs.tsx +72 -0
- package/src/interfaces/web/src/components/ui/textarea.tsx +18 -0
- package/src/interfaces/web/src/components/ui/tip.tsx +21 -0
- package/src/interfaces/web/src/components/ui/toggle-group.tsx +87 -0
- package/src/interfaces/web/src/components/ui/toggle.tsx +45 -0
- package/src/interfaces/web/src/components/ui/tooltip.tsx +64 -0
- package/src/interfaces/web/src/components/ui.tsx +211 -0
- package/src/interfaces/web/src/components/voice/VoiceProviderList.tsx +197 -0
- package/src/interfaces/web/src/components/voice/VoiceProviderModal.tsx +213 -0
- package/src/interfaces/web/src/components/voice/VoiceSttCard.tsx +72 -0
- package/src/interfaces/web/src/components/voice/VoiceTestCard.tsx +112 -0
- package/src/interfaces/web/src/components/voice/useTtsPlayer.ts +59 -0
- package/src/interfaces/web/src/constants/index.ts +91 -0
- package/src/interfaces/web/src/hooks/use-mobile.ts +19 -0
- package/src/interfaces/web/src/hooks/useChat.ts +276 -0
- package/src/interfaces/web/src/hooks/useDaemonStatus.ts +12 -0
- package/src/interfaces/web/src/hooks/useDevices.ts +12 -0
- package/src/interfaces/web/src/hooks/useEngines.ts +10 -0
- package/src/interfaces/web/src/hooks/useGlobalConfig.ts +24 -0
- package/src/interfaces/web/src/hooks/useIdentity.ts +16 -0
- package/src/interfaces/web/src/hooks/useProjects.ts +27 -0
- package/src/interfaces/web/src/hooks/useTelegram.ts +35 -0
- package/src/interfaces/web/src/hooks/useTheme.tsx +57 -0
- package/src/interfaces/web/src/hooks/useTokenBootstrap.ts +122 -0
- package/src/interfaces/web/src/i18n/en.ts +767 -0
- package/src/interfaces/web/src/i18n/es.ts +770 -0
- package/src/interfaces/web/src/i18n/index.ts +86 -0
- package/src/interfaces/web/src/lib/api/admin.ts +30 -0
- package/src/interfaces/web/src/lib/api/agents.ts +46 -0
- package/src/interfaces/web/src/lib/api/code.ts +122 -0
- package/src/interfaces/web/src/lib/api/conversations.ts +16 -0
- package/src/interfaces/web/src/lib/api/deck.ts +106 -0
- package/src/interfaces/web/src/lib/api/desktop.ts +54 -0
- package/src/interfaces/web/src/lib/api/embeddings.ts +44 -0
- package/src/interfaces/web/src/lib/api/engines.ts +17 -0
- package/src/interfaces/web/src/lib/api/filesystem.ts +12 -0
- package/src/interfaces/web/src/lib/api/health.ts +6 -0
- package/src/interfaces/web/src/lib/api/identity.ts +7 -0
- package/src/interfaces/web/src/lib/api/mcps.ts +29 -0
- package/src/interfaces/web/src/lib/api/messages.ts +24 -0
- package/src/interfaces/web/src/lib/api/projects.ts +29 -0
- package/src/interfaces/web/src/lib/api/routines.ts +14 -0
- package/src/interfaces/web/src/lib/api/sessions.ts +16 -0
- package/src/interfaces/web/src/lib/api/super_agent.ts +29 -0
- package/src/interfaces/web/src/lib/api/tasks.ts +19 -0
- package/src/interfaces/web/src/lib/api/telegram.ts +57 -0
- package/src/interfaces/web/src/lib/api/tools.ts +13 -0
- package/src/interfaces/web/src/lib/api/voice.ts +169 -0
- package/src/interfaces/web/src/lib/api.ts +48 -0
- package/src/interfaces/web/src/lib/cn.ts +6 -0
- package/src/interfaces/web/src/lib/code-context.ts +83 -0
- package/src/interfaces/web/src/lib/config-values.ts +29 -0
- package/src/interfaces/web/src/lib/device.ts +10 -0
- package/src/interfaces/web/src/lib/http.ts +104 -0
- package/src/interfaces/web/src/lib/secrets.ts +15 -0
- package/src/interfaces/web/src/lib/utils.ts +6 -0
- package/src/interfaces/web/src/main.tsx +16 -0
- package/src/interfaces/web/src/screens/ApxAdminScreen.tsx +174 -0
- package/src/interfaces/web/src/screens/PairingScreen.tsx +105 -0
- package/src/interfaces/web/src/screens/ProjectScreen.tsx +178 -0
- package/src/interfaces/web/src/screens/SettingsScreen.tsx +111 -0
- package/src/interfaces/web/src/screens/base/AgentDefaultsTab.tsx +274 -0
- package/src/interfaces/web/src/screens/base/ComingSoon.tsx +16 -0
- package/src/interfaces/web/src/screens/base/GlobalTasksTab.tsx +53 -0
- package/src/interfaces/web/src/screens/base/LogsTab.tsx +188 -0
- package/src/interfaces/web/src/screens/base/ModelsTab.tsx +13 -0
- package/src/interfaces/web/src/screens/base/SessionsTab.tsx +58 -0
- package/src/interfaces/web/src/screens/base/WorkspacesTab.tsx +49 -0
- package/src/interfaces/web/src/screens/modules/CodeScreen.tsx +295 -0
- package/src/interfaces/web/src/screens/modules/DeckScreen.tsx +173 -0
- package/src/interfaces/web/src/screens/modules/DesktopScreen.tsx +304 -0
- package/src/interfaces/web/src/screens/modules/VoiceScreen.tsx +174 -0
- package/src/interfaces/web/src/screens/project/AgentBrainGraph.tsx +152 -0
- package/src/interfaces/web/src/screens/project/AgentDetailScreen.tsx +455 -0
- package/src/interfaces/web/src/screens/project/AgentsTab.tsx +364 -0
- package/src/interfaces/web/src/screens/project/ChatTab.tsx +198 -0
- package/src/interfaces/web/src/screens/project/ConfigTab.tsx +94 -0
- package/src/interfaces/web/src/screens/project/McpsTab.tsx +149 -0
- package/src/interfaces/web/src/screens/project/MemoriesTab.tsx +134 -0
- package/src/interfaces/web/src/screens/project/Overview.tsx +37 -0
- package/src/interfaces/web/src/screens/project/RoutinesTab.tsx +386 -0
- package/src/interfaces/web/src/screens/project/TasksTab.tsx +116 -0
- package/src/interfaces/web/src/screens/project/TelegramTab.tsx +126 -0
- package/src/interfaces/web/src/screens/project/ThreadsTab.tsx +100 -0
- package/src/interfaces/web/src/styles.css +128 -0
- package/src/interfaces/web/src/types/daemon.ts +289 -0
- package/src/interfaces/web/tailwind.config.js +53 -0
- package/src/interfaces/web/tsconfig.json +24 -0
- package/src/interfaces/web/vite.config.ts +50 -0
- package/src/cli/commands/exec.js +0 -56
- package/src/cli/commands/overlay.js +0 -253
- package/src/cli/commands/session.js +0 -395
- package/src/cli/commands/sessions.js +0 -517
- package/src/cli/commands/telegram.js +0 -77
- package/src/cli/postinstall.js +0 -75
- package/src/cli-ts/commands/agent.ts +0 -173
- package/src/cli-ts/commands/chat.ts +0 -119
- package/src/cli-ts/commands/daemon.ts +0 -112
- package/src/cli-ts/commands/exec.ts +0 -109
- package/src/cli-ts/commands/mcp.ts +0 -235
- package/src/cli-ts/commands/session.ts +0 -224
- package/src/cli-ts/commands/status.ts +0 -61
- package/src/cli-ts/http.ts +0 -36
- package/src/cli-ts/index.ts +0 -73
- package/src/cli-ts/ui.ts +0 -107
- package/src/daemon/api.js +0 -1558
- package/src/daemon/engines/gemini.js +0 -56
- package/src/daemon/engines/openai.js +0 -79
- package/src/daemon/mcp-sources.js +0 -114
- package/src/daemon/super-agent-tools/index.js +0 -84
- package/src/daemon/super-agent-tools.js +0 -1
- package/src/daemon/super-agent.js +0 -541
- package/src/overlay/index.html +0 -44
- package/src/overlay/main.js +0 -480
- package/src/overlay/preload.js +0 -34
- package/src/overlay/renderer.js +0 -371
- package/src/overlay/style.css +0 -250
- package/src/tui/context/sync-apx.tsx +0 -284
- package/src/tui/routes/session/index.tsx +0 -274
- package/src/tui/routes/session/sidebar-apx.tsx +0 -90
- /package/src/{daemon → core}/tools/browser.js +0 -0
- /package/src/{daemon → core}/tools/fetch.js +0 -0
- /package/src/{daemon → core}/tools/glob.js +0 -0
- /package/src/{daemon → core}/tools/grep.js +0 -0
- /package/src/{daemon → core}/tools/registry.js +0 -0
- /package/src/{daemon → core}/tools/search.js +0 -0
- /package/src/{daemon → host/daemon}/conversations.js +0 -0
- /package/src/{daemon → host/daemon}/env-detect.js +0 -0
- /package/src/{daemon → host/daemon}/runtimes/_spawn.js +0 -0
- /package/src/{daemon → host/daemon}/runtimes/aider.js +0 -0
- /package/src/{daemon → host/daemon}/runtimes/claude-code.js +0 -0
- /package/src/{daemon → host/daemon}/runtimes/codex.js +0 -0
- /package/src/{daemon → host/daemon}/runtimes/cursor-agent.js +0 -0
- /package/src/{daemon → host/daemon}/runtimes/gemini-cli.js +0 -0
- /package/src/{daemon → host/daemon}/runtimes/index.js +0 -0
- /package/src/{daemon → host/daemon}/runtimes/opencode.js +0 -0
- /package/src/{daemon → host/daemon}/runtimes/qwen-code.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/call-mcp.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/edit-file.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/list-files.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/list-mcps.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/list-projects.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/list-skills.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/load-skill.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/read-agent-memory.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/read-file.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/run-shell.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/search-files.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/transcribe-audio.js +0 -0
- /package/src/{daemon → host/daemon}/super-agent-tools/tools/write-file.js +0 -0
- /package/src/{daemon → host/daemon}/thinking.js +0 -0
- /package/src/{daemon → host/daemon}/whisper-server.py +0 -0
- /package/src/{daemon → host/daemon}/whisper-transcribe.py +0 -0
- /package/src/{cli → interfaces/cli}/commands/a2a.js +0 -0
- /package/src/{cli → interfaces/cli}/commands/artifact.js +0 -0
- /package/src/{cli → interfaces/cli}/commands/chat.js +0 -0
- /package/src/{cli → interfaces/cli}/commands/log.js +0 -0
- /package/src/{cli → interfaces/cli}/commands/messages.js +0 -0
- /package/src/{cli → interfaces/cli}/commands/plugins.js +0 -0
- /package/src/{cli → interfaces/cli}/commands/routine.js +0 -0
- /package/src/{cli → interfaces/cli}/commands/runtime.js +0 -0
- /package/src/{cli → interfaces/cli}/terminal-chat/renderer.js +0 -0
- /package/src/{overlay → interfaces/desktop}/package.json +0 -0
- /package/src/{tui → interfaces/tui}/_shims/cli-error.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/cli-logo.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/cli-ui.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/config-console-state.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/core-any.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/core-binary.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/core-flag.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/core-log.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/lsp-language.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/opencode-any.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/opencode-sdk-v2.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/plugin-tui.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/prompt-display.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/provider-provider.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/session-retry.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/session-schema.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/session-session.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/snapshot.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/tool-any.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/util-error.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/util-filesystem.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/util-format.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/util-iife.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/util-locale.ts +0 -0
- /package/src/{tui → interfaces/tui}/_shims/util-process.ts +0 -0
- /package/src/{tui → interfaces/tui}/asset/charge.wav +0 -0
- /package/src/{tui → interfaces/tui}/asset/pulse-a.wav +0 -0
- /package/src/{tui → interfaces/tui}/asset/pulse-b.wav +0 -0
- /package/src/{tui → interfaces/tui}/asset/pulse-c.wav +0 -0
- /package/src/{tui → interfaces/tui}/attach.ts +0 -0
- /package/src/{tui → interfaces/tui}/component/bg-pulse-render.ts +0 -0
- /package/src/{tui → interfaces/tui}/component/bg-pulse.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/border.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-agent.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-console-org.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-mcp.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-model.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-provider.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-retry-action.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-session-delete-failed.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-session-list.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-session-rename.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-skill.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-stash.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-status.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-tag.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-theme-list.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-variant.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-workspace-create.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-workspace-file-changes.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/dialog-workspace-unavailable.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/error-component.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/logo.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/plugin-route-missing.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/prompt/autocomplete.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/prompt/cwd.ts +0 -0
- /package/src/{tui → interfaces/tui}/component/prompt/frecency.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/prompt/history.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/prompt/part.ts +0 -0
- /package/src/{tui → interfaces/tui}/component/prompt/stash.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/prompt/traits.ts +0 -0
- /package/src/{tui → interfaces/tui}/component/spinner.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/startup-loading.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/todo-item.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/use-connected.tsx +0 -0
- /package/src/{tui → interfaces/tui}/component/workspace-label.tsx +0 -0
- /package/src/{tui → interfaces/tui}/config/cwd.ts +0 -0
- /package/src/{tui → interfaces/tui}/config/keybind.ts +0 -0
- /package/src/{tui → interfaces/tui}/config/tui-migrate.ts +0 -0
- /package/src/{tui → interfaces/tui}/config/tui-schema.ts +0 -0
- /package/src/{tui → interfaces/tui}/config/tui.ts +0 -0
- /package/src/{tui → interfaces/tui}/context/aggregate-failures.ts +0 -0
- /package/src/{tui → interfaces/tui}/context/args.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/command-palette.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/directory.ts +0 -0
- /package/src/{tui → interfaces/tui}/context/editor-zed.ts +0 -0
- /package/src/{tui → interfaces/tui}/context/editor.ts +0 -0
- /package/src/{tui → interfaces/tui}/context/event-apx.ts +0 -0
- /package/src/{tui → interfaces/tui}/context/event.ts +0 -0
- /package/src/{tui → interfaces/tui}/context/exit.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/helper.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/kv.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/local.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/path-format.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/project-apx.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/project.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/prompt.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/route.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/sdk.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/sync-v2.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/sync.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/aura.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/ayu.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/carbonfox.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/catppuccin-frappe.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/catppuccin-macchiato.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/catppuccin.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/cobalt2.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/cursor.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/dracula.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/everforest.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/flexoki.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/github.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/gruvbox.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/kanagawa.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/lucent-orng.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/material.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/matrix.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/mercury.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/monokai.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/nightowl.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/nord.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/one-dark.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/opencode.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/orng.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/osaka-jade.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/palenight.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/rosepine.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/solarized.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/synthwave84.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/tokyonight.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/vercel.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/vesper.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme/zenburn.json +0 -0
- /package/src/{tui → interfaces/tui}/context/theme.tsx +0 -0
- /package/src/{tui → interfaces/tui}/context/tui-config.tsx +0 -0
- /package/src/{tui → interfaces/tui}/event.ts +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/home/footer.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/home/tips-view.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/home/tips.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/sidebar/context.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/sidebar/files.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/sidebar/footer.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/sidebar/lsp.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/sidebar/mcp.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/sidebar/todo.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/system/plugins.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/system/session-v2.tsx +0 -0
- /package/src/{tui → interfaces/tui}/feature-plugins/system/which-key.tsx +0 -0
- /package/src/{tui → interfaces/tui}/keymap.tsx +0 -0
- /package/src/{tui → interfaces/tui}/layer.ts +0 -0
- /package/src/{tui → interfaces/tui}/plugin/api.tsx +0 -0
- /package/src/{tui → interfaces/tui}/plugin/command-shim.ts +0 -0
- /package/src/{tui → interfaces/tui}/plugin/internal.ts +0 -0
- /package/src/{tui → interfaces/tui}/plugin/runtime.ts +0 -0
- /package/src/{tui → interfaces/tui}/plugin/slots.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/home.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/session/dialog-fork-from-timeline.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/session/dialog-message.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/session/dialog-subagent.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/session/dialog-timeline.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/session/footer.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/session/permission.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/session/question.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/session/sidebar.tsx +0 -0
- /package/src/{tui → interfaces/tui}/routes/session/subagent-footer.tsx +0 -0
- /package/src/{tui → interfaces/tui}/run.ts +0 -0
- /package/src/{tui → interfaces/tui}/thread.ts +0 -0
- /package/src/{tui → interfaces/tui}/ui/dialog-alert.tsx +0 -0
- /package/src/{tui → interfaces/tui}/ui/dialog-confirm.tsx +0 -0
- /package/src/{tui → interfaces/tui}/ui/dialog-export-options.tsx +0 -0
- /package/src/{tui → interfaces/tui}/ui/dialog-help.tsx +0 -0
- /package/src/{tui → interfaces/tui}/ui/dialog-prompt.tsx +0 -0
- /package/src/{tui → interfaces/tui}/ui/dialog-select.tsx +0 -0
- /package/src/{tui → interfaces/tui}/ui/dialog.tsx +0 -0
- /package/src/{tui → interfaces/tui}/ui/link.tsx +0 -0
- /package/src/{tui → interfaces/tui}/ui/spinner.ts +0 -0
- /package/src/{tui → interfaces/tui}/ui/toast.tsx +0 -0
- /package/src/{tui → interfaces/tui}/util/editor.ts +0 -0
- /package/src/{tui → interfaces/tui}/util/model.ts +0 -0
- /package/src/{tui → interfaces/tui}/util/provider-origin.ts +0 -0
- /package/src/{tui → interfaces/tui}/util/revert-diff.ts +0 -0
- /package/src/{tui → interfaces/tui}/util/scroll.ts +0 -0
- /package/src/{tui → interfaces/tui}/util/selection.ts +0 -0
- /package/src/{tui → interfaces/tui}/util/signal.ts +0 -0
- /package/src/{tui → interfaces/tui}/util/sound.ts +0 -0
- /package/src/{tui → interfaces/tui}/util/transcript.ts +0 -0
- /package/src/{tui → interfaces/tui}/validate-session.ts +0 -0
- /package/src/{tui → interfaces/tui}/win32.ts +0 -0
- /package/src/{tui → interfaces/tui}/worker.ts +0 -0
|
@@ -0,0 +1,548 @@
|
|
|
1
|
+
function NE(e,n){for(var s=0;s<n.length;s++){const r=n[s];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const c=Object.getOwnPropertyDescriptor(r,i);c&&Object.defineProperty(e,i,c.get?c:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const c of i)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function s(i){const c={};return i.integrity&&(c.integrity=i.integrity),i.referrerPolicy&&(c.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?c.credentials="include":i.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(i){if(i.ep)return;i.ep=!0;const c=s(i);fetch(i.href,c)}})();function th(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var op={exports:{}},ai={};/**
|
|
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 b0;function TE(){if(b0)return ai;b0=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function s(r,i,c){var d=null;if(c!==void 0&&(d=""+c),i.key!==void 0&&(d=""+i.key),"key"in i){c={};for(var f in i)f!=="key"&&(c[f]=i[f])}else c=i;return i=c.ref,{$$typeof:e,type:r,key:d,ref:i!==void 0?i:null,props:c}}return ai.Fragment=n,ai.jsx=s,ai.jsxs=s,ai}var v0;function AE(){return v0||(v0=1,op.exports=TE()),op.exports}var l=AE(),lp={exports:{}},We={};/**
|
|
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 y0;function ME(){if(y0)return We;y0=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),y=Symbol.iterator;function w(P){return P===null||typeof P!="object"?null:(P=y&&P[y]||P["@@iterator"],typeof P=="function"?P:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,j={};function E(P,K,$){this.props=P,this.context=K,this.refs=j,this.updater=$||S}E.prototype.isReactComponent={},E.prototype.setState=function(P,K){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,K,"setState")},E.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function k(){}k.prototype=E.prototype;function N(P,K,$){this.props=P,this.context=K,this.refs=j,this.updater=$||S}var R=N.prototype=new k;R.constructor=N,_(R,E.prototype),R.isPureReactComponent=!0;var A=Array.isArray;function M(){}var O={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function I(P,K,$){var W=$.ref;return{$$typeof:e,type:P,key:K,ref:W!==void 0?W:null,props:$}}function B(P,K){return I(P.type,K,P.props)}function L(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function D(P){var K={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function($){return K[$]})}var q=/\/+/g;function F(P,K){return typeof P=="object"&&P!==null&&P.key!=null?D(""+P.key):K.toString(36)}function Z(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(M,M):(P.status="pending",P.then(function(K){P.status==="pending"&&(P.status="fulfilled",P.value=K)},function(K){P.status==="pending"&&(P.status="rejected",P.reason=K)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function H(P,K,$,W,ce){var ie=typeof P;(ie==="undefined"||ie==="boolean")&&(P=null);var oe=!1;if(P===null)oe=!0;else switch(ie){case"bigint":case"string":case"number":oe=!0;break;case"object":switch(P.$$typeof){case e:case n:oe=!0;break;case h:return oe=P._init,H(oe(P._payload),K,$,W,ce)}}if(oe)return ce=ce(P),oe=W===""?"."+F(P,0):W,A(ce)?($="",oe!=null&&($=oe.replace(q,"$&/")+"/"),H(ce,K,$,"",function(Ne){return Ne})):ce!=null&&(L(ce)&&(ce=B(ce,$+(ce.key==null||P&&P.key===ce.key?"":(""+ce.key).replace(q,"$&/")+"/")+oe)),K.push(ce)),1;oe=0;var ue=W===""?".":W+":";if(A(P))for(var te=0;te<P.length;te++)W=P[te],ie=ue+F(W,te),oe+=H(W,K,$,ie,ce);else if(te=w(P),typeof te=="function")for(P=te.call(P),te=0;!(W=P.next()).done;)W=W.value,ie=ue+F(W,te++),oe+=H(W,K,$,ie,ce);else if(ie==="object"){if(typeof P.then=="function")return H(Z(P),K,$,W,ce);throw K=String(P),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return oe}function G(P,K,$){if(P==null)return P;var W=[],ce=0;return H(P,W,"","",function(ie){return K.call($,ie,ce++)}),W}function Q(P){if(P._status===-1){var K=P._result;K=K(),K.then(function($){(P._status===0||P._status===-1)&&(P._status=1,P._result=$)},function($){(P._status===0||P._status===-1)&&(P._status=2,P._result=$)}),P._status===-1&&(P._status=0,P._result=K)}if(P._status===1)return P._result.default;throw P._result}var V=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},Y={map:G,forEach:function(P,K,$){G(P,function(){K.apply(this,arguments)},$)},count:function(P){var K=0;return G(P,function(){K++}),K},toArray:function(P){return G(P,function(K){return K})||[]},only:function(P){if(!L(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return We.Activity=x,We.Children=Y,We.Component=E,We.Fragment=s,We.Profiler=i,We.PureComponent=N,We.StrictMode=r,We.Suspense=g,We.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,We.__COMPILER_RUNTIME={__proto__:null,c:function(P){return O.H.useMemoCache(P)}},We.cache=function(P){return function(){return P.apply(null,arguments)}},We.cacheSignal=function(){return null},We.cloneElement=function(P,K,$){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var W=_({},P.props),ce=P.key;if(K!=null)for(ie in K.key!==void 0&&(ce=""+K.key),K)!U.call(K,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&K.ref===void 0||(W[ie]=K[ie]);var ie=arguments.length-2;if(ie===1)W.children=$;else if(1<ie){for(var oe=Array(ie),ue=0;ue<ie;ue++)oe[ue]=arguments[ue+2];W.children=oe}return I(P.type,ce,W)},We.createContext=function(P){return P={$$typeof:d,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:c,_context:P},P},We.createElement=function(P,K,$){var W,ce={},ie=null;if(K!=null)for(W in K.key!==void 0&&(ie=""+K.key),K)U.call(K,W)&&W!=="key"&&W!=="__self"&&W!=="__source"&&(ce[W]=K[W]);var oe=arguments.length-2;if(oe===1)ce.children=$;else if(1<oe){for(var ue=Array(oe),te=0;te<oe;te++)ue[te]=arguments[te+2];ce.children=ue}if(P&&P.defaultProps)for(W in oe=P.defaultProps,oe)ce[W]===void 0&&(ce[W]=oe[W]);return I(P,ie,ce)},We.createRef=function(){return{current:null}},We.forwardRef=function(P){return{$$typeof:f,render:P}},We.isValidElement=L,We.lazy=function(P){return{$$typeof:h,_payload:{_status:-1,_result:P},_init:Q}},We.memo=function(P,K){return{$$typeof:m,type:P,compare:K===void 0?null:K}},We.startTransition=function(P){var K=O.T,$={};O.T=$;try{var W=P(),ce=O.S;ce!==null&&ce($,W),typeof W=="object"&&W!==null&&typeof W.then=="function"&&W.then(M,V)}catch(ie){V(ie)}finally{K!==null&&$.types!==null&&(K.types=$.types),O.T=K}},We.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},We.use=function(P){return O.H.use(P)},We.useActionState=function(P,K,$){return O.H.useActionState(P,K,$)},We.useCallback=function(P,K){return O.H.useCallback(P,K)},We.useContext=function(P){return O.H.useContext(P)},We.useDebugValue=function(){},We.useDeferredValue=function(P,K){return O.H.useDeferredValue(P,K)},We.useEffect=function(P,K){return O.H.useEffect(P,K)},We.useEffectEvent=function(P){return O.H.useEffectEvent(P)},We.useId=function(){return O.H.useId()},We.useImperativeHandle=function(P,K,$){return O.H.useImperativeHandle(P,K,$)},We.useInsertionEffect=function(P,K){return O.H.useInsertionEffect(P,K)},We.useLayoutEffect=function(P,K){return O.H.useLayoutEffect(P,K)},We.useMemo=function(P,K){return O.H.useMemo(P,K)},We.useOptimistic=function(P,K){return O.H.useOptimistic(P,K)},We.useReducer=function(P,K,$){return O.H.useReducer(P,K,$)},We.useRef=function(P){return O.H.useRef(P)},We.useState=function(P){return O.H.useState(P)},We.useSyncExternalStore=function(P,K,$){return O.H.useSyncExternalStore(P,K,$)},We.useTransition=function(){return O.H.useTransition()},We.version="19.2.7",We}var _0;function Xi(){return _0||(_0=1,lp.exports=ME()),lp.exports}var v=Xi();const Ki=th(v),OE=NE({__proto__:null,default:Ki},[v]);var ip={exports:{}},si={},cp={exports:{}},up={};/**
|
|
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 j0;function zE(){return j0||(j0=1,(function(e){function n(H,G){var Q=H.length;H.push(G);e:for(;0<Q;){var V=Q-1>>>1,Y=H[V];if(0<i(Y,G))H[V]=G,H[Q]=Y,Q=V;else break e}}function s(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var G=H[0],Q=H.pop();if(Q!==G){H[0]=Q;e:for(var V=0,Y=H.length,P=Y>>>1;V<P;){var K=2*(V+1)-1,$=H[K],W=K+1,ce=H[W];if(0>i($,Q))W<Y&&0>i(ce,$)?(H[V]=ce,H[W]=Q,V=W):(H[V]=$,H[K]=Q,V=K);else if(W<Y&&0>i(ce,Q))H[V]=ce,H[W]=Q,V=W;else break e}}return G}function i(H,G){var Q=H.sortIndex-G.sortIndex;return Q!==0?Q:H.id-G.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var g=[],m=[],h=1,x=null,y=3,w=!1,S=!1,_=!1,j=!1,E=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function R(H){for(var G=s(m);G!==null;){if(G.callback===null)r(m);else if(G.startTime<=H)r(m),G.sortIndex=G.expirationTime,n(g,G);else break;G=s(m)}}function A(H){if(_=!1,R(H),!S)if(s(g)!==null)S=!0,M||(M=!0,D());else{var G=s(m);G!==null&&Z(A,G.startTime-H)}}var M=!1,O=-1,U=5,I=-1;function B(){return j?!0:!(e.unstable_now()-I<U)}function L(){if(j=!1,M){var H=e.unstable_now();I=H;var G=!0;try{e:{S=!1,_&&(_=!1,k(O),O=-1),w=!0;var Q=y;try{t:{for(R(H),x=s(g);x!==null&&!(x.expirationTime>H&&B());){var V=x.callback;if(typeof V=="function"){x.callback=null,y=x.priorityLevel;var Y=V(x.expirationTime<=H);if(H=e.unstable_now(),typeof Y=="function"){x.callback=Y,R(H),G=!0;break t}x===s(g)&&r(g),R(H)}else r(g);x=s(g)}if(x!==null)G=!0;else{var P=s(m);P!==null&&Z(A,P.startTime-H),G=!1}}break e}finally{x=null,y=Q,w=!1}G=void 0}}finally{G?D():M=!1}}}var D;if(typeof N=="function")D=function(){N(L)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,F=q.port2;q.port1.onmessage=L,D=function(){F.postMessage(null)}}else D=function(){E(L,0)};function Z(H,G){O=E(function(){H(e.unstable_now())},G)}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(H){H.callback=null},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(H){switch(y){case 1:case 2:case 3:var G=3;break;default:G=y}var Q=y;y=G;try{return H()}finally{y=Q}},e.unstable_requestPaint=function(){j=!0},e.unstable_runWithPriority=function(H,G){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var Q=y;y=H;try{return G()}finally{y=Q}},e.unstable_scheduleCallback=function(H,G,Q){var V=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?V+Q:V):Q=V,H){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=Q+Y,H={id:h++,callback:G,priorityLevel:H,startTime:Q,expirationTime:Y,sortIndex:-1},Q>V?(H.sortIndex=Q,n(m,H),s(g)===null&&H===s(m)&&(_?(k(O),O=-1):_=!0,Z(A,Q-V))):(H.sortIndex=Y,n(g,H),S||w||(S=!0,M||(M=!0,D()))),H},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(H){var G=y;return function(){var Q=y;y=G;try{return H.apply(this,arguments)}finally{y=Q}}}})(up)),up}var S0;function DE(){return S0||(S0=1,cp.exports=zE()),cp.exports}var dp={exports:{}},Mn={};/**
|
|
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 w0;function LE(){if(w0)return Mn;w0=1;var e=Xi();function n(g){var m="https://react.dev/errors/"+g;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)m+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+g+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var r={d:{f:s,r:function(){throw Error(n(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},i=Symbol.for("react.portal");function c(g,m,h){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:x==null?null:""+x,children:g,containerInfo:m,implementation:h}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(g,m){if(g==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Mn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Mn.createPortal=function(g,m){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(n(299));return c(g,m,null,h)},Mn.flushSync=function(g){var m=d.T,h=r.p;try{if(d.T=null,r.p=2,g)return g()}finally{d.T=m,r.p=h,r.d.f()}},Mn.preconnect=function(g,m){typeof g=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,r.d.C(g,m))},Mn.prefetchDNS=function(g){typeof g=="string"&&r.d.D(g)},Mn.preinit=function(g,m){if(typeof g=="string"&&m&&typeof m.as=="string"){var h=m.as,x=f(h,m.crossOrigin),y=typeof m.integrity=="string"?m.integrity:void 0,w=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;h==="style"?r.d.S(g,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:x,integrity:y,fetchPriority:w}):h==="script"&&r.d.X(g,{crossOrigin:x,integrity:y,fetchPriority:w,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Mn.preinitModule=function(g,m){if(typeof g=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var h=f(m.as,m.crossOrigin);r.d.M(g,{crossOrigin:h,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&r.d.M(g)},Mn.preload=function(g,m){if(typeof g=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var h=m.as,x=f(h,m.crossOrigin);r.d.L(g,h,{crossOrigin:x,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Mn.preloadModule=function(g,m){if(typeof g=="string")if(m){var h=f(m.as,m.crossOrigin);r.d.m(g,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:h,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else r.d.m(g)},Mn.requestFormReset=function(g){r.d.r(g)},Mn.unstable_batchedUpdates=function(g,m){return g(m)},Mn.useFormState=function(g,m,h){return d.H.useFormState(g,m,h)},Mn.useFormStatus=function(){return d.H.useHostTransitionStatus()},Mn.version="19.2.7",Mn}var C0;function D_(){if(C0)return dp.exports;C0=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(n){console.error(n)}}return e(),dp.exports=LE(),dp.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 E0;function PE(){if(E0)return si;E0=1;var e=DE(),n=Xi(),s=D_();function r(t){var a="https://react.dev/errors/"+t;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)a+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+t+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var a=t,o=t;if(t.alternate)for(;a.return;)a=a.return;else{t=a;do a=t,(a.flags&4098)!==0&&(o=a.return),t=a.return;while(t)}return a.tag===3?o:null}function d(t){if(t.tag===13){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function f(t){if(t.tag===31){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function g(t){if(c(t)!==t)throw Error(r(188))}function m(t){var a=t.alternate;if(!a){if(a=c(t),a===null)throw Error(r(188));return a!==t?null:t}for(var o=t,u=a;;){var p=o.return;if(p===null)break;var b=p.alternate;if(b===null){if(u=p.return,u!==null){o=u;continue}break}if(p.child===b.child){for(b=p.child;b;){if(b===o)return g(p),t;if(b===u)return g(p),a;b=b.sibling}throw Error(r(188))}if(o.return!==u.return)o=p,u=b;else{for(var T=!1,z=p.child;z;){if(z===o){T=!0,o=p,u=b;break}if(z===u){T=!0,u=p,o=b;break}z=z.sibling}if(!T){for(z=b.child;z;){if(z===o){T=!0,o=b,u=p;break}if(z===u){T=!0,u=b,o=p;break}z=z.sibling}if(!T)throw Error(r(189))}}if(o.alternate!==u)throw Error(r(190))}if(o.tag!==3)throw Error(r(188));return o.stateNode.current===o?t:a}function h(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t;for(t=t.child;t!==null;){if(a=h(t),a!==null)return a;t=t.sibling}return null}var x=Object.assign,y=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),N=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),L=Symbol.iterator;function D(t){return t===null||typeof t!="object"?null:(t=L&&t[L]||t["@@iterator"],typeof t=="function"?t:null)}var q=Symbol.for("react.client.reference");function F(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===q?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case _:return"Fragment";case E:return"Profiler";case j:return"StrictMode";case A:return"Suspense";case M:return"SuspenseList";case I:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case S:return"Portal";case N:return t.displayName||"Context";case k:return(t._context.displayName||"Context")+".Consumer";case R:var a=t.render;return t=t.displayName,t||(t=a.displayName||a.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case O:return a=t.displayName||null,a!==null?a:F(t.type)||"Memo";case U:a=t._payload,t=t._init;try{return F(t(a))}catch{}}return null}var Z=Array.isArray,H=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},V=[],Y=-1;function P(t){return{current:t}}function K(t){0>Y||(t.current=V[Y],V[Y]=null,Y--)}function $(t,a){Y++,V[Y]=t.current,t.current=a}var W=P(null),ce=P(null),ie=P(null),oe=P(null);function ue(t,a){switch($(ie,a),$(ce,t),$(W,null),a.nodeType){case 9:case 11:t=(t=a.documentElement)&&(t=t.namespaceURI)?Hy(t):0;break;default:if(t=a.tagName,a=a.namespaceURI)a=Hy(a),t=qy(a,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}K(W),$(W,t)}function te(){K(W),K(ce),K(ie)}function Ne(t){t.memoizedState!==null&&$(oe,t);var a=W.current,o=qy(a,t.type);a!==o&&($(ce,t),$(W,o))}function $e(t){ce.current===t&&(K(W),K(ce)),oe.current===t&&(K(oe),Wl._currentValue=Q)}var be,Se;function Ee(t){if(be===void 0)try{throw Error()}catch(o){var a=o.stack.trim().match(/\n( *(at )?)/);be=a&&a[1]||"",Se=-1<o.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+be+t+Se}var Oe=!1;function ze(t,a){if(!t||Oe)return"";Oe=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(a){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(le){var se=le}Reflect.construct(t,[],pe)}else{try{pe.call()}catch(le){se=le}t.call(pe.prototype)}}else{try{throw Error()}catch(le){se=le}(pe=t())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(le){if(le&&se&&typeof le.stack=="string")return[le.stack,se.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=u.DetermineComponentFrameRoot(),T=b[0],z=b[1];if(T&&z){var X=T.split(`
|
|
44
|
+
`),ae=z.split(`
|
|
45
|
+
`);for(p=u=0;u<X.length&&!X[u].includes("DetermineComponentFrameRoot");)u++;for(;p<ae.length&&!ae[p].includes("DetermineComponentFrameRoot");)p++;if(u===X.length||p===ae.length)for(u=X.length-1,p=ae.length-1;1<=u&&0<=p&&X[u]!==ae[p];)p--;for(;1<=u&&0<=p;u--,p--)if(X[u]!==ae[p]){if(u!==1||p!==1)do if(u--,p--,0>p||X[u]!==ae[p]){var de=`
|
|
46
|
+
`+X[u].replace(" at new "," at ");return t.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",t.displayName)),de}while(1<=u&&0<=p);break}}}finally{Oe=!1,Error.prepareStackTrace=o}return(o=t?t.displayName||t.name:"")?Ee(o):""}function xe(t,a){switch(t.tag){case 26:case 27:case 5:return Ee(t.type);case 16:return Ee("Lazy");case 13:return t.child!==a&&a!==null?Ee("Suspense Fallback"):Ee("Suspense");case 19:return Ee("SuspenseList");case 0:case 15:return ze(t.type,!1);case 11:return ze(t.type.render,!1);case 1:return ze(t.type,!0);case 31:return Ee("Activity");default:return""}}function ke(t){try{var a="",o=null;do a+=xe(t,o),o=t,t=t.return;while(t);return a}catch(u){return`
|
|
47
|
+
Error generating stack: `+u.message+`
|
|
48
|
+
`+u.stack}}var _e=Object.prototype.hasOwnProperty,De=e.unstable_scheduleCallback,Ge=e.unstable_cancelCallback,qe=e.unstable_shouldYield,Me=e.unstable_requestPaint,ve=e.unstable_now,re=e.unstable_getCurrentPriorityLevel,ye=e.unstable_ImmediatePriority,je=e.unstable_UserBlockingPriority,Pe=e.unstable_NormalPriority,Ze=e.unstable_LowPriority,_t=e.unstable_IdlePriority,Ht=e.log,vt=e.unstable_setDisableYieldValue,ut=null,it=null;function Et(t){if(typeof Ht=="function"&&vt(t),it&&typeof it.setStrictMode=="function")try{it.setStrictMode(ut,t)}catch{}}var Bt=Math.clz32?Math.clz32:dt,pa=Math.log,gn=Math.LN2;function dt(t){return t>>>=0,t===0?32:31-(pa(t)/gn|0)|0}var Tt=256,Xt=262144,yt=4194304;function Wt(t){var a=t&42;if(a!==0)return a;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Vt(t,a,o){var u=t.pendingLanes;if(u===0)return 0;var p=0,b=t.suspendedLanes,T=t.pingedLanes;t=t.warmLanes;var z=u&134217727;return z!==0?(u=z&~b,u!==0?p=Wt(u):(T&=z,T!==0?p=Wt(T):o||(o=z&~t,o!==0&&(p=Wt(o))))):(z=u&~b,z!==0?p=Wt(z):T!==0?p=Wt(T):o||(o=u&~t,o!==0&&(p=Wt(o)))),p===0?0:a!==0&&a!==p&&(a&b)===0&&(b=p&-p,o=a&-a,b>=o||b===32&&(o&4194048)!==0)?a:p}function rn(t,a){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&a)===0}function Tn(t,a){switch(t){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 qn(){var t=yt;return yt<<=1,(yt&62914560)===0&&(yt=4194304),t}function ta(t){for(var a=[],o=0;31>o;o++)a.push(t);return a}function Vn(t,a){t.pendingLanes|=a,a!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function es(t,a,o,u,p,b){var T=t.pendingLanes;t.pendingLanes=o,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=o,t.entangledLanes&=o,t.errorRecoveryDisabledLanes&=o,t.shellSuspendCounter=0;var z=t.entanglements,X=t.expirationTimes,ae=t.hiddenUpdates;for(o=T&~o;0<o;){var de=31-Bt(o),pe=1<<de;z[de]=0,X[de]=-1;var se=ae[de];if(se!==null)for(ae[de]=null,de=0;de<se.length;de++){var le=se[de];le!==null&&(le.lane&=-536870913)}o&=~pe}u!==0&&An(t,u,0),b!==0&&p===0&&t.tag!==0&&(t.suspendedLanes|=b&~(T&~a))}function An(t,a,o){t.pendingLanes|=a,t.suspendedLanes&=~a;var u=31-Bt(a);t.entangledLanes|=a,t.entanglements[u]=t.entanglements[u]|1073741824|o&261930}function na(t,a){var o=t.entangledLanes|=a;for(t=t.entanglements;o;){var u=31-Bt(o),p=1<<u;p&a|t[u]&a&&(t[u]|=a),o&=~p}}function Na(t,a){var o=a&-a;return o=(o&42)!==0?1:ts(o),(o&(t.suspendedLanes|a))!==0?0:o}function ts(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function nt(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function At(){var t=G.p;return t!==0?t:(t=window.event,t===void 0?32:d0(t.type))}function yn(t,a){var o=G.p;try{return G.p=t,a()}finally{G.p=o}}var en=Math.random().toString(36).slice(2),kt="__reactFiber$"+en,un="__reactProps$"+en,yr="__reactContainer$"+en,oc="__reactEvents$"+en,b2="__reactListeners$"+en,v2="__reactHandles$"+en,Rx="__reactResources$"+en,pl="__reactMarker$"+en;function Zd(t){delete t[kt],delete t[un],delete t[oc],delete t[b2],delete t[v2]}function to(t){var a=t[kt];if(a)return a;for(var o=t.parentNode;o;){if(a=o[yr]||o[kt]){if(o=a.alternate,a.child!==null||o!==null&&o.child!==null)for(t=Ky(t);t!==null;){if(o=t[kt])return o;t=Ky(t)}return a}t=o,o=t.parentNode}return null}function no(t){if(t=t[kt]||t[yr]){var a=t.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return t}return null}function gl(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t.stateNode;throw Error(r(33))}function ao(t){var a=t[Rx];return a||(a=t[Rx]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function xn(t){t[pl]=!0}var Nx=new Set,Tx={};function _r(t,a){so(t,a),so(t+"Capture",a)}function so(t,a){for(Tx[t]=a,t=0;t<a.length;t++)Nx.add(a[t])}var y2=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]*$"),Ax={},Mx={};function _2(t){return _e.call(Mx,t)?!0:_e.call(Ax,t)?!1:y2.test(t)?Mx[t]=!0:(Ax[t]=!0,!1)}function lc(t,a,o){if(_2(a))if(o===null)t.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":t.removeAttribute(a);return;case"boolean":var u=a.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){t.removeAttribute(a);return}}t.setAttribute(a,""+o)}}function ic(t,a,o){if(o===null)t.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttribute(a,""+o)}}function ns(t,a,o,u){if(u===null)t.removeAttribute(o);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(o);return}t.setAttributeNS(a,o,""+u)}}function ga(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Ox(t){var a=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function j2(t,a,o){var u=Object.getOwnPropertyDescriptor(t.constructor.prototype,a);if(!t.hasOwnProperty(a)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var p=u.get,b=u.set;return Object.defineProperty(t,a,{configurable:!0,get:function(){return p.call(this)},set:function(T){o=""+T,b.call(this,T)}}),Object.defineProperty(t,a,{enumerable:u.enumerable}),{getValue:function(){return o},setValue:function(T){o=""+T},stopTracking:function(){t._valueTracker=null,delete t[a]}}}}function Jd(t){if(!t._valueTracker){var a=Ox(t)?"checked":"value";t._valueTracker=j2(t,a,""+t[a])}}function zx(t){if(!t)return!1;var a=t._valueTracker;if(!a)return!0;var o=a.getValue(),u="";return t&&(u=Ox(t)?t.checked?"true":"false":t.value),t=u,t!==o?(a.setValue(t),!0):!1}function cc(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var S2=/[\n"\\]/g;function ha(t){return t.replace(S2,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Wd(t,a,o,u,p,b,T,z){t.name="",T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?t.type=T:t.removeAttribute("type"),a!=null?T==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+ga(a)):t.value!==""+ga(a)&&(t.value=""+ga(a)):T!=="submit"&&T!=="reset"||t.removeAttribute("value"),a!=null?ef(t,T,ga(a)):o!=null?ef(t,T,ga(o)):u!=null&&t.removeAttribute("value"),p==null&&b!=null&&(t.defaultChecked=!!b),p!=null&&(t.checked=p&&typeof p!="function"&&typeof p!="symbol"),z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"?t.name=""+ga(z):t.removeAttribute("name")}function Dx(t,a,o,u,p,b,T,z){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(t.type=b),a!=null||o!=null){if(!(b!=="submit"&&b!=="reset"||a!=null)){Jd(t);return}o=o!=null?""+ga(o):"",a=a!=null?""+ga(a):o,z||a===t.value||(t.value=a),t.defaultValue=a}u=u??p,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=z?t.checked:!!u,t.defaultChecked=!!u,T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(t.name=T),Jd(t)}function ef(t,a,o){a==="number"&&cc(t.ownerDocument)===t||t.defaultValue===""+o||(t.defaultValue=""+o)}function ro(t,a,o,u){if(t=t.options,a){a={};for(var p=0;p<o.length;p++)a["$"+o[p]]=!0;for(o=0;o<t.length;o++)p=a.hasOwnProperty("$"+t[o].value),t[o].selected!==p&&(t[o].selected=p),p&&u&&(t[o].defaultSelected=!0)}else{for(o=""+ga(o),a=null,p=0;p<t.length;p++){if(t[p].value===o){t[p].selected=!0,u&&(t[p].defaultSelected=!0);return}a!==null||t[p].disabled||(a=t[p])}a!==null&&(a.selected=!0)}}function Lx(t,a,o){if(a!=null&&(a=""+ga(a),a!==t.value&&(t.value=a),o==null)){t.defaultValue!==a&&(t.defaultValue=a);return}t.defaultValue=o!=null?""+ga(o):""}function Px(t,a,o,u){if(a==null){if(u!=null){if(o!=null)throw Error(r(92));if(Z(u)){if(1<u.length)throw Error(r(93));u=u[0]}o=u}o==null&&(o=""),a=o}o=ga(a),t.defaultValue=o,u=t.textContent,u===o&&u!==""&&u!==null&&(t.value=u),Jd(t)}function oo(t,a){if(a){var o=t.firstChild;if(o&&o===t.lastChild&&o.nodeType===3){o.nodeValue=a;return}}t.textContent=a}var w2=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 Bx(t,a,o){var u=a.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?u?t.setProperty(a,""):a==="float"?t.cssFloat="":t[a]="":u?t.setProperty(a,o):typeof o!="number"||o===0||w2.has(a)?a==="float"?t.cssFloat=o:t[a]=(""+o).trim():t[a]=o+"px"}function Ix(t,a,o){if(a!=null&&typeof a!="object")throw Error(r(62));if(t=t.style,o!=null){for(var u in o)!o.hasOwnProperty(u)||a!=null&&a.hasOwnProperty(u)||(u.indexOf("--")===0?t.setProperty(u,""):u==="float"?t.cssFloat="":t[u]="");for(var p in a)u=a[p],a.hasOwnProperty(p)&&o[p]!==u&&Bx(t,p,u)}else for(var b in a)a.hasOwnProperty(b)&&Bx(t,b,a[b])}function tf(t){if(t.indexOf("-")===-1)return!1;switch(t){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 C2=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"]]),E2=/^[\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 uc(t){return E2.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function as(){}var nf=null;function af(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var lo=null,io=null;function Ux(t){var a=no(t);if(a&&(t=a.stateNode)){var o=t[un]||null;e:switch(t=a.stateNode,a.type){case"input":if(Wd(t,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),a=o.name,o.type==="radio"&&a!=null){for(o=t;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+ha(""+a)+'"][type="radio"]'),a=0;a<o.length;a++){var u=o[a];if(u!==t&&u.form===t.form){var p=u[un]||null;if(!p)throw Error(r(90));Wd(u,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(a=0;a<o.length;a++)u=o[a],u.form===t.form&&zx(u)}break e;case"textarea":Lx(t,o.value,o.defaultValue);break e;case"select":a=o.value,a!=null&&ro(t,!!o.multiple,a,!1)}}}var sf=!1;function Hx(t,a,o){if(sf)return t(a,o);sf=!0;try{var u=t(a);return u}finally{if(sf=!1,(lo!==null||io!==null)&&(Zc(),lo&&(a=lo,t=io,io=lo=null,Ux(a),t)))for(a=0;a<t.length;a++)Ux(t[a])}}function hl(t,a){var o=t.stateNode;if(o===null)return null;var u=o[un]||null;if(u===null)return null;o=u[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(o&&typeof o!="function")throw Error(r(231,a,typeof o));return o}var ss=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rf=!1;if(ss)try{var xl={};Object.defineProperty(xl,"passive",{get:function(){rf=!0}}),window.addEventListener("test",xl,xl),window.removeEventListener("test",xl,xl)}catch{rf=!1}var Os=null,of=null,dc=null;function qx(){if(dc)return dc;var t,a=of,o=a.length,u,p="value"in Os?Os.value:Os.textContent,b=p.length;for(t=0;t<o&&a[t]===p[t];t++);var T=o-t;for(u=1;u<=T&&a[o-u]===p[b-u];u++);return dc=p.slice(t,1<u?1-u:void 0)}function fc(t){var a=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&a===13&&(t=13)):t=a,t===10&&(t=13),32<=t||t===13?t:0}function mc(){return!0}function Vx(){return!1}function $n(t){function a(o,u,p,b,T){this._reactName=o,this._targetInst=p,this.type=u,this.nativeEvent=b,this.target=T,this.currentTarget=null;for(var z in t)t.hasOwnProperty(z)&&(o=t[z],this[z]=o?o(b):b[z]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?mc:Vx,this.isPropagationStopped=Vx,this}return x(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=mc)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=mc)},persist:function(){},isPersistent:mc}),a}var jr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pc=$n(jr),bl=x({},jr,{view:0,detail:0}),k2=$n(bl),lf,cf,vl,gc=x({},bl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:df,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==vl&&(vl&&t.type==="mousemove"?(lf=t.screenX-vl.screenX,cf=t.screenY-vl.screenY):cf=lf=0,vl=t),lf)},movementY:function(t){return"movementY"in t?t.movementY:cf}}),$x=$n(gc),R2=x({},gc,{dataTransfer:0}),N2=$n(R2),T2=x({},bl,{relatedTarget:0}),uf=$n(T2),A2=x({},jr,{animationName:0,elapsedTime:0,pseudoElement:0}),M2=$n(A2),O2=x({},jr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),z2=$n(O2),D2=x({},jr,{data:0}),Gx=$n(D2),L2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},P2={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"},B2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function I2(t){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(t):(t=B2[t])?!!a[t]:!1}function df(){return I2}var U2=x({},bl,{key:function(t){if(t.key){var a=L2[t.key]||t.key;if(a!=="Unidentified")return a}return t.type==="keypress"?(t=fc(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?P2[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:df,charCode:function(t){return t.type==="keypress"?fc(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?fc(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),H2=$n(U2),q2=x({},gc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Yx=$n(q2),V2=x({},bl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:df}),$2=$n(V2),G2=x({},jr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Y2=$n(G2),F2=x({},gc,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),X2=$n(F2),K2=x({},jr,{newState:0,oldState:0}),Q2=$n(K2),Z2=[9,13,27,32],ff=ss&&"CompositionEvent"in window,yl=null;ss&&"documentMode"in document&&(yl=document.documentMode);var J2=ss&&"TextEvent"in window&&!yl,Fx=ss&&(!ff||yl&&8<yl&&11>=yl),Xx=" ",Kx=!1;function Qx(t,a){switch(t){case"keyup":return Z2.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zx(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var co=!1;function W2(t,a){switch(t){case"compositionend":return Zx(a);case"keypress":return a.which!==32?null:(Kx=!0,Xx);case"textInput":return t=a.data,t===Xx&&Kx?null:t;default:return null}}function eC(t,a){if(co)return t==="compositionend"||!ff&&Qx(t,a)?(t=qx(),dc=of=Os=null,co=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Fx&&a.locale!=="ko"?null:a.data;default:return null}}var tC={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 Jx(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a==="input"?!!tC[t.type]:a==="textarea"}function Wx(t,a,o,u){lo?io?io.push(u):io=[u]:lo=u,a=su(a,"onChange"),0<a.length&&(o=new pc("onChange","change",null,o,u),t.push({event:o,listeners:a}))}var _l=null,jl=null;function nC(t){Dy(t,0)}function hc(t){var a=gl(t);if(zx(a))return t}function eb(t,a){if(t==="change")return a}var tb=!1;if(ss){var mf;if(ss){var pf="oninput"in document;if(!pf){var nb=document.createElement("div");nb.setAttribute("oninput","return;"),pf=typeof nb.oninput=="function"}mf=pf}else mf=!1;tb=mf&&(!document.documentMode||9<document.documentMode)}function ab(){_l&&(_l.detachEvent("onpropertychange",sb),jl=_l=null)}function sb(t){if(t.propertyName==="value"&&hc(jl)){var a=[];Wx(a,jl,t,af(t)),Hx(nC,a)}}function aC(t,a,o){t==="focusin"?(ab(),_l=a,jl=o,_l.attachEvent("onpropertychange",sb)):t==="focusout"&&ab()}function sC(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return hc(jl)}function rC(t,a){if(t==="click")return hc(a)}function oC(t,a){if(t==="input"||t==="change")return hc(a)}function lC(t,a){return t===a&&(t!==0||1/t===1/a)||t!==t&&a!==a}var aa=typeof Object.is=="function"?Object.is:lC;function Sl(t,a){if(aa(t,a))return!0;if(typeof t!="object"||t===null||typeof a!="object"||a===null)return!1;var o=Object.keys(t),u=Object.keys(a);if(o.length!==u.length)return!1;for(u=0;u<o.length;u++){var p=o[u];if(!_e.call(a,p)||!aa(t[p],a[p]))return!1}return!0}function rb(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function ob(t,a){var o=rb(t);t=0;for(var u;o;){if(o.nodeType===3){if(u=t+o.textContent.length,t<=a&&u>=a)return{node:o,offset:a-t};t=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=rb(o)}}function lb(t,a){return t&&a?t===a?!0:t&&t.nodeType===3?!1:a&&a.nodeType===3?lb(t,a.parentNode):"contains"in t?t.contains(a):t.compareDocumentPosition?!!(t.compareDocumentPosition(a)&16):!1:!1}function ib(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var a=cc(t.document);a instanceof t.HTMLIFrameElement;){try{var o=typeof a.contentWindow.location.href=="string"}catch{o=!1}if(o)t=a.contentWindow;else break;a=cc(t.document)}return a}function gf(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a&&(a==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||a==="textarea"||t.contentEditable==="true")}var iC=ss&&"documentMode"in document&&11>=document.documentMode,uo=null,hf=null,wl=null,xf=!1;function cb(t,a,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;xf||uo==null||uo!==cc(u)||(u=uo,"selectionStart"in u&&gf(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),wl&&Sl(wl,u)||(wl=u,u=su(hf,"onSelect"),0<u.length&&(a=new pc("onSelect","select",null,a,o),t.push({event:a,listeners:u}),a.target=uo)))}function Sr(t,a){var o={};return o[t.toLowerCase()]=a.toLowerCase(),o["Webkit"+t]="webkit"+a,o["Moz"+t]="moz"+a,o}var fo={animationend:Sr("Animation","AnimationEnd"),animationiteration:Sr("Animation","AnimationIteration"),animationstart:Sr("Animation","AnimationStart"),transitionrun:Sr("Transition","TransitionRun"),transitionstart:Sr("Transition","TransitionStart"),transitioncancel:Sr("Transition","TransitionCancel"),transitionend:Sr("Transition","TransitionEnd")},bf={},ub={};ss&&(ub=document.createElement("div").style,"AnimationEvent"in window||(delete fo.animationend.animation,delete fo.animationiteration.animation,delete fo.animationstart.animation),"TransitionEvent"in window||delete fo.transitionend.transition);function wr(t){if(bf[t])return bf[t];if(!fo[t])return t;var a=fo[t],o;for(o in a)if(a.hasOwnProperty(o)&&o in ub)return bf[t]=a[o];return t}var db=wr("animationend"),fb=wr("animationiteration"),mb=wr("animationstart"),cC=wr("transitionrun"),uC=wr("transitionstart"),dC=wr("transitioncancel"),pb=wr("transitionend"),gb=new Map,vf="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(" ");vf.push("scrollEnd");function Ta(t,a){gb.set(t,a),_r(a,[t])}var xc=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},xa=[],mo=0,yf=0;function bc(){for(var t=mo,a=yf=mo=0;a<t;){var o=xa[a];xa[a++]=null;var u=xa[a];xa[a++]=null;var p=xa[a];xa[a++]=null;var b=xa[a];if(xa[a++]=null,u!==null&&p!==null){var T=u.pending;T===null?p.next=p:(p.next=T.next,T.next=p),u.pending=p}b!==0&&hb(o,p,b)}}function vc(t,a,o,u){xa[mo++]=t,xa[mo++]=a,xa[mo++]=o,xa[mo++]=u,yf|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function _f(t,a,o,u){return vc(t,a,o,u),yc(t)}function Cr(t,a){return vc(t,null,null,a),yc(t)}function hb(t,a,o){t.lanes|=o;var u=t.alternate;u!==null&&(u.lanes|=o);for(var p=!1,b=t.return;b!==null;)b.childLanes|=o,u=b.alternate,u!==null&&(u.childLanes|=o),b.tag===22&&(t=b.stateNode,t===null||t._visibility&1||(p=!0)),t=b,b=b.return;return t.tag===3?(b=t.stateNode,p&&a!==null&&(p=31-Bt(o),t=b.hiddenUpdates,u=t[p],u===null?t[p]=[a]:u.push(a),a.lane=o|536870912),b):null}function yc(t){if(50<Yl)throw Yl=0,Tm=null,Error(r(185));for(var a=t.return;a!==null;)t=a,a=t.return;return t.tag===3?t.stateNode:null}var po={};function fC(t,a,o,u){this.tag=t,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function sa(t,a,o,u){return new fC(t,a,o,u)}function jf(t){return t=t.prototype,!(!t||!t.isReactComponent)}function rs(t,a){var o=t.alternate;return o===null?(o=sa(t.tag,a,t.key,t.mode),o.elementType=t.elementType,o.type=t.type,o.stateNode=t.stateNode,o.alternate=t,t.alternate=o):(o.pendingProps=a,o.type=t.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=t.flags&65011712,o.childLanes=t.childLanes,o.lanes=t.lanes,o.child=t.child,o.memoizedProps=t.memoizedProps,o.memoizedState=t.memoizedState,o.updateQueue=t.updateQueue,a=t.dependencies,o.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},o.sibling=t.sibling,o.index=t.index,o.ref=t.ref,o.refCleanup=t.refCleanup,o}function xb(t,a){t.flags&=65011714;var o=t.alternate;return o===null?(t.childLanes=0,t.lanes=a,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=o.childLanes,t.lanes=o.lanes,t.child=o.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=o.memoizedProps,t.memoizedState=o.memoizedState,t.updateQueue=o.updateQueue,t.type=o.type,a=o.dependencies,t.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),t}function _c(t,a,o,u,p,b){var T=0;if(u=t,typeof t=="function")jf(t)&&(T=1);else if(typeof t=="string")T=xE(t,o,W.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case I:return t=sa(31,o,a,p),t.elementType=I,t.lanes=b,t;case _:return Er(o.children,p,b,a);case j:T=8,p|=24;break;case E:return t=sa(12,o,a,p|2),t.elementType=E,t.lanes=b,t;case A:return t=sa(13,o,a,p),t.elementType=A,t.lanes=b,t;case M:return t=sa(19,o,a,p),t.elementType=M,t.lanes=b,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case N:T=10;break e;case k:T=9;break e;case R:T=11;break e;case O:T=14;break e;case U:T=16,u=null;break e}T=29,o=Error(r(130,t===null?"null":typeof t,"")),u=null}return a=sa(T,o,a,p),a.elementType=t,a.type=u,a.lanes=b,a}function Er(t,a,o,u){return t=sa(7,t,u,a),t.lanes=o,t}function Sf(t,a,o){return t=sa(6,t,null,a),t.lanes=o,t}function bb(t){var a=sa(18,null,null,0);return a.stateNode=t,a}function wf(t,a,o){return a=sa(4,t.children!==null?t.children:[],t.key,a),a.lanes=o,a.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},a}var vb=new WeakMap;function ba(t,a){if(typeof t=="object"&&t!==null){var o=vb.get(t);return o!==void 0?o:(a={value:t,source:a,stack:ke(a)},vb.set(t,a),a)}return{value:t,source:a,stack:ke(a)}}var go=[],ho=0,jc=null,Cl=0,va=[],ya=0,zs=null,Ha=1,qa="";function os(t,a){go[ho++]=Cl,go[ho++]=jc,jc=t,Cl=a}function yb(t,a,o){va[ya++]=Ha,va[ya++]=qa,va[ya++]=zs,zs=t;var u=Ha;t=qa;var p=32-Bt(u)-1;u&=~(1<<p),o+=1;var b=32-Bt(a)+p;if(30<b){var T=p-p%5;b=(u&(1<<T)-1).toString(32),u>>=T,p-=T,Ha=1<<32-Bt(a)+p|o<<p|u,qa=b+t}else Ha=1<<b|o<<p|u,qa=t}function Cf(t){t.return!==null&&(os(t,1),yb(t,1,0))}function Ef(t){for(;t===jc;)jc=go[--ho],go[ho]=null,Cl=go[--ho],go[ho]=null;for(;t===zs;)zs=va[--ya],va[ya]=null,qa=va[--ya],va[ya]=null,Ha=va[--ya],va[ya]=null}function _b(t,a){va[ya++]=Ha,va[ya++]=qa,va[ya++]=zs,Ha=a.id,qa=a.overflow,zs=t}var _n=null,$t=null,bt=!1,Ds=null,_a=!1,kf=Error(r(519));function Ls(t){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw El(ba(a,t)),kf}function jb(t){var a=t.stateNode,o=t.type,u=t.memoizedProps;switch(a[kt]=t,a[un]=u,o){case"dialog":mt("cancel",a),mt("close",a);break;case"iframe":case"object":case"embed":mt("load",a);break;case"video":case"audio":for(o=0;o<Xl.length;o++)mt(Xl[o],a);break;case"source":mt("error",a);break;case"img":case"image":case"link":mt("error",a),mt("load",a);break;case"details":mt("toggle",a);break;case"input":mt("invalid",a),Dx(a,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":mt("invalid",a);break;case"textarea":mt("invalid",a),Px(a,u.value,u.defaultValue,u.children)}o=u.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||a.textContent===""+o||u.suppressHydrationWarning===!0||Iy(a.textContent,o)?(u.popover!=null&&(mt("beforetoggle",a),mt("toggle",a)),u.onScroll!=null&&mt("scroll",a),u.onScrollEnd!=null&&mt("scrollend",a),u.onClick!=null&&(a.onclick=as),a=!0):a=!1,a||Ls(t,!0)}function Sb(t){for(_n=t.return;_n;)switch(_n.tag){case 5:case 31:case 13:_a=!1;return;case 27:case 3:_a=!0;return;default:_n=_n.return}}function xo(t){if(t!==_n)return!1;if(!bt)return Sb(t),bt=!0,!1;var a=t.tag,o;if((o=a!==3&&a!==27)&&((o=a===5)&&(o=t.type,o=!(o!=="form"&&o!=="button")||Gm(t.type,t.memoizedProps)),o=!o),o&&$t&&Ls(t),Sb(t),a===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));$t=Xy(t)}else if(a===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));$t=Xy(t)}else a===27?(a=$t,Qs(t.type)?(t=Qm,Qm=null,$t=t):$t=a):$t=_n?Sa(t.stateNode.nextSibling):null;return!0}function kr(){$t=_n=null,bt=!1}function Rf(){var t=Ds;return t!==null&&(Xn===null?Xn=t:Xn.push.apply(Xn,t),Ds=null),t}function El(t){Ds===null?Ds=[t]:Ds.push(t)}var Nf=P(null),Rr=null,ls=null;function Ps(t,a,o){$(Nf,a._currentValue),a._currentValue=o}function is(t){t._currentValue=Nf.current,K(Nf)}function Tf(t,a,o){for(;t!==null;){var u=t.alternate;if((t.childLanes&a)!==a?(t.childLanes|=a,u!==null&&(u.childLanes|=a)):u!==null&&(u.childLanes&a)!==a&&(u.childLanes|=a),t===o)break;t=t.return}}function Af(t,a,o,u){var p=t.child;for(p!==null&&(p.return=t);p!==null;){var b=p.dependencies;if(b!==null){var T=p.child;b=b.firstContext;e:for(;b!==null;){var z=b;b=p;for(var X=0;X<a.length;X++)if(z.context===a[X]){b.lanes|=o,z=b.alternate,z!==null&&(z.lanes|=o),Tf(b.return,o,t),u||(T=null);break e}b=z.next}}else if(p.tag===18){if(T=p.return,T===null)throw Error(r(341));T.lanes|=o,b=T.alternate,b!==null&&(b.lanes|=o),Tf(T,o,t),T=null}else T=p.child;if(T!==null)T.return=p;else for(T=p;T!==null;){if(T===t){T=null;break}if(p=T.sibling,p!==null){p.return=T.return,T=p;break}T=T.return}p=T}}function bo(t,a,o,u){t=null;for(var p=a,b=!1;p!==null;){if(!b){if((p.flags&524288)!==0)b=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var T=p.alternate;if(T===null)throw Error(r(387));if(T=T.memoizedProps,T!==null){var z=p.type;aa(p.pendingProps.value,T.value)||(t!==null?t.push(z):t=[z])}}else if(p===oe.current){if(T=p.alternate,T===null)throw Error(r(387));T.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(t!==null?t.push(Wl):t=[Wl])}p=p.return}t!==null&&Af(a,t,o,u),a.flags|=262144}function Sc(t){for(t=t.firstContext;t!==null;){if(!aa(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Nr(t){Rr=t,ls=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function jn(t){return wb(Rr,t)}function wc(t,a){return Rr===null&&Nr(t),wb(t,a)}function wb(t,a){var o=a._currentValue;if(a={context:a,memoizedValue:o,next:null},ls===null){if(t===null)throw Error(r(308));ls=a,t.dependencies={lanes:0,firstContext:a},t.flags|=524288}else ls=ls.next=a;return o}var mC=typeof AbortController<"u"?AbortController:function(){var t=[],a=this.signal={aborted:!1,addEventListener:function(o,u){t.push(u)}};this.abort=function(){a.aborted=!0,t.forEach(function(o){return o()})}},pC=e.unstable_scheduleCallback,gC=e.unstable_NormalPriority,dn={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Mf(){return{controller:new mC,data:new Map,refCount:0}}function kl(t){t.refCount--,t.refCount===0&&pC(gC,function(){t.controller.abort()})}var Rl=null,Of=0,vo=0,yo=null;function hC(t,a){if(Rl===null){var o=Rl=[];Of=0,vo=Lm(),yo={status:"pending",value:void 0,then:function(u){o.push(u)}}}return Of++,a.then(Cb,Cb),a}function Cb(){if(--Of===0&&Rl!==null){yo!==null&&(yo.status="fulfilled");var t=Rl;Rl=null,vo=0,yo=null;for(var a=0;a<t.length;a++)(0,t[a])()}}function xC(t,a){var o=[],u={status:"pending",value:null,reason:null,then:function(p){o.push(p)}};return t.then(function(){u.status="fulfilled",u.value=a;for(var p=0;p<o.length;p++)(0,o[p])(a)},function(p){for(u.status="rejected",u.reason=p,p=0;p<o.length;p++)(0,o[p])(void 0)}),u}var Eb=H.S;H.S=function(t,a){cy=ve(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&hC(t,a),Eb!==null&&Eb(t,a)};var Tr=P(null);function zf(){var t=Tr.current;return t!==null?t:It.pooledCache}function Cc(t,a){a===null?$(Tr,Tr.current):$(Tr,a.pool)}function kb(){var t=zf();return t===null?null:{parent:dn._currentValue,pool:t}}var _o=Error(r(460)),Df=Error(r(474)),Ec=Error(r(542)),kc={then:function(){}};function Rb(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Nb(t,a,o){switch(o=t[o],o===void 0?t.push(a):o!==a&&(a.then(as,as),a=o),a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,Ab(t),t;default:if(typeof a.status=="string")a.then(as,as);else{if(t=It,t!==null&&100<t.shellSuspendCounter)throw Error(r(482));t=a,t.status="pending",t.then(function(u){if(a.status==="pending"){var p=a;p.status="fulfilled",p.value=u}},function(u){if(a.status==="pending"){var p=a;p.status="rejected",p.reason=u}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,Ab(t),t}throw Mr=a,_o}}function Ar(t){try{var a=t._init;return a(t._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Mr=o,_o):o}}var Mr=null;function Tb(){if(Mr===null)throw Error(r(459));var t=Mr;return Mr=null,t}function Ab(t){if(t===_o||t===Ec)throw Error(r(483))}var jo=null,Nl=0;function Rc(t){var a=Nl;return Nl+=1,jo===null&&(jo=[]),Nb(jo,t,a)}function Tl(t,a){a=a.props.ref,t.ref=a!==void 0?a:null}function Nc(t,a){throw a.$$typeof===y?Error(r(525)):(t=Object.prototype.toString.call(a),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":t)))}function Mb(t){function a(ee,J){if(t){var ne=ee.deletions;ne===null?(ee.deletions=[J],ee.flags|=16):ne.push(J)}}function o(ee,J){if(!t)return null;for(;J!==null;)a(ee,J),J=J.sibling;return null}function u(ee){for(var J=new Map;ee!==null;)ee.key!==null?J.set(ee.key,ee):J.set(ee.index,ee),ee=ee.sibling;return J}function p(ee,J){return ee=rs(ee,J),ee.index=0,ee.sibling=null,ee}function b(ee,J,ne){return ee.index=ne,t?(ne=ee.alternate,ne!==null?(ne=ne.index,ne<J?(ee.flags|=67108866,J):ne):(ee.flags|=67108866,J)):(ee.flags|=1048576,J)}function T(ee){return t&&ee.alternate===null&&(ee.flags|=67108866),ee}function z(ee,J,ne,me){return J===null||J.tag!==6?(J=Sf(ne,ee.mode,me),J.return=ee,J):(J=p(J,ne),J.return=ee,J)}function X(ee,J,ne,me){var Ve=ne.type;return Ve===_?de(ee,J,ne.props.children,me,ne.key):J!==null&&(J.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===U&&Ar(Ve)===J.type)?(J=p(J,ne.props),Tl(J,ne),J.return=ee,J):(J=_c(ne.type,ne.key,ne.props,null,ee.mode,me),Tl(J,ne),J.return=ee,J)}function ae(ee,J,ne,me){return J===null||J.tag!==4||J.stateNode.containerInfo!==ne.containerInfo||J.stateNode.implementation!==ne.implementation?(J=wf(ne,ee.mode,me),J.return=ee,J):(J=p(J,ne.children||[]),J.return=ee,J)}function de(ee,J,ne,me,Ve){return J===null||J.tag!==7?(J=Er(ne,ee.mode,me,Ve),J.return=ee,J):(J=p(J,ne),J.return=ee,J)}function pe(ee,J,ne){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return J=Sf(""+J,ee.mode,ne),J.return=ee,J;if(typeof J=="object"&&J!==null){switch(J.$$typeof){case w:return ne=_c(J.type,J.key,J.props,null,ee.mode,ne),Tl(ne,J),ne.return=ee,ne;case S:return J=wf(J,ee.mode,ne),J.return=ee,J;case U:return J=Ar(J),pe(ee,J,ne)}if(Z(J)||D(J))return J=Er(J,ee.mode,ne,null),J.return=ee,J;if(typeof J.then=="function")return pe(ee,Rc(J),ne);if(J.$$typeof===N)return pe(ee,wc(ee,J),ne);Nc(ee,J)}return null}function se(ee,J,ne,me){var Ve=J!==null?J.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return Ve!==null?null:z(ee,J,""+ne,me);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case w:return ne.key===Ve?X(ee,J,ne,me):null;case S:return ne.key===Ve?ae(ee,J,ne,me):null;case U:return ne=Ar(ne),se(ee,J,ne,me)}if(Z(ne)||D(ne))return Ve!==null?null:de(ee,J,ne,me,null);if(typeof ne.then=="function")return se(ee,J,Rc(ne),me);if(ne.$$typeof===N)return se(ee,J,wc(ee,ne),me);Nc(ee,ne)}return null}function le(ee,J,ne,me,Ve){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return ee=ee.get(ne)||null,z(J,ee,""+me,Ve);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case w:return ee=ee.get(me.key===null?ne:me.key)||null,X(J,ee,me,Ve);case S:return ee=ee.get(me.key===null?ne:me.key)||null,ae(J,ee,me,Ve);case U:return me=Ar(me),le(ee,J,ne,me,Ve)}if(Z(me)||D(me))return ee=ee.get(ne)||null,de(J,ee,me,Ve,null);if(typeof me.then=="function")return le(ee,J,ne,Rc(me),Ve);if(me.$$typeof===N)return le(ee,J,ne,wc(J,me),Ve);Nc(J,me)}return null}function Le(ee,J,ne,me){for(var Ve=null,jt=null,Be=J,at=J=0,gt=null;Be!==null&&at<ne.length;at++){Be.index>at?(gt=Be,Be=null):gt=Be.sibling;var St=se(ee,Be,ne[at],me);if(St===null){Be===null&&(Be=gt);break}t&&Be&&St.alternate===null&&a(ee,Be),J=b(St,J,at),jt===null?Ve=St:jt.sibling=St,jt=St,Be=gt}if(at===ne.length)return o(ee,Be),bt&&os(ee,at),Ve;if(Be===null){for(;at<ne.length;at++)Be=pe(ee,ne[at],me),Be!==null&&(J=b(Be,J,at),jt===null?Ve=Be:jt.sibling=Be,jt=Be);return bt&&os(ee,at),Ve}for(Be=u(Be);at<ne.length;at++)gt=le(Be,ee,at,ne[at],me),gt!==null&&(t&>.alternate!==null&&Be.delete(gt.key===null?at:gt.key),J=b(gt,J,at),jt===null?Ve=gt:jt.sibling=gt,jt=gt);return t&&Be.forEach(function(tr){return a(ee,tr)}),bt&&os(ee,at),Ve}function Xe(ee,J,ne,me){if(ne==null)throw Error(r(151));for(var Ve=null,jt=null,Be=J,at=J=0,gt=null,St=ne.next();Be!==null&&!St.done;at++,St=ne.next()){Be.index>at?(gt=Be,Be=null):gt=Be.sibling;var tr=se(ee,Be,St.value,me);if(tr===null){Be===null&&(Be=gt);break}t&&Be&&tr.alternate===null&&a(ee,Be),J=b(tr,J,at),jt===null?Ve=tr:jt.sibling=tr,jt=tr,Be=gt}if(St.done)return o(ee,Be),bt&&os(ee,at),Ve;if(Be===null){for(;!St.done;at++,St=ne.next())St=pe(ee,St.value,me),St!==null&&(J=b(St,J,at),jt===null?Ve=St:jt.sibling=St,jt=St);return bt&&os(ee,at),Ve}for(Be=u(Be);!St.done;at++,St=ne.next())St=le(Be,ee,at,St.value,me),St!==null&&(t&&St.alternate!==null&&Be.delete(St.key===null?at:St.key),J=b(St,J,at),jt===null?Ve=St:jt.sibling=St,jt=St);return t&&Be.forEach(function(RE){return a(ee,RE)}),bt&&os(ee,at),Ve}function zt(ee,J,ne,me){if(typeof ne=="object"&&ne!==null&&ne.type===_&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case w:e:{for(var Ve=ne.key;J!==null;){if(J.key===Ve){if(Ve=ne.type,Ve===_){if(J.tag===7){o(ee,J.sibling),me=p(J,ne.props.children),me.return=ee,ee=me;break e}}else if(J.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===U&&Ar(Ve)===J.type){o(ee,J.sibling),me=p(J,ne.props),Tl(me,ne),me.return=ee,ee=me;break e}o(ee,J);break}else a(ee,J);J=J.sibling}ne.type===_?(me=Er(ne.props.children,ee.mode,me,ne.key),me.return=ee,ee=me):(me=_c(ne.type,ne.key,ne.props,null,ee.mode,me),Tl(me,ne),me.return=ee,ee=me)}return T(ee);case S:e:{for(Ve=ne.key;J!==null;){if(J.key===Ve)if(J.tag===4&&J.stateNode.containerInfo===ne.containerInfo&&J.stateNode.implementation===ne.implementation){o(ee,J.sibling),me=p(J,ne.children||[]),me.return=ee,ee=me;break e}else{o(ee,J);break}else a(ee,J);J=J.sibling}me=wf(ne,ee.mode,me),me.return=ee,ee=me}return T(ee);case U:return ne=Ar(ne),zt(ee,J,ne,me)}if(Z(ne))return Le(ee,J,ne,me);if(D(ne)){if(Ve=D(ne),typeof Ve!="function")throw Error(r(150));return ne=Ve.call(ne),Xe(ee,J,ne,me)}if(typeof ne.then=="function")return zt(ee,J,Rc(ne),me);if(ne.$$typeof===N)return zt(ee,J,wc(ee,ne),me);Nc(ee,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,J!==null&&J.tag===6?(o(ee,J.sibling),me=p(J,ne),me.return=ee,ee=me):(o(ee,J),me=Sf(ne,ee.mode,me),me.return=ee,ee=me),T(ee)):o(ee,J)}return function(ee,J,ne,me){try{Nl=0;var Ve=zt(ee,J,ne,me);return jo=null,Ve}catch(Be){if(Be===_o||Be===Ec)throw Be;var jt=sa(29,Be,null,ee.mode);return jt.lanes=me,jt.return=ee,jt}finally{}}}var Or=Mb(!0),Ob=Mb(!1),Bs=!1;function Lf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Pf(t,a){t=t.updateQueue,a.updateQueue===t&&(a.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Is(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Us(t,a,o){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(wt&2)!==0){var p=u.pending;return p===null?a.next=a:(a.next=p.next,p.next=a),u.pending=a,a=yc(t),hb(t,null,o),a}return vc(t,u,a,o),yc(t)}function Al(t,a,o){if(a=a.updateQueue,a!==null&&(a=a.shared,(o&4194048)!==0)){var u=a.lanes;u&=t.pendingLanes,o|=u,a.lanes=o,na(t,o)}}function Bf(t,a){var o=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var p=null,b=null;if(o=o.firstBaseUpdate,o!==null){do{var T={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};b===null?p=b=T:b=b.next=T,o=o.next}while(o!==null);b===null?p=b=a:b=b.next=a}else p=b=a;o={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:b,shared:u.shared,callbacks:u.callbacks},t.updateQueue=o;return}t=o.lastBaseUpdate,t===null?o.firstBaseUpdate=a:t.next=a,o.lastBaseUpdate=a}var If=!1;function Ml(){if(If){var t=yo;if(t!==null)throw t}}function Ol(t,a,o,u){If=!1;var p=t.updateQueue;Bs=!1;var b=p.firstBaseUpdate,T=p.lastBaseUpdate,z=p.shared.pending;if(z!==null){p.shared.pending=null;var X=z,ae=X.next;X.next=null,T===null?b=ae:T.next=ae,T=X;var de=t.alternate;de!==null&&(de=de.updateQueue,z=de.lastBaseUpdate,z!==T&&(z===null?de.firstBaseUpdate=ae:z.next=ae,de.lastBaseUpdate=X))}if(b!==null){var pe=p.baseState;T=0,de=ae=X=null,z=b;do{var se=z.lane&-536870913,le=se!==z.lane;if(le?(pt&se)===se:(u&se)===se){se!==0&&se===vo&&(If=!0),de!==null&&(de=de.next={lane:0,tag:z.tag,payload:z.payload,callback:null,next:null});e:{var Le=t,Xe=z;se=a;var zt=o;switch(Xe.tag){case 1:if(Le=Xe.payload,typeof Le=="function"){pe=Le.call(zt,pe,se);break e}pe=Le;break e;case 3:Le.flags=Le.flags&-65537|128;case 0:if(Le=Xe.payload,se=typeof Le=="function"?Le.call(zt,pe,se):Le,se==null)break e;pe=x({},pe,se);break e;case 2:Bs=!0}}se=z.callback,se!==null&&(t.flags|=64,le&&(t.flags|=8192),le=p.callbacks,le===null?p.callbacks=[se]:le.push(se))}else le={lane:se,tag:z.tag,payload:z.payload,callback:z.callback,next:null},de===null?(ae=de=le,X=pe):de=de.next=le,T|=se;if(z=z.next,z===null){if(z=p.shared.pending,z===null)break;le=z,z=le.next,le.next=null,p.lastBaseUpdate=le,p.shared.pending=null}}while(!0);de===null&&(X=pe),p.baseState=X,p.firstBaseUpdate=ae,p.lastBaseUpdate=de,b===null&&(p.shared.lanes=0),Gs|=T,t.lanes=T,t.memoizedState=pe}}function zb(t,a){if(typeof t!="function")throw Error(r(191,t));t.call(a)}function Db(t,a){var o=t.callbacks;if(o!==null)for(t.callbacks=null,t=0;t<o.length;t++)zb(o[t],a)}var So=P(null),Tc=P(0);function Lb(t,a){t=xs,$(Tc,t),$(So,a),xs=t|a.baseLanes}function Uf(){$(Tc,xs),$(So,So.current)}function Hf(){xs=Tc.current,K(So),K(Tc)}var ra=P(null),ja=null;function Hs(t){var a=t.alternate;$(on,on.current&1),$(ra,t),ja===null&&(a===null||So.current!==null||a.memoizedState!==null)&&(ja=t)}function qf(t){$(on,on.current),$(ra,t),ja===null&&(ja=t)}function Pb(t){t.tag===22?($(on,on.current),$(ra,t),ja===null&&(ja=t)):qs()}function qs(){$(on,on.current),$(ra,ra.current)}function oa(t){K(ra),ja===t&&(ja=null),K(on)}var on=P(0);function Ac(t){for(var a=t;a!==null;){if(a.tag===13){var o=a.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||Xm(o)||Km(o)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var cs=0,et=null,Mt=null,fn=null,Mc=!1,wo=!1,zr=!1,Oc=0,zl=0,Co=null,bC=0;function tn(){throw Error(r(321))}function Vf(t,a){if(a===null)return!1;for(var o=0;o<a.length&&o<t.length;o++)if(!aa(t[o],a[o]))return!1;return!0}function $f(t,a,o,u,p,b){return cs=b,et=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,H.H=t===null||t.memoizedState===null?yv:rm,zr=!1,b=o(u,p),zr=!1,wo&&(b=Ib(a,o,u,p)),Bb(t),b}function Bb(t){H.H=Pl;var a=Mt!==null&&Mt.next!==null;if(cs=0,fn=Mt=et=null,Mc=!1,zl=0,Co=null,a)throw Error(r(300));t===null||mn||(t=t.dependencies,t!==null&&Sc(t)&&(mn=!0))}function Ib(t,a,o,u){et=t;var p=0;do{if(wo&&(Co=null),zl=0,wo=!1,25<=p)throw Error(r(301));if(p+=1,fn=Mt=null,t.updateQueue!=null){var b=t.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}H.H=_v,b=a(o,u)}while(wo);return b}function vC(){var t=H.H,a=t.useState()[0];return a=typeof a.then=="function"?Dl(a):a,t=t.useState()[0],(Mt!==null?Mt.memoizedState:null)!==t&&(et.flags|=1024),a}function Gf(){var t=Oc!==0;return Oc=0,t}function Yf(t,a,o){a.updateQueue=t.updateQueue,a.flags&=-2053,t.lanes&=~o}function Ff(t){if(Mc){for(t=t.memoizedState;t!==null;){var a=t.queue;a!==null&&(a.pending=null),t=t.next}Mc=!1}cs=0,fn=Mt=et=null,wo=!1,zl=Oc=0,Co=null}function Bn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return fn===null?et.memoizedState=fn=t:fn=fn.next=t,fn}function ln(){if(Mt===null){var t=et.alternate;t=t!==null?t.memoizedState:null}else t=Mt.next;var a=fn===null?et.memoizedState:fn.next;if(a!==null)fn=a,Mt=t;else{if(t===null)throw et.alternate===null?Error(r(467)):Error(r(310));Mt=t,t={memoizedState:Mt.memoizedState,baseState:Mt.baseState,baseQueue:Mt.baseQueue,queue:Mt.queue,next:null},fn===null?et.memoizedState=fn=t:fn=fn.next=t}return fn}function zc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Dl(t){var a=zl;return zl+=1,Co===null&&(Co=[]),t=Nb(Co,t,a),a=et,(fn===null?a.memoizedState:fn.next)===null&&(a=a.alternate,H.H=a===null||a.memoizedState===null?yv:rm),t}function Dc(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Dl(t);if(t.$$typeof===N)return jn(t)}throw Error(r(438,String(t)))}function Xf(t){var a=null,o=et.updateQueue;if(o!==null&&(a=o.memoCache),a==null){var u=et.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(a={data:u.data.map(function(p){return p.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),o===null&&(o=zc(),et.updateQueue=o),o.memoCache=a,o=a.data[a.index],o===void 0)for(o=a.data[a.index]=Array(t),u=0;u<t;u++)o[u]=B;return a.index++,o}function us(t,a){return typeof a=="function"?a(t):a}function Lc(t){var a=ln();return Kf(a,Mt,t)}function Kf(t,a,o){var u=t.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=o;var p=t.baseQueue,b=u.pending;if(b!==null){if(p!==null){var T=p.next;p.next=b.next,b.next=T}a.baseQueue=p=b,u.pending=null}if(b=t.baseState,p===null)t.memoizedState=b;else{a=p.next;var z=T=null,X=null,ae=a,de=!1;do{var pe=ae.lane&-536870913;if(pe!==ae.lane?(pt&pe)===pe:(cs&pe)===pe){var se=ae.revertLane;if(se===0)X!==null&&(X=X.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),pe===vo&&(de=!0);else if((cs&se)===se){ae=ae.next,se===vo&&(de=!0);continue}else pe={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},X===null?(z=X=pe,T=b):X=X.next=pe,et.lanes|=se,Gs|=se;pe=ae.action,zr&&o(b,pe),b=ae.hasEagerState?ae.eagerState:o(b,pe)}else se={lane:pe,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},X===null?(z=X=se,T=b):X=X.next=se,et.lanes|=pe,Gs|=pe;ae=ae.next}while(ae!==null&&ae!==a);if(X===null?T=b:X.next=z,!aa(b,t.memoizedState)&&(mn=!0,de&&(o=yo,o!==null)))throw o;t.memoizedState=b,t.baseState=T,t.baseQueue=X,u.lastRenderedState=b}return p===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function Qf(t){var a=ln(),o=a.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=t;var u=o.dispatch,p=o.pending,b=a.memoizedState;if(p!==null){o.pending=null;var T=p=p.next;do b=t(b,T.action),T=T.next;while(T!==p);aa(b,a.memoizedState)||(mn=!0),a.memoizedState=b,a.baseQueue===null&&(a.baseState=b),o.lastRenderedState=b}return[b,u]}function Ub(t,a,o){var u=et,p=ln(),b=bt;if(b){if(o===void 0)throw Error(r(407));o=o()}else o=a();var T=!aa((Mt||p).memoizedState,o);if(T&&(p.memoizedState=o,mn=!0),p=p.queue,Wf(Vb.bind(null,u,p,t),[t]),p.getSnapshot!==a||T||fn!==null&&fn.memoizedState.tag&1){if(u.flags|=2048,Eo(9,{destroy:void 0},qb.bind(null,u,p,o,a),null),It===null)throw Error(r(349));b||(cs&127)!==0||Hb(u,a,o)}return o}function Hb(t,a,o){t.flags|=16384,t={getSnapshot:a,value:o},a=et.updateQueue,a===null?(a=zc(),et.updateQueue=a,a.stores=[t]):(o=a.stores,o===null?a.stores=[t]:o.push(t))}function qb(t,a,o,u){a.value=o,a.getSnapshot=u,$b(a)&&Gb(t)}function Vb(t,a,o){return o(function(){$b(a)&&Gb(t)})}function $b(t){var a=t.getSnapshot;t=t.value;try{var o=a();return!aa(t,o)}catch{return!0}}function Gb(t){var a=Cr(t,2);a!==null&&Kn(a,t,2)}function Zf(t){var a=Bn();if(typeof t=="function"){var o=t;if(t=o(),zr){Et(!0);try{o()}finally{Et(!1)}}}return a.memoizedState=a.baseState=t,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:us,lastRenderedState:t},a}function Yb(t,a,o,u){return t.baseState=o,Kf(t,Mt,typeof u=="function"?u:us)}function yC(t,a,o,u,p){if(Ic(t))throw Error(r(485));if(t=a.action,t!==null){var b={payload:p,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(T){b.listeners.push(T)}};H.T!==null?o(!0):b.isTransition=!1,u(b),o=a.pending,o===null?(b.next=a.pending=b,Fb(a,b)):(b.next=o.next,a.pending=o.next=b)}}function Fb(t,a){var o=a.action,u=a.payload,p=t.state;if(a.isTransition){var b=H.T,T={};H.T=T;try{var z=o(p,u),X=H.S;X!==null&&X(T,z),Xb(t,a,z)}catch(ae){Jf(t,a,ae)}finally{b!==null&&T.types!==null&&(b.types=T.types),H.T=b}}else try{b=o(p,u),Xb(t,a,b)}catch(ae){Jf(t,a,ae)}}function Xb(t,a,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(u){Kb(t,a,u)},function(u){return Jf(t,a,u)}):Kb(t,a,o)}function Kb(t,a,o){a.status="fulfilled",a.value=o,Qb(a),t.state=o,a=t.pending,a!==null&&(o=a.next,o===a?t.pending=null:(o=o.next,a.next=o,Fb(t,o)))}function Jf(t,a,o){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do a.status="rejected",a.reason=o,Qb(a),a=a.next;while(a!==u)}t.action=null}function Qb(t){t=t.listeners;for(var a=0;a<t.length;a++)(0,t[a])()}function Zb(t,a){return a}function Jb(t,a){if(bt){var o=It.formState;if(o!==null){e:{var u=et;if(bt){if($t){t:{for(var p=$t,b=_a;p.nodeType!==8;){if(!b){p=null;break t}if(p=Sa(p.nextSibling),p===null){p=null;break t}}b=p.data,p=b==="F!"||b==="F"?p:null}if(p){$t=Sa(p.nextSibling),u=p.data==="F!";break e}}Ls(u)}u=!1}u&&(a=o[0])}}return o=Bn(),o.memoizedState=o.baseState=a,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zb,lastRenderedState:a},o.queue=u,o=xv.bind(null,et,u),u.dispatch=o,u=Zf(!1),b=sm.bind(null,et,!1,u.queue),u=Bn(),p={state:a,dispatch:null,action:t,pending:null},u.queue=p,o=yC.bind(null,et,p,b,o),p.dispatch=o,u.memoizedState=t,[a,o,!1]}function Wb(t){var a=ln();return ev(a,Mt,t)}function ev(t,a,o){if(a=Kf(t,a,Zb)[0],t=Lc(us)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var u=Dl(a)}catch(T){throw T===_o?Ec:T}else u=a;a=ln();var p=a.queue,b=p.dispatch;return o!==a.memoizedState&&(et.flags|=2048,Eo(9,{destroy:void 0},_C.bind(null,p,o),null)),[u,b,t]}function _C(t,a){t.action=a}function tv(t){var a=ln(),o=Mt;if(o!==null)return ev(a,o,t);ln(),a=a.memoizedState,o=ln();var u=o.queue.dispatch;return o.memoizedState=t,[a,u,!1]}function Eo(t,a,o,u){return t={tag:t,create:o,deps:u,inst:a,next:null},a=et.updateQueue,a===null&&(a=zc(),et.updateQueue=a),o=a.lastEffect,o===null?a.lastEffect=t.next=t:(u=o.next,o.next=t,t.next=u,a.lastEffect=t),t}function nv(){return ln().memoizedState}function Pc(t,a,o,u){var p=Bn();et.flags|=t,p.memoizedState=Eo(1|a,{destroy:void 0},o,u===void 0?null:u)}function Bc(t,a,o,u){var p=ln();u=u===void 0?null:u;var b=p.memoizedState.inst;Mt!==null&&u!==null&&Vf(u,Mt.memoizedState.deps)?p.memoizedState=Eo(a,b,o,u):(et.flags|=t,p.memoizedState=Eo(1|a,b,o,u))}function av(t,a){Pc(8390656,8,t,a)}function Wf(t,a){Bc(2048,8,t,a)}function jC(t){et.flags|=4;var a=et.updateQueue;if(a===null)a=zc(),et.updateQueue=a,a.events=[t];else{var o=a.events;o===null?a.events=[t]:o.push(t)}}function sv(t){var a=ln().memoizedState;return jC({ref:a,nextImpl:t}),function(){if((wt&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function rv(t,a){return Bc(4,2,t,a)}function ov(t,a){return Bc(4,4,t,a)}function lv(t,a){if(typeof a=="function"){t=t();var o=a(t);return function(){typeof o=="function"?o():a(null)}}if(a!=null)return t=t(),a.current=t,function(){a.current=null}}function iv(t,a,o){o=o!=null?o.concat([t]):null,Bc(4,4,lv.bind(null,a,t),o)}function em(){}function cv(t,a){var o=ln();a=a===void 0?null:a;var u=o.memoizedState;return a!==null&&Vf(a,u[1])?u[0]:(o.memoizedState=[t,a],t)}function uv(t,a){var o=ln();a=a===void 0?null:a;var u=o.memoizedState;if(a!==null&&Vf(a,u[1]))return u[0];if(u=t(),zr){Et(!0);try{t()}finally{Et(!1)}}return o.memoizedState=[u,a],u}function tm(t,a,o){return o===void 0||(cs&1073741824)!==0&&(pt&261930)===0?t.memoizedState=a:(t.memoizedState=o,t=dy(),et.lanes|=t,Gs|=t,o)}function dv(t,a,o,u){return aa(o,a)?o:So.current!==null?(t=tm(t,o,u),aa(t,a)||(mn=!0),t):(cs&42)===0||(cs&1073741824)!==0&&(pt&261930)===0?(mn=!0,t.memoizedState=o):(t=dy(),et.lanes|=t,Gs|=t,a)}function fv(t,a,o,u,p){var b=G.p;G.p=b!==0&&8>b?b:8;var T=H.T,z={};H.T=z,sm(t,!1,a,o);try{var X=p(),ae=H.S;if(ae!==null&&ae(z,X),X!==null&&typeof X=="object"&&typeof X.then=="function"){var de=xC(X,u);Ll(t,a,de,ca(t))}else Ll(t,a,u,ca(t))}catch(pe){Ll(t,a,{then:function(){},status:"rejected",reason:pe},ca())}finally{G.p=b,T!==null&&z.types!==null&&(T.types=z.types),H.T=T}}function SC(){}function nm(t,a,o,u){if(t.tag!==5)throw Error(r(476));var p=mv(t).queue;fv(t,p,a,Q,o===null?SC:function(){return pv(t),o(u)})}function mv(t){var a=t.memoizedState;if(a!==null)return a;a={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:us,lastRenderedState:Q},next:null};var o={};return a.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:us,lastRenderedState:o},next:null},t.memoizedState=a,t=t.alternate,t!==null&&(t.memoizedState=a),a}function pv(t){var a=mv(t);a.next===null&&(a=t.alternate.memoizedState),Ll(t,a.next.queue,{},ca())}function am(){return jn(Wl)}function gv(){return ln().memoizedState}function hv(){return ln().memoizedState}function wC(t){for(var a=t.return;a!==null;){switch(a.tag){case 24:case 3:var o=ca();t=Is(o);var u=Us(a,t,o);u!==null&&(Kn(u,a,o),Al(u,a,o)),a={cache:Mf()},t.payload=a;return}a=a.return}}function CC(t,a,o){var u=ca();o={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Ic(t)?bv(a,o):(o=_f(t,a,o,u),o!==null&&(Kn(o,t,u),vv(o,a,u)))}function xv(t,a,o){var u=ca();Ll(t,a,o,u)}function Ll(t,a,o,u){var p={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Ic(t))bv(a,p);else{var b=t.alternate;if(t.lanes===0&&(b===null||b.lanes===0)&&(b=a.lastRenderedReducer,b!==null))try{var T=a.lastRenderedState,z=b(T,o);if(p.hasEagerState=!0,p.eagerState=z,aa(z,T))return vc(t,a,p,0),It===null&&bc(),!1}catch{}finally{}if(o=_f(t,a,p,u),o!==null)return Kn(o,t,u),vv(o,a,u),!0}return!1}function sm(t,a,o,u){if(u={lane:2,revertLane:Lm(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Ic(t)){if(a)throw Error(r(479))}else a=_f(t,o,u,2),a!==null&&Kn(a,t,2)}function Ic(t){var a=t.alternate;return t===et||a!==null&&a===et}function bv(t,a){wo=Mc=!0;var o=t.pending;o===null?a.next=a:(a.next=o.next,o.next=a),t.pending=a}function vv(t,a,o){if((o&4194048)!==0){var u=a.lanes;u&=t.pendingLanes,o|=u,a.lanes=o,na(t,o)}}var Pl={readContext:jn,use:Dc,useCallback:tn,useContext:tn,useEffect:tn,useImperativeHandle:tn,useLayoutEffect:tn,useInsertionEffect:tn,useMemo:tn,useReducer:tn,useRef:tn,useState:tn,useDebugValue:tn,useDeferredValue:tn,useTransition:tn,useSyncExternalStore:tn,useId:tn,useHostTransitionStatus:tn,useFormState:tn,useActionState:tn,useOptimistic:tn,useMemoCache:tn,useCacheRefresh:tn};Pl.useEffectEvent=tn;var yv={readContext:jn,use:Dc,useCallback:function(t,a){return Bn().memoizedState=[t,a===void 0?null:a],t},useContext:jn,useEffect:av,useImperativeHandle:function(t,a,o){o=o!=null?o.concat([t]):null,Pc(4194308,4,lv.bind(null,a,t),o)},useLayoutEffect:function(t,a){return Pc(4194308,4,t,a)},useInsertionEffect:function(t,a){Pc(4,2,t,a)},useMemo:function(t,a){var o=Bn();a=a===void 0?null:a;var u=t();if(zr){Et(!0);try{t()}finally{Et(!1)}}return o.memoizedState=[u,a],u},useReducer:function(t,a,o){var u=Bn();if(o!==void 0){var p=o(a);if(zr){Et(!0);try{o(a)}finally{Et(!1)}}}else p=a;return u.memoizedState=u.baseState=p,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:p},u.queue=t,t=t.dispatch=CC.bind(null,et,t),[u.memoizedState,t]},useRef:function(t){var a=Bn();return t={current:t},a.memoizedState=t},useState:function(t){t=Zf(t);var a=t.queue,o=xv.bind(null,et,a);return a.dispatch=o,[t.memoizedState,o]},useDebugValue:em,useDeferredValue:function(t,a){var o=Bn();return tm(o,t,a)},useTransition:function(){var t=Zf(!1);return t=fv.bind(null,et,t.queue,!0,!1),Bn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,a,o){var u=et,p=Bn();if(bt){if(o===void 0)throw Error(r(407));o=o()}else{if(o=a(),It===null)throw Error(r(349));(pt&127)!==0||Hb(u,a,o)}p.memoizedState=o;var b={value:o,getSnapshot:a};return p.queue=b,av(Vb.bind(null,u,b,t),[t]),u.flags|=2048,Eo(9,{destroy:void 0},qb.bind(null,u,b,o,a),null),o},useId:function(){var t=Bn(),a=It.identifierPrefix;if(bt){var o=qa,u=Ha;o=(u&~(1<<32-Bt(u)-1)).toString(32)+o,a="_"+a+"R_"+o,o=Oc++,0<o&&(a+="H"+o.toString(32)),a+="_"}else o=bC++,a="_"+a+"r_"+o.toString(32)+"_";return t.memoizedState=a},useHostTransitionStatus:am,useFormState:Jb,useActionState:Jb,useOptimistic:function(t){var a=Bn();a.memoizedState=a.baseState=t;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=o,a=sm.bind(null,et,!0,o),o.dispatch=a,[t,a]},useMemoCache:Xf,useCacheRefresh:function(){return Bn().memoizedState=wC.bind(null,et)},useEffectEvent:function(t){var a=Bn(),o={impl:t};return a.memoizedState=o,function(){if((wt&2)!==0)throw Error(r(440));return o.impl.apply(void 0,arguments)}}},rm={readContext:jn,use:Dc,useCallback:cv,useContext:jn,useEffect:Wf,useImperativeHandle:iv,useInsertionEffect:rv,useLayoutEffect:ov,useMemo:uv,useReducer:Lc,useRef:nv,useState:function(){return Lc(us)},useDebugValue:em,useDeferredValue:function(t,a){var o=ln();return dv(o,Mt.memoizedState,t,a)},useTransition:function(){var t=Lc(us)[0],a=ln().memoizedState;return[typeof t=="boolean"?t:Dl(t),a]},useSyncExternalStore:Ub,useId:gv,useHostTransitionStatus:am,useFormState:Wb,useActionState:Wb,useOptimistic:function(t,a){var o=ln();return Yb(o,Mt,t,a)},useMemoCache:Xf,useCacheRefresh:hv};rm.useEffectEvent=sv;var _v={readContext:jn,use:Dc,useCallback:cv,useContext:jn,useEffect:Wf,useImperativeHandle:iv,useInsertionEffect:rv,useLayoutEffect:ov,useMemo:uv,useReducer:Qf,useRef:nv,useState:function(){return Qf(us)},useDebugValue:em,useDeferredValue:function(t,a){var o=ln();return Mt===null?tm(o,t,a):dv(o,Mt.memoizedState,t,a)},useTransition:function(){var t=Qf(us)[0],a=ln().memoizedState;return[typeof t=="boolean"?t:Dl(t),a]},useSyncExternalStore:Ub,useId:gv,useHostTransitionStatus:am,useFormState:tv,useActionState:tv,useOptimistic:function(t,a){var o=ln();return Mt!==null?Yb(o,Mt,t,a):(o.baseState=t,[t,o.queue.dispatch])},useMemoCache:Xf,useCacheRefresh:hv};_v.useEffectEvent=sv;function om(t,a,o,u){a=t.memoizedState,o=o(u,a),o=o==null?a:x({},a,o),t.memoizedState=o,t.lanes===0&&(t.updateQueue.baseState=o)}var lm={enqueueSetState:function(t,a,o){t=t._reactInternals;var u=ca(),p=Is(u);p.payload=a,o!=null&&(p.callback=o),a=Us(t,p,u),a!==null&&(Kn(a,t,u),Al(a,t,u))},enqueueReplaceState:function(t,a,o){t=t._reactInternals;var u=ca(),p=Is(u);p.tag=1,p.payload=a,o!=null&&(p.callback=o),a=Us(t,p,u),a!==null&&(Kn(a,t,u),Al(a,t,u))},enqueueForceUpdate:function(t,a){t=t._reactInternals;var o=ca(),u=Is(o);u.tag=2,a!=null&&(u.callback=a),a=Us(t,u,o),a!==null&&(Kn(a,t,o),Al(a,t,o))}};function jv(t,a,o,u,p,b,T){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,b,T):a.prototype&&a.prototype.isPureReactComponent?!Sl(o,u)||!Sl(p,b):!0}function Sv(t,a,o,u){t=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(o,u),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(o,u),a.state!==t&&lm.enqueueReplaceState(a,a.state,null)}function Dr(t,a){var o=a;if("ref"in a){o={};for(var u in a)u!=="ref"&&(o[u]=a[u])}if(t=t.defaultProps){o===a&&(o=x({},o));for(var p in t)o[p]===void 0&&(o[p]=t[p])}return o}function wv(t){xc(t)}function Cv(t){console.error(t)}function Ev(t){xc(t)}function Uc(t,a){try{var o=t.onUncaughtError;o(a.value,{componentStack:a.stack})}catch(u){setTimeout(function(){throw u})}}function kv(t,a,o){try{var u=t.onCaughtError;u(o.value,{componentStack:o.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function im(t,a,o){return o=Is(o),o.tag=3,o.payload={element:null},o.callback=function(){Uc(t,a)},o}function Rv(t){return t=Is(t),t.tag=3,t}function Nv(t,a,o,u){var p=o.type.getDerivedStateFromError;if(typeof p=="function"){var b=u.value;t.payload=function(){return p(b)},t.callback=function(){kv(a,o,u)}}var T=o.stateNode;T!==null&&typeof T.componentDidCatch=="function"&&(t.callback=function(){kv(a,o,u),typeof p!="function"&&(Ys===null?Ys=new Set([this]):Ys.add(this));var z=u.stack;this.componentDidCatch(u.value,{componentStack:z!==null?z:""})})}function EC(t,a,o,u,p){if(o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(a=o.alternate,a!==null&&bo(a,o,p,!0),o=ra.current,o!==null){switch(o.tag){case 31:case 13:return ja===null?Jc():o.alternate===null&&nn===0&&(nn=3),o.flags&=-257,o.flags|=65536,o.lanes=p,u===kc?o.flags|=16384:(a=o.updateQueue,a===null?o.updateQueue=new Set([u]):a.add(u),Om(t,u,p)),!1;case 22:return o.flags|=65536,u===kc?o.flags|=16384:(a=o.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([u])},o.updateQueue=a):(o=a.retryQueue,o===null?a.retryQueue=new Set([u]):o.add(u)),Om(t,u,p)),!1}throw Error(r(435,o.tag))}return Om(t,u,p),Jc(),!1}if(bt)return a=ra.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=p,u!==kf&&(t=Error(r(422),{cause:u}),El(ba(t,o)))):(u!==kf&&(a=Error(r(423),{cause:u}),El(ba(a,o))),t=t.current.alternate,t.flags|=65536,p&=-p,t.lanes|=p,u=ba(u,o),p=im(t.stateNode,u,p),Bf(t,p),nn!==4&&(nn=2)),!1;var b=Error(r(520),{cause:u});if(b=ba(b,o),Gl===null?Gl=[b]:Gl.push(b),nn!==4&&(nn=2),a===null)return!0;u=ba(u,o),o=a;do{switch(o.tag){case 3:return o.flags|=65536,t=p&-p,o.lanes|=t,t=im(o.stateNode,u,t),Bf(o,t),!1;case 1:if(a=o.type,b=o.stateNode,(o.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(Ys===null||!Ys.has(b))))return o.flags|=65536,p&=-p,o.lanes|=p,p=Rv(p),Nv(p,t,o,u),Bf(o,p),!1}o=o.return}while(o!==null);return!1}var cm=Error(r(461)),mn=!1;function Sn(t,a,o,u){a.child=t===null?Ob(a,null,o,u):Or(a,t.child,o,u)}function Tv(t,a,o,u,p){o=o.render;var b=a.ref;if("ref"in u){var T={};for(var z in u)z!=="ref"&&(T[z]=u[z])}else T=u;return Nr(a),u=$f(t,a,o,T,b,p),z=Gf(),t!==null&&!mn?(Yf(t,a,p),ds(t,a,p)):(bt&&z&&Cf(a),a.flags|=1,Sn(t,a,u,p),a.child)}function Av(t,a,o,u,p){if(t===null){var b=o.type;return typeof b=="function"&&!jf(b)&&b.defaultProps===void 0&&o.compare===null?(a.tag=15,a.type=b,Mv(t,a,b,u,p)):(t=_c(o.type,null,u,a,a.mode,p),t.ref=a.ref,t.return=a,a.child=t)}if(b=t.child,!xm(t,p)){var T=b.memoizedProps;if(o=o.compare,o=o!==null?o:Sl,o(T,u)&&t.ref===a.ref)return ds(t,a,p)}return a.flags|=1,t=rs(b,u),t.ref=a.ref,t.return=a,a.child=t}function Mv(t,a,o,u,p){if(t!==null){var b=t.memoizedProps;if(Sl(b,u)&&t.ref===a.ref)if(mn=!1,a.pendingProps=u=b,xm(t,p))(t.flags&131072)!==0&&(mn=!0);else return a.lanes=t.lanes,ds(t,a,p)}return um(t,a,o,u,p)}function Ov(t,a,o,u){var p=u.children,b=t!==null?t.memoizedState:null;if(t===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((a.flags&128)!==0){if(b=b!==null?b.baseLanes|o:o,t!==null){for(u=a.child=t.child,p=0;u!==null;)p=p|u.lanes|u.childLanes,u=u.sibling;u=p&~b}else u=0,a.child=null;return zv(t,a,b,o,u)}if((o&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},t!==null&&Cc(a,b!==null?b.cachePool:null),b!==null?Lb(a,b):Uf(),Pb(a);else return u=a.lanes=536870912,zv(t,a,b!==null?b.baseLanes|o:o,o,u)}else b!==null?(Cc(a,b.cachePool),Lb(a,b),qs(),a.memoizedState=null):(t!==null&&Cc(a,null),Uf(),qs());return Sn(t,a,p,o),a.child}function Bl(t,a){return t!==null&&t.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function zv(t,a,o,u,p){var b=zf();return b=b===null?null:{parent:dn._currentValue,pool:b},a.memoizedState={baseLanes:o,cachePool:b},t!==null&&Cc(a,null),Uf(),Pb(a),t!==null&&bo(t,a,u,!0),a.childLanes=p,null}function Hc(t,a){return a=Vc({mode:a.mode,children:a.children},t.mode),a.ref=t.ref,t.child=a,a.return=t,a}function Dv(t,a,o){return Or(a,t.child,null,o),t=Hc(a,a.pendingProps),t.flags|=2,oa(a),a.memoizedState=null,t}function kC(t,a,o){var u=a.pendingProps,p=(a.flags&128)!==0;if(a.flags&=-129,t===null){if(bt){if(u.mode==="hidden")return t=Hc(a,u),a.lanes=536870912,Bl(null,t);if(qf(a),(t=$t)?(t=Fy(t,_a),t=t!==null&&t.data==="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:zs!==null?{id:Ha,overflow:qa}:null,retryLane:536870912,hydrationErrors:null},o=bb(t),o.return=a,a.child=o,_n=a,$t=null)):t=null,t===null)throw Ls(a);return a.lanes=536870912,null}return Hc(a,u)}var b=t.memoizedState;if(b!==null){var T=b.dehydrated;if(qf(a),p)if(a.flags&256)a.flags&=-257,a=Dv(t,a,o);else if(a.memoizedState!==null)a.child=t.child,a.flags|=128,a=null;else throw Error(r(558));else if(mn||bo(t,a,o,!1),p=(o&t.childLanes)!==0,mn||p){if(u=It,u!==null&&(T=Na(u,o),T!==0&&T!==b.retryLane))throw b.retryLane=T,Cr(t,T),Kn(u,t,T),cm;Jc(),a=Dv(t,a,o)}else t=b.treeContext,$t=Sa(T.nextSibling),_n=a,bt=!0,Ds=null,_a=!1,t!==null&&_b(a,t),a=Hc(a,u),a.flags|=4096;return a}return t=rs(t.child,{mode:u.mode,children:u.children}),t.ref=a.ref,a.child=t,t.return=a,t}function qc(t,a){var o=a.ref;if(o===null)t!==null&&t.ref!==null&&(a.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(r(284));(t===null||t.ref!==o)&&(a.flags|=4194816)}}function um(t,a,o,u,p){return Nr(a),o=$f(t,a,o,u,void 0,p),u=Gf(),t!==null&&!mn?(Yf(t,a,p),ds(t,a,p)):(bt&&u&&Cf(a),a.flags|=1,Sn(t,a,o,p),a.child)}function Lv(t,a,o,u,p,b){return Nr(a),a.updateQueue=null,o=Ib(a,u,o,p),Bb(t),u=Gf(),t!==null&&!mn?(Yf(t,a,b),ds(t,a,b)):(bt&&u&&Cf(a),a.flags|=1,Sn(t,a,o,b),a.child)}function Pv(t,a,o,u,p){if(Nr(a),a.stateNode===null){var b=po,T=o.contextType;typeof T=="object"&&T!==null&&(b=jn(T)),b=new o(u,b),a.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=lm,a.stateNode=b,b._reactInternals=a,b=a.stateNode,b.props=u,b.state=a.memoizedState,b.refs={},Lf(a),T=o.contextType,b.context=typeof T=="object"&&T!==null?jn(T):po,b.state=a.memoizedState,T=o.getDerivedStateFromProps,typeof T=="function"&&(om(a,o,T,u),b.state=a.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(T=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),T!==b.state&&lm.enqueueReplaceState(b,b.state,null),Ol(a,u,b,p),Ml(),b.state=a.memoizedState),typeof b.componentDidMount=="function"&&(a.flags|=4194308),u=!0}else if(t===null){b=a.stateNode;var z=a.memoizedProps,X=Dr(o,z);b.props=X;var ae=b.context,de=o.contextType;T=po,typeof de=="object"&&de!==null&&(T=jn(de));var pe=o.getDerivedStateFromProps;de=typeof pe=="function"||typeof b.getSnapshotBeforeUpdate=="function",z=a.pendingProps!==z,de||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(z||ae!==T)&&Sv(a,b,u,T),Bs=!1;var se=a.memoizedState;b.state=se,Ol(a,u,b,p),Ml(),ae=a.memoizedState,z||se!==ae||Bs?(typeof pe=="function"&&(om(a,o,pe,u),ae=a.memoizedState),(X=Bs||jv(a,o,X,u,se,ae,T))?(de||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount()),typeof b.componentDidMount=="function"&&(a.flags|=4194308)):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=u,a.memoizedState=ae),b.props=u,b.state=ae,b.context=T,u=X):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),u=!1)}else{b=a.stateNode,Pf(t,a),T=a.memoizedProps,de=Dr(o,T),b.props=de,pe=a.pendingProps,se=b.context,ae=o.contextType,X=po,typeof ae=="object"&&ae!==null&&(X=jn(ae)),z=o.getDerivedStateFromProps,(ae=typeof z=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(T!==pe||se!==X)&&Sv(a,b,u,X),Bs=!1,se=a.memoizedState,b.state=se,Ol(a,u,b,p),Ml();var le=a.memoizedState;T!==pe||se!==le||Bs||t!==null&&t.dependencies!==null&&Sc(t.dependencies)?(typeof z=="function"&&(om(a,o,z,u),le=a.memoizedState),(de=Bs||jv(a,o,de,u,se,le,X)||t!==null&&t.dependencies!==null&&Sc(t.dependencies))?(ae||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(u,le,X),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(u,le,X)),typeof b.componentDidUpdate=="function"&&(a.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof b.componentDidUpdate!="function"||T===t.memoizedProps&&se===t.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||T===t.memoizedProps&&se===t.memoizedState||(a.flags|=1024),a.memoizedProps=u,a.memoizedState=le),b.props=u,b.state=le,b.context=X,u=de):(typeof b.componentDidUpdate!="function"||T===t.memoizedProps&&se===t.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||T===t.memoizedProps&&se===t.memoizedState||(a.flags|=1024),u=!1)}return b=u,qc(t,a),u=(a.flags&128)!==0,b||u?(b=a.stateNode,o=u&&typeof o.getDerivedStateFromError!="function"?null:b.render(),a.flags|=1,t!==null&&u?(a.child=Or(a,t.child,null,p),a.child=Or(a,null,o,p)):Sn(t,a,o,p),a.memoizedState=b.state,t=a.child):t=ds(t,a,p),t}function Bv(t,a,o,u){return kr(),a.flags|=256,Sn(t,a,o,u),a.child}var dm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function fm(t){return{baseLanes:t,cachePool:kb()}}function mm(t,a,o){return t=t!==null?t.childLanes&~o:0,a&&(t|=ia),t}function Iv(t,a,o){var u=a.pendingProps,p=!1,b=(a.flags&128)!==0,T;if((T=b)||(T=t!==null&&t.memoizedState===null?!1:(on.current&2)!==0),T&&(p=!0,a.flags&=-129),T=(a.flags&32)!==0,a.flags&=-33,t===null){if(bt){if(p?Hs(a):qs(),(t=$t)?(t=Fy(t,_a),t=t!==null&&t.data!=="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:zs!==null?{id:Ha,overflow:qa}:null,retryLane:536870912,hydrationErrors:null},o=bb(t),o.return=a,a.child=o,_n=a,$t=null)):t=null,t===null)throw Ls(a);return Km(t)?a.lanes=32:a.lanes=536870912,null}var z=u.children;return u=u.fallback,p?(qs(),p=a.mode,z=Vc({mode:"hidden",children:z},p),u=Er(u,p,o,null),z.return=a,u.return=a,z.sibling=u,a.child=z,u=a.child,u.memoizedState=fm(o),u.childLanes=mm(t,T,o),a.memoizedState=dm,Bl(null,u)):(Hs(a),pm(a,z))}var X=t.memoizedState;if(X!==null&&(z=X.dehydrated,z!==null)){if(b)a.flags&256?(Hs(a),a.flags&=-257,a=gm(t,a,o)):a.memoizedState!==null?(qs(),a.child=t.child,a.flags|=128,a=null):(qs(),z=u.fallback,p=a.mode,u=Vc({mode:"visible",children:u.children},p),z=Er(z,p,o,null),z.flags|=2,u.return=a,z.return=a,u.sibling=z,a.child=u,Or(a,t.child,null,o),u=a.child,u.memoizedState=fm(o),u.childLanes=mm(t,T,o),a.memoizedState=dm,a=Bl(null,u));else if(Hs(a),Km(z)){if(T=z.nextSibling&&z.nextSibling.dataset,T)var ae=T.dgst;T=ae,u=Error(r(419)),u.stack="",u.digest=T,El({value:u,source:null,stack:null}),a=gm(t,a,o)}else if(mn||bo(t,a,o,!1),T=(o&t.childLanes)!==0,mn||T){if(T=It,T!==null&&(u=Na(T,o),u!==0&&u!==X.retryLane))throw X.retryLane=u,Cr(t,u),Kn(T,t,u),cm;Xm(z)||Jc(),a=gm(t,a,o)}else Xm(z)?(a.flags|=192,a.child=t.child,a=null):(t=X.treeContext,$t=Sa(z.nextSibling),_n=a,bt=!0,Ds=null,_a=!1,t!==null&&_b(a,t),a=pm(a,u.children),a.flags|=4096);return a}return p?(qs(),z=u.fallback,p=a.mode,X=t.child,ae=X.sibling,u=rs(X,{mode:"hidden",children:u.children}),u.subtreeFlags=X.subtreeFlags&65011712,ae!==null?z=rs(ae,z):(z=Er(z,p,o,null),z.flags|=2),z.return=a,u.return=a,u.sibling=z,a.child=u,Bl(null,u),u=a.child,z=t.child.memoizedState,z===null?z=fm(o):(p=z.cachePool,p!==null?(X=dn._currentValue,p=p.parent!==X?{parent:X,pool:X}:p):p=kb(),z={baseLanes:z.baseLanes|o,cachePool:p}),u.memoizedState=z,u.childLanes=mm(t,T,o),a.memoizedState=dm,Bl(t.child,u)):(Hs(a),o=t.child,t=o.sibling,o=rs(o,{mode:"visible",children:u.children}),o.return=a,o.sibling=null,t!==null&&(T=a.deletions,T===null?(a.deletions=[t],a.flags|=16):T.push(t)),a.child=o,a.memoizedState=null,o)}function pm(t,a){return a=Vc({mode:"visible",children:a},t.mode),a.return=t,t.child=a}function Vc(t,a){return t=sa(22,t,null,a),t.lanes=0,t}function gm(t,a,o){return Or(a,t.child,null,o),t=pm(a,a.pendingProps.children),t.flags|=2,a.memoizedState=null,t}function Uv(t,a,o){t.lanes|=a;var u=t.alternate;u!==null&&(u.lanes|=a),Tf(t.return,a,o)}function hm(t,a,o,u,p,b){var T=t.memoizedState;T===null?t.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:u,tail:o,tailMode:p,treeForkCount:b}:(T.isBackwards=a,T.rendering=null,T.renderingStartTime=0,T.last=u,T.tail=o,T.tailMode=p,T.treeForkCount=b)}function Hv(t,a,o){var u=a.pendingProps,p=u.revealOrder,b=u.tail;u=u.children;var T=on.current,z=(T&2)!==0;if(z?(T=T&1|2,a.flags|=128):T&=1,$(on,T),Sn(t,a,u,o),u=bt?Cl:0,!z&&t!==null&&(t.flags&128)!==0)e:for(t=a.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Uv(t,o,a);else if(t.tag===19)Uv(t,o,a);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===a)break e;for(;t.sibling===null;){if(t.return===null||t.return===a)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(p){case"forwards":for(o=a.child,p=null;o!==null;)t=o.alternate,t!==null&&Ac(t)===null&&(p=o),o=o.sibling;o=p,o===null?(p=a.child,a.child=null):(p=o.sibling,o.sibling=null),hm(a,!1,p,o,b,u);break;case"backwards":case"unstable_legacy-backwards":for(o=null,p=a.child,a.child=null;p!==null;){if(t=p.alternate,t!==null&&Ac(t)===null){a.child=p;break}t=p.sibling,p.sibling=o,o=p,p=t}hm(a,!0,o,null,b,u);break;case"together":hm(a,!1,null,null,void 0,u);break;default:a.memoizedState=null}return a.child}function ds(t,a,o){if(t!==null&&(a.dependencies=t.dependencies),Gs|=a.lanes,(o&a.childLanes)===0)if(t!==null){if(bo(t,a,o,!1),(o&a.childLanes)===0)return null}else return null;if(t!==null&&a.child!==t.child)throw Error(r(153));if(a.child!==null){for(t=a.child,o=rs(t,t.pendingProps),a.child=o,o.return=a;t.sibling!==null;)t=t.sibling,o=o.sibling=rs(t,t.pendingProps),o.return=a;o.sibling=null}return a.child}function xm(t,a){return(t.lanes&a)!==0?!0:(t=t.dependencies,!!(t!==null&&Sc(t)))}function RC(t,a,o){switch(a.tag){case 3:ue(a,a.stateNode.containerInfo),Ps(a,dn,t.memoizedState.cache),kr();break;case 27:case 5:Ne(a);break;case 4:ue(a,a.stateNode.containerInfo);break;case 10:Ps(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,qf(a),null;break;case 13:var u=a.memoizedState;if(u!==null)return u.dehydrated!==null?(Hs(a),a.flags|=128,null):(o&a.child.childLanes)!==0?Iv(t,a,o):(Hs(a),t=ds(t,a,o),t!==null?t.sibling:null);Hs(a);break;case 19:var p=(t.flags&128)!==0;if(u=(o&a.childLanes)!==0,u||(bo(t,a,o,!1),u=(o&a.childLanes)!==0),p){if(u)return Hv(t,a,o);a.flags|=128}if(p=a.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),$(on,on.current),u)break;return null;case 22:return a.lanes=0,Ov(t,a,o,a.pendingProps);case 24:Ps(a,dn,t.memoizedState.cache)}return ds(t,a,o)}function qv(t,a,o){if(t!==null)if(t.memoizedProps!==a.pendingProps)mn=!0;else{if(!xm(t,o)&&(a.flags&128)===0)return mn=!1,RC(t,a,o);mn=(t.flags&131072)!==0}else mn=!1,bt&&(a.flags&1048576)!==0&&yb(a,Cl,a.index);switch(a.lanes=0,a.tag){case 16:e:{var u=a.pendingProps;if(t=Ar(a.elementType),a.type=t,typeof t=="function")jf(t)?(u=Dr(t,u),a.tag=1,a=Pv(null,a,t,u,o)):(a.tag=0,a=um(null,a,t,u,o));else{if(t!=null){var p=t.$$typeof;if(p===R){a.tag=11,a=Tv(null,a,t,u,o);break e}else if(p===O){a.tag=14,a=Av(null,a,t,u,o);break e}}throw a=F(t)||t,Error(r(306,a,""))}}return a;case 0:return um(t,a,a.type,a.pendingProps,o);case 1:return u=a.type,p=Dr(u,a.pendingProps),Pv(t,a,u,p,o);case 3:e:{if(ue(a,a.stateNode.containerInfo),t===null)throw Error(r(387));u=a.pendingProps;var b=a.memoizedState;p=b.element,Pf(t,a),Ol(a,u,null,o);var T=a.memoizedState;if(u=T.cache,Ps(a,dn,u),u!==b.cache&&Af(a,[dn],o,!0),Ml(),u=T.element,b.isDehydrated)if(b={element:u,isDehydrated:!1,cache:T.cache},a.updateQueue.baseState=b,a.memoizedState=b,a.flags&256){a=Bv(t,a,u,o);break e}else if(u!==p){p=ba(Error(r(424)),a),El(p),a=Bv(t,a,u,o);break e}else{switch(t=a.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for($t=Sa(t.firstChild),_n=a,bt=!0,Ds=null,_a=!0,o=Ob(a,null,u,o),a.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling}else{if(kr(),u===p){a=ds(t,a,o);break e}Sn(t,a,u,o)}a=a.child}return a;case 26:return qc(t,a),t===null?(o=Wy(a.type,null,a.pendingProps,null))?a.memoizedState=o:bt||(o=a.type,t=a.pendingProps,u=ru(ie.current).createElement(o),u[kt]=a,u[un]=t,wn(u,o,t),xn(u),a.stateNode=u):a.memoizedState=Wy(a.type,t.memoizedProps,a.pendingProps,t.memoizedState),null;case 27:return Ne(a),t===null&&bt&&(u=a.stateNode=Qy(a.type,a.pendingProps,ie.current),_n=a,_a=!0,p=$t,Qs(a.type)?(Qm=p,$t=Sa(u.firstChild)):$t=p),Sn(t,a,a.pendingProps.children,o),qc(t,a),t===null&&(a.flags|=4194304),a.child;case 5:return t===null&&bt&&((p=u=$t)&&(u=sE(u,a.type,a.pendingProps,_a),u!==null?(a.stateNode=u,_n=a,$t=Sa(u.firstChild),_a=!1,p=!0):p=!1),p||Ls(a)),Ne(a),p=a.type,b=a.pendingProps,T=t!==null?t.memoizedProps:null,u=b.children,Gm(p,b)?u=null:T!==null&&Gm(p,T)&&(a.flags|=32),a.memoizedState!==null&&(p=$f(t,a,vC,null,null,o),Wl._currentValue=p),qc(t,a),Sn(t,a,u,o),a.child;case 6:return t===null&&bt&&((t=o=$t)&&(o=rE(o,a.pendingProps,_a),o!==null?(a.stateNode=o,_n=a,$t=null,t=!0):t=!1),t||Ls(a)),null;case 13:return Iv(t,a,o);case 4:return ue(a,a.stateNode.containerInfo),u=a.pendingProps,t===null?a.child=Or(a,null,u,o):Sn(t,a,u,o),a.child;case 11:return Tv(t,a,a.type,a.pendingProps,o);case 7:return Sn(t,a,a.pendingProps,o),a.child;case 8:return Sn(t,a,a.pendingProps.children,o),a.child;case 12:return Sn(t,a,a.pendingProps.children,o),a.child;case 10:return u=a.pendingProps,Ps(a,a.type,u.value),Sn(t,a,u.children,o),a.child;case 9:return p=a.type._context,u=a.pendingProps.children,Nr(a),p=jn(p),u=u(p),a.flags|=1,Sn(t,a,u,o),a.child;case 14:return Av(t,a,a.type,a.pendingProps,o);case 15:return Mv(t,a,a.type,a.pendingProps,o);case 19:return Hv(t,a,o);case 31:return kC(t,a,o);case 22:return Ov(t,a,o,a.pendingProps);case 24:return Nr(a),u=jn(dn),t===null?(p=zf(),p===null&&(p=It,b=Mf(),p.pooledCache=b,b.refCount++,b!==null&&(p.pooledCacheLanes|=o),p=b),a.memoizedState={parent:u,cache:p},Lf(a),Ps(a,dn,p)):((t.lanes&o)!==0&&(Pf(t,a),Ol(a,null,null,o),Ml()),p=t.memoizedState,b=a.memoizedState,p.parent!==u?(p={parent:u,cache:u},a.memoizedState=p,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=p),Ps(a,dn,u)):(u=b.cache,Ps(a,dn,u),u!==p.cache&&Af(a,[dn],o,!0))),Sn(t,a,a.pendingProps.children,o),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function fs(t){t.flags|=4}function bm(t,a,o,u,p){if((a=(t.mode&32)!==0)&&(a=!1),a){if(t.flags|=16777216,(p&335544128)===p)if(t.stateNode.complete)t.flags|=8192;else if(gy())t.flags|=8192;else throw Mr=kc,Df}else t.flags&=-16777217}function Vv(t,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!s0(a))if(gy())t.flags|=8192;else throw Mr=kc,Df}function $c(t,a){a!==null&&(t.flags|=4),t.flags&16384&&(a=t.tag!==22?qn():536870912,t.lanes|=a,To|=a)}function Il(t,a){if(!bt)switch(t.tailMode){case"hidden":a=t.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?t.tail=null:o.sibling=null;break;case"collapsed":o=t.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?a||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function Gt(t){var a=t.alternate!==null&&t.alternate.child===t.child,o=0,u=0;if(a)for(var p=t.child;p!==null;)o|=p.lanes|p.childLanes,u|=p.subtreeFlags&65011712,u|=p.flags&65011712,p.return=t,p=p.sibling;else for(p=t.child;p!==null;)o|=p.lanes|p.childLanes,u|=p.subtreeFlags,u|=p.flags,p.return=t,p=p.sibling;return t.subtreeFlags|=u,t.childLanes=o,a}function NC(t,a,o){var u=a.pendingProps;switch(Ef(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Gt(a),null;case 1:return Gt(a),null;case 3:return o=a.stateNode,u=null,t!==null&&(u=t.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),is(dn),te(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(t===null||t.child===null)&&(xo(a)?fs(a):t===null||t.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Rf())),Gt(a),null;case 26:var p=a.type,b=a.memoizedState;return t===null?(fs(a),b!==null?(Gt(a),Vv(a,b)):(Gt(a),bm(a,p,null,u,o))):b?b!==t.memoizedState?(fs(a),Gt(a),Vv(a,b)):(Gt(a),a.flags&=-16777217):(t=t.memoizedProps,t!==u&&fs(a),Gt(a),bm(a,p,t,u,o)),null;case 27:if($e(a),o=ie.current,p=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&fs(a);else{if(!u){if(a.stateNode===null)throw Error(r(166));return Gt(a),null}t=W.current,xo(a)?jb(a):(t=Qy(p,u,o),a.stateNode=t,fs(a))}return Gt(a),null;case 5:if($e(a),p=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&fs(a);else{if(!u){if(a.stateNode===null)throw Error(r(166));return Gt(a),null}if(b=W.current,xo(a))jb(a);else{var T=ru(ie.current);switch(b){case 1:b=T.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:b=T.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":b=T.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":b=T.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":b=T.createElement("div"),b.innerHTML="<script><\/script>",b=b.removeChild(b.firstChild);break;case"select":b=typeof u.is=="string"?T.createElement("select",{is:u.is}):T.createElement("select"),u.multiple?b.multiple=!0:u.size&&(b.size=u.size);break;default:b=typeof u.is=="string"?T.createElement(p,{is:u.is}):T.createElement(p)}}b[kt]=a,b[un]=u;e:for(T=a.child;T!==null;){if(T.tag===5||T.tag===6)b.appendChild(T.stateNode);else if(T.tag!==4&&T.tag!==27&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===a)break e;for(;T.sibling===null;){if(T.return===null||T.return===a)break e;T=T.return}T.sibling.return=T.return,T=T.sibling}a.stateNode=b;e:switch(wn(b,p,u),p){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&fs(a)}}return Gt(a),bm(a,a.type,t===null?null:t.memoizedProps,a.pendingProps,o),null;case 6:if(t&&a.stateNode!=null)t.memoizedProps!==u&&fs(a);else{if(typeof u!="string"&&a.stateNode===null)throw Error(r(166));if(t=ie.current,xo(a)){if(t=a.stateNode,o=a.memoizedProps,u=null,p=_n,p!==null)switch(p.tag){case 27:case 5:u=p.memoizedProps}t[kt]=a,t=!!(t.nodeValue===o||u!==null&&u.suppressHydrationWarning===!0||Iy(t.nodeValue,o)),t||Ls(a,!0)}else t=ru(t).createTextNode(u),t[kt]=a,a.stateNode=t}return Gt(a),null;case 31:if(o=a.memoizedState,t===null||t.memoizedState!==null){if(u=xo(a),o!==null){if(t===null){if(!u)throw Error(r(318));if(t=a.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(557));t[kt]=a}else kr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Gt(a),t=!1}else o=Rf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=o),t=!0;if(!t)return a.flags&256?(oa(a),a):(oa(a),null);if((a.flags&128)!==0)throw Error(r(558))}return Gt(a),null;case 13:if(u=a.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(p=xo(a),u!==null&&u.dehydrated!==null){if(t===null){if(!p)throw Error(r(318));if(p=a.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(r(317));p[kt]=a}else kr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Gt(a),p=!1}else p=Rf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=p),p=!0;if(!p)return a.flags&256?(oa(a),a):(oa(a),null)}return oa(a),(a.flags&128)!==0?(a.lanes=o,a):(o=u!==null,t=t!==null&&t.memoizedState!==null,o&&(u=a.child,p=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(p=u.alternate.memoizedState.cachePool.pool),b=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(b=u.memoizedState.cachePool.pool),b!==p&&(u.flags|=2048)),o!==t&&o&&(a.child.flags|=8192),$c(a,a.updateQueue),Gt(a),null);case 4:return te(),t===null&&Um(a.stateNode.containerInfo),Gt(a),null;case 10:return is(a.type),Gt(a),null;case 19:if(K(on),u=a.memoizedState,u===null)return Gt(a),null;if(p=(a.flags&128)!==0,b=u.rendering,b===null)if(p)Il(u,!1);else{if(nn!==0||t!==null&&(t.flags&128)!==0)for(t=a.child;t!==null;){if(b=Ac(t),b!==null){for(a.flags|=128,Il(u,!1),t=b.updateQueue,a.updateQueue=t,$c(a,t),a.subtreeFlags=0,t=o,o=a.child;o!==null;)xb(o,t),o=o.sibling;return $(on,on.current&1|2),bt&&os(a,u.treeForkCount),a.child}t=t.sibling}u.tail!==null&&ve()>Kc&&(a.flags|=128,p=!0,Il(u,!1),a.lanes=4194304)}else{if(!p)if(t=Ac(b),t!==null){if(a.flags|=128,p=!0,t=t.updateQueue,a.updateQueue=t,$c(a,t),Il(u,!0),u.tail===null&&u.tailMode==="hidden"&&!b.alternate&&!bt)return Gt(a),null}else 2*ve()-u.renderingStartTime>Kc&&o!==536870912&&(a.flags|=128,p=!0,Il(u,!1),a.lanes=4194304);u.isBackwards?(b.sibling=a.child,a.child=b):(t=u.last,t!==null?t.sibling=b:a.child=b,u.last=b)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=ve(),t.sibling=null,o=on.current,$(on,p?o&1|2:o&1),bt&&os(a,u.treeForkCount),t):(Gt(a),null);case 22:case 23:return oa(a),Hf(),u=a.memoizedState!==null,t!==null?t.memoizedState!==null!==u&&(a.flags|=8192):u&&(a.flags|=8192),u?(o&536870912)!==0&&(a.flags&128)===0&&(Gt(a),a.subtreeFlags&6&&(a.flags|=8192)):Gt(a),o=a.updateQueue,o!==null&&$c(a,o.retryQueue),o=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(o=t.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==o&&(a.flags|=2048),t!==null&&K(Tr),null;case 24:return o=null,t!==null&&(o=t.memoizedState.cache),a.memoizedState.cache!==o&&(a.flags|=2048),is(dn),Gt(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function TC(t,a){switch(Ef(a),a.tag){case 1:return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 3:return is(dn),te(),t=a.flags,(t&65536)!==0&&(t&128)===0?(a.flags=t&-65537|128,a):null;case 26:case 27:case 5:return $e(a),null;case 31:if(a.memoizedState!==null){if(oa(a),a.alternate===null)throw Error(r(340));kr()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 13:if(oa(a),t=a.memoizedState,t!==null&&t.dehydrated!==null){if(a.alternate===null)throw Error(r(340));kr()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 19:return K(on),null;case 4:return te(),null;case 10:return is(a.type),null;case 22:case 23:return oa(a),Hf(),t!==null&&K(Tr),t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 24:return is(dn),null;case 25:return null;default:return null}}function $v(t,a){switch(Ef(a),a.tag){case 3:is(dn),te();break;case 26:case 27:case 5:$e(a);break;case 4:te();break;case 31:a.memoizedState!==null&&oa(a);break;case 13:oa(a);break;case 19:K(on);break;case 10:is(a.type);break;case 22:case 23:oa(a),Hf(),t!==null&&K(Tr);break;case 24:is(dn)}}function Ul(t,a){try{var o=a.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var p=u.next;o=p;do{if((o.tag&t)===t){u=void 0;var b=o.create,T=o.inst;u=b(),T.destroy=u}o=o.next}while(o!==p)}}catch(z){Nt(a,a.return,z)}}function Vs(t,a,o){try{var u=a.updateQueue,p=u!==null?u.lastEffect:null;if(p!==null){var b=p.next;u=b;do{if((u.tag&t)===t){var T=u.inst,z=T.destroy;if(z!==void 0){T.destroy=void 0,p=a;var X=o,ae=z;try{ae()}catch(de){Nt(p,X,de)}}}u=u.next}while(u!==b)}}catch(de){Nt(a,a.return,de)}}function Gv(t){var a=t.updateQueue;if(a!==null){var o=t.stateNode;try{Db(a,o)}catch(u){Nt(t,t.return,u)}}}function Yv(t,a,o){o.props=Dr(t.type,t.memoizedProps),o.state=t.memoizedState;try{o.componentWillUnmount()}catch(u){Nt(t,a,u)}}function Hl(t,a){try{var o=t.ref;if(o!==null){switch(t.tag){case 26:case 27:case 5:var u=t.stateNode;break;case 30:u=t.stateNode;break;default:u=t.stateNode}typeof o=="function"?t.refCleanup=o(u):o.current=u}}catch(p){Nt(t,a,p)}}function Va(t,a){var o=t.ref,u=t.refCleanup;if(o!==null)if(typeof u=="function")try{u()}catch(p){Nt(t,a,p)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(p){Nt(t,a,p)}else o.current=null}function Fv(t){var a=t.type,o=t.memoizedProps,u=t.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":o.autoFocus&&u.focus();break e;case"img":o.src?u.src=o.src:o.srcSet&&(u.srcset=o.srcSet)}}catch(p){Nt(t,t.return,p)}}function vm(t,a,o){try{var u=t.stateNode;JC(u,t.type,o,a),u[un]=a}catch(p){Nt(t,t.return,p)}}function Xv(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Qs(t.type)||t.tag===4}function ym(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Xv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Qs(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function _m(t,a,o){var u=t.tag;if(u===5||u===6)t=t.stateNode,a?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(t,a):(a=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,a.appendChild(t),o=o._reactRootContainer,o!=null||a.onclick!==null||(a.onclick=as));else if(u!==4&&(u===27&&Qs(t.type)&&(o=t.stateNode,a=null),t=t.child,t!==null))for(_m(t,a,o),t=t.sibling;t!==null;)_m(t,a,o),t=t.sibling}function Gc(t,a,o){var u=t.tag;if(u===5||u===6)t=t.stateNode,a?o.insertBefore(t,a):o.appendChild(t);else if(u!==4&&(u===27&&Qs(t.type)&&(o=t.stateNode),t=t.child,t!==null))for(Gc(t,a,o),t=t.sibling;t!==null;)Gc(t,a,o),t=t.sibling}function Kv(t){var a=t.stateNode,o=t.memoizedProps;try{for(var u=t.type,p=a.attributes;p.length;)a.removeAttributeNode(p[0]);wn(a,u,o),a[kt]=t,a[un]=o}catch(b){Nt(t,t.return,b)}}var ms=!1,pn=!1,jm=!1,Qv=typeof WeakSet=="function"?WeakSet:Set,bn=null;function AC(t,a){if(t=t.containerInfo,Vm=fu,t=ib(t),gf(t)){if("selectionStart"in t)var o={start:t.selectionStart,end:t.selectionEnd};else e:{o=(o=t.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var p=u.anchorOffset,b=u.focusNode;u=u.focusOffset;try{o.nodeType,b.nodeType}catch{o=null;break e}var T=0,z=-1,X=-1,ae=0,de=0,pe=t,se=null;t:for(;;){for(var le;pe!==o||p!==0&&pe.nodeType!==3||(z=T+p),pe!==b||u!==0&&pe.nodeType!==3||(X=T+u),pe.nodeType===3&&(T+=pe.nodeValue.length),(le=pe.firstChild)!==null;)se=pe,pe=le;for(;;){if(pe===t)break t;if(se===o&&++ae===p&&(z=T),se===b&&++de===u&&(X=T),(le=pe.nextSibling)!==null)break;pe=se,se=pe.parentNode}pe=le}o=z===-1||X===-1?null:{start:z,end:X}}else o=null}o=o||{start:0,end:0}}else o=null;for($m={focusedElem:t,selectionRange:o},fu=!1,bn=a;bn!==null;)if(a=bn,t=a.child,(a.subtreeFlags&1028)!==0&&t!==null)t.return=a,bn=t;else for(;bn!==null;){switch(a=bn,b=a.alternate,t=a.flags,a.tag){case 0:if((t&4)!==0&&(t=a.updateQueue,t=t!==null?t.events:null,t!==null))for(o=0;o<t.length;o++)p=t[o],p.ref.impl=p.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&b!==null){t=void 0,o=a,p=b.memoizedProps,b=b.memoizedState,u=o.stateNode;try{var Le=Dr(o.type,p);t=u.getSnapshotBeforeUpdate(Le,b),u.__reactInternalSnapshotBeforeUpdate=t}catch(Xe){Nt(o,o.return,Xe)}}break;case 3:if((t&1024)!==0){if(t=a.stateNode.containerInfo,o=t.nodeType,o===9)Fm(t);else if(o===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Fm(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(r(163))}if(t=a.sibling,t!==null){t.return=a.return,bn=t;break}bn=a.return}}function Zv(t,a,o){var u=o.flags;switch(o.tag){case 0:case 11:case 15:gs(t,o),u&4&&Ul(5,o);break;case 1:if(gs(t,o),u&4)if(t=o.stateNode,a===null)try{t.componentDidMount()}catch(T){Nt(o,o.return,T)}else{var p=Dr(o.type,a.memoizedProps);a=a.memoizedState;try{t.componentDidUpdate(p,a,t.__reactInternalSnapshotBeforeUpdate)}catch(T){Nt(o,o.return,T)}}u&64&&Gv(o),u&512&&Hl(o,o.return);break;case 3:if(gs(t,o),u&64&&(t=o.updateQueue,t!==null)){if(a=null,o.child!==null)switch(o.child.tag){case 27:case 5:a=o.child.stateNode;break;case 1:a=o.child.stateNode}try{Db(t,a)}catch(T){Nt(o,o.return,T)}}break;case 27:a===null&&u&4&&Kv(o);case 26:case 5:gs(t,o),a===null&&u&4&&Fv(o),u&512&&Hl(o,o.return);break;case 12:gs(t,o);break;case 31:gs(t,o),u&4&&ey(t,o);break;case 13:gs(t,o),u&4&&ty(t,o),u&64&&(t=o.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(o=UC.bind(null,o),oE(t,o))));break;case 22:if(u=o.memoizedState!==null||ms,!u){a=a!==null&&a.memoizedState!==null||pn,p=ms;var b=pn;ms=u,(pn=a)&&!b?hs(t,o,(o.subtreeFlags&8772)!==0):gs(t,o),ms=p,pn=b}break;case 30:break;default:gs(t,o)}}function Jv(t){var a=t.alternate;a!==null&&(t.alternate=null,Jv(a)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(a=t.stateNode,a!==null&&Zd(a)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Kt=null,Gn=!1;function ps(t,a,o){for(o=o.child;o!==null;)Wv(t,a,o),o=o.sibling}function Wv(t,a,o){if(it&&typeof it.onCommitFiberUnmount=="function")try{it.onCommitFiberUnmount(ut,o)}catch{}switch(o.tag){case 26:pn||Va(o,a),ps(t,a,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:pn||Va(o,a);var u=Kt,p=Gn;Qs(o.type)&&(Kt=o.stateNode,Gn=!1),ps(t,a,o),Ql(o.stateNode),Kt=u,Gn=p;break;case 5:pn||Va(o,a);case 6:if(u=Kt,p=Gn,Kt=null,ps(t,a,o),Kt=u,Gn=p,Kt!==null)if(Gn)try{(Kt.nodeType===9?Kt.body:Kt.nodeName==="HTML"?Kt.ownerDocument.body:Kt).removeChild(o.stateNode)}catch(b){Nt(o,a,b)}else try{Kt.removeChild(o.stateNode)}catch(b){Nt(o,a,b)}break;case 18:Kt!==null&&(Gn?(t=Kt,Gy(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,o.stateNode),Bo(t)):Gy(Kt,o.stateNode));break;case 4:u=Kt,p=Gn,Kt=o.stateNode.containerInfo,Gn=!0,ps(t,a,o),Kt=u,Gn=p;break;case 0:case 11:case 14:case 15:Vs(2,o,a),pn||Vs(4,o,a),ps(t,a,o);break;case 1:pn||(Va(o,a),u=o.stateNode,typeof u.componentWillUnmount=="function"&&Yv(o,a,u)),ps(t,a,o);break;case 21:ps(t,a,o);break;case 22:pn=(u=pn)||o.memoizedState!==null,ps(t,a,o),pn=u;break;default:ps(t,a,o)}}function ey(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Bo(t)}catch(o){Nt(a,a.return,o)}}}function ty(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Bo(t)}catch(o){Nt(a,a.return,o)}}function MC(t){switch(t.tag){case 31:case 13:case 19:var a=t.stateNode;return a===null&&(a=t.stateNode=new Qv),a;case 22:return t=t.stateNode,a=t._retryCache,a===null&&(a=t._retryCache=new Qv),a;default:throw Error(r(435,t.tag))}}function Yc(t,a){var o=MC(t);a.forEach(function(u){if(!o.has(u)){o.add(u);var p=HC.bind(null,t,u);u.then(p,p)}})}function Yn(t,a){var o=a.deletions;if(o!==null)for(var u=0;u<o.length;u++){var p=o[u],b=t,T=a,z=T;e:for(;z!==null;){switch(z.tag){case 27:if(Qs(z.type)){Kt=z.stateNode,Gn=!1;break e}break;case 5:Kt=z.stateNode,Gn=!1;break e;case 3:case 4:Kt=z.stateNode.containerInfo,Gn=!0;break e}z=z.return}if(Kt===null)throw Error(r(160));Wv(b,T,p),Kt=null,Gn=!1,b=p.alternate,b!==null&&(b.return=null),p.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)ny(a,t),a=a.sibling}var Aa=null;function ny(t,a){var o=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Yn(a,t),Fn(t),u&4&&(Vs(3,t,t.return),Ul(3,t),Vs(5,t,t.return));break;case 1:Yn(a,t),Fn(t),u&512&&(pn||o===null||Va(o,o.return)),u&64&&ms&&(t=t.updateQueue,t!==null&&(u=t.callbacks,u!==null&&(o=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=o===null?u:o.concat(u))));break;case 26:var p=Aa;if(Yn(a,t),Fn(t),u&512&&(pn||o===null||Va(o,o.return)),u&4){var b=o!==null?o.memoizedState:null;if(u=t.memoizedState,o===null)if(u===null)if(t.stateNode===null){e:{u=t.type,o=t.memoizedProps,p=p.ownerDocument||p;t:switch(u){case"title":b=p.getElementsByTagName("title")[0],(!b||b[pl]||b[kt]||b.namespaceURI==="http://www.w3.org/2000/svg"||b.hasAttribute("itemprop"))&&(b=p.createElement(u),p.head.insertBefore(b,p.querySelector("head > title"))),wn(b,u,o),b[kt]=t,xn(b),u=b;break e;case"link":var T=n0("link","href",p).get(u+(o.href||""));if(T){for(var z=0;z<T.length;z++)if(b=T[z],b.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&b.getAttribute("rel")===(o.rel==null?null:o.rel)&&b.getAttribute("title")===(o.title==null?null:o.title)&&b.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){T.splice(z,1);break t}}b=p.createElement(u),wn(b,u,o),p.head.appendChild(b);break;case"meta":if(T=n0("meta","content",p).get(u+(o.content||""))){for(z=0;z<T.length;z++)if(b=T[z],b.getAttribute("content")===(o.content==null?null:""+o.content)&&b.getAttribute("name")===(o.name==null?null:o.name)&&b.getAttribute("property")===(o.property==null?null:o.property)&&b.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&b.getAttribute("charset")===(o.charSet==null?null:o.charSet)){T.splice(z,1);break t}}b=p.createElement(u),wn(b,u,o),p.head.appendChild(b);break;default:throw Error(r(468,u))}b[kt]=t,xn(b),u=b}t.stateNode=u}else a0(p,t.type,t.stateNode);else t.stateNode=t0(p,u,t.memoizedProps);else b!==u?(b===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):b.count--,u===null?a0(p,t.type,t.stateNode):t0(p,u,t.memoizedProps)):u===null&&t.stateNode!==null&&vm(t,t.memoizedProps,o.memoizedProps)}break;case 27:Yn(a,t),Fn(t),u&512&&(pn||o===null||Va(o,o.return)),o!==null&&u&4&&vm(t,t.memoizedProps,o.memoizedProps);break;case 5:if(Yn(a,t),Fn(t),u&512&&(pn||o===null||Va(o,o.return)),t.flags&32){p=t.stateNode;try{oo(p,"")}catch(Le){Nt(t,t.return,Le)}}u&4&&t.stateNode!=null&&(p=t.memoizedProps,vm(t,p,o!==null?o.memoizedProps:p)),u&1024&&(jm=!0);break;case 6:if(Yn(a,t),Fn(t),u&4){if(t.stateNode===null)throw Error(r(162));u=t.memoizedProps,o=t.stateNode;try{o.nodeValue=u}catch(Le){Nt(t,t.return,Le)}}break;case 3:if(iu=null,p=Aa,Aa=ou(a.containerInfo),Yn(a,t),Aa=p,Fn(t),u&4&&o!==null&&o.memoizedState.isDehydrated)try{Bo(a.containerInfo)}catch(Le){Nt(t,t.return,Le)}jm&&(jm=!1,ay(t));break;case 4:u=Aa,Aa=ou(t.stateNode.containerInfo),Yn(a,t),Fn(t),Aa=u;break;case 12:Yn(a,t),Fn(t);break;case 31:Yn(a,t),Fn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Yc(t,u)));break;case 13:Yn(a,t),Fn(t),t.child.flags&8192&&t.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Xc=ve()),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Yc(t,u)));break;case 22:p=t.memoizedState!==null;var X=o!==null&&o.memoizedState!==null,ae=ms,de=pn;if(ms=ae||p,pn=de||X,Yn(a,t),pn=de,ms=ae,Fn(t),u&8192)e:for(a=t.stateNode,a._visibility=p?a._visibility&-2:a._visibility|1,p&&(o===null||X||ms||pn||Lr(t)),o=null,a=t;;){if(a.tag===5||a.tag===26){if(o===null){X=o=a;try{if(b=X.stateNode,p)T=b.style,typeof T.setProperty=="function"?T.setProperty("display","none","important"):T.display="none";else{z=X.stateNode;var pe=X.memoizedProps.style,se=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;z.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(Le){Nt(X,X.return,Le)}}}else if(a.tag===6){if(o===null){X=a;try{X.stateNode.nodeValue=p?"":X.memoizedProps}catch(Le){Nt(X,X.return,Le)}}}else if(a.tag===18){if(o===null){X=a;try{var le=X.stateNode;p?Yy(le,!0):Yy(X.stateNode,!1)}catch(Le){Nt(X,X.return,Le)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===t)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;o===a&&(o=null),a=a.return}o===a&&(o=null),a.sibling.return=a.return,a=a.sibling}u&4&&(u=t.updateQueue,u!==null&&(o=u.retryQueue,o!==null&&(u.retryQueue=null,Yc(t,o))));break;case 19:Yn(a,t),Fn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Yc(t,u)));break;case 30:break;case 21:break;default:Yn(a,t),Fn(t)}}function Fn(t){var a=t.flags;if(a&2){try{for(var o,u=t.return;u!==null;){if(Xv(u)){o=u;break}u=u.return}if(o==null)throw Error(r(160));switch(o.tag){case 27:var p=o.stateNode,b=ym(t);Gc(t,b,p);break;case 5:var T=o.stateNode;o.flags&32&&(oo(T,""),o.flags&=-33);var z=ym(t);Gc(t,z,T);break;case 3:case 4:var X=o.stateNode.containerInfo,ae=ym(t);_m(t,ae,X);break;default:throw Error(r(161))}}catch(de){Nt(t,t.return,de)}t.flags&=-3}a&4096&&(t.flags&=-4097)}function ay(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var a=t;ay(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),t=t.sibling}}function gs(t,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Zv(t,a.alternate,a),a=a.sibling}function Lr(t){for(t=t.child;t!==null;){var a=t;switch(a.tag){case 0:case 11:case 14:case 15:Vs(4,a,a.return),Lr(a);break;case 1:Va(a,a.return);var o=a.stateNode;typeof o.componentWillUnmount=="function"&&Yv(a,a.return,o),Lr(a);break;case 27:Ql(a.stateNode);case 26:case 5:Va(a,a.return),Lr(a);break;case 22:a.memoizedState===null&&Lr(a);break;case 30:Lr(a);break;default:Lr(a)}t=t.sibling}}function hs(t,a,o){for(o=o&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var u=a.alternate,p=t,b=a,T=b.flags;switch(b.tag){case 0:case 11:case 15:hs(p,b,o),Ul(4,b);break;case 1:if(hs(p,b,o),u=b,p=u.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(ae){Nt(u,u.return,ae)}if(u=b,p=u.updateQueue,p!==null){var z=u.stateNode;try{var X=p.shared.hiddenCallbacks;if(X!==null)for(p.shared.hiddenCallbacks=null,p=0;p<X.length;p++)zb(X[p],z)}catch(ae){Nt(u,u.return,ae)}}o&&T&64&&Gv(b),Hl(b,b.return);break;case 27:Kv(b);case 26:case 5:hs(p,b,o),o&&u===null&&T&4&&Fv(b),Hl(b,b.return);break;case 12:hs(p,b,o);break;case 31:hs(p,b,o),o&&T&4&&ey(p,b);break;case 13:hs(p,b,o),o&&T&4&&ty(p,b);break;case 22:b.memoizedState===null&&hs(p,b,o),Hl(b,b.return);break;case 30:break;default:hs(p,b,o)}a=a.sibling}}function Sm(t,a){var o=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(o=t.memoizedState.cachePool.pool),t=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(t=a.memoizedState.cachePool.pool),t!==o&&(t!=null&&t.refCount++,o!=null&&kl(o))}function wm(t,a){t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&kl(t))}function Ma(t,a,o,u){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)sy(t,a,o,u),a=a.sibling}function sy(t,a,o,u){var p=a.flags;switch(a.tag){case 0:case 11:case 15:Ma(t,a,o,u),p&2048&&Ul(9,a);break;case 1:Ma(t,a,o,u);break;case 3:Ma(t,a,o,u),p&2048&&(t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&kl(t)));break;case 12:if(p&2048){Ma(t,a,o,u),t=a.stateNode;try{var b=a.memoizedProps,T=b.id,z=b.onPostCommit;typeof z=="function"&&z(T,a.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(X){Nt(a,a.return,X)}}else Ma(t,a,o,u);break;case 31:Ma(t,a,o,u);break;case 13:Ma(t,a,o,u);break;case 23:break;case 22:b=a.stateNode,T=a.alternate,a.memoizedState!==null?b._visibility&2?Ma(t,a,o,u):ql(t,a):b._visibility&2?Ma(t,a,o,u):(b._visibility|=2,ko(t,a,o,u,(a.subtreeFlags&10256)!==0||!1)),p&2048&&Sm(T,a);break;case 24:Ma(t,a,o,u),p&2048&&wm(a.alternate,a);break;default:Ma(t,a,o,u)}}function ko(t,a,o,u,p){for(p=p&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var b=t,T=a,z=o,X=u,ae=T.flags;switch(T.tag){case 0:case 11:case 15:ko(b,T,z,X,p),Ul(8,T);break;case 23:break;case 22:var de=T.stateNode;T.memoizedState!==null?de._visibility&2?ko(b,T,z,X,p):ql(b,T):(de._visibility|=2,ko(b,T,z,X,p)),p&&ae&2048&&Sm(T.alternate,T);break;case 24:ko(b,T,z,X,p),p&&ae&2048&&wm(T.alternate,T);break;default:ko(b,T,z,X,p)}a=a.sibling}}function ql(t,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var o=t,u=a,p=u.flags;switch(u.tag){case 22:ql(o,u),p&2048&&Sm(u.alternate,u);break;case 24:ql(o,u),p&2048&&wm(u.alternate,u);break;default:ql(o,u)}a=a.sibling}}var Vl=8192;function Ro(t,a,o){if(t.subtreeFlags&Vl)for(t=t.child;t!==null;)ry(t,a,o),t=t.sibling}function ry(t,a,o){switch(t.tag){case 26:Ro(t,a,o),t.flags&Vl&&t.memoizedState!==null&&bE(o,Aa,t.memoizedState,t.memoizedProps);break;case 5:Ro(t,a,o);break;case 3:case 4:var u=Aa;Aa=ou(t.stateNode.containerInfo),Ro(t,a,o),Aa=u;break;case 22:t.memoizedState===null&&(u=t.alternate,u!==null&&u.memoizedState!==null?(u=Vl,Vl=16777216,Ro(t,a,o),Vl=u):Ro(t,a,o));break;default:Ro(t,a,o)}}function oy(t){var a=t.alternate;if(a!==null&&(t=a.child,t!==null)){a.child=null;do a=t.sibling,t.sibling=null,t=a;while(t!==null)}}function $l(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var o=0;o<a.length;o++){var u=a[o];bn=u,iy(u,t)}oy(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)ly(t),t=t.sibling}function ly(t){switch(t.tag){case 0:case 11:case 15:$l(t),t.flags&2048&&Vs(9,t,t.return);break;case 3:$l(t);break;case 12:$l(t);break;case 22:var a=t.stateNode;t.memoizedState!==null&&a._visibility&2&&(t.return===null||t.return.tag!==13)?(a._visibility&=-3,Fc(t)):$l(t);break;default:$l(t)}}function Fc(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var o=0;o<a.length;o++){var u=a[o];bn=u,iy(u,t)}oy(t)}for(t=t.child;t!==null;){switch(a=t,a.tag){case 0:case 11:case 15:Vs(8,a,a.return),Fc(a);break;case 22:o=a.stateNode,o._visibility&2&&(o._visibility&=-3,Fc(a));break;default:Fc(a)}t=t.sibling}}function iy(t,a){for(;bn!==null;){var o=bn;switch(o.tag){case 0:case 11:case 15:Vs(8,o,a);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var u=o.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:kl(o.memoizedState.cache)}if(u=o.child,u!==null)u.return=o,bn=u;else e:for(o=t;bn!==null;){u=bn;var p=u.sibling,b=u.return;if(Jv(u),u===o){bn=null;break e}if(p!==null){p.return=b,bn=p;break e}bn=b}}}var OC={getCacheForType:function(t){var a=jn(dn),o=a.data.get(t);return o===void 0&&(o=t(),a.data.set(t,o)),o},cacheSignal:function(){return jn(dn).controller.signal}},zC=typeof WeakMap=="function"?WeakMap:Map,wt=0,It=null,ft=null,pt=0,Rt=0,la=null,$s=!1,No=!1,Cm=!1,xs=0,nn=0,Gs=0,Pr=0,Em=0,ia=0,To=0,Gl=null,Xn=null,km=!1,Xc=0,cy=0,Kc=1/0,Qc=null,Ys=null,hn=0,Fs=null,Ao=null,bs=0,Rm=0,Nm=null,uy=null,Yl=0,Tm=null;function ca(){return(wt&2)!==0&&pt!==0?pt&-pt:H.T!==null?Lm():At()}function dy(){if(ia===0)if((pt&536870912)===0||bt){var t=Xt;Xt<<=1,(Xt&3932160)===0&&(Xt=262144),ia=t}else ia=536870912;return t=ra.current,t!==null&&(t.flags|=32),ia}function Kn(t,a,o){(t===It&&(Rt===2||Rt===9)||t.cancelPendingCommit!==null)&&(Mo(t,0),Xs(t,pt,ia,!1)),Vn(t,o),((wt&2)===0||t!==It)&&(t===It&&((wt&2)===0&&(Pr|=o),nn===4&&Xs(t,pt,ia,!1)),$a(t))}function fy(t,a,o){if((wt&6)!==0)throw Error(r(327));var u=!o&&(a&127)===0&&(a&t.expiredLanes)===0||rn(t,a),p=u?PC(t,a):Mm(t,a,!0),b=u;do{if(p===0){No&&!u&&Xs(t,a,0,!1);break}else{if(o=t.current.alternate,b&&!DC(o)){p=Mm(t,a,!1),b=!1;continue}if(p===2){if(b=a,t.errorRecoveryDisabledLanes&b)var T=0;else T=t.pendingLanes&-536870913,T=T!==0?T:T&536870912?536870912:0;if(T!==0){a=T;e:{var z=t;p=Gl;var X=z.current.memoizedState.isDehydrated;if(X&&(Mo(z,T).flags|=256),T=Mm(z,T,!1),T!==2){if(Cm&&!X){z.errorRecoveryDisabledLanes|=b,Pr|=b,p=4;break e}b=Xn,Xn=p,b!==null&&(Xn===null?Xn=b:Xn.push.apply(Xn,b))}p=T}if(b=!1,p!==2)continue}}if(p===1){Mo(t,0),Xs(t,a,0,!0);break}e:{switch(u=t,b=p,b){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Xs(u,a,ia,!$s);break e;case 2:Xn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(p=Xc+300-ve(),10<p)){if(Xs(u,a,ia,!$s),Vt(u,0,!0)!==0)break e;bs=a,u.timeoutHandle=Vy(my.bind(null,u,o,Xn,Qc,km,a,ia,Pr,To,$s,b,"Throttled",-0,0),p);break e}my(u,o,Xn,Qc,km,a,ia,Pr,To,$s,b,null,-0,0)}}break}while(!0);$a(t)}function my(t,a,o,u,p,b,T,z,X,ae,de,pe,se,le){if(t.timeoutHandle=-1,pe=a.subtreeFlags,pe&8192||(pe&16785408)===16785408){pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:as},ry(a,b,pe);var Le=(b&62914560)===b?Xc-ve():(b&4194048)===b?cy-ve():0;if(Le=vE(pe,Le),Le!==null){bs=b,t.cancelPendingCommit=Le(_y.bind(null,t,a,b,o,u,p,T,z,X,de,pe,null,se,le)),Xs(t,b,T,!ae);return}}_y(t,a,b,o,u,p,T,z,X)}function DC(t){for(var a=t;;){var o=a.tag;if((o===0||o===11||o===15)&&a.flags&16384&&(o=a.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var u=0;u<o.length;u++){var p=o[u],b=p.getSnapshot;p=p.value;try{if(!aa(b(),p))return!1}catch{return!1}}if(o=a.child,a.subtreeFlags&16384&&o!==null)o.return=a,a=o;else{if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Xs(t,a,o,u){a&=~Em,a&=~Pr,t.suspendedLanes|=a,t.pingedLanes&=~a,u&&(t.warmLanes|=a),u=t.expirationTimes;for(var p=a;0<p;){var b=31-Bt(p),T=1<<b;u[b]=-1,p&=~T}o!==0&&An(t,o,a)}function Zc(){return(wt&6)===0?(Fl(0),!1):!0}function Am(){if(ft!==null){if(Rt===0)var t=ft.return;else t=ft,ls=Rr=null,Ff(t),jo=null,Nl=0,t=ft;for(;t!==null;)$v(t.alternate,t),t=t.return;ft=null}}function Mo(t,a){var o=t.timeoutHandle;o!==-1&&(t.timeoutHandle=-1,tE(o)),o=t.cancelPendingCommit,o!==null&&(t.cancelPendingCommit=null,o()),bs=0,Am(),It=t,ft=o=rs(t.current,null),pt=a,Rt=0,la=null,$s=!1,No=rn(t,a),Cm=!1,To=ia=Em=Pr=Gs=nn=0,Xn=Gl=null,km=!1,(a&8)!==0&&(a|=a&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=a;0<u;){var p=31-Bt(u),b=1<<p;a|=t[p],u&=~b}return xs=a,bc(),o}function py(t,a){et=null,H.H=Pl,a===_o||a===Ec?(a=Tb(),Rt=3):a===Df?(a=Tb(),Rt=4):Rt=a===cm?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,la=a,ft===null&&(nn=1,Uc(t,ba(a,t.current)))}function gy(){var t=ra.current;return t===null?!0:(pt&4194048)===pt?ja===null:(pt&62914560)===pt||(pt&536870912)!==0?t===ja:!1}function hy(){var t=H.H;return H.H=Pl,t===null?Pl:t}function xy(){var t=H.A;return H.A=OC,t}function Jc(){nn=4,$s||(pt&4194048)!==pt&&ra.current!==null||(No=!0),(Gs&134217727)===0&&(Pr&134217727)===0||It===null||Xs(It,pt,ia,!1)}function Mm(t,a,o){var u=wt;wt|=2;var p=hy(),b=xy();(It!==t||pt!==a)&&(Qc=null,Mo(t,a)),a=!1;var T=nn;e:do try{if(Rt!==0&&ft!==null){var z=ft,X=la;switch(Rt){case 8:Am(),T=6;break e;case 3:case 2:case 9:case 6:ra.current===null&&(a=!0);var ae=Rt;if(Rt=0,la=null,Oo(t,z,X,ae),o&&No){T=0;break e}break;default:ae=Rt,Rt=0,la=null,Oo(t,z,X,ae)}}LC(),T=nn;break}catch(de){py(t,de)}while(!0);return a&&t.shellSuspendCounter++,ls=Rr=null,wt=u,H.H=p,H.A=b,ft===null&&(It=null,pt=0,bc()),T}function LC(){for(;ft!==null;)by(ft)}function PC(t,a){var o=wt;wt|=2;var u=hy(),p=xy();It!==t||pt!==a?(Qc=null,Kc=ve()+500,Mo(t,a)):No=rn(t,a);e:do try{if(Rt!==0&&ft!==null){a=ft;var b=la;t:switch(Rt){case 1:Rt=0,la=null,Oo(t,a,b,1);break;case 2:case 9:if(Rb(b)){Rt=0,la=null,vy(a);break}a=function(){Rt!==2&&Rt!==9||It!==t||(Rt=7),$a(t)},b.then(a,a);break e;case 3:Rt=7;break e;case 4:Rt=5;break e;case 7:Rb(b)?(Rt=0,la=null,vy(a)):(Rt=0,la=null,Oo(t,a,b,7));break;case 5:var T=null;switch(ft.tag){case 26:T=ft.memoizedState;case 5:case 27:var z=ft;if(T?s0(T):z.stateNode.complete){Rt=0,la=null;var X=z.sibling;if(X!==null)ft=X;else{var ae=z.return;ae!==null?(ft=ae,Wc(ae)):ft=null}break t}}Rt=0,la=null,Oo(t,a,b,5);break;case 6:Rt=0,la=null,Oo(t,a,b,6);break;case 8:Am(),nn=6;break e;default:throw Error(r(462))}}BC();break}catch(de){py(t,de)}while(!0);return ls=Rr=null,H.H=u,H.A=p,wt=o,ft!==null?0:(It=null,pt=0,bc(),nn)}function BC(){for(;ft!==null&&!qe();)by(ft)}function by(t){var a=qv(t.alternate,t,xs);t.memoizedProps=t.pendingProps,a===null?Wc(t):ft=a}function vy(t){var a=t,o=a.alternate;switch(a.tag){case 15:case 0:a=Lv(o,a,a.pendingProps,a.type,void 0,pt);break;case 11:a=Lv(o,a,a.pendingProps,a.type.render,a.ref,pt);break;case 5:Ff(a);default:$v(o,a),a=ft=xb(a,xs),a=qv(o,a,xs)}t.memoizedProps=t.pendingProps,a===null?Wc(t):ft=a}function Oo(t,a,o,u){ls=Rr=null,Ff(a),jo=null,Nl=0;var p=a.return;try{if(EC(t,p,a,o,pt)){nn=1,Uc(t,ba(o,t.current)),ft=null;return}}catch(b){if(p!==null)throw ft=p,b;nn=1,Uc(t,ba(o,t.current)),ft=null;return}a.flags&32768?(bt||u===1?t=!0:No||(pt&536870912)!==0?t=!1:($s=t=!0,(u===2||u===9||u===3||u===6)&&(u=ra.current,u!==null&&u.tag===13&&(u.flags|=16384))),yy(a,t)):Wc(a)}function Wc(t){var a=t;do{if((a.flags&32768)!==0){yy(a,$s);return}t=a.return;var o=NC(a.alternate,a,xs);if(o!==null){ft=o;return}if(a=a.sibling,a!==null){ft=a;return}ft=a=t}while(a!==null);nn===0&&(nn=5)}function yy(t,a){do{var o=TC(t.alternate,t);if(o!==null){o.flags&=32767,ft=o;return}if(o=t.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!a&&(t=t.sibling,t!==null)){ft=t;return}ft=t=o}while(t!==null);nn=6,ft=null}function _y(t,a,o,u,p,b,T,z,X){t.cancelPendingCommit=null;do eu();while(hn!==0);if((wt&6)!==0)throw Error(r(327));if(a!==null){if(a===t.current)throw Error(r(177));if(b=a.lanes|a.childLanes,b|=yf,es(t,o,b,T,z,X),t===It&&(ft=It=null,pt=0),Ao=a,Fs=t,bs=o,Rm=b,Nm=p,uy=u,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,qC(Pe,function(){return Ey(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||u){u=H.T,H.T=null,p=G.p,G.p=2,T=wt,wt|=4;try{AC(t,a,o)}finally{wt=T,G.p=p,H.T=u}}hn=1,jy(),Sy(),wy()}}function jy(){if(hn===1){hn=0;var t=Fs,a=Ao,o=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||o){o=H.T,H.T=null;var u=G.p;G.p=2;var p=wt;wt|=4;try{ny(a,t);var b=$m,T=ib(t.containerInfo),z=b.focusedElem,X=b.selectionRange;if(T!==z&&z&&z.ownerDocument&&lb(z.ownerDocument.documentElement,z)){if(X!==null&&gf(z)){var ae=X.start,de=X.end;if(de===void 0&&(de=ae),"selectionStart"in z)z.selectionStart=ae,z.selectionEnd=Math.min(de,z.value.length);else{var pe=z.ownerDocument||document,se=pe&&pe.defaultView||window;if(se.getSelection){var le=se.getSelection(),Le=z.textContent.length,Xe=Math.min(X.start,Le),zt=X.end===void 0?Xe:Math.min(X.end,Le);!le.extend&&Xe>zt&&(T=zt,zt=Xe,Xe=T);var ee=ob(z,Xe),J=ob(z,zt);if(ee&&J&&(le.rangeCount!==1||le.anchorNode!==ee.node||le.anchorOffset!==ee.offset||le.focusNode!==J.node||le.focusOffset!==J.offset)){var ne=pe.createRange();ne.setStart(ee.node,ee.offset),le.removeAllRanges(),Xe>zt?(le.addRange(ne),le.extend(J.node,J.offset)):(ne.setEnd(J.node,J.offset),le.addRange(ne))}}}}for(pe=[],le=z;le=le.parentNode;)le.nodeType===1&&pe.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof z.focus=="function"&&z.focus(),z=0;z<pe.length;z++){var me=pe[z];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}fu=!!Vm,$m=Vm=null}finally{wt=p,G.p=u,H.T=o}}t.current=a,hn=2}}function Sy(){if(hn===2){hn=0;var t=Fs,a=Ao,o=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||o){o=H.T,H.T=null;var u=G.p;G.p=2;var p=wt;wt|=4;try{Zv(t,a.alternate,a)}finally{wt=p,G.p=u,H.T=o}}hn=3}}function wy(){if(hn===4||hn===3){hn=0,Me();var t=Fs,a=Ao,o=bs,u=uy;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?hn=5:(hn=0,Ao=Fs=null,Cy(t,t.pendingLanes));var p=t.pendingLanes;if(p===0&&(Ys=null),nt(o),a=a.stateNode,it&&typeof it.onCommitFiberRoot=="function")try{it.onCommitFiberRoot(ut,a,void 0,(a.current.flags&128)===128)}catch{}if(u!==null){a=H.T,p=G.p,G.p=2,H.T=null;try{for(var b=t.onRecoverableError,T=0;T<u.length;T++){var z=u[T];b(z.value,{componentStack:z.stack})}}finally{H.T=a,G.p=p}}(bs&3)!==0&&eu(),$a(t),p=t.pendingLanes,(o&261930)!==0&&(p&42)!==0?t===Tm?Yl++:(Yl=0,Tm=t):Yl=0,Fl(0)}}function Cy(t,a){(t.pooledCacheLanes&=a)===0&&(a=t.pooledCache,a!=null&&(t.pooledCache=null,kl(a)))}function eu(){return jy(),Sy(),wy(),Ey()}function Ey(){if(hn!==5)return!1;var t=Fs,a=Rm;Rm=0;var o=nt(bs),u=H.T,p=G.p;try{G.p=32>o?32:o,H.T=null,o=Nm,Nm=null;var b=Fs,T=bs;if(hn=0,Ao=Fs=null,bs=0,(wt&6)!==0)throw Error(r(331));var z=wt;if(wt|=4,ly(b.current),sy(b,b.current,T,o),wt=z,Fl(0,!1),it&&typeof it.onPostCommitFiberRoot=="function")try{it.onPostCommitFiberRoot(ut,b)}catch{}return!0}finally{G.p=p,H.T=u,Cy(t,a)}}function ky(t,a,o){a=ba(o,a),a=im(t.stateNode,a,2),t=Us(t,a,2),t!==null&&(Vn(t,2),$a(t))}function Nt(t,a,o){if(t.tag===3)ky(t,t,o);else for(;a!==null;){if(a.tag===3){ky(a,t,o);break}else if(a.tag===1){var u=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Ys===null||!Ys.has(u))){t=ba(o,t),o=Rv(2),u=Us(a,o,2),u!==null&&(Nv(o,u,a,t),Vn(u,2),$a(u));break}}a=a.return}}function Om(t,a,o){var u=t.pingCache;if(u===null){u=t.pingCache=new zC;var p=new Set;u.set(a,p)}else p=u.get(a),p===void 0&&(p=new Set,u.set(a,p));p.has(o)||(Cm=!0,p.add(o),t=IC.bind(null,t,a,o),a.then(t,t))}function IC(t,a,o){var u=t.pingCache;u!==null&&u.delete(a),t.pingedLanes|=t.suspendedLanes&o,t.warmLanes&=~o,It===t&&(pt&o)===o&&(nn===4||nn===3&&(pt&62914560)===pt&&300>ve()-Xc?(wt&2)===0&&Mo(t,0):Em|=o,To===pt&&(To=0)),$a(t)}function Ry(t,a){a===0&&(a=qn()),t=Cr(t,a),t!==null&&(Vn(t,a),$a(t))}function UC(t){var a=t.memoizedState,o=0;a!==null&&(o=a.retryLane),Ry(t,o)}function HC(t,a){var o=0;switch(t.tag){case 31:case 13:var u=t.stateNode,p=t.memoizedState;p!==null&&(o=p.retryLane);break;case 19:u=t.stateNode;break;case 22:u=t.stateNode._retryCache;break;default:throw Error(r(314))}u!==null&&u.delete(a),Ry(t,o)}function qC(t,a){return De(t,a)}var tu=null,zo=null,zm=!1,nu=!1,Dm=!1,Ks=0;function $a(t){t!==zo&&t.next===null&&(zo===null?tu=zo=t:zo=zo.next=t),nu=!0,zm||(zm=!0,$C())}function Fl(t,a){if(!Dm&&nu){Dm=!0;do for(var o=!1,u=tu;u!==null;){if(t!==0){var p=u.pendingLanes;if(p===0)var b=0;else{var T=u.suspendedLanes,z=u.pingedLanes;b=(1<<31-Bt(42|t)+1)-1,b&=p&~(T&~z),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(o=!0,My(u,b))}else b=pt,b=Vt(u,u===It?b:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(b&3)===0||rn(u,b)||(o=!0,My(u,b));u=u.next}while(o);Dm=!1}}function VC(){Ny()}function Ny(){nu=zm=!1;var t=0;Ks!==0&&eE()&&(t=Ks);for(var a=ve(),o=null,u=tu;u!==null;){var p=u.next,b=Ty(u,a);b===0?(u.next=null,o===null?tu=p:o.next=p,p===null&&(zo=o)):(o=u,(t!==0||(b&3)!==0)&&(nu=!0)),u=p}hn!==0&&hn!==5||Fl(t),Ks!==0&&(Ks=0)}function Ty(t,a){for(var o=t.suspendedLanes,u=t.pingedLanes,p=t.expirationTimes,b=t.pendingLanes&-62914561;0<b;){var T=31-Bt(b),z=1<<T,X=p[T];X===-1?((z&o)===0||(z&u)!==0)&&(p[T]=Tn(z,a)):X<=a&&(t.expiredLanes|=z),b&=~z}if(a=It,o=pt,o=Vt(t,t===a?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u=t.callbackNode,o===0||t===a&&(Rt===2||Rt===9)||t.cancelPendingCommit!==null)return u!==null&&u!==null&&Ge(u),t.callbackNode=null,t.callbackPriority=0;if((o&3)===0||rn(t,o)){if(a=o&-o,a===t.callbackPriority)return a;switch(u!==null&&Ge(u),nt(o)){case 2:case 8:o=je;break;case 32:o=Pe;break;case 268435456:o=_t;break;default:o=Pe}return u=Ay.bind(null,t),o=De(o,u),t.callbackPriority=a,t.callbackNode=o,a}return u!==null&&u!==null&&Ge(u),t.callbackPriority=2,t.callbackNode=null,2}function Ay(t,a){if(hn!==0&&hn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var o=t.callbackNode;if(eu()&&t.callbackNode!==o)return null;var u=pt;return u=Vt(t,t===It?u:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u===0?null:(fy(t,u,a),Ty(t,ve()),t.callbackNode!=null&&t.callbackNode===o?Ay.bind(null,t):null)}function My(t,a){if(eu())return null;fy(t,a,!0)}function $C(){nE(function(){(wt&6)!==0?De(ye,VC):Ny()})}function Lm(){if(Ks===0){var t=vo;t===0&&(t=Tt,Tt<<=1,(Tt&261888)===0&&(Tt=256)),Ks=t}return Ks}function Oy(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:uc(""+t)}function zy(t,a){var o=a.ownerDocument.createElement("input");return o.name=a.name,o.value=a.value,t.id&&o.setAttribute("form",t.id),a.parentNode.insertBefore(o,a),t=new FormData(t),o.parentNode.removeChild(o),t}function GC(t,a,o,u,p){if(a==="submit"&&o&&o.stateNode===p){var b=Oy((p[un]||null).action),T=u.submitter;T&&(a=(a=T[un]||null)?Oy(a.formAction):T.getAttribute("formAction"),a!==null&&(b=a,T=null));var z=new pc("action","action",null,u,p);t.push({event:z,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(Ks!==0){var X=T?zy(p,T):new FormData(p);nm(o,{pending:!0,data:X,method:p.method,action:b},null,X)}}else typeof b=="function"&&(z.preventDefault(),X=T?zy(p,T):new FormData(p),nm(o,{pending:!0,data:X,method:p.method,action:b},b,X))},currentTarget:p}]})}}for(var Pm=0;Pm<vf.length;Pm++){var Bm=vf[Pm],YC=Bm.toLowerCase(),FC=Bm[0].toUpperCase()+Bm.slice(1);Ta(YC,"on"+FC)}Ta(db,"onAnimationEnd"),Ta(fb,"onAnimationIteration"),Ta(mb,"onAnimationStart"),Ta("dblclick","onDoubleClick"),Ta("focusin","onFocus"),Ta("focusout","onBlur"),Ta(cC,"onTransitionRun"),Ta(uC,"onTransitionStart"),Ta(dC,"onTransitionCancel"),Ta(pb,"onTransitionEnd"),so("onMouseEnter",["mouseout","mouseover"]),so("onMouseLeave",["mouseout","mouseover"]),so("onPointerEnter",["pointerout","pointerover"]),so("onPointerLeave",["pointerout","pointerover"]),_r("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),_r("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),_r("onBeforeInput",["compositionend","keypress","textInput","paste"]),_r("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),_r("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),_r("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xl="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(" "),XC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Xl));function Dy(t,a){a=(a&4)!==0;for(var o=0;o<t.length;o++){var u=t[o],p=u.event;u=u.listeners;e:{var b=void 0;if(a)for(var T=u.length-1;0<=T;T--){var z=u[T],X=z.instance,ae=z.currentTarget;if(z=z.listener,X!==b&&p.isPropagationStopped())break e;b=z,p.currentTarget=ae;try{b(p)}catch(de){xc(de)}p.currentTarget=null,b=X}else for(T=0;T<u.length;T++){if(z=u[T],X=z.instance,ae=z.currentTarget,z=z.listener,X!==b&&p.isPropagationStopped())break e;b=z,p.currentTarget=ae;try{b(p)}catch(de){xc(de)}p.currentTarget=null,b=X}}}}function mt(t,a){var o=a[oc];o===void 0&&(o=a[oc]=new Set);var u=t+"__bubble";o.has(u)||(Ly(a,t,2,!1),o.add(u))}function Im(t,a,o){var u=0;a&&(u|=4),Ly(o,t,u,a)}var au="_reactListening"+Math.random().toString(36).slice(2);function Um(t){if(!t[au]){t[au]=!0,Nx.forEach(function(o){o!=="selectionchange"&&(XC.has(o)||Im(o,!1,t),Im(o,!0,t))});var a=t.nodeType===9?t:t.ownerDocument;a===null||a[au]||(a[au]=!0,Im("selectionchange",!1,a))}}function Ly(t,a,o,u){switch(d0(a)){case 2:var p=jE;break;case 8:p=SE;break;default:p=tp}o=p.bind(null,a,o,t),p=void 0,!rf||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(p=!0),u?p!==void 0?t.addEventListener(a,o,{capture:!0,passive:p}):t.addEventListener(a,o,!0):p!==void 0?t.addEventListener(a,o,{passive:p}):t.addEventListener(a,o,!1)}function Hm(t,a,o,u,p){var b=u;if((a&1)===0&&(a&2)===0&&u!==null)e:for(;;){if(u===null)return;var T=u.tag;if(T===3||T===4){var z=u.stateNode.containerInfo;if(z===p)break;if(T===4)for(T=u.return;T!==null;){var X=T.tag;if((X===3||X===4)&&T.stateNode.containerInfo===p)return;T=T.return}for(;z!==null;){if(T=to(z),T===null)return;if(X=T.tag,X===5||X===6||X===26||X===27){u=b=T;continue e}z=z.parentNode}}u=u.return}Hx(function(){var ae=b,de=af(o),pe=[];e:{var se=gb.get(t);if(se!==void 0){var le=pc,Le=t;switch(t){case"keypress":if(fc(o)===0)break e;case"keydown":case"keyup":le=H2;break;case"focusin":Le="focus",le=uf;break;case"focusout":Le="blur",le=uf;break;case"beforeblur":case"afterblur":le=uf;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=$x;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=N2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=$2;break;case db:case fb:case mb:le=M2;break;case pb:le=Y2;break;case"scroll":case"scrollend":le=k2;break;case"wheel":le=X2;break;case"copy":case"cut":case"paste":le=z2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=Yx;break;case"toggle":case"beforetoggle":le=Q2}var Xe=(a&4)!==0,zt=!Xe&&(t==="scroll"||t==="scrollend"),ee=Xe?se!==null?se+"Capture":null:se;Xe=[];for(var J=ae,ne;J!==null;){var me=J;if(ne=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||ne===null||ee===null||(me=hl(J,ee),me!=null&&Xe.push(Kl(J,me,ne))),zt)break;J=J.return}0<Xe.length&&(se=new le(se,Le,null,o,de),pe.push({event:se,listeners:Xe}))}}if((a&7)===0){e:{if(se=t==="mouseover"||t==="pointerover",le=t==="mouseout"||t==="pointerout",se&&o!==nf&&(Le=o.relatedTarget||o.fromElement)&&(to(Le)||Le[yr]))break e;if((le||se)&&(se=de.window===de?de:(se=de.ownerDocument)?se.defaultView||se.parentWindow:window,le?(Le=o.relatedTarget||o.toElement,le=ae,Le=Le?to(Le):null,Le!==null&&(zt=c(Le),Xe=Le.tag,Le!==zt||Xe!==5&&Xe!==27&&Xe!==6)&&(Le=null)):(le=null,Le=ae),le!==Le)){if(Xe=$x,me="onMouseLeave",ee="onMouseEnter",J="mouse",(t==="pointerout"||t==="pointerover")&&(Xe=Yx,me="onPointerLeave",ee="onPointerEnter",J="pointer"),zt=le==null?se:gl(le),ne=Le==null?se:gl(Le),se=new Xe(me,J+"leave",le,o,de),se.target=zt,se.relatedTarget=ne,me=null,to(de)===ae&&(Xe=new Xe(ee,J+"enter",Le,o,de),Xe.target=ne,Xe.relatedTarget=zt,me=Xe),zt=me,le&&Le)t:{for(Xe=KC,ee=le,J=Le,ne=0,me=ee;me;me=Xe(me))ne++;me=0;for(var Ve=J;Ve;Ve=Xe(Ve))me++;for(;0<ne-me;)ee=Xe(ee),ne--;for(;0<me-ne;)J=Xe(J),me--;for(;ne--;){if(ee===J||J!==null&&ee===J.alternate){Xe=ee;break t}ee=Xe(ee),J=Xe(J)}Xe=null}else Xe=null;le!==null&&Py(pe,se,le,Xe,!1),Le!==null&&zt!==null&&Py(pe,zt,Le,Xe,!0)}}e:{if(se=ae?gl(ae):window,le=se.nodeName&&se.nodeName.toLowerCase(),le==="select"||le==="input"&&se.type==="file")var jt=eb;else if(Jx(se))if(tb)jt=oC;else{jt=sC;var Be=aC}else le=se.nodeName,!le||le.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ae&&tf(ae.elementType)&&(jt=eb):jt=rC;if(jt&&(jt=jt(t,ae))){Wx(pe,jt,o,de);break e}Be&&Be(t,se,ae),t==="focusout"&&ae&&se.type==="number"&&ae.memoizedProps.value!=null&&ef(se,"number",se.value)}switch(Be=ae?gl(ae):window,t){case"focusin":(Jx(Be)||Be.contentEditable==="true")&&(uo=Be,hf=ae,wl=null);break;case"focusout":wl=hf=uo=null;break;case"mousedown":xf=!0;break;case"contextmenu":case"mouseup":case"dragend":xf=!1,cb(pe,o,de);break;case"selectionchange":if(iC)break;case"keydown":case"keyup":cb(pe,o,de)}var at;if(ff)e:{switch(t){case"compositionstart":var gt="onCompositionStart";break e;case"compositionend":gt="onCompositionEnd";break e;case"compositionupdate":gt="onCompositionUpdate";break e}gt=void 0}else co?Qx(t,o)&&(gt="onCompositionEnd"):t==="keydown"&&o.keyCode===229&&(gt="onCompositionStart");gt&&(Fx&&o.locale!=="ko"&&(co||gt!=="onCompositionStart"?gt==="onCompositionEnd"&&co&&(at=qx()):(Os=de,of="value"in Os?Os.value:Os.textContent,co=!0)),Be=su(ae,gt),0<Be.length&&(gt=new Gx(gt,t,null,o,de),pe.push({event:gt,listeners:Be}),at?gt.data=at:(at=Zx(o),at!==null&&(gt.data=at)))),(at=J2?W2(t,o):eC(t,o))&&(gt=su(ae,"onBeforeInput"),0<gt.length&&(Be=new Gx("onBeforeInput","beforeinput",null,o,de),pe.push({event:Be,listeners:gt}),Be.data=at)),GC(pe,t,ae,o,de)}Dy(pe,a)})}function Kl(t,a,o){return{instance:t,listener:a,currentTarget:o}}function su(t,a){for(var o=a+"Capture",u=[];t!==null;){var p=t,b=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||b===null||(p=hl(t,o),p!=null&&u.unshift(Kl(t,p,b)),p=hl(t,a),p!=null&&u.push(Kl(t,p,b))),t.tag===3)return u;t=t.return}return[]}function KC(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Py(t,a,o,u,p){for(var b=a._reactName,T=[];o!==null&&o!==u;){var z=o,X=z.alternate,ae=z.stateNode;if(z=z.tag,X!==null&&X===u)break;z!==5&&z!==26&&z!==27||ae===null||(X=ae,p?(ae=hl(o,b),ae!=null&&T.unshift(Kl(o,ae,X))):p||(ae=hl(o,b),ae!=null&&T.push(Kl(o,ae,X)))),o=o.return}T.length!==0&&t.push({event:a,listeners:T})}var QC=/\r\n?/g,ZC=/\u0000|\uFFFD/g;function By(t){return(typeof t=="string"?t:""+t).replace(QC,`
|
|
49
|
+
`).replace(ZC,"")}function Iy(t,a){return a=By(a),By(t)===a}function Ot(t,a,o,u,p,b){switch(o){case"children":typeof u=="string"?a==="body"||a==="textarea"&&u===""||oo(t,u):(typeof u=="number"||typeof u=="bigint")&&a!=="body"&&oo(t,""+u);break;case"className":ic(t,"class",u);break;case"tabIndex":ic(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":ic(t,o,u);break;case"style":Ix(t,u,b);break;case"data":if(a!=="object"){ic(t,"data",u);break}case"src":case"href":if(u===""&&(a!=="a"||o!=="href")){t.removeAttribute(o);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(o);break}u=uc(""+u),t.setAttribute(o,u);break;case"action":case"formAction":if(typeof u=="function"){t.setAttribute(o,"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 b=="function"&&(o==="formAction"?(a!=="input"&&Ot(t,a,"name",p.name,p,null),Ot(t,a,"formEncType",p.formEncType,p,null),Ot(t,a,"formMethod",p.formMethod,p,null),Ot(t,a,"formTarget",p.formTarget,p,null)):(Ot(t,a,"encType",p.encType,p,null),Ot(t,a,"method",p.method,p,null),Ot(t,a,"target",p.target,p,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(o);break}u=uc(""+u),t.setAttribute(o,u);break;case"onClick":u!=null&&(t.onclick=as);break;case"onScroll":u!=null&&mt("scroll",t);break;case"onScrollEnd":u!=null&&mt("scrollend",t);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(o=u.__html,o!=null){if(p.children!=null)throw Error(r(60));t.innerHTML=o}}break;case"multiple":t.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":t.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){t.removeAttribute("xlink:href");break}o=uc(""+u),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(o,""+u):t.removeAttribute(o);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":u&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(o,""):t.removeAttribute(o);break;case"capture":case"download":u===!0?t.setAttribute(o,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(o,u):t.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?t.setAttribute(o,u):t.removeAttribute(o);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?t.removeAttribute(o):t.setAttribute(o,u);break;case"popover":mt("beforetoggle",t),mt("toggle",t),lc(t,"popover",u);break;case"xlinkActuate":ns(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":ns(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":ns(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":ns(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":ns(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":ns(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":ns(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":ns(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":ns(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":lc(t,"is",u);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=C2.get(o)||o,lc(t,o,u))}}function qm(t,a,o,u,p,b){switch(o){case"style":Ix(t,u,b);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(o=u.__html,o!=null){if(p.children!=null)throw Error(r(60));t.innerHTML=o}}break;case"children":typeof u=="string"?oo(t,u):(typeof u=="number"||typeof u=="bigint")&&oo(t,""+u);break;case"onScroll":u!=null&&mt("scroll",t);break;case"onScrollEnd":u!=null&&mt("scrollend",t);break;case"onClick":u!=null&&(t.onclick=as);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Tx.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(p=o.endsWith("Capture"),a=o.slice(2,p?o.length-7:void 0),b=t[un]||null,b=b!=null?b[o]:null,typeof b=="function"&&t.removeEventListener(a,b,p),typeof u=="function")){typeof b!="function"&&b!==null&&(o in t?t[o]=null:t.hasAttribute(o)&&t.removeAttribute(o)),t.addEventListener(a,u,p);break e}o in t?t[o]=u:u===!0?t.setAttribute(o,""):lc(t,o,u)}}}function wn(t,a,o){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":mt("error",t),mt("load",t);var u=!1,p=!1,b;for(b in o)if(o.hasOwnProperty(b)){var T=o[b];if(T!=null)switch(b){case"src":u=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:Ot(t,a,b,T,o,null)}}p&&Ot(t,a,"srcSet",o.srcSet,o,null),u&&Ot(t,a,"src",o.src,o,null);return;case"input":mt("invalid",t);var z=b=T=p=null,X=null,ae=null;for(u in o)if(o.hasOwnProperty(u)){var de=o[u];if(de!=null)switch(u){case"name":p=de;break;case"type":T=de;break;case"checked":X=de;break;case"defaultChecked":ae=de;break;case"value":b=de;break;case"defaultValue":z=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(r(137,a));break;default:Ot(t,a,u,de,o,null)}}Dx(t,b,z,X,ae,T,p,!1);return;case"select":mt("invalid",t),u=T=b=null;for(p in o)if(o.hasOwnProperty(p)&&(z=o[p],z!=null))switch(p){case"value":b=z;break;case"defaultValue":T=z;break;case"multiple":u=z;default:Ot(t,a,p,z,o,null)}a=b,o=T,t.multiple=!!u,a!=null?ro(t,!!u,a,!1):o!=null&&ro(t,!!u,o,!0);return;case"textarea":mt("invalid",t),b=p=u=null;for(T in o)if(o.hasOwnProperty(T)&&(z=o[T],z!=null))switch(T){case"value":u=z;break;case"defaultValue":p=z;break;case"children":b=z;break;case"dangerouslySetInnerHTML":if(z!=null)throw Error(r(91));break;default:Ot(t,a,T,z,o,null)}Px(t,u,p,b);return;case"option":for(X in o)if(o.hasOwnProperty(X)&&(u=o[X],u!=null))switch(X){case"selected":t.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:Ot(t,a,X,u,o,null)}return;case"dialog":mt("beforetoggle",t),mt("toggle",t),mt("cancel",t),mt("close",t);break;case"iframe":case"object":mt("load",t);break;case"video":case"audio":for(u=0;u<Xl.length;u++)mt(Xl[u],t);break;case"image":mt("error",t),mt("load",t);break;case"details":mt("toggle",t);break;case"embed":case"source":case"link":mt("error",t),mt("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in o)if(o.hasOwnProperty(ae)&&(u=o[ae],u!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:Ot(t,a,ae,u,o,null)}return;default:if(tf(a)){for(de in o)o.hasOwnProperty(de)&&(u=o[de],u!==void 0&&qm(t,a,de,u,o,void 0));return}}for(z in o)o.hasOwnProperty(z)&&(u=o[z],u!=null&&Ot(t,a,z,u,o,null))}function JC(t,a,o,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,b=null,T=null,z=null,X=null,ae=null,de=null;for(le in o){var pe=o[le];if(o.hasOwnProperty(le)&&pe!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":X=pe;default:u.hasOwnProperty(le)||Ot(t,a,le,null,u,pe)}}for(var se in u){var le=u[se];if(pe=o[se],u.hasOwnProperty(se)&&(le!=null||pe!=null))switch(se){case"type":b=le;break;case"name":p=le;break;case"checked":ae=le;break;case"defaultChecked":de=le;break;case"value":T=le;break;case"defaultValue":z=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(r(137,a));break;default:le!==pe&&Ot(t,a,se,le,u,pe)}}Wd(t,T,z,X,ae,de,b,p);return;case"select":le=T=z=se=null;for(b in o)if(X=o[b],o.hasOwnProperty(b)&&X!=null)switch(b){case"value":break;case"multiple":le=X;default:u.hasOwnProperty(b)||Ot(t,a,b,null,u,X)}for(p in u)if(b=u[p],X=o[p],u.hasOwnProperty(p)&&(b!=null||X!=null))switch(p){case"value":se=b;break;case"defaultValue":z=b;break;case"multiple":T=b;default:b!==X&&Ot(t,a,p,b,u,X)}a=z,o=T,u=le,se!=null?ro(t,!!o,se,!1):!!u!=!!o&&(a!=null?ro(t,!!o,a,!0):ro(t,!!o,o?[]:"",!1));return;case"textarea":le=se=null;for(z in o)if(p=o[z],o.hasOwnProperty(z)&&p!=null&&!u.hasOwnProperty(z))switch(z){case"value":break;case"children":break;default:Ot(t,a,z,null,u,p)}for(T in u)if(p=u[T],b=o[T],u.hasOwnProperty(T)&&(p!=null||b!=null))switch(T){case"value":se=p;break;case"defaultValue":le=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(r(91));break;default:p!==b&&Ot(t,a,T,p,u,b)}Lx(t,se,le);return;case"option":for(var Le in o)if(se=o[Le],o.hasOwnProperty(Le)&&se!=null&&!u.hasOwnProperty(Le))switch(Le){case"selected":t.selected=!1;break;default:Ot(t,a,Le,null,u,se)}for(X in u)if(se=u[X],le=o[X],u.hasOwnProperty(X)&&se!==le&&(se!=null||le!=null))switch(X){case"selected":t.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:Ot(t,a,X,se,u,le)}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 Xe in o)se=o[Xe],o.hasOwnProperty(Xe)&&se!=null&&!u.hasOwnProperty(Xe)&&Ot(t,a,Xe,null,u,se);for(ae in u)if(se=u[ae],le=o[ae],u.hasOwnProperty(ae)&&se!==le&&(se!=null||le!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,a));break;default:Ot(t,a,ae,se,u,le)}return;default:if(tf(a)){for(var zt in o)se=o[zt],o.hasOwnProperty(zt)&&se!==void 0&&!u.hasOwnProperty(zt)&&qm(t,a,zt,void 0,u,se);for(de in u)se=u[de],le=o[de],!u.hasOwnProperty(de)||se===le||se===void 0&&le===void 0||qm(t,a,de,se,u,le);return}}for(var ee in o)se=o[ee],o.hasOwnProperty(ee)&&se!=null&&!u.hasOwnProperty(ee)&&Ot(t,a,ee,null,u,se);for(pe in u)se=u[pe],le=o[pe],!u.hasOwnProperty(pe)||se===le||se==null&&le==null||Ot(t,a,pe,se,u,le)}function Uy(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function WC(){if(typeof performance.getEntriesByType=="function"){for(var t=0,a=0,o=performance.getEntriesByType("resource"),u=0;u<o.length;u++){var p=o[u],b=p.transferSize,T=p.initiatorType,z=p.duration;if(b&&z&&Uy(T)){for(T=0,z=p.responseEnd,u+=1;u<o.length;u++){var X=o[u],ae=X.startTime;if(ae>z)break;var de=X.transferSize,pe=X.initiatorType;de&&Uy(pe)&&(X=X.responseEnd,T+=de*(X<z?1:(z-ae)/(X-ae)))}if(--u,a+=8*(b+T)/(p.duration/1e3),t++,10<t)break}}if(0<t)return a/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Vm=null,$m=null;function ru(t){return t.nodeType===9?t:t.ownerDocument}function Hy(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function qy(t,a){if(t===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&a==="foreignObject"?0:t}function Gm(t,a){return t==="textarea"||t==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Ym=null;function eE(){var t=window.event;return t&&t.type==="popstate"?t===Ym?!1:(Ym=t,!0):(Ym=null,!1)}var Vy=typeof setTimeout=="function"?setTimeout:void 0,tE=typeof clearTimeout=="function"?clearTimeout:void 0,$y=typeof Promise=="function"?Promise:void 0,nE=typeof queueMicrotask=="function"?queueMicrotask:typeof $y<"u"?function(t){return $y.resolve(null).then(t).catch(aE)}:Vy;function aE(t){setTimeout(function(){throw t})}function Qs(t){return t==="head"}function Gy(t,a){var o=a,u=0;do{var p=o.nextSibling;if(t.removeChild(o),p&&p.nodeType===8)if(o=p.data,o==="/$"||o==="/&"){if(u===0){t.removeChild(p),Bo(a);return}u--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")u++;else if(o==="html")Ql(t.ownerDocument.documentElement);else if(o==="head"){o=t.ownerDocument.head,Ql(o);for(var b=o.firstChild;b;){var T=b.nextSibling,z=b.nodeName;b[pl]||z==="SCRIPT"||z==="STYLE"||z==="LINK"&&b.rel.toLowerCase()==="stylesheet"||o.removeChild(b),b=T}}else o==="body"&&Ql(t.ownerDocument.body);o=p}while(o);Bo(a)}function Yy(t,a){var o=t;t=0;do{var u=o.nextSibling;if(o.nodeType===1?a?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(a?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),u&&u.nodeType===8)if(o=u.data,o==="/$"){if(t===0)break;t--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||t++;o=u}while(o)}function Fm(t){var a=t.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var o=a;switch(a=a.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":Fm(o),Zd(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}t.removeChild(o)}}function sE(t,a,o,u){for(;t.nodeType===1;){var p=o;if(t.nodeName.toLowerCase()!==a.toLowerCase()){if(!u&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(u){if(!t[pl])switch(a){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(b=t.getAttribute("rel"),b==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(b!==p.rel||t.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||t.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||t.getAttribute("title")!==(p.title==null?null:p.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(b=t.getAttribute("src"),(b!==(p.src==null?null:p.src)||t.getAttribute("type")!==(p.type==null?null:p.type)||t.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&b&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(a==="input"&&t.type==="hidden"){var b=p.name==null?null:""+p.name;if(p.type==="hidden"&&t.getAttribute("name")===b)return t}else return t;if(t=Sa(t.nextSibling),t===null)break}return null}function rE(t,a,o){if(a==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!o||(t=Sa(t.nextSibling),t===null))return null;return t}function Fy(t,a){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Sa(t.nextSibling),t===null))return null;return t}function Xm(t){return t.data==="$?"||t.data==="$~"}function Km(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function oE(t,a){var o=t.ownerDocument;if(t.data==="$~")t._reactRetry=a;else if(t.data!=="$?"||o.readyState!=="loading")a();else{var u=function(){a(),o.removeEventListener("DOMContentLoaded",u)};o.addEventListener("DOMContentLoaded",u),t._reactRetry=u}}function Sa(t){for(;t!=null;t=t.nextSibling){var a=t.nodeType;if(a===1||a===3)break;if(a===8){if(a=t.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return t}var Qm=null;function Xy(t){t=t.nextSibling;for(var a=0;t;){if(t.nodeType===8){var o=t.data;if(o==="/$"||o==="/&"){if(a===0)return Sa(t.nextSibling);a--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||a++}t=t.nextSibling}return null}function Ky(t){t=t.previousSibling;for(var a=0;t;){if(t.nodeType===8){var o=t.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(a===0)return t;a--}else o!=="/$"&&o!=="/&"||a++}t=t.previousSibling}return null}function Qy(t,a,o){switch(a=ru(o),t){case"html":if(t=a.documentElement,!t)throw Error(r(452));return t;case"head":if(t=a.head,!t)throw Error(r(453));return t;case"body":if(t=a.body,!t)throw Error(r(454));return t;default:throw Error(r(451))}}function Ql(t){for(var a=t.attributes;a.length;)t.removeAttributeNode(a[0]);Zd(t)}var wa=new Map,Zy=new Set;function ou(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var vs=G.d;G.d={f:lE,r:iE,D:cE,C:uE,L:dE,m:fE,X:pE,S:mE,M:gE};function lE(){var t=vs.f(),a=Zc();return t||a}function iE(t){var a=no(t);a!==null&&a.tag===5&&a.type==="form"?pv(a):vs.r(t)}var Do=typeof document>"u"?null:document;function Jy(t,a,o){var u=Do;if(u&&typeof a=="string"&&a){var p=ha(a);p='link[rel="'+t+'"][href="'+p+'"]',typeof o=="string"&&(p+='[crossorigin="'+o+'"]'),Zy.has(p)||(Zy.add(p),t={rel:t,crossOrigin:o,href:a},u.querySelector(p)===null&&(a=u.createElement("link"),wn(a,"link",t),xn(a),u.head.appendChild(a)))}}function cE(t){vs.D(t),Jy("dns-prefetch",t,null)}function uE(t,a){vs.C(t,a),Jy("preconnect",t,a)}function dE(t,a,o){vs.L(t,a,o);var u=Do;if(u&&t&&a){var p='link[rel="preload"][as="'+ha(a)+'"]';a==="image"&&o&&o.imageSrcSet?(p+='[imagesrcset="'+ha(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(p+='[imagesizes="'+ha(o.imageSizes)+'"]')):p+='[href="'+ha(t)+'"]';var b=p;switch(a){case"style":b=Lo(t);break;case"script":b=Po(t)}wa.has(b)||(t=x({rel:"preload",href:a==="image"&&o&&o.imageSrcSet?void 0:t,as:a},o),wa.set(b,t),u.querySelector(p)!==null||a==="style"&&u.querySelector(Zl(b))||a==="script"&&u.querySelector(Jl(b))||(a=u.createElement("link"),wn(a,"link",t),xn(a),u.head.appendChild(a)))}}function fE(t,a){vs.m(t,a);var o=Do;if(o&&t){var u=a&&typeof a.as=="string"?a.as:"script",p='link[rel="modulepreload"][as="'+ha(u)+'"][href="'+ha(t)+'"]',b=p;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=Po(t)}if(!wa.has(b)&&(t=x({rel:"modulepreload",href:t},a),wa.set(b,t),o.querySelector(p)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Jl(b)))return}u=o.createElement("link"),wn(u,"link",t),xn(u),o.head.appendChild(u)}}}function mE(t,a,o){vs.S(t,a,o);var u=Do;if(u&&t){var p=ao(u).hoistableStyles,b=Lo(t);a=a||"default";var T=p.get(b);if(!T){var z={loading:0,preload:null};if(T=u.querySelector(Zl(b)))z.loading=5;else{t=x({rel:"stylesheet",href:t,"data-precedence":a},o),(o=wa.get(b))&&Zm(t,o);var X=T=u.createElement("link");xn(X),wn(X,"link",t),X._p=new Promise(function(ae,de){X.onload=ae,X.onerror=de}),X.addEventListener("load",function(){z.loading|=1}),X.addEventListener("error",function(){z.loading|=2}),z.loading|=4,lu(T,a,u)}T={type:"stylesheet",instance:T,count:1,state:z},p.set(b,T)}}}function pE(t,a){vs.X(t,a);var o=Do;if(o&&t){var u=ao(o).hoistableScripts,p=Po(t),b=u.get(p);b||(b=o.querySelector(Jl(p)),b||(t=x({src:t,async:!0},a),(a=wa.get(p))&&Jm(t,a),b=o.createElement("script"),xn(b),wn(b,"link",t),o.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},u.set(p,b))}}function gE(t,a){vs.M(t,a);var o=Do;if(o&&t){var u=ao(o).hoistableScripts,p=Po(t),b=u.get(p);b||(b=o.querySelector(Jl(p)),b||(t=x({src:t,async:!0,type:"module"},a),(a=wa.get(p))&&Jm(t,a),b=o.createElement("script"),xn(b),wn(b,"link",t),o.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},u.set(p,b))}}function Wy(t,a,o,u){var p=(p=ie.current)?ou(p):null;if(!p)throw Error(r(446));switch(t){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(a=Lo(o.href),o=ao(p).hoistableStyles,u=o.get(a),u||(u={type:"style",instance:null,count:0,state:null},o.set(a,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){t=Lo(o.href);var b=ao(p).hoistableStyles,T=b.get(t);if(T||(p=p.ownerDocument||p,T={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(t,T),(b=p.querySelector(Zl(t)))&&!b._p&&(T.instance=b,T.state.loading=5),wa.has(t)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},wa.set(t,o),b||hE(p,t,o,T.state))),a&&u===null)throw Error(r(528,""));return T}if(a&&u!==null)throw Error(r(529,""));return null;case"script":return a=o.async,o=o.src,typeof o=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Po(o),o=ao(p).hoistableScripts,u=o.get(a),u||(u={type:"script",instance:null,count:0,state:null},o.set(a,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,t))}}function Lo(t){return'href="'+ha(t)+'"'}function Zl(t){return'link[rel="stylesheet"]['+t+"]"}function e0(t){return x({},t,{"data-precedence":t.precedence,precedence:null})}function hE(t,a,o,u){t.querySelector('link[rel="preload"][as="style"]['+a+"]")?u.loading=1:(a=t.createElement("link"),u.preload=a,a.addEventListener("load",function(){return u.loading|=1}),a.addEventListener("error",function(){return u.loading|=2}),wn(a,"link",o),xn(a),t.head.appendChild(a))}function Po(t){return'[src="'+ha(t)+'"]'}function Jl(t){return"script[async]"+t}function t0(t,a,o){if(a.count++,a.instance===null)switch(a.type){case"style":var u=t.querySelector('style[data-href~="'+ha(o.href)+'"]');if(u)return a.instance=u,xn(u),u;var p=x({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),xn(u),wn(u,"style",p),lu(u,o.precedence,t),a.instance=u;case"stylesheet":p=Lo(o.href);var b=t.querySelector(Zl(p));if(b)return a.state.loading|=4,a.instance=b,xn(b),b;u=e0(o),(p=wa.get(p))&&Zm(u,p),b=(t.ownerDocument||t).createElement("link"),xn(b);var T=b;return T._p=new Promise(function(z,X){T.onload=z,T.onerror=X}),wn(b,"link",u),a.state.loading|=4,lu(b,o.precedence,t),a.instance=b;case"script":return b=Po(o.src),(p=t.querySelector(Jl(b)))?(a.instance=p,xn(p),p):(u=o,(p=wa.get(b))&&(u=x({},o),Jm(u,p)),t=t.ownerDocument||t,p=t.createElement("script"),xn(p),wn(p,"link",u),t.head.appendChild(p),a.instance=p);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(u=a.instance,a.state.loading|=4,lu(u,o.precedence,t));return a.instance}function lu(t,a,o){for(var u=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=u.length?u[u.length-1]:null,b=p,T=0;T<u.length;T++){var z=u[T];if(z.dataset.precedence===a)b=z;else if(b!==p)break}b?b.parentNode.insertBefore(t,b.nextSibling):(a=o.nodeType===9?o.head:o,a.insertBefore(t,a.firstChild))}function Zm(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.title==null&&(t.title=a.title)}function Jm(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.integrity==null&&(t.integrity=a.integrity)}var iu=null;function n0(t,a,o){if(iu===null){var u=new Map,p=iu=new Map;p.set(o,u)}else p=iu,u=p.get(o),u||(u=new Map,p.set(o,u));if(u.has(t))return u;for(u.set(t,null),o=o.getElementsByTagName(t),p=0;p<o.length;p++){var b=o[p];if(!(b[pl]||b[kt]||t==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var T=b.getAttribute(a)||"";T=t+T;var z=u.get(T);z?z.push(b):u.set(T,[b])}}return u}function a0(t,a,o){t=t.ownerDocument||t,t.head.insertBefore(o,a==="title"?t.querySelector("head > title"):null)}function xE(t,a,o){if(o===1||a.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return t=a.disabled,typeof a.precedence=="string"&&t==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function s0(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function bE(t,a,o,u){if(o.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var p=Lo(u.href),b=a.querySelector(Zl(p));if(b){a=b._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(t.count++,t=cu.bind(t),a.then(t,t)),o.state.loading|=4,o.instance=b,xn(b);return}b=a.ownerDocument||a,u=e0(u),(p=wa.get(p))&&Zm(u,p),b=b.createElement("link"),xn(b);var T=b;T._p=new Promise(function(z,X){T.onload=z,T.onerror=X}),wn(b,"link",u),o.instance=b}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(o,a),(a=o.state.preload)&&(o.state.loading&3)===0&&(t.count++,o=cu.bind(t),a.addEventListener("load",o),a.addEventListener("error",o))}}var Wm=0;function vE(t,a){return t.stylesheets&&t.count===0&&du(t,t.stylesheets),0<t.count||0<t.imgCount?function(o){var u=setTimeout(function(){if(t.stylesheets&&du(t,t.stylesheets),t.unsuspend){var b=t.unsuspend;t.unsuspend=null,b()}},6e4+a);0<t.imgBytes&&Wm===0&&(Wm=62500*WC());var p=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&du(t,t.stylesheets),t.unsuspend)){var b=t.unsuspend;t.unsuspend=null,b()}},(t.imgBytes>Wm?50:800)+a);return t.unsuspend=o,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(p)}}:null}function cu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)du(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var uu=null;function du(t,a){t.stylesheets=null,t.unsuspend!==null&&(t.count++,uu=new Map,a.forEach(yE,t),uu=null,cu.call(t))}function yE(t,a){if(!(a.state.loading&4)){var o=uu.get(t);if(o)var u=o.get(null);else{o=new Map,uu.set(t,o);for(var p=t.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b<p.length;b++){var T=p[b];(T.nodeName==="LINK"||T.getAttribute("media")!=="not all")&&(o.set(T.dataset.precedence,T),u=T)}u&&o.set(null,u)}p=a.instance,T=p.getAttribute("data-precedence"),b=o.get(T)||u,b===u&&o.set(null,p),o.set(T,p),this.count++,u=cu.bind(this),p.addEventListener("load",u),p.addEventListener("error",u),b?b.parentNode.insertBefore(p,b.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(p,t.firstChild)),a.state.loading|=4}}var Wl={$$typeof:N,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function _E(t,a,o,u,p,b,T,z,X){this.tag=1,this.containerInfo=t,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=ta(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ta(0),this.hiddenUpdates=ta(null),this.identifierPrefix=u,this.onUncaughtError=p,this.onCaughtError=b,this.onRecoverableError=T,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=X,this.incompleteTransitions=new Map}function r0(t,a,o,u,p,b,T,z,X,ae,de,pe){return t=new _E(t,a,o,T,X,ae,de,pe,z),a=1,b===!0&&(a|=24),b=sa(3,null,null,a),t.current=b,b.stateNode=t,a=Mf(),a.refCount++,t.pooledCache=a,a.refCount++,b.memoizedState={element:u,isDehydrated:o,cache:a},Lf(b),t}function o0(t){return t?(t=po,t):po}function l0(t,a,o,u,p,b){p=o0(p),u.context===null?u.context=p:u.pendingContext=p,u=Is(a),u.payload={element:o},b=b===void 0?null:b,b!==null&&(u.callback=b),o=Us(t,u,a),o!==null&&(Kn(o,t,a),Al(o,t,a))}function i0(t,a){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var o=t.retryLane;t.retryLane=o!==0&&o<a?o:a}}function ep(t,a){i0(t,a),(t=t.alternate)&&i0(t,a)}function c0(t){if(t.tag===13||t.tag===31){var a=Cr(t,67108864);a!==null&&Kn(a,t,67108864),ep(t,67108864)}}function u0(t){if(t.tag===13||t.tag===31){var a=ca();a=ts(a);var o=Cr(t,a);o!==null&&Kn(o,t,a),ep(t,a)}}var fu=!0;function jE(t,a,o,u){var p=H.T;H.T=null;var b=G.p;try{G.p=2,tp(t,a,o,u)}finally{G.p=b,H.T=p}}function SE(t,a,o,u){var p=H.T;H.T=null;var b=G.p;try{G.p=8,tp(t,a,o,u)}finally{G.p=b,H.T=p}}function tp(t,a,o,u){if(fu){var p=np(u);if(p===null)Hm(t,a,u,mu,o),f0(t,u);else if(CE(p,t,a,o,u))u.stopPropagation();else if(f0(t,u),a&4&&-1<wE.indexOf(t)){for(;p!==null;){var b=no(p);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var T=Wt(b.pendingLanes);if(T!==0){var z=b;for(z.pendingLanes|=2,z.entangledLanes|=2;T;){var X=1<<31-Bt(T);z.entanglements[1]|=X,T&=~X}$a(b),(wt&6)===0&&(Kc=ve()+500,Fl(0))}}break;case 31:case 13:z=Cr(b,2),z!==null&&Kn(z,b,2),Zc(),ep(b,2)}if(b=np(u),b===null&&Hm(t,a,u,mu,o),b===p)break;p=b}p!==null&&u.stopPropagation()}else Hm(t,a,u,null,o)}}function np(t){return t=af(t),ap(t)}var mu=null;function ap(t){if(mu=null,t=to(t),t!==null){var a=c(t);if(a===null)t=null;else{var o=a.tag;if(o===13){if(t=d(a),t!==null)return t;t=null}else if(o===31){if(t=f(a),t!==null)return t;t=null}else if(o===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;t=null}else a!==t&&(t=null)}}return mu=t,null}function d0(t){switch(t){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(re()){case ye:return 2;case je:return 8;case Pe:case Ze:return 32;case _t:return 268435456;default:return 32}default:return 32}}var sp=!1,Zs=null,Js=null,Ws=null,ei=new Map,ti=new Map,er=[],wE="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 f0(t,a){switch(t){case"focusin":case"focusout":Zs=null;break;case"dragenter":case"dragleave":Js=null;break;case"mouseover":case"mouseout":Ws=null;break;case"pointerover":case"pointerout":ei.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":ti.delete(a.pointerId)}}function ni(t,a,o,u,p,b){return t===null||t.nativeEvent!==b?(t={blockedOn:a,domEventName:o,eventSystemFlags:u,nativeEvent:b,targetContainers:[p]},a!==null&&(a=no(a),a!==null&&c0(a)),t):(t.eventSystemFlags|=u,a=t.targetContainers,p!==null&&a.indexOf(p)===-1&&a.push(p),t)}function CE(t,a,o,u,p){switch(a){case"focusin":return Zs=ni(Zs,t,a,o,u,p),!0;case"dragenter":return Js=ni(Js,t,a,o,u,p),!0;case"mouseover":return Ws=ni(Ws,t,a,o,u,p),!0;case"pointerover":var b=p.pointerId;return ei.set(b,ni(ei.get(b)||null,t,a,o,u,p)),!0;case"gotpointercapture":return b=p.pointerId,ti.set(b,ni(ti.get(b)||null,t,a,o,u,p)),!0}return!1}function m0(t){var a=to(t.target);if(a!==null){var o=c(a);if(o!==null){if(a=o.tag,a===13){if(a=d(o),a!==null){t.blockedOn=a,yn(t.priority,function(){u0(o)});return}}else if(a===31){if(a=f(o),a!==null){t.blockedOn=a,yn(t.priority,function(){u0(o)});return}}else if(a===3&&o.stateNode.current.memoizedState.isDehydrated){t.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}t.blockedOn=null}function pu(t){if(t.blockedOn!==null)return!1;for(var a=t.targetContainers;0<a.length;){var o=np(t.nativeEvent);if(o===null){o=t.nativeEvent;var u=new o.constructor(o.type,o);nf=u,o.target.dispatchEvent(u),nf=null}else return a=no(o),a!==null&&c0(a),t.blockedOn=o,!1;a.shift()}return!0}function p0(t,a,o){pu(t)&&o.delete(a)}function EE(){sp=!1,Zs!==null&&pu(Zs)&&(Zs=null),Js!==null&&pu(Js)&&(Js=null),Ws!==null&&pu(Ws)&&(Ws=null),ei.forEach(p0),ti.forEach(p0)}function gu(t,a){t.blockedOn===a&&(t.blockedOn=null,sp||(sp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,EE)))}var hu=null;function g0(t){hu!==t&&(hu=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){hu===t&&(hu=null);for(var a=0;a<t.length;a+=3){var o=t[a],u=t[a+1],p=t[a+2];if(typeof u!="function"){if(ap(u||o)===null)continue;break}var b=no(o);b!==null&&(t.splice(a,3),a-=3,nm(b,{pending:!0,data:p,method:o.method,action:u},u,p))}}))}function Bo(t){function a(X){return gu(X,t)}Zs!==null&&gu(Zs,t),Js!==null&&gu(Js,t),Ws!==null&&gu(Ws,t),ei.forEach(a),ti.forEach(a);for(var o=0;o<er.length;o++){var u=er[o];u.blockedOn===t&&(u.blockedOn=null)}for(;0<er.length&&(o=er[0],o.blockedOn===null);)m0(o),o.blockedOn===null&&er.shift();if(o=(t.ownerDocument||t).$$reactFormReplay,o!=null)for(u=0;u<o.length;u+=3){var p=o[u],b=o[u+1],T=p[un]||null;if(typeof b=="function")T||g0(o);else if(T){var z=null;if(b&&b.hasAttribute("formAction")){if(p=b,T=b[un]||null)z=T.formAction;else if(ap(p)!==null)continue}else z=T.action;typeof z=="function"?o[u+1]=z:(o.splice(u,3),u-=3),g0(o)}}}function h0(){function t(b){b.canIntercept&&b.info==="react-transition"&&b.intercept({handler:function(){return new Promise(function(T){return p=T})},focusReset:"manual",scroll:"manual"})}function a(){p!==null&&(p(),p=null),u||setTimeout(o,20)}function o(){if(!u&&!navigation.transition){var b=navigation.currentEntry;b&&b.url!=null&&navigation.navigate(b.url,{state:b.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,p=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(o,100),function(){u=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),p!==null&&(p(),p=null)}}}function rp(t){this._internalRoot=t}xu.prototype.render=rp.prototype.render=function(t){var a=this._internalRoot;if(a===null)throw Error(r(409));var o=a.current,u=ca();l0(o,u,t,a,null,null)},xu.prototype.unmount=rp.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var a=t.containerInfo;l0(t.current,2,null,t,null,null),Zc(),a[yr]=null}};function xu(t){this._internalRoot=t}xu.prototype.unstable_scheduleHydration=function(t){if(t){var a=At();t={blockedOn:null,target:t,priority:a};for(var o=0;o<er.length&&a!==0&&a<er[o].priority;o++);er.splice(o,0,t),o===0&&m0(t)}};var x0=n.version;if(x0!=="19.2.7")throw Error(r(527,x0,"19.2.7"));G.findDOMNode=function(t){var a=t._reactInternals;if(a===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=m(a),t=t!==null?h(t):null,t=t===null?null:t.stateNode,t};var kE={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var bu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!bu.isDisabled&&bu.supportsFiber)try{ut=bu.inject(kE),it=bu}catch{}}return si.createRoot=function(t,a){if(!i(t))throw Error(r(299));var o=!1,u="",p=wv,b=Cv,T=Ev;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(b=a.onCaughtError),a.onRecoverableError!==void 0&&(T=a.onRecoverableError)),a=r0(t,1,!1,null,null,o,u,null,p,b,T,h0),t[yr]=a.current,Um(t),new rp(a)},si.hydrateRoot=function(t,a,o){if(!i(t))throw Error(r(299));var u=!1,p="",b=wv,T=Cv,z=Ev,X=null;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(p=o.identifierPrefix),o.onUncaughtError!==void 0&&(b=o.onUncaughtError),o.onCaughtError!==void 0&&(T=o.onCaughtError),o.onRecoverableError!==void 0&&(z=o.onRecoverableError),o.formState!==void 0&&(X=o.formState)),a=r0(t,1,!0,a,o??null,u,p,X,b,T,z,h0),a.context=o0(null),o=a.current,u=ca(),u=ts(u),p=Is(u),p.callback=null,Us(o,p,u),o=u,a.current.lanes=o,Vn(a,o),$a(a),t[yr]=a.current,Um(t),new xu(a)},si.version="19.2.7",si}var k0;function BE(){if(k0)return ip.exports;k0=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(n){console.error(n)}}return e(),ip.exports=PE(),ip.exports}var IE=BE();const UE=th(IE);/**
|
|
50
|
+
* react-router v7.17.0
|
|
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 R0="popstate";function N0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function HE(e={}){function n(r,i){let c=i.state?.masked,{pathname:d,search:f,hash:g}=c||r.location;return _g("",{pathname:d,search:f,hash:g},i.state&&i.state.usr||null,i.state&&i.state.key||"default",c?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function s(r,i){return typeof i=="string"?i:Di(i)}return VE(n,s,null,e)}function Zt(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Ba(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function qE(){return Math.random().toString(36).substring(2,10)}function T0(e,n){return{usr:e.state,key:e.key,idx:n,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function _g(e,n,s=null,r,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?al(n):n,state:s,key:n&&n.key||r||qE(),mask:i}}function Di({pathname:e="/",search:n="",hash:s=""}){return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(e+=s.charAt(0)==="#"?s:"#"+s),e}function al(e){let n={};if(e){let s=e.indexOf("#");s>=0&&(n.hash=e.substring(s),e=e.substring(0,s));let r=e.indexOf("?");r>=0&&(n.search=e.substring(r),e=e.substring(0,r)),e&&(n.pathname=e)}return n}function VE(e,n,s,r={}){let{window:i=document.defaultView,v5Compat:c=!1}=r,d=i.history,f="POP",g=null,m=h();m==null&&(m=0,d.replaceState({...d.state,idx:m},""));function h(){return(d.state||{idx:null}).idx}function x(){f="POP";let j=h(),E=j==null?null:j-m;m=j,g&&g({action:f,location:_.location,delta:E})}function y(j,E){f="PUSH";let k=N0(j)?j:_g(_.location,j,E);m=h()+1;let N=T0(k,m),R=_.createHref(k.mask||k);try{d.pushState(N,"",R)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;i.location.assign(R)}c&&g&&g({action:f,location:_.location,delta:1})}function w(j,E){f="REPLACE";let k=N0(j)?j:_g(_.location,j,E);m=h();let N=T0(k,m),R=_.createHref(k.mask||k);d.replaceState(N,"",R),c&&g&&g({action:f,location:_.location,delta:0})}function S(j){return $E(i,j)}let _={get action(){return f},get location(){return e(i,d)},listen(j){if(g)throw new Error("A history only accepts one active listener");return i.addEventListener(R0,x),g=j,()=>{i.removeEventListener(R0,x),g=null}},createHref(j){return n(i,j)},createURL:S,encodeLocation(j){let E=S(j);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:y,replace:w,go(j){return d.go(j)}};return _}function $E(e,n,s=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),Zt(r,"No window.location.(origin|href) available to create URL");let i=typeof n=="string"?n:Di(n);return i=i.replace(/ $/,"%20"),!s&&i.startsWith("//")&&(i=r+i),new URL(i,r)}function L_(e,n,s="/"){return GE(e,n,s,!1)}function GE(e,n,s,r,i){let c=typeof n=="string"?al(n):n,d=Es(c.pathname||"/",s);if(d==null)return null;let f=YE(e),g=null,m=sk(d);for(let h=0;g==null&&h<f.length;++h)g=nk(f[h],m,r);return g}function YE(e){let n=P_(e);return FE(n),n}function P_(e,n=[],s=[],r="",i=!1){let c=(d,f,g=i,m)=>{let h={relativePath:m===void 0?d.path||"":m,caseSensitive:d.caseSensitive===!0,childrenIndex:f,route:d};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(r)&&g)return;Zt(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 x=Pa([r,h.relativePath]),y=s.concat(h);d.children&&d.children.length>0&&(Zt(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${x}".`),P_(d.children,n,y,x,g)),!(d.path==null&&!d.index)&&n.push({path:x,score:ek(x,d.index),routesMeta:y})};return e.forEach((d,f)=>{if(d.path===""||!d.path?.includes("?"))c(d,f);else for(let g of B_(d.path))c(d,f,!0,g)}),n}function B_(e){let n=e.split("/");if(n.length===0)return[];let[s,...r]=n,i=s.endsWith("?"),c=s.replace(/\?$/,"");if(r.length===0)return i?[c,""]:[c];let d=B_(r.join("/")),f=[];return f.push(...d.map(g=>g===""?c:[c,g].join("/"))),i&&f.push(...d),f.map(g=>e.startsWith("/")&&g===""?"/":g)}function FE(e){e.sort((n,s)=>n.score!==s.score?s.score-n.score:tk(n.routesMeta.map(r=>r.childrenIndex),s.routesMeta.map(r=>r.childrenIndex)))}var XE=/^:[\w-]+$/,KE=3,QE=2,ZE=1,JE=10,WE=-2,A0=e=>e==="*";function ek(e,n){let s=e.split("/"),r=s.length;return s.some(A0)&&(r+=WE),n&&(r+=QE),s.filter(i=>!A0(i)).reduce((i,c)=>i+(XE.test(c)?KE:c===""?ZE:JE),r)}function tk(e,n){return e.length===n.length&&e.slice(0,-1).every((r,i)=>r===n[i])?e[e.length-1]-n[n.length-1]:0}function nk(e,n,s=!1){let{routesMeta:r}=e,i={},c="/",d=[];for(let f=0;f<r.length;++f){let g=r[f],m=f===r.length-1,h=c==="/"?n:n.slice(c.length)||"/",x=Qu({path:g.relativePath,caseSensitive:g.caseSensitive,end:m},h),y=g.route;if(!x&&m&&s&&!r[r.length-1].route.index&&(x=Qu({path:g.relativePath,caseSensitive:g.caseSensitive,end:!1},h)),!x)return null;Object.assign(i,x.params),d.push({params:i,pathname:Pa([c,x.pathname]),pathnameBase:ik(Pa([c,x.pathnameBase])),route:y}),x.pathnameBase!=="/"&&(c=Pa([c,x.pathnameBase]))}return d}function Qu(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[s,r]=ak(e.path,e.caseSensitive,e.end),i=n.match(s);if(!i)return null;let c=i[0],d=c.replace(/(.)\/+$/,"$1"),f=i.slice(1);return{params:r.reduce((m,{paramName:h,isOptional:x},y)=>{if(h==="*"){let S=f[y]||"";d=c.slice(0,c.length-S.length).replace(/(.)\/+$/,"$1")}const w=f[y];return x&&!w?m[h]=void 0:m[h]=(w||"").replace(/%2F/g,"/"),m},{}),pathname:c,pathnameBase:d,pattern:e}}function ak(e,n=!1,s=!0){Ba(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,g,m,h)=>{if(r.push({paramName:f,isOptional:g!=null}),g){let x=h.charAt(m+d.length);return x&&x!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,n?void 0:"i"),r]}function sk(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return Ba(!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 (${n}).`),e}}function Es(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let s=n.endsWith("/")?n.length-1:n.length,r=e.charAt(s);return r&&r!=="/"?null:e.slice(s)||"/"}var rk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function ok(e,n="/"){let{pathname:s,search:r="",hash:i=""}=typeof e=="string"?al(e):e,c;return s?(s=U_(s),s.startsWith("/")?c=M0(s.substring(1),"/"):c=M0(s,n)):c=n,{pathname:c,search:ck(r),hash:uk(i)}}function M0(e,n){let s=Zu(n).split("/");return e.split("/").forEach(i=>{i===".."?s.length>1&&s.pop():i!=="."&&s.push(i)}),s.length>1?s.join("/"):"/"}function fp(e,n,s,r){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${s}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function lk(e){return e.filter((n,s)=>s===0||n.route.path&&n.route.path.length>0)}function I_(e){let n=lk(e);return n.map((s,r)=>r===n.length-1?s.pathname:s.pathnameBase)}function nh(e,n,s,r=!1){let i;typeof e=="string"?i=al(e):(i={...e},Zt(!i.pathname||!i.pathname.includes("?"),fp("?","pathname","search",i)),Zt(!i.pathname||!i.pathname.includes("#"),fp("#","pathname","hash",i)),Zt(!i.search||!i.search.includes("#"),fp("#","search","hash",i)));let c=e===""||i.pathname==="",d=c?"/":i.pathname,f;if(d==null)f=s;else{let x=n.length-1;if(!r&&d.startsWith("..")){let y=d.split("/");for(;y[0]==="..";)y.shift(),x-=1;i.pathname=y.join("/")}f=x>=0?n[x]:"/"}let g=ok(i,f),m=d&&d!=="/"&&d.endsWith("/"),h=(c||d===".")&&s.endsWith("/");return!g.pathname.endsWith("/")&&(m||h)&&(g.pathname+="/"),g}var U_=e=>e.replace(/\/\/+/g,"/"),Pa=e=>U_(e.join("/")),Zu=e=>e.replace(/\/+$/,""),ik=e=>Zu(e).replace(/^\/*/,"/"),ck=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,uk=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,dk=class{constructor(e,n,s,r=!1){this.status=e,this.statusText=n||"",this.internal=r,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}};function fk(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function mk(e){let n=e.map(s=>s.route.path).filter(Boolean);return Pa(n)||"/"}var H_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function q_(e,n){let s=e;if(typeof s!="string"||!rk.test(s))return{absoluteURL:void 0,isExternal:!1,to:s};let r=s,i=!1;if(H_)try{let c=new URL(window.location.href),d=s.startsWith("//")?new URL(c.protocol+s):new URL(s),f=Es(d.pathname,n);d.origin===c.origin&&f!=null?s=f+d.search+d.hash:i=!0}catch{Ba(!1,`<Link to="${s}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var V_=["POST","PUT","PATCH","DELETE"];new Set(V_);var pk=["GET",...V_];new Set(pk);var sl=v.createContext(null);sl.displayName="DataRouter";var jd=v.createContext(null);jd.displayName="DataRouterState";var $_=v.createContext(!1);function gk(){return v.useContext($_)}var G_=v.createContext({isTransitioning:!1});G_.displayName="ViewTransition";var hk=v.createContext(new Map);hk.displayName="Fetchers";var xk=v.createContext(null);xk.displayName="Await";var Ra=v.createContext(null);Ra.displayName="Navigation";var Qi=v.createContext(null);Qi.displayName="Location";var Qa=v.createContext({outlet:null,matches:[],isDataRoute:!1});Qa.displayName="Route";var ah=v.createContext(null);ah.displayName="RouteError";var Y_="REACT_ROUTER_ERROR",bk="REDIRECT",vk="ROUTE_ERROR_RESPONSE";function yk(e){if(e.startsWith(`${Y_}:${bk}:{`))try{let n=JSON.parse(e.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function _k(e){if(e.startsWith(`${Y_}:${vk}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new dk(n.status,n.statusText,n.data)}catch{}}function jk(e,{relative:n}={}){Zt(Zi(),"useHref() may be used only in the context of a <Router> component.");let{basename:s,navigator:r}=v.useContext(Ra),{hash:i,pathname:c,search:d}=Ji(e,{relative:n}),f=c;return s!=="/"&&(f=c==="/"?s:Pa([s,c])),r.createHref({pathname:f,search:d,hash:i})}function Zi(){return v.useContext(Qi)!=null}function ea(){return Zt(Zi(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(Qi).location}var F_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function X_(e){v.useContext(Ra).static||v.useLayoutEffect(e)}function Ua(){let{isDataRoute:e}=v.useContext(Qa);return e?Dk():Sk()}function Sk(){Zt(Zi(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(sl),{basename:n,navigator:s}=v.useContext(Ra),{matches:r}=v.useContext(Qa),{pathname:i}=ea(),c=JSON.stringify(I_(r)),d=v.useRef(!1);return X_(()=>{d.current=!0}),v.useCallback((g,m={})=>{if(Ba(d.current,F_),!d.current)return;if(typeof g=="number"){s.go(g);return}let h=nh(g,JSON.parse(c),i,m.relative==="path");e==null&&n!=="/"&&(h.pathname=h.pathname==="/"?n:Pa([n,h.pathname])),(m.replace?s.replace:s.push)(h,m.state,m)},[n,s,c,i,e])}v.createContext(null);function K_(){let{matches:e}=v.useContext(Qa);return e[e.length-1]?.params??{}}function Ji(e,{relative:n}={}){let{matches:s}=v.useContext(Qa),{pathname:r}=ea(),i=JSON.stringify(I_(s));return v.useMemo(()=>nh(e,JSON.parse(i),r,n==="path"),[e,i,r,n])}function wk(e,n){return Q_(e,n)}function Q_(e,n,s){Zt(Zi(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=v.useContext(Ra),{matches:i}=v.useContext(Qa),c=i[i.length-1],d=c?c.params:{},f=c?c.pathname:"/",g=c?c.pathnameBase:"/",m=c&&c.route;{let j=m&&m.path||"";J_(f,!m||j.endsWith("*")||j.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${j}">) 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="${j}"> to <Route path="${j==="/"?"*":`${j}/*`}">.`)}let h=ea(),x;if(n){let j=typeof n=="string"?al(n):n;Zt(g==="/"||j.pathname?.startsWith(g),`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 "${g}" but pathname "${j.pathname}" was given in the \`location\` prop.`),x=j}else x=h;let y=x.pathname||"/",w=y;if(g!=="/"){let j=g.replace(/^\//,"").split("/");w="/"+y.replace(/^\//,"").split("/").slice(j.length).join("/")}let S=s&&s.state.matches.length?s.state.matches.map(j=>Object.assign(j,{route:s.manifest[j.route.id]||j.route})):L_(e,{pathname:w});Ba(m||S!=null,`No routes matched location "${x.pathname}${x.search}${x.hash}" `),Ba(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 "${x.pathname}${x.search}${x.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 _=Nk(S&&S.map(j=>Object.assign({},j,{params:Object.assign({},d,j.params),pathname:Pa([g,r.encodeLocation?r.encodeLocation(j.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?g:Pa([g,r.encodeLocation?r.encodeLocation(j.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathnameBase])})),i,s);return n&&_?v.createElement(Qi.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...x},navigationType:"POP"}},_):_}function Ck(){let e=zk(),n=fk(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),s=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},c={padding:"2px 4px",backgroundColor:r},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:c},"ErrorBoundary")," or"," ",v.createElement("code",{style:c},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},n),s?v.createElement("pre",{style:i},s):null,d)}var Ek=v.createElement(Ck,null),Z_=class extends v.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,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):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 s=_k(e.digest);s&&(e=s)}let n=e!==void 0?v.createElement(Qa.Provider,{value:this.props.routeContext},v.createElement(ah.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?v.createElement(kk,{error:e},n):n}};Z_.contextType=$_;var mp=new WeakMap;function kk({children:e,error:n}){let{basename:s}=v.useContext(Ra);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let r=yk(n.digest);if(r){let i=mp.get(n);if(i)throw i;let c=q_(r.location,s);if(H_&&!mp.get(n))if(c.isExternal||r.reloadDocument)window.location.href=c.absoluteURL||c.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:r.replace}));throw mp.set(n,d),d}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c.absoluteURL||c.to}`})}}return e}function Rk({routeContext:e,match:n,children:s}){let r=v.useContext(sl);return r&&r.static&&r.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(Qa.Provider,{value:e},s)}function Nk(e,n=[],s){let r=s?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(n.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,c=r?.errors;if(c!=null){let h=i.findIndex(x=>x.route.id&&c?.[x.route.id]!==void 0);Zt(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),i=i.slice(0,Math.min(i.length,h+1))}let d=!1,f=-1;if(s&&r){d=r.renderFallback;for(let h=0;h<i.length;h++){let x=i[h];if((x.route.HydrateFallback||x.route.hydrateFallbackElement)&&(f=h),x.route.id){let{loaderData:y,errors:w}=r,S=x.route.loader&&!y.hasOwnProperty(x.route.id)&&(!w||w[x.route.id]===void 0);if(x.route.lazy||S){s.isStatic&&(d=!0),f>=0?i=i.slice(0,f+1):i=[i[0]];break}}}}let g=s?.onError,m=r&&g?(h,x)=>{g(h,{location:r.location,params:r.matches?.[0]?.params??{},pattern:mk(r.matches),errorInfo:x})}:void 0;return i.reduceRight((h,x,y)=>{let w,S=!1,_=null,j=null;r&&(w=c&&x.route.id?c[x.route.id]:void 0,_=x.route.errorElement||Ek,d&&(f<0&&y===0?(J_("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,j=null):f===y&&(S=!0,j=x.route.hydrateFallbackElement||null)));let E=n.concat(i.slice(0,y+1)),k=()=>{let N;return w?N=_:S?N=j:x.route.Component?N=v.createElement(x.route.Component,null):x.route.element?N=x.route.element:N=h,v.createElement(Rk,{match:x,routeContext:{outlet:h,matches:E,isDataRoute:r!=null},children:N})};return r&&(x.route.ErrorBoundary||x.route.errorElement||y===0)?v.createElement(Z_,{location:r.location,revalidation:r.revalidation,component:_,error:w,children:k(),routeContext:{outlet:null,matches:E,isDataRoute:!0},onError:m}):k()},null)}function sh(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Tk(e){let n=v.useContext(sl);return Zt(n,sh(e)),n}function Ak(e){let n=v.useContext(jd);return Zt(n,sh(e)),n}function Mk(e){let n=v.useContext(Qa);return Zt(n,sh(e)),n}function rh(e){let n=Mk(e),s=n.matches[n.matches.length-1];return Zt(s.route.id,`${e} can only be used on routes that contain a unique "id"`),s.route.id}function Ok(){return rh("useRouteId")}function zk(){let e=v.useContext(ah),n=Ak("useRouteError"),s=rh("useRouteError");return e!==void 0?e:n.errors?.[s]}function Dk(){let{router:e}=Tk("useNavigate"),n=rh("useNavigate"),s=v.useRef(!1);return X_(()=>{s.current=!0}),v.useCallback(async(i,c={})=>{Ba(s.current,F_),s.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:n,...c}))},[e,n])}var O0={};function J_(e,n,s){!n&&!O0[e]&&(O0[e]=!0,Ba(!1,s))}v.memo(Lk);function Lk({routes:e,manifest:n,future:s,state:r,isStatic:i,onError:c}){return Q_(e,void 0,{manifest:n,state:r,isStatic:i,onError:c})}function qt(e){Zt(!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 Pk({basename:e="/",children:n=null,location:s,navigationType:r="POP",navigator:i,static:c=!1,useTransitions:d}){Zt(!Zi(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),g=v.useMemo(()=>({basename:f,navigator:i,static:c,useTransitions:d,future:{}}),[f,i,c,d]);typeof s=="string"&&(s=al(s));let{pathname:m="/",search:h="",hash:x="",state:y=null,key:w="default",mask:S}=s,_=v.useMemo(()=>{let j=Es(m,f);return j==null?null:{location:{pathname:j,search:h,hash:x,state:y,key:w,mask:S},navigationType:r}},[f,m,h,x,y,w,r,S]);return Ba(_!=null,`<Router basename="${f}"> is not able to match the URL "${m}${h}${x}" because it does not start with the basename, so the <Router> won't render anything.`),_==null?null:v.createElement(Ra.Provider,{value:g},v.createElement(Qi.Provider,{children:n,value:_}))}function W_({children:e,location:n}){return wk(jg(e),n)}function jg(e,n=[]){let s=[];return v.Children.forEach(e,(r,i)=>{if(!v.isValidElement(r))return;let c=[...n,i];if(r.type===v.Fragment){s.push.apply(s,jg(r.props.children,c));return}Zt(r.type===qt,`[${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>`),Zt(!r.props.index||!r.props.children,"An index route cannot have child routes.");let d={id:r.props.id||c.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=jg(r.props.children,c)),s.push(d)}),s}var Hu="get",qu="application/x-www-form-urlencoded";function Sd(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Bk(e){return Sd(e)&&e.tagName.toLowerCase()==="button"}function Ik(e){return Sd(e)&&e.tagName.toLowerCase()==="form"}function Uk(e){return Sd(e)&&e.tagName.toLowerCase()==="input"}function Hk(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function qk(e,n){return e.button===0&&(!n||n==="_self")&&!Hk(e)}function Sg(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((n,s)=>{let r=e[s];return n.concat(Array.isArray(r)?r.map(i=>[s,i]):[[s,r]])},[]))}function Vk(e,n){let s=Sg(e);return n&&n.forEach((r,i)=>{s.has(i)||n.getAll(i).forEach(c=>{s.append(i,c)})}),s}var vu=null;function $k(){if(vu===null)try{new FormData(document.createElement("form"),0),vu=!1}catch{vu=!0}return vu}var Gk=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function pp(e){return e!=null&&!Gk.has(e)?(Ba(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${qu}"`),null):e}function Yk(e,n){let s,r,i,c,d;if(Ik(e)){let f=e.getAttribute("action");r=f?Es(f,n):null,s=e.getAttribute("method")||Hu,i=pp(e.getAttribute("enctype"))||qu,c=new FormData(e)}else if(Bk(e)||Uk(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 g=e.getAttribute("formaction")||f.getAttribute("action");if(r=g?Es(g,n):null,s=e.getAttribute("formmethod")||f.getAttribute("method")||Hu,i=pp(e.getAttribute("formenctype"))||pp(f.getAttribute("enctype"))||qu,c=new FormData(f,e),!$k()){let{name:m,type:h,value:x}=e;if(h==="image"){let y=m?`${m}.`:"";c.append(`${y}x`,"0"),c.append(`${y}y`,"0")}else m&&c.append(m,x)}}else{if(Sd(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=Hu,r=null,i=qu,d=e}return c&&i==="text/plain"&&(d=c,c=void 0),{action:r,method:s.toLowerCase(),encType:i,formData:c,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function oh(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function ej(e,n,s,r){let i=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return s?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname==="/"?i.pathname=`_root.${r}`:n&&Es(i.pathname,n)==="/"?i.pathname=`${Zu(n)}/_root.${r}`:i.pathname=`${Zu(i.pathname)}.${r}`,i}async function Fk(e,n){if(e.id in n)return n[e.id];try{let s=await import(e.module);return n[e.id]=s,s}catch(s){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(s),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Xk(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 Kk(e,n,s){let r=await Promise.all(e.map(async i=>{let c=n.routes[i.route.id];if(c){let d=await Fk(c,s);return d.links?d.links():[]}return[]}));return Wk(r.flat(1).filter(Xk).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function z0(e,n,s,r,i,c){let d=(g,m)=>s[m]?g.route.id!==s[m].route.id:!0,f=(g,m)=>s[m].pathname!==g.pathname||s[m].route.path?.endsWith("*")&&s[m].params["*"]!==g.params["*"];return c==="assets"?n.filter((g,m)=>d(g,m)||f(g,m)):c==="data"?n.filter((g,m)=>{let h=r.routes[g.route.id];if(!h||!h.hasLoader)return!1;if(d(g,m)||f(g,m))return!0;if(g.route.shouldRevalidate){let x=g.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:s[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:g.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function Qk(e,n,{includeHydrateFallback:s}={}){return Zk(e.map(r=>{let i=n.routes[r.route.id];if(!i)return[];let c=[i.module];return i.clientActionModule&&(c=c.concat(i.clientActionModule)),i.clientLoaderModule&&(c=c.concat(i.clientLoaderModule)),s&&i.hydrateFallbackModule&&(c=c.concat(i.hydrateFallbackModule)),i.imports&&(c=c.concat(i.imports)),c}).flat(1))}function Zk(e){return[...new Set(e)]}function Jk(e){let n={},s=Object.keys(e).sort();for(let r of s)n[r]=e[r];return n}function Wk(e,n){let s=new Set;return new Set(n),e.reduce((r,i)=>{let c=JSON.stringify(Jk(i));return s.has(c)||(s.add(c),r.push({key:c,link:i})),r},[])}function lh(){let e=v.useContext(sl);return oh(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function eR(){let e=v.useContext(jd);return oh(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var ih=v.createContext(void 0);ih.displayName="FrameworkContext";function ch(){let e=v.useContext(ih);return oh(e,"You must render this element inside a <HydratedRouter> element"),e}function tR(e,n){let s=v.useContext(ih),[r,i]=v.useState(!1),[c,d]=v.useState(!1),{onFocus:f,onBlur:g,onMouseEnter:m,onMouseLeave:h,onTouchStart:x}=n,y=v.useRef(null);v.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let _=E=>{E.forEach(k=>{d(k.isIntersecting)})},j=new IntersectionObserver(_,{threshold:.5});return y.current&&j.observe(y.current),()=>{j.disconnect()}}},[e]),v.useEffect(()=>{if(r){let _=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(_)}}},[r]);let w=()=>{i(!0)},S=()=>{i(!1),d(!1)};return s?e!=="intent"?[c,y,{}]:[c,y,{onFocus:ri(f,w),onBlur:ri(g,S),onMouseEnter:ri(m,w),onMouseLeave:ri(h,S),onTouchStart:ri(x,w)}]:[!1,y,{}]}function ri(e,n){return s=>{e&&e(s),s.defaultPrevented||n(s)}}function nR({page:e,...n}){let s=gk(),{router:r}=lh(),i=v.useMemo(()=>L_(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?s?v.createElement(sR,{page:e,matches:i,...n}):v.createElement(rR,{page:e,matches:i,...n}):null}function aR(e){let{manifest:n,routeModules:s}=ch(),[r,i]=v.useState([]);return v.useEffect(()=>{let c=!1;return Kk(e,n,s).then(d=>{c||i(d)}),()=>{c=!0}},[e,n,s]),r}function sR({page:e,matches:n,...s}){let r=ea(),{future:i}=ch(),{basename:c}=lh(),d=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let f=ej(e,c,i.v8_trailingSlashAwareDataRequests,"rsc"),g=!1,m=[];for(let h of n)typeof h.route.shouldRevalidate=="function"?g=!0:m.push(h.route.id);return g&&m.length>0&&f.searchParams.set("_routes",m.join(",")),[f.pathname+f.search]},[c,i.v8_trailingSlashAwareDataRequests,e,r,n]);return v.createElement(v.Fragment,null,d.map(f=>v.createElement("link",{key:f,rel:"prefetch",as:"fetch",href:f,...s})))}function rR({page:e,matches:n,...s}){let r=ea(),{future:i,manifest:c,routeModules:d}=ch(),{basename:f}=lh(),{loaderData:g,matches:m}=eR(),h=v.useMemo(()=>z0(e,n,m,c,r,"data"),[e,n,m,c,r]),x=v.useMemo(()=>z0(e,n,m,c,r,"assets"),[e,n,m,c,r]),y=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let _=new Set,j=!1;if(n.forEach(k=>{let N=c.routes[k.route.id];!N||!N.hasLoader||(!h.some(R=>R.route.id===k.route.id)&&k.route.id in g&&d[k.route.id]?.shouldRevalidate||N.hasClientLoader?j=!0:_.add(k.route.id))}),_.size===0)return[];let E=ej(e,f,i.v8_trailingSlashAwareDataRequests,"data");return j&&_.size>0&&E.searchParams.set("_routes",n.filter(k=>_.has(k.route.id)).map(k=>k.route.id).join(",")),[E.pathname+E.search]},[f,i.v8_trailingSlashAwareDataRequests,g,r,c,h,n,e,d]),w=v.useMemo(()=>Qk(x,c),[x,c]),S=aR(x);return v.createElement(v.Fragment,null,y.map(_=>v.createElement("link",{key:_,rel:"prefetch",as:"fetch",href:_,...s})),w.map(_=>v.createElement("link",{key:_,rel:"modulepreload",href:_,...s})),S.map(({key:_,link:j})=>v.createElement("link",{key:_,nonce:s.nonce,...j,crossOrigin:j.crossOrigin??s.crossOrigin})))}function oR(...e){return n=>{e.forEach(s=>{typeof s=="function"?s(n):s!=null&&(s.current=n)})}}var lR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{lR&&(window.__reactRouterVersion="7.17.0")}catch{}function iR({basename:e,children:n,useTransitions:s,window:r}){let i=v.useRef();i.current==null&&(i.current=HE({window:r,v5Compat:!0}));let c=i.current,[d,f]=v.useState({action:c.action,location:c.location}),g=v.useCallback(m=>{s===!1?f(m):v.startTransition(()=>f(m))},[s]);return v.useLayoutEffect(()=>c.listen(g),[c,g]),v.createElement(Pk,{basename:e,children:n,location:d.location,navigationType:d.action,navigator:c,useTransitions:s})}var tj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,uh=v.forwardRef(function({onClick:n,discover:s="render",prefetch:r="none",relative:i,reloadDocument:c,replace:d,mask:f,state:g,target:m,to:h,preventScrollReset:x,viewTransition:y,defaultShouldRevalidate:w,...S},_){let{basename:j,navigator:E,useTransitions:k}=v.useContext(Ra),N=typeof h=="string"&&tj.test(h),R=q_(h,j);h=R.to;let A=jk(h,{relative:i}),M=ea(),O=null;if(f){let Z=nh(f,[],M.mask?M.mask.pathname:"/",!0);j!=="/"&&(Z.pathname=Z.pathname==="/"?j:Pa([j,Z.pathname])),O=E.createHref(Z)}let[U,I,B]=tR(r,S),L=dR(h,{replace:d,mask:f,state:g,target:m,preventScrollReset:x,relative:i,viewTransition:y,defaultShouldRevalidate:w,useTransitions:k});function D(Z){n&&n(Z),Z.defaultPrevented||L(Z)}let q=!(R.isExternal||c),F=v.createElement("a",{...S,...B,href:(q?O:void 0)||R.absoluteURL||A,onClick:q?D:n,ref:oR(_,I),target:m,"data-discover":!N&&s==="render"?"true":void 0});return U&&!N?v.createElement(v.Fragment,null,F,v.createElement(nR,{page:A})):F});uh.displayName="Link";var nj=v.forwardRef(function({"aria-current":n="page",caseSensitive:s=!1,className:r="",end:i=!1,style:c,to:d,viewTransition:f,children:g,...m},h){let x=Ji(d,{relative:m.relative}),y=ea(),w=v.useContext(jd),{navigator:S,basename:_}=v.useContext(Ra),j=w!=null&&hR(x)&&f===!0,E=S.encodeLocation?S.encodeLocation(x).pathname:x.pathname,k=y.pathname,N=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;s||(k=k.toLowerCase(),N=N?N.toLowerCase():null,E=E.toLowerCase()),N&&_&&(N=Es(N,_)||N);const R=E!=="/"&&E.endsWith("/")?E.length-1:E.length;let A=k===E||!i&&k.startsWith(E)&&k.charAt(R)==="/",M=N!=null&&(N===E||!i&&N.startsWith(E)&&N.charAt(E.length)==="/"),O={isActive:A,isPending:M,isTransitioning:j},U=A?n:void 0,I;typeof r=="function"?I=r(O):I=[r,A?"active":null,M?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let B=typeof c=="function"?c(O):c;return v.createElement(uh,{...m,"aria-current":U,className:I,ref:h,style:B,to:d,viewTransition:f},typeof g=="function"?g(O):g)});nj.displayName="NavLink";var cR=v.forwardRef(({discover:e="render",fetcherKey:n,navigate:s,reloadDocument:r,replace:i,state:c,method:d=Hu,action:f,onSubmit:g,relative:m,preventScrollReset:h,viewTransition:x,defaultShouldRevalidate:y,...w},S)=>{let{useTransitions:_}=v.useContext(Ra),j=pR(),E=gR(f,{relative:m}),k=d.toLowerCase()==="get"?"get":"post",N=typeof f=="string"&&tj.test(f),R=A=>{if(g&&g(A),A.defaultPrevented)return;A.preventDefault();let M=A.nativeEvent.submitter,O=M?.getAttribute("formmethod")||d,U=()=>j(M||A.currentTarget,{fetcherKey:n,method:O,navigate:s,replace:i,state:c,relative:m,preventScrollReset:h,viewTransition:x,defaultShouldRevalidate:y});_&&s!==!1?v.startTransition(()=>U()):U()};return v.createElement("form",{ref:S,method:k,action:E,onSubmit:r?g:R,...w,"data-discover":!N&&e==="render"?"true":void 0})});cR.displayName="Form";function uR(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function aj(e){let n=v.useContext(sl);return Zt(n,uR(e)),n}function dR(e,{target:n,replace:s,mask:r,state:i,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:g,useTransitions:m}={}){let h=Ua(),x=ea(),y=Ji(e,{relative:d});return v.useCallback(w=>{if(qk(w,n)){w.preventDefault();let S=s!==void 0?s:Di(x)===Di(y),_=()=>h(e,{replace:S,mask:r,state:i,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:g});m?v.startTransition(()=>_()):_()}},[x,h,y,s,r,i,n,e,c,d,f,g,m])}function sj(e){Ba(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 n=v.useRef(Sg(e)),s=v.useRef(!1),r=ea(),i=v.useMemo(()=>Vk(r.search,s.current?null:n.current),[r.search]),c=Ua(),d=v.useCallback((f,g)=>{const m=Sg(typeof f=="function"?f(new URLSearchParams(i)):f);s.current=!0,c("?"+m,g)},[c,i]);return[i,d]}var fR=0,mR=()=>`__${String(++fR)}__`;function pR(){let{router:e}=aj("useSubmit"),{basename:n}=v.useContext(Ra),s=Ok(),r=e.fetch,i=e.navigate;return v.useCallback(async(c,d={})=>{let{action:f,method:g,encType:m,formData:h,body:x}=Yk(c,n);if(d.navigate===!1){let y=d.fetcherKey||mR();await r(y,s,d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:h,body:x,formMethod:d.method||g,formEncType:d.encType||m,flushSync:d.flushSync})}else await i(d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:h,body:x,formMethod:d.method||g,formEncType:d.encType||m,replace:d.replace,state:d.state,fromRouteId:s,flushSync:d.flushSync,viewTransition:d.viewTransition})},[r,i,n,s])}function gR(e,{relative:n}={}){let{basename:s}=v.useContext(Ra),r=v.useContext(Qa);Zt(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),c={...Ji(e||".",{relative:n})},d=ea();if(e==null){c.search=d.search;let f=new URLSearchParams(c.search),g=f.getAll("index");if(g.some(h=>h==="")){f.delete("index"),g.filter(x=>x).forEach(x=>f.append("index",x));let h=f.toString();c.search=h?`?${h}`:""}}return(!e||e===".")&&i.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),s!=="/"&&(c.pathname=c.pathname==="/"?s:Pa([s,c.pathname])),Di(c)}function hR(e,{relative:n}={}){let s=v.useContext(G_);Zt(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=aj("useViewTransitionState"),i=Ji(e,{relative:n});if(!s.isTransitioning)return!1;let c=Es(s.currentLocation.pathname,r)||s.currentLocation.pathname,d=Es(s.nextLocation.pathname,r)||s.nextLocation.pathname;return Qu(i.pathname,d)!=null||Qu(i.pathname,c)!=null}var Qr=D_();/**
|
|
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 xR=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),rj=(...e)=>e.filter((n,s,r)=>!!n&&n.trim()!==""&&r.indexOf(n)===s).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 bR={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 vR=v.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:i="",children:c,iconNode:d,...f},g)=>v.createElement("svg",{ref:g,...bR,width:n,height:n,stroke:e,strokeWidth:r?Number(s)*24/Number(n):s,className:rj("lucide",i),...f},[...d.map(([m,h])=>v.createElement(m,h)),...Array.isArray(c)?c:[c]]));/**
|
|
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 we=(e,n)=>{const s=v.forwardRef(({className:r,...i},c)=>v.createElement(vR,{ref:c,iconNode:n,className:rj(`lucide-${xR(e)}`,r),...i}));return s.displayName=`${e}`,s};/**
|
|
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 oj=we("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 lj=we("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 yR=we("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 ij=we("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 cj=we("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 _R=we("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 vn=we("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"}]]);/**
|
|
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 jR=we("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"}]]);/**
|
|
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 SR=we("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"}]]);/**
|
|
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 Ju=we("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"}]]);/**
|
|
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 Li=we("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
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 Zr=we("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
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 dh=we("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
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 uj=we("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
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 wR=we("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
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 CR=we("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
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 ER=we("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"}]]);/**
|
|
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 kR=we("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
|
|
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 RR=we("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"}]]);/**
|
|
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 wg=we("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"}]]);/**
|
|
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 NR=we("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/**
|
|
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 fh=we("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"}]]);/**
|
|
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 ks=we("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"}]]);/**
|
|
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 dj=we("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"}]]);/**
|
|
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 fj=we("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"}]]);/**
|
|
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 Wu=we("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"}]]);/**
|
|
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 TR=we("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"}]]);/**
|
|
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 AR=we("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"}]]);/**
|
|
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 MR=we("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"}]]);/**
|
|
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 OR=we("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"}]]);/**
|
|
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 zR=we("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"}]]);/**
|
|
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 DR=we("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"}]]);/**
|
|
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 mj=we("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"}]]);/**
|
|
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 LR=we("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"}]]);/**
|
|
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 PR=we("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"}]]);/**
|
|
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 wd=we("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
|
|
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 BR=we("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"}]]);/**
|
|
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 mh=we("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"}]]);/**
|
|
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 IR=we("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"}]]);/**
|
|
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 UR=we("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"}]]);/**
|
|
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 Go=we("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"}]]);/**
|
|
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 HR=we("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"}]]);/**
|
|
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 qR=we("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"}]]);/**
|
|
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 VR=we("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
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 $R=we("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"}]]);/**
|
|
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 GR=we("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"}]]);/**
|
|
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 YR=we("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"}]]);/**
|
|
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 FR=we("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"}]]);/**
|
|
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 XR=we("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"}]]);/**
|
|
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 ph=we("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
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 KR=we("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"}]]);/**
|
|
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 ki=we("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"}]]);/**
|
|
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 QR=we("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"}]]);/**
|
|
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 ZR=we("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"}]]);/**
|
|
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 JR=we("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
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 WR=we("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
|
|
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 eN=we("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
|
|
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 gh=we("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"}]]);/**
|
|
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 pj=we("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
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 tN=we("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"}]]);/**
|
|
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 Rn=we("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
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 Cg=we("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"}]]);/**
|
|
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 nN=we("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"}]]);/**
|
|
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 rl=we("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"}]]);/**
|
|
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 gj=we("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"}]]);/**
|
|
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 hh=we("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"}]]);/**
|
|
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 Eg=we("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"}]]);/**
|
|
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 Vu=we("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
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 Za=we("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"}]]);/**
|
|
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 hj=we("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"}]]);/**
|
|
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 aN=we("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"}]]);/**
|
|
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 ed=we("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"}]]);/**
|
|
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 sN=we("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
|
|
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 ol=we("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"}]]);/**
|
|
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 xj=we("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
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 rN=we("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"}]]);/**
|
|
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 Pi=we("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
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 Ms=we("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"}]]);/**
|
|
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 bj=we("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"}]]);/**
|
|
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 oN=we("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"}]]);/**
|
|
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 vj=we("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"}]]);/**
|
|
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 lN=we("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"}]]);/**
|
|
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 ll=we("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"}]]);/**
|
|
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 Cd=we("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
|
|
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 Bi=we("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"}]]),Ed={health:5e3,projects:15e3,telegramStatus:8e3,pairList:12e3},Cn={theme:"apx.theme",token:"apx.token",sidebarCollapsed:"apx.sidebar.collapsed",language:"apx.lang",robyChat:"apx.roby.chat"},xh=["total","automatico","permiso"],D0=["sky","violet","emerald","amber","rose","indigo","teal","fuchsia"],iN={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 cN(){if(typeof window>"u")return"dark";const e=localStorage.getItem(Cn.theme);return e==="light"||e==="dark"?e:document.documentElement.classList.contains("dark")?"dark":"light"}const yj=v.createContext(null);function uN({children:e}){const[n,s]=v.useState(cN);v.useEffect(()=>{document.documentElement.classList.toggle("dark",n==="dark");try{localStorage.setItem(Cn.theme,n)}catch{}},[n]);const r=v.useCallback(()=>{s(c=>c==="dark"?"light":"dark")},[]),i=v.useMemo(()=>({theme:n,toggle:r,set:s}),[n,r]);return l.jsx(yj.Provider,{value:i,children:e})}function bh(){const e=v.useContext(yj);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const dN=1367/458,fN=735/1016;function mN({size:e=32,title:n="APX",variant:s="icon"}){const{theme:r}=bh(),i=iN[s][r];if(s==="full"){const c=e,d=Math.round(e*dN);return l.jsx("img",{src:i,alt:n,width:d,height:c,className:"block object-contain",draggable:!1})}if(s==="vertical"){const c=e,d=Math.round(e/fN);return l.jsx("img",{src:i,alt:n,width:c,height:d,className:"block object-contain",draggable:!1})}return l.jsx("img",{src:i,alt:n,width:e,height:e,className:"block object-contain",draggable:!1})}function _j(e){var n,s,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(n=0;n<i;n++)e[n]&&(s=_j(e[n]))&&(r&&(r+=" "),r+=s)}else for(s in e)e[s]&&(r&&(r+=" "),r+=s);return r}function vh(){for(var e,n,s=0,r="",i=arguments.length;s<i;s++)(e=arguments[s])&&(n=_j(e))&&(r&&(r+=" "),r+=n);return r}const yh="-",pN=e=>{const n=hN(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:d=>{const f=d.split(yh);return f[0]===""&&f.length!==1&&f.shift(),jj(f,n)||gN(d)},getConflictingClassGroupIds:(d,f)=>{const g=s[d]||[];return f&&r[d]?[...g,...r[d]]:g}}},jj=(e,n)=>{if(e.length===0)return n.classGroupId;const s=e[0],r=n.nextPart.get(s),i=r?jj(e.slice(1),r):void 0;if(i)return i;if(n.validators.length===0)return;const c=e.join(yh);return n.validators.find(({validator:d})=>d(c))?.classGroupId},L0=/^\[(.+)\]$/,gN=e=>{if(L0.test(e)){const n=L0.exec(e)[1],s=n?.substring(0,n.indexOf(":"));if(s)return"arbitrary.."+s}},hN=e=>{const{theme:n,prefix:s}=e,r={nextPart:new Map,validators:[]};return bN(Object.entries(e.classGroups),s).forEach(([c,d])=>{kg(d,r,c,n)}),r},kg=(e,n,s,r)=>{e.forEach(i=>{if(typeof i=="string"){const c=i===""?n:P0(n,i);c.classGroupId=s;return}if(typeof i=="function"){if(xN(i)){kg(i(r),n,s,r);return}n.validators.push({validator:i,classGroupId:s});return}Object.entries(i).forEach(([c,d])=>{kg(d,P0(n,c),s,r)})})},P0=(e,n)=>{let s=e;return n.split(yh).forEach(r=>{s.nextPart.has(r)||s.nextPart.set(r,{nextPart:new Map,validators:[]}),s=s.nextPart.get(r)}),s},xN=e=>e.isThemeGetter,bN=(e,n)=>n?e.map(([s,r])=>{const i=r.map(c=>typeof c=="string"?n+c:typeof c=="object"?Object.fromEntries(Object.entries(c).map(([d,f])=>[n+d,f])):c);return[s,i]}):e,vN=e=>{if(e<1)return{get:()=>{},set:()=>{}};let n=0,s=new Map,r=new Map;const i=(c,d)=>{s.set(c,d),n++,n>e&&(n=0,r=s,s=new Map)};return{get(c){let d=s.get(c);if(d!==void 0)return d;if((d=r.get(c))!==void 0)return i(c,d),d},set(c,d){s.has(c)?s.set(c,d):i(c,d)}}},Sj="!",yN=e=>{const{separator:n,experimentalParseClassName:s}=e,r=n.length===1,i=n[0],c=n.length,d=f=>{const g=[];let m=0,h=0,x;for(let j=0;j<f.length;j++){let E=f[j];if(m===0){if(E===i&&(r||f.slice(j,j+c)===n)){g.push(f.slice(h,j)),h=j+c;continue}if(E==="/"){x=j;continue}}E==="["?m++:E==="]"&&m--}const y=g.length===0?f:f.substring(h),w=y.startsWith(Sj),S=w?y.substring(1):y,_=x&&x>h?x-h:void 0;return{modifiers:g,hasImportantModifier:w,baseClassName:S,maybePostfixModifierPosition:_}};return s?f=>s({className:f,parseClassName:d}):d},_N=e=>{if(e.length<=1)return e;const n=[];let s=[];return e.forEach(r=>{r[0]==="["?(n.push(...s.sort(),r),s=[]):s.push(r)}),n.push(...s.sort()),n},jN=e=>({cache:vN(e.cacheSize),parseClassName:yN(e),...pN(e)}),SN=/\s+/,wN=(e,n)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:i}=n,c=[],d=e.trim().split(SN);let f="";for(let g=d.length-1;g>=0;g-=1){const m=d[g],{modifiers:h,hasImportantModifier:x,baseClassName:y,maybePostfixModifierPosition:w}=s(m);let S=!!w,_=r(S?y.substring(0,w):y);if(!_){if(!S){f=m+(f.length>0?" "+f:f);continue}if(_=r(y),!_){f=m+(f.length>0?" "+f:f);continue}S=!1}const j=_N(h).join(":"),E=x?j+Sj:j,k=E+_;if(c.includes(k))continue;c.push(k);const N=i(_,S);for(let R=0;R<N.length;++R){const A=N[R];c.push(E+A)}f=m+(f.length>0?" "+f:f)}return f};function CN(){let e=0,n,s,r="";for(;e<arguments.length;)(n=arguments[e++])&&(s=wj(n))&&(r&&(r+=" "),r+=s);return r}const wj=e=>{if(typeof e=="string")return e;let n,s="";for(let r=0;r<e.length;r++)e[r]&&(n=wj(e[r]))&&(s&&(s+=" "),s+=n);return s};function EN(e,...n){let s,r,i,c=d;function d(g){const m=n.reduce((h,x)=>x(h),e());return s=jN(m),r=s.cache.get,i=s.cache.set,c=f,f(g)}function f(g){const m=r(g);if(m)return m;const h=wN(g,s);return i(g,h),h}return function(){return c(CN.apply(null,arguments))}}const Yt=e=>{const n=s=>s[e]||[];return n.isThemeGetter=!0,n},Cj=/^\[(?:([a-z-]+):)?(.+)\]$/i,kN=/^\d+\/\d+$/,RN=new Set(["px","full","screen"]),NN=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,TN=/\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$/,AN=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,MN=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ON=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ys=e=>qo(e)||RN.has(e)||kN.test(e),nr=e=>il(e,"length",HN),qo=e=>!!e&&!Number.isNaN(Number(e)),gp=e=>il(e,"number",qo),oi=e=>!!e&&Number.isInteger(Number(e)),zN=e=>e.endsWith("%")&&qo(e.slice(0,-1)),st=e=>Cj.test(e),ar=e=>NN.test(e),DN=new Set(["length","size","percentage"]),LN=e=>il(e,DN,Ej),PN=e=>il(e,"position",Ej),BN=new Set(["image","url"]),IN=e=>il(e,BN,VN),UN=e=>il(e,"",qN),li=()=>!0,il=(e,n,s)=>{const r=Cj.exec(e);return r?r[1]?typeof n=="string"?r[1]===n:n.has(r[1]):s(r[2]):!1},HN=e=>TN.test(e)&&!AN.test(e),Ej=()=>!1,qN=e=>MN.test(e),VN=e=>ON.test(e),$N=()=>{const e=Yt("colors"),n=Yt("spacing"),s=Yt("blur"),r=Yt("brightness"),i=Yt("borderColor"),c=Yt("borderRadius"),d=Yt("borderSpacing"),f=Yt("borderWidth"),g=Yt("contrast"),m=Yt("grayscale"),h=Yt("hueRotate"),x=Yt("invert"),y=Yt("gap"),w=Yt("gradientColorStops"),S=Yt("gradientColorStopPositions"),_=Yt("inset"),j=Yt("margin"),E=Yt("opacity"),k=Yt("padding"),N=Yt("saturate"),R=Yt("scale"),A=Yt("sepia"),M=Yt("skew"),O=Yt("space"),U=Yt("translate"),I=()=>["auto","contain","none"],B=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto",st,n],D=()=>[st,n],q=()=>["",ys,nr],F=()=>["auto",qo,st],Z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],H=()=>["solid","dashed","dotted","double","none"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>["start","end","center","between","around","evenly","stretch"],V=()=>["","0",st],Y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>[qo,st];return{cacheSize:500,separator:":",theme:{colors:[li],spacing:[ys,nr],blur:["none","",ar,st],brightness:P(),borderColor:[e],borderRadius:["none","","full",ar,st],borderSpacing:D(),borderWidth:q(),contrast:P(),grayscale:V(),hueRotate:P(),invert:V(),gap:D(),gradientColorStops:[e],gradientColorStopPositions:[zN,nr],inset:L(),margin:L(),opacity:P(),padding:D(),saturate:P(),scale:P(),sepia:V(),skew:P(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",st]}],container:["container"],columns:[{columns:[ar]}],"break-after":[{"break-after":Y()}],"break-before":[{"break-before":Y()}],"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:[...Z(),st]}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[_]}],"inset-x":[{"inset-x":[_]}],"inset-y":[{"inset-y":[_]}],start:[{start:[_]}],end:[{end:[_]}],top:[{top:[_]}],right:[{right:[_]}],bottom:[{bottom:[_]}],left:[{left:[_]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",oi,st]}],basis:[{basis:L()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",st]}],grow:[{grow:V()}],shrink:[{shrink:V()}],order:[{order:["first","last","none",oi,st]}],"grid-cols":[{"grid-cols":[li]}],"col-start-end":[{col:["auto",{span:["full",oi,st]},st]}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":[li]}],"row-start-end":[{row:["auto",{span:[oi,st]},st]}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",st]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",st]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",...Q()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Q(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Q(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[k]}],px:[{px:[k]}],py:[{py:[k]}],ps:[{ps:[k]}],pe:[{pe:[k]}],pt:[{pt:[k]}],pr:[{pr:[k]}],pb:[{pb:[k]}],pl:[{pl:[k]}],m:[{m:[j]}],mx:[{mx:[j]}],my:[{my:[j]}],ms:[{ms:[j]}],me:[{me:[j]}],mt:[{mt:[j]}],mr:[{mr:[j]}],mb:[{mb:[j]}],ml:[{ml:[j]}],"space-x":[{"space-x":[O]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[O]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",st,n]}],"min-w":[{"min-w":[st,n,"min","max","fit"]}],"max-w":[{"max-w":[st,n,"none","full","min","max","fit","prose",{screen:[ar]},ar]}],h:[{h:[st,n,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[st,n,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[st,n,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[st,n,"auto","min","max","fit"]}],"font-size":[{text:["base",ar,nr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",gp]}],"font-family":[{font:[li]}],"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",st]}],"line-clamp":[{"line-clamp":["none",qo,gp]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ys,st]}],"list-image":[{"list-image":["none",st]}],"list-style-type":[{list:["none","disc","decimal",st]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ys,nr]}],"underline-offset":[{"underline-offset":["auto",ys,st]}],"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:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",st]}],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",st]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Z(),PN]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",LN]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},IN]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[S]}],"gradient-via-pos":[{via:[S]}],"gradient-to-pos":[{to:[S]}],"gradient-from":[{from:[w]}],"gradient-via":[{via:[w]}],"gradient-to":[{to:[w]}],rounded:[{rounded:[c]}],"rounded-s":[{"rounded-s":[c]}],"rounded-e":[{"rounded-e":[c]}],"rounded-t":[{"rounded-t":[c]}],"rounded-r":[{"rounded-r":[c]}],"rounded-b":[{"rounded-b":[c]}],"rounded-l":[{"rounded-l":[c]}],"rounded-ss":[{"rounded-ss":[c]}],"rounded-se":[{"rounded-se":[c]}],"rounded-ee":[{"rounded-ee":[c]}],"rounded-es":[{"rounded-es":[c]}],"rounded-tl":[{"rounded-tl":[c]}],"rounded-tr":[{"rounded-tr":[c]}],"rounded-br":[{"rounded-br":[c]}],"rounded-bl":[{"rounded-bl":[c]}],"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":[E]}],"border-style":[{border:[...H(),"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":[E]}],"divide-style":[{divide:H()}],"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:["",...H()]}],"outline-offset":[{"outline-offset":[ys,st]}],"outline-w":[{outline:[ys,nr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[ys,nr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ar,UN]}],"shadow-color":[{shadow:[li]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...G(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":G()}],filter:[{filter:["","none"]}],blur:[{blur:[s]}],brightness:[{brightness:[r]}],contrast:[{contrast:[g]}],"drop-shadow":[{"drop-shadow":["","none",ar,st]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[x]}],saturate:[{saturate:[N]}],sepia:[{sepia:[A]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[s]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[g]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[x]}],"backdrop-opacity":[{"backdrop-opacity":[E]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[A]}],"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",st]}],duration:[{duration:P()}],ease:[{ease:["linear","in","out","in-out",st]}],delay:[{delay:P()}],animate:[{animate:["none","spin","ping","pulse","bounce",st]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[oi,st]}],"translate-x":[{"translate-x":[U]}],"translate-y":[{"translate-y":[U]}],"skew-x":[{"skew-x":[M]}],"skew-y":[{"skew-y":[M]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",st]}],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",st]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"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",st]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[ys,nr,gp]}],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"]}}},kj=EN($N);function Ie(...e){return kj(vh(e))}const B0={};function fa(e,n){const s=v.useRef(B0);return s.current===B0&&(s.current=e(n)),s}const Rg=[];let Ng;function GN(){return Ng}function YN(e){Rg.push(e)}function Rj(e){const n=(s,r)=>{const i=fa(XN).current;let c;try{Ng=i;for(const d of Rg)d.before(i);c=e(s,r);for(const d of Rg)d.after(i);i.didInitialize=!0}finally{Ng=void 0}return c};return n.displayName=e.displayName||e.name,n}function FN(e){return v.forwardRef(Rj(e))}function XN(){return{didInitialize:!1}}function _h(e){const n=v.useRef(!0);n.current&&(n.current=!1,e())}const KN=()=>{},Re=typeof document<"u"?v.useLayoutEffect:KN;function QN(e,n){return function(r,...i){const c=new URL(e);return c.searchParams.set("code",r.toString()),i.forEach(d=>c.searchParams.append("args[]",d)),`${n} error #${r}; visit ${c} for the full message.`}}const Nn=QN("https://base-ui.com/production-error","Base UI"),Nj=v.createContext(void 0);function Wi(e){const n=v.useContext(Nj);if(n===void 0&&!e)throw new Error(Nn(72));return n}const ZN=[];function jh(e){v.useEffect(e,ZN)}const ii=0;class Ia{static create(){return new Ia}currentId=ii;start(n,s){this.clear(),this.currentId=setTimeout(()=>{this.currentId=ii,s()},n)}isStarted(){return this.currentId!==ii}clear=()=>{this.currentId!==ii&&(clearTimeout(this.currentId),this.currentId=ii)};disposeEffect=()=>this.clear}function Zn(){const e=fa(Ia.create).current;return jh(e.disposeEffect),e}const cl=typeof navigator<"u",hp=WN(),Tj=tT(),Aj=eT(),Sh=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),Mj=hp.platform==="MacIntel"&&hp.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(hp.platform),Oj=cl&&/apple/i.test(navigator.vendor),Tg=cl&&/android/i.test(Tj)||/android/i.test(Aj),JN=cl&&Tj.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,zj=Aj.includes("jsdom/");function WN(){if(!cl)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function eT(){if(!cl)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:n,version:s})=>`${n}/${s}`).join(" "):navigator.userAgent}function tT(){if(!cl)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}function ua(e){e.preventDefault(),e.stopPropagation()}function nT(e){return"nativeEvent"in e}function wh(e){return e.pointerType===""&&e.isTrusted?!0:Tg&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Dj(e){return zj?!1:!Tg&&e.width===0&&e.height===0||Tg&&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 Yr(e,n){const s=["mouse","pen"];return n||s.push("",void 0),s.includes(e)}function aT(e){const n=e.type;return n==="click"||n==="mousedown"||n==="keydown"||n==="keyup"}function kd(){return typeof window<"u"}function Pn(e){return Ch(e)?(e.nodeName||"").toLowerCase():"#document"}function Ft(e){var n;return(e==null||(n=e.ownerDocument)==null?void 0:n.defaultView)||window}function Ja(e){var n;return(n=(Ch(e)?e.ownerDocument:e.document)||window.document)==null?void 0:n.documentElement}function Ch(e){return kd()?e instanceof Node||e instanceof Ft(e).Node:!1}function ot(e){return kd()?e instanceof Element||e instanceof Ft(e).Element:!1}function Ut(e){return kd()?e instanceof HTMLElement||e instanceof Ft(e).HTMLElement:!1}function Yo(e){return!kd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ft(e).ShadowRoot}function gr(e){const{overflow:n,overflowX:s,overflowY:r,display:i}=Wn(e);return/auto|scroll|overlay|hidden|clip/.test(n+r+s)&&i!=="inline"&&i!=="contents"}function sT(e){return/^(table|td|th)$/.test(Pn(e))}function Rd(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const rT=/transform|translate|scale|rotate|perspective|filter/,oT=/paint|layout|strict|content/,Br=e=>!!e&&e!=="none";let xp;function Eh(e){const n=ot(e)?Wn(e):e;return Br(n.transform)||Br(n.translate)||Br(n.scale)||Br(n.rotate)||Br(n.perspective)||!Nd()&&(Br(n.backdropFilter)||Br(n.filter))||rT.test(n.willChange||"")||oT.test(n.contain||"")}function lT(e){let n=Rs(e);for(;Ut(n)&&!ws(n);){if(Eh(n))return n;if(Rd(n))return null;n=Rs(n)}return null}function Nd(){return xp==null&&(xp=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),xp}function ws(e){return/^(html|body|#document)$/.test(Pn(e))}function Wn(e){return Ft(e).getComputedStyle(e)}function Td(e){return ot(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Rs(e){if(Pn(e)==="html")return e;const n=e.assignedSlot||e.parentNode||Yo(e)&&e.host||Ja(e);return Yo(n)?n.host:n}function Lj(e){const n=Rs(e);return ws(n)?e.ownerDocument?e.ownerDocument.body:e.body:Ut(n)&&gr(n)?n:Lj(n)}function Ii(e,n,s){var r;n===void 0&&(n=[]),s===void 0&&(s=!0);const i=Lj(e),c=i===((r=e.ownerDocument)==null?void 0:r.body),d=Ft(i);if(c){const f=Ag(d);return n.concat(d,d.visualViewport||[],gr(i)?i:[],f&&s?Ii(f):[])}else return n.concat(i,Ii(i,[],s))}function Ag(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Mg="data-base-ui-focusable",Pj="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",ur="ArrowLeft",dr="ArrowRight",kh="ArrowUp",ec="ArrowDown";function zn(e){let n=e.activeElement;for(;n?.shadowRoot?.activeElement!=null;)n=n.shadowRoot.activeElement;return n}function Ye(e,n){if(!e||!n)return!1;const s=n.getRootNode?.();if(e.contains(n))return!0;if(s&&Yo(s)){let r=n;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function En(e){return"composedPath"in e?e.composedPath()[0]:e.target}function td(e,n){if(!ot(e))return!1;const s=e;if(n.hasElement(s))return!s.hasAttribute("data-trigger-disabled");for(const[,r]of n.entries())if(Ye(r,s))return!r.hasAttribute("data-trigger-disabled");return!1}function bp(e,n){if(n==null)return!1;if("composedPath"in e)return e.composedPath().includes(n);const s=e;return s.target!=null&&n.contains(s.target)}function iT(e){return e.matches("html,body")}function Ad(e){return Ut(e)&&e.matches(Pj)}function cT(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Pj}`)!=null}function Og(e){return e?e.getAttribute("role")==="combobox"&&Ad(e):!1}function uT(e){if(!e||zj)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function nd(e){return e?e.hasAttribute(Mg)?e:e.querySelector(`[${Mg}]`)||e:null}function dT(e,n){return n!=null&&!Yr(n)?0:typeof e=="function"?e():e}function ad(e,n,s){const r=dT(e,s);return typeof r=="number"?r:r?.[n]}function I0(e){return typeof e=="function"?e():e}function Bj(e,n){return n||e==="click"||e==="mousedown"}function fT(e){return e?.includes("mouse")&&e!=="mousedown"}function Dn(){}const Ui=Object.freeze([]),an=Object.freeze({}),Ns="none",Hi="trigger-press",In="trigger-hover",$u="trigger-focus",Rh="outside-press",vp="item-press",mT="close-press",Md="focus-out",Nh="escape-key",U0="list-navigation",pT="cancel-open",Ij="disabled",H0="missing",q0="initial",Uj="imperative-action",gT="window-resize";function tt(e,n,s,r){let i=!1,c=!1;const d=r??an;return{reason:e,event:n??new Event("base-ui"),cancel(){i=!0},allowPropagation(){c=!0},get isCanceled(){return i},get isPropagationAllowed(){return c},trigger:s,...d}}const Hj=v.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Ia,currentIdRef:{current:null},currentContextRef:{current:null}});function hT(e){const{children:n,delay:s,timeoutMs:r=0}=e,i=v.useRef(s),c=v.useRef(s),d=v.useRef(null),f=v.useRef(null),g=Zn();return l.jsx(Hj.Provider,{value:v.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:c,currentIdRef:d,timeoutMs:r,currentContextRef:f,timeout:g}),[r,g]),children:n})}function xT(e,n={open:!1}){const{open:s}=n,r="rootStore"in e?e.rootStore:e,i=r.useState("floatingId"),c=v.useContext(Hj),{currentIdRef:d,delayRef:f,timeoutMs:g,initialDelayRef:m,currentContextRef:h,hasProvider:x,timeout:y}=c,[w,S]=v.useState(!1);return Re(()=>{function _(){S(!1),h.current?.setIsInstantPhase(!1),d.current=null,h.current=null,f.current=m.current}if(d.current&&!s&&d.current===i){if(S(!1),g){const j=i;return y.start(g,()=>{r.select("open")||d.current&&d.current!==j||_()}),()=>{y.clear()}}_()}},[s,i,d,f,g,m,h,y,r]),Re(()=>{if(!s)return;const _=h.current,j=d.current;y.clear(),h.current={onOpenChange:r.setOpen,setIsInstantPhase:S},d.current=i,f.current={open:0,close:ad(m.current,"close")},j!==null&&j!==i?(S(!0),_?.setIsInstantPhase(!0),_?.onOpenChange(!1,tt(Ns))):(S(!1),_?.setIsInstantPhase(!1))},[s,i,r,d,f,m,h,y]),Re(()=>()=>{h.current=null},[h]),v.useMemo(()=>({hasProvider:x,delayRef:f,isInstantPhase:w}),[x,f,w])}function ct(e,n,s,r){return e.addEventListener(n,s,r),()=>{e.removeEventListener(n,s,r)}}function Xa(...e){return()=>{for(let n=0;n<e.length;n+=1){const s=e[n];s&&s()}}}function Ts(e,n,s,r){const i=fa(qj).current;return vT(i,e,n,s,r)&&Vj(i,[e,n,s,r]),i.callback}function bT(e){const n=fa(qj).current;return yT(n,e)&&Vj(n,e),n.callback}function qj(){return{callback:null,cleanup:null,refs:[]}}function vT(e,n,s,r,i){return e.refs[0]!==n||e.refs[1]!==s||e.refs[2]!==r||e.refs[3]!==i}function yT(e,n){return e.refs.length!==n.length||e.refs.some((s,r)=>s!==n[r])}function Vj(e,n){if(e.refs=n,n.every(s=>s==null)){e.callback=null;return}e.callback=s=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),s!=null){const r=Array(n.length).fill(null);for(let i=0;i<n.length;i+=1){const c=n[i];if(c!=null)switch(typeof c){case"function":{const d=c(s);typeof d=="function"&&(r[i]=d);break}case"object":{c.current=s;break}}}e.cleanup=()=>{for(let i=0;i<n.length;i+=1){const c=n[i];if(c!=null)switch(typeof c){case"function":{const d=r[i];typeof d=="function"?d():c(null);break}case"object":{c.current=null;break}}}}}}}function cn(e){const n=fa(_T,e).current;return n.next=e,Re(n.effect),n}function _T(e){const n={current:e,next:e,effect:()=>{n.current=n.next}};return n}const Th={...OE},yp=Th.useInsertionEffect,jT=yp&&yp!==Th.useLayoutEffect?yp:e=>e();function Ae(e){const n=fa(ST).current;return n.next=e,jT(n.effect),n.trampoline}function ST(){const e={next:void 0,callback:wT,trampoline:(...n)=>e.callback?.(...n),effect:()=>{e.callback=e.next}};return e}function wT(){}const yu=null;class CT{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=n=>{this.isScheduled=!1;const s=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let i=0;i<s.length;i+=1)s[i]?.(n)};request(n){const s=this.nextId;return this.nextId+=1,this.callbacks.push(n),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),s}cancel(n){const s=n-this.startId;s<0||s>=this.callbacks.length||(this.callbacks[s]=null,this.callbacksCount-=1)}}const _u=new CT;class Ya{static create(){return new Ya}static request(n){return _u.request(n)}static cancel(n){return _u.cancel(n)}currentId=yu;request(n){this.cancel(),this.currentId=_u.request(()=>{this.currentId=yu,n()})}cancel=()=>{this.currentId!==yu&&(_u.cancel(this.currentId),this.currentId=yu)};disposeEffect=()=>this.cancel}function Fo(){const e=fa(Ya.create).current;return jh(e.disposeEffect),e}function xt(e){return e?.ownerDocument||document}const $j={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Ah={...$j,position:"fixed",top:0,left:0},Gj={...$j,position:"absolute"},sd=v.forwardRef(function(n,s){const[r,i]=v.useState();Re(()=>{Oj&&i("button")},[]);const c={tabIndex:0,role:r};return l.jsx("span",{...n,ref:s,style:Ah,"aria-hidden":r?void 0:!0,...c,"data-base-ui-focus-guard":""})}),ET=["top","right","bottom","left"],Xo=Math.min,da=Math.max,rd=Math.round,Hr=Math.floor,Ka=e=>({x:e,y:e}),kT={left:"right",right:"left",bottom:"top",top:"bottom"};function zg(e,n,s){return da(e,Xo(n,s))}function As(e,n){return typeof e=="function"?e(n):e}function Jn(e){return e.split("-")[0]}function hr(e){return e.split("-")[1]}function Mh(e){return e==="x"?"y":"x"}function Oh(e){return e==="y"?"height":"width"}function Ea(e){const n=e[0];return n==="t"||n==="b"?"y":"x"}function zh(e){return Mh(Ea(e))}function RT(e,n,s){s===void 0&&(s=!1);const r=hr(e),i=zh(e),c=Oh(i);let d=i==="x"?r===(s?"end":"start")?"right":"left":r==="start"?"bottom":"top";return n.reference[c]>n.floating[c]&&(d=od(d)),[d,od(d)]}function NT(e){const n=od(e);return[Dg(e),n,Dg(n)]}function Dg(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const V0=["left","right"],$0=["right","left"],TT=["top","bottom"],AT=["bottom","top"];function MT(e,n,s){switch(e){case"top":case"bottom":return s?n?$0:V0:n?V0:$0;case"left":case"right":return n?TT:AT;default:return[]}}function OT(e,n,s,r){const i=hr(e);let c=MT(Jn(e),s==="start",r);return i&&(c=c.map(d=>d+"-"+i),n&&(c=c.concat(c.map(Dg)))),c}function od(e){const n=Jn(e);return kT[n]+e.slice(n.length)}function zT(e){return{top:0,right:0,bottom:0,left:0,...e}}function Yj(e){return typeof e!="number"?zT(e):{top:e,right:e,bottom:e,left:e}}function qi(e){const{x:n,y:s,width:r,height:i}=e;return{width:r,height:i,top:s,left:n,right:n+r,bottom:s+i,x:n,y:s}}function ju(e,n,s){return Math.floor(e/n)!==s}function Vi(e,n){return n<0||n>=e.length}function Gu(e,n){return On(e.current,{disabledIndices:n})}function Lg(e,n){return On(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:n})}function On(e,{startingIndex:n=-1,decrement:s=!1,disabledIndices:r,amount:i=1}={}){let c=n;do c+=s?-i:i;while(c>=0&&c<=e.length-1&&Cs(e,c,r));return c}function Fj(e,{event:n,orientation:s,loopFocus:r,onLoop:i,rtl:c,cols:d,disabledIndices:f,minIndex:g,maxIndex:m,prevIndex:h,stopEvent:x=!1}){let y=h,w;if(n.key===kh?w="up":n.key===ec&&(w="down"),w){const S=[],_=[];let j=!1,E=0;{let I=null,B=-1;e.forEach((L,D)=>{if(L==null)return;E+=1;const q=L.closest('[role="row"]');q&&(j=!0),(q!==I||B===-1)&&(I=q,B+=1,S[B]=[]),S[B].push(D),_[D]=B})}let k=!1,N=0;if(j)for(const I of S){const B=I.length;B>N&&(N=B),B!==d&&(k=!0)}const R=k&&E<e.length,A=N||d,M=I=>{if(!k||h===-1)return;const B=_[h];if(B==null)return;const L=S[B].indexOf(h),D=I==="up"?-1:1;for(let q=B+D,F=0;F<S.length;F+=1,q+=D){if(q<0||q>=S.length){if(!r||R)return;if(q=q<0?S.length-1:0,i){const H=Math.min(L,S[q].length-1),G=S[q][H]??S[q][0],Q=i(n,h,G);q=_[Q]??q}}const Z=S[q];for(let H=Math.min(L,Z.length-1);H>=0;H-=1){const G=Z[H];if(!Cs(e,G,f))return G}}},O=I=>{if(!R||h===-1)return;const B=h%A,L=I==="up"?-A:A,D=m-m%A,q=Hr(m/A)+1;for(let F=h-B+L,Z=0;Z<q;Z+=1,F+=L){if(F<0||F>m){if(!r)return;F=F<0?D:0}const H=Math.min(F+A-1,m);for(let G=Math.min(F+B,H);G>=F;G-=1)if(!Cs(e,G,f))return G}};x&&ua(n);const U=M(w)??O(w);if(U!==void 0)y=U;else if(h===-1)y=w==="up"?m:g;else if(y=On(e,{startingIndex:h,amount:A,decrement:w==="up",disabledIndices:f}),r){if(w==="up"&&(h-A<g||y<0)){const I=h%A,B=m%A,L=m-(B-I);B===I?y=m:y=B>I?L:L-A,i&&(y=i(n,h,y))}w==="down"&&h+A>m&&(y=On(e,{startingIndex:h%A-A,amount:A,disabledIndices:f}),i&&(y=i(n,h,y)))}Vi(e,y)&&(y=h)}if(s==="both"){const S=Hr(h/d);n.key===(c?ur:dr)&&(x&&ua(n),h%d!==d-1?(y=On(e,{startingIndex:h,disabledIndices:f}),r&&ju(y,d,S)&&(y=On(e,{startingIndex:h-h%d-1,disabledIndices:f}),i&&(y=i(n,h,y)))):r&&(y=On(e,{startingIndex:h-h%d-1,disabledIndices:f}),i&&(y=i(n,h,y))),ju(y,d,S)&&(y=h)),n.key===(c?dr:ur)&&(x&&ua(n),h%d!==0?(y=On(e,{startingIndex:h,decrement:!0,disabledIndices:f}),r&&ju(y,d,S)&&(y=On(e,{startingIndex:h+(d-h%d),decrement:!0,disabledIndices:f}),i&&(y=i(n,h,y)))):r&&(y=On(e,{startingIndex:h+(d-h%d),decrement:!0,disabledIndices:f}),i&&(y=i(n,h,y))),ju(y,d,S)&&(y=h));const _=Hr(m/d)===S;Vi(e,y)&&(r&&_?(y=n.key===(c?dr:ur)?m:On(e,{startingIndex:h-h%d-1,disabledIndices:f}),i&&(y=i(n,h,y))):y=h)}return y}function Xj(e,n,s){const r=[];let i=0;return e.forEach(({width:c,height:d},f)=>{let g=!1;for(s&&(i=0);!g;){const m=[];for(let h=0;h<c;h+=1)for(let x=0;x<d;x+=1)m.push(i+h+x*n);i%n+c<=n&&m.every(h=>r[h]==null)?(m.forEach(h=>{r[h]=f}),g=!0):i+=1}}),[...r]}function Kj(e,n,s,r,i){if(e===-1)return-1;const c=s.indexOf(e),d=n[e];switch(i){case"tl":return c;case"tr":return d?c+d.width-1:c;case"bl":return d?c+(d.height-1)*r:c;case"br":return s.lastIndexOf(e);default:return-1}}function Qj(e,n){return n.flatMap((s,r)=>e.includes(s)?[r]:[])}function Cs(e,n,s){if(typeof s=="function"?s(n):s?.includes(n)??!1)return!0;const i=e[n];return i?Od(i)?!s&&(i.hasAttribute("disabled")||i.getAttribute("aria-disabled")==="true"):!0:!1}function DT(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Od(e,n=e?Wn(e):null){return!e||!e.isConnected||!n||DT(n)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():n.display!=="none"&&n.display!=="contents"}const LT='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function PT(e){const n=e.assignedSlot;if(n)return n;if(e.parentElement)return e.parentElement;const s=e.getRootNode();return Yo(s)?s.host:null}function Pg(e){for(const n of Array.from(e.children))if(Pn(n)==="summary")return n;return null}function BT(e,n){const s=Pg(n);return!!s&&(e===s||Ye(s,e))}function Zj(e){const n=e?Pn(e):"";return e!=null&&e.matches(LT)&&(n!=="summary"||e.parentElement!=null&&Pn(e.parentElement)==="details"&&Pg(e.parentElement)===e)&&(n!=="details"||Pg(e)==null)&&(n!=="input"||e.type!=="hidden")}function Jj(e){if(!Zj(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let n=e;n;n=PT(n)){const s=n!==e,r=Pn(n)==="slot";if(n.hasAttribute("inert")||s&&Pn(n)==="details"&&!n.open&&!BT(e,n)||n.hasAttribute("hidden")||!r&&!IT(n,s))return!1}return!0}function IT(e,n){const s=Wn(e);return n?s.display!=="none":Od(e,s)}function Wj(e){const n=e.tabIndex;if(n<0){const s=Pn(e);if(s==="details"||s==="audio"||s==="video"||Ut(e)&&e.isContentEditable)return 0}return n}function _p(e){if(Pn(e)!=="input")return null;const n=e;return n.type==="radio"&&n.name!==""?n:null}function UT(e,n){const s=_p(e);if(!s)return!0;const r=n.find(i=>{const c=_p(i);return c?.name===s.name&&c.form===s.form&&c.checked});return r?r===s:n.find(i=>{const c=_p(i);return c?.name===s.name&&c.form===s.form})===s}function eS(e){if(Ut(e)&&Pn(e)==="slot"){const n=e.assignedElements({flatten:!0});if(n.length>0)return n}return Ut(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function tS(e,n){eS(e).forEach(s=>{Zj(s)&&n.push(s),tS(s,n)})}function nS(e,n,s){eS(e).forEach(r=>{Ut(r)&&r.matches(n)&&s.push(r),nS(r,n,s)})}function Dh(e){return Jj(e)&&Wj(e)>=0}function aS(e){const n=[];return tS(e,n),n.filter(Jj)}function zd(e){const n=aS(e);return n.filter(s=>Wj(s)>=0&&UT(s,n))}function sS(e,n){const s=zd(e),r=s.length;if(r===0)return;const i=zn(xt(e)),c=s.indexOf(i),d=c===-1?n===1?0:r-1:c+n;return s[d]}function rS(e){return sS(xt(e).body,1)||e}function oS(e){return sS(xt(e).body,-1)||e}function Ri(e,n){const s=n||e.currentTarget,r=e.relatedTarget;return!r||!Ye(s,r)}function HT(e){zd(e).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function G0(e){const n=[];nS(e,"[data-tabindex]",n),n.forEach(s=>{const r=s.dataset.tabindex;delete s.dataset.tabindex,r?s.setAttribute("tabindex",r):s.removeAttribute("tabindex")})}function mr(e,n,s=!0){return e.filter(i=>i.parentId===n).flatMap(i=>[...!s||i.context?.open?[i]:[],...mr(e,i.id,s)])}function Y0(e,n){let s=[],r=e.find(i=>i.id===n)?.parentId;for(;r;){const i=e.find(c=>c.id===r);r=i?.parentId,i&&(s=s.concat(i))}return s}function $i(e){return`data-base-ui-${e}`}let Su=0;function Yu(e,n={}){const{preventScroll:s=!1,sync:r=!1,shouldFocus:i}=n;cancelAnimationFrame(Su);function c(){i&&!i()||e?.focus({preventScroll:s})}if(r)return c(),Dn;const d=requestAnimationFrame(c);return Su=d,()=>{Su===d&&(cancelAnimationFrame(d),Su=0)}}const jp={inert:new WeakMap,"aria-hidden":new WeakMap},F0="data-base-ui-inert",Bg={inert:new WeakSet,"aria-hidden":new WeakSet};let ci=new WeakMap,Sp=0;function qT(e){return Bg[e]}function lS(e){return e?Yo(e)?e.host:lS(e.parentNode):null}const wp=(e,n)=>n.map(s=>{if(e.contains(s))return s;const r=lS(s);return e.contains(r)?r:null}).filter(s=>s!=null),X0=e=>{const n=new Set;return e.forEach(s=>{let r=s;for(;r&&!n.has(r);)n.add(r),r=r.parentNode}),n},K0=(e,n,s)=>{const r=[],i=c=>{!c||s.has(c)||Array.from(c.children).forEach(d=>{Pn(d)!=="script"&&(n.has(d)?i(d):r.push(d))})};return i(e),r};function VT(e,n,s,r,{mark:i=!0,markerIgnoreElements:c=[]}){const d=r?"inert":s?"aria-hidden":null;let f=null,g=null;const m=wp(n,e),h=i?wp(n,c):[],x=new Set(h),y=i?K0(n,X0(m),new Set(m)).filter(_=>!x.has(_)):[],w=[],S=[];if(d){const _=jp[d],j=qT(d);g=j,f=_;const E=wp(n,Array.from(n.querySelectorAll("[aria-live]"))),k=m.concat(E);K0(n,X0(k),new Set(k)).forEach(R=>{const A=R.getAttribute(d),M=A!==null&&A!=="false",O=(_.get(R)||0)+1;_.set(R,O),w.push(R),O===1&&M&&j.add(R),M||R.setAttribute(d,d==="inert"?"":"true")})}return i&&y.forEach(_=>{const j=(ci.get(_)||0)+1;ci.set(_,j),S.push(_),j===1&&_.setAttribute(F0,"")}),Sp+=1,()=>{f&&w.forEach(_=>{const E=(f.get(_)||0)-1;f.set(_,E),E||(!g?.has(_)&&d&&_.removeAttribute(d),g?.delete(_))}),i&&S.forEach(_=>{const j=(ci.get(_)||0)-1;ci.set(_,j),j||_.removeAttribute(F0)}),Sp-=1,Sp||(jp.inert=new WeakMap,jp["aria-hidden"]=new WeakMap,Bg.inert=new WeakSet,Bg["aria-hidden"]=new WeakSet,ci=new WeakMap)}}function Q0(e,n={}){const{ariaHidden:s=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:c=[]}=n,d=xt(e[0]).body;return VT(e,d,s,r,{mark:i,markerIgnoreElements:c})}let Z0=0;function $T(e,n="mui"){const[s,r]=v.useState(e),i=e||s;return v.useEffect(()=>{s==null&&(Z0+=1,r(`${n}-${Z0}`))},[s,n]),i}const J0=Th.useId;function Dd(e,n){if(J0!==void 0){const s=J0();return e??(n?`${n}-${s}`:s)}return $T(e,n)}const GT=parseInt(v.version,10);function Lh(e){return GT>=e}function W0(e){if(!v.isValidElement(e))return null;const n=e,s=n.props;return(Lh(19)?s?.ref:n.ref)??null}function Ig(e,n){if(e&&!n)return e;if(!e&&n)return n;if(e||n)return{...e,...n}}function YT(e,n){const s={};for(const r in e){const i=e[r];if(n?.hasOwnProperty(r)){const c=n[r](i);c!=null&&Object.assign(s,c);continue}i===!0?s[`data-${r.toLowerCase()}`]="":i&&(s[`data-${r.toLowerCase()}`]=i.toString())}return s}function FT(e,n){return typeof e=="function"?e(n):e}function XT(e,n){return typeof e=="function"?e(n):e}const Ph={};function ka(e,n,s,r,i){if(!s&&!r&&!i&&!e)return ld(n);let c=ld(e);return n&&(c=_i(c,n)),s&&(c=_i(c,s)),r&&(c=_i(c,r)),i&&(c=_i(c,i)),c}function KT(e){if(e.length===0)return Ph;if(e.length===1)return ld(e[0]);let n=ld(e[0]);for(let s=1;s<e.length;s+=1)n=_i(n,e[s]);return n}function ld(e){return Bh(e)?{...cS(e,Ph)}:QT(e)}function _i(e,n){return Bh(n)?cS(n,e):ZT(e,n)}function QT(e){const n={...e};for(const s in n){const r=n[s];iS(s,r)&&(n[s]=uS(r))}return n}function ZT(e,n){if(!n)return e;for(const s in n){const r=n[s];switch(s){case"style":{e[s]=Ig(e.style,r);break}case"className":{e[s]=dS(e.className,r);break}default:iS(s,r)?e[s]=JT(e[s],r):e[s]=r}}return e}function iS(e,n){const s=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return s===111&&r===110&&i>=65&&i<=90&&(typeof n=="function"||typeof n>"u")}function Bh(e){return typeof e=="function"}function cS(e,n){return Bh(e)?e(n):e??Ph}function JT(e,n){return n?e?(...s)=>{const r=s[0];if(fS(r)){const c=r;id(c);const d=n(...s);return c.baseUIHandlerPrevented||e?.(...s),d}const i=n(...s);return e?.(...s),i}:uS(n):e}function uS(e){return e&&((...n)=>{const s=n[0];return fS(s)&&id(s),e(...n)})}function id(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function dS(e,n){return n?e?n+" "+e:n:e}function fS(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Lt(e,n,s={}){const r=n.render,i=WT(n,s);if(s.enabled===!1)return null;const c=s.state??an;return nA(e,r,i,c)}function WT(e,n={}){const{className:s,style:r,render:i}=e,{state:c=an,ref:d,props:f,stateAttributesMapping:g,enabled:m=!0}=n,h=m?FT(s,c):void 0,x=m?XT(r,c):void 0,y=m?YT(c,g):an,w=m&&f?eA(f):void 0,S=m?Ig(y,w)??{}:an;return typeof document<"u"&&(m?Array.isArray(d)?S.ref=bT([S.ref,W0(i),...d]):S.ref=Ts(S.ref,W0(i),d):Ts(null,null)),m?(h!==void 0&&(S.className=dS(S.className,h)),x!==void 0&&(S.style=Ig(S.style,x)),S):an}function eA(e){return Array.isArray(e)?KT(e):ka(void 0,e)}const tA=Symbol.for("react.lazy");function nA(e,n,s,r){if(n){if(typeof n=="function")return n(s,r);const i=ka(s,n.props);i.ref=s.ref;let c=n;return c?.$$typeof===tA&&(c=v.Children.toArray(n)[0]),v.cloneElement(c,i)}if(e&&typeof e=="string")return aA(e,s);throw new Error(Nn(8))}function aA(e,n){return e==="button"?v.createElement("button",{type:"button",...n,key:n.key}):e==="img"?v.createElement("img",{alt:"",...n,key:n.key}):v.createElement(e,n)}const sA={style:{transition:"none"}},rA="data-base-ui-click-trigger",oA={fallbackAxisSide:"none"},lA={fallbackAxisSide:"end"},iA={clipPath:"inset(50%)",position:"fixed",top:0,left:0},mS=v.createContext(null),pS=()=>v.useContext(mS),cA=$i("portal");function gS(e={}){const{ref:n,container:s,componentProps:r=an,elementProps:i}=e,c=Dd(),f=pS()?.portalNode,[g,m]=v.useState(null),[h,x]=v.useState(null),y=Ae(j=>{j!==null&&x(j)}),w=v.useRef(null);Re(()=>{if(s===null){w.current&&(w.current=null,x(null),m(null));return}if(c==null)return;const j=(s&&(Ch(s)?s:s.current))??f??document.body;if(j==null){w.current&&(w.current=null,x(null),m(null));return}w.current!==j&&(w.current=j,x(null),m(j))},[s,f,c]);const S=Lt("div",r,{ref:[n,y],props:[{id:c,[cA]:""},i]});return{portalNode:h,portalSubtree:g&&S?Qr.createPortal(S,g):null}}const hS=v.forwardRef(function(n,s){const{render:r,className:i,style:c,children:d,container:f,renderGuards:g,...m}=n,{portalNode:h,portalSubtree:x}=gS({container:f,ref:s,componentProps:n,elementProps:m}),y=v.useRef(null),w=v.useRef(null),S=v.useRef(null),_=v.useRef(null),[j,E]=v.useState(null),k=v.useRef(!1),N=j?.modal,R=j?.open,A=typeof g=="boolean"?g:!!j&&!j.modal&&j.open&&!!h;v.useEffect(()=>{if(!h||N)return;function O(U){h&&U.relatedTarget&&Ri(U)&&(U.type==="focusin"?k.current&&(G0(h),k.current=!1):(HT(h),k.current=!0))}return Xa(ct(h,"focusin",O,!0),ct(h,"focusout",O,!0))},[h,N]),v.useEffect(()=>{!h||R!==!1||(G0(h),k.current=!1)},[R,h]);const M=v.useMemo(()=>({beforeOutsideRef:y,afterOutsideRef:w,beforeInsideRef:S,afterInsideRef:_,portalNode:h,setFocusManagerState:E}),[h]);return l.jsxs(v.Fragment,{children:[x,l.jsxs(mS.Provider,{value:M,children:[A&&h&&l.jsx(sd,{"data-type":"outside",ref:y,onFocus:O=>{if(Ri(O,h))S.current?.focus();else{const U=j?j.domReference:null;oS(U)?.focus()}}}),A&&h&&l.jsx("span",{"aria-owns":h.id,style:iA}),h&&Qr.createPortal(d,h),A&&h&&l.jsx(sd,{"data-type":"outside",ref:w,onFocus:O=>{if(Ri(O,h))_.current?.focus();else{const U=j?j.domReference:null;rS(U)?.focus(),j?.closeOnFocusOut&&j?.onOpenChange(!1,tt(Md,O.nativeEvent))}}})]})]})});function uA(){const e=new Map;return{emit(n,s){e.get(n)?.forEach(r=>r(s))},on(n,s){e.has(n)||e.set(n,new Set),e.get(n).add(s)},off(n,s){e.get(n)?.delete(s)}}}const dA=v.createContext(null),fA=v.createContext(null),Ld=()=>v.useContext(dA)?.id||null,ul=e=>{const n=v.useContext(fA);return e??n};function _s(e){return e==null?e:"current"in e?e.current:e}function mA(e,n){const s=Ft(En(e));return e instanceof s.KeyboardEvent?"keyboard":e instanceof s.FocusEvent?n||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof s.MouseEvent?n||(e.detail===0?"keyboard":"mouse"):""}const e1=20;let ir=[];function Ih(){ir=ir.filter(e=>e.deref()?.isConnected)}function pA(e){Ih(),e&&Pn(e)!=="body"&&(ir.push(new WeakRef(e)),ir.length>e1&&(ir=ir.slice(-e1)))}function Cp(){return Ih(),ir[ir.length-1]?.deref()}function gA(e){return e?Dh(e)?e:zd(e)[0]||e:null}function t1(e,n){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!n.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const r=aS(e).filter(c=>{const d=c.getAttribute("data-tabindex")||"";return Dh(c)||c.hasAttribute("data-tabindex")&&!d.startsWith("-")}),i=e.getAttribute("tabindex");n.current.includes("floating")||r.length===0?i!=="0"&&e.setAttribute("tabindex","0"):(i!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function xS(e){const{context:n,children:s,disabled:r=!1,initialFocus:i=!0,returnFocus:c=!0,restoreFocus:d=!1,modal:f=!0,closeOnFocusOut:g=!0,openInteractionType:m="",nextFocusableElement:h,previousFocusableElement:x,beforeContentFocusGuardRef:y,externalTree:w,getInsideElements:S}=e,_="rootStore"in n?n.rootStore:n,j=_.useState("open"),E=_.useState("domReferenceElement"),k=_.useState("floatingElement"),{events:N,dataRef:R}=_.context,A=Ae(()=>R.current.floatingContext?.nodeId),M=i===!1,O=Og(E)&&M,U=v.useRef(["content"]),I=cn(i),B=cn(c),L=cn(m),D=ul(w),q=pS(),F=v.useRef(!1),Z=v.useRef(!1),H=v.useRef(!1),G=v.useRef(null),Q=v.useRef(""),V=v.useRef(""),Y=v.useRef(null),P=v.useRef(null),K=Ts(Y,y,q?.beforeInsideRef),$=Ts(P,q?.afterInsideRef),W=Zn(),ce=Zn(),ie=Fo(),oe=q!=null,ue=nd(k),te=Ae((be=ue)=>be?zd(be):[]),Ne=Ae(()=>S?.().filter(be=>be!=null)??[]);v.useEffect(()=>{if(r||!f)return;function be(Ee){Ee.key==="Tab"&&Ye(ue,zn(xt(ue)))&&te().length===0&&!O&&ua(Ee)}const Se=xt(ue);return ct(Se,"keydown",be)},[r,ue,f,O,te]),v.useEffect(()=>{if(r||!j)return;const be=xt(ue);function Se(){H.current=!1}function Ee(ze){const xe=En(ze),ke=Ne(),_e=Ye(k,xe)||Ye(E,xe)||Ye(q?.portalNode,xe)||ke.some(De=>De===xe||Ye(De,xe));H.current=!_e,V.current=ze.pointerType||"keyboard",xe?.closest(`[${rA}]`)&&(Z.current=!0)}function Oe(){V.current="keyboard"}return Xa(ct(be,"pointerdown",Ee,!0),ct(be,"pointerup",Se,!0),ct(be,"pointercancel",Se,!0),ct(be,"keydown",Oe,!0))},[r,k,E,ue,j,q,Ne]),v.useEffect(()=>{if(r||!g)return;const be=xt(ue);function Se(){Z.current=!0,ce.start(0,()=>{Z.current=!1})}function Ee(ke){const _e=En(ke);Dh(_e)&&(G.current=_e)}function Oe(ke){const _e=ke.relatedTarget,De=ke.currentTarget,Ge=En(ke);queueMicrotask(()=>{const qe=A(),Me=_.context.triggerElements,ve=Ne(),re=_e?.hasAttribute($i("focus-guard"))&&[Y.current,P.current,q?.beforeInsideRef.current,q?.afterInsideRef.current,q?.beforeOutsideRef.current,q?.afterOutsideRef.current,_s(x),_s(h)].includes(_e),ye=!(Ye(E,_e)||Ye(k,_e)||Ye(_e,k)||Ye(q?.portalNode,_e)||ve.some(je=>je===_e||Ye(je,_e))||_e!=null&&Me.hasElement(_e)||Me.hasMatchingElement(je=>Ye(je,_e))||re||D&&(mr(D.nodesRef.current,qe).find(je=>Ye(je.context?.elements.floating,_e)||Ye(je.context?.elements.domReference,_e))||Y0(D.nodesRef.current,qe).find(je=>[je.context?.elements.floating,nd(je.context?.elements.floating)].includes(_e)||je.context?.elements.domReference===_e)));if(De===E&&ue&&t1(ue,U),d&&De!==E&&!Od(Ge)&&zn(be)===be.body){if(Ut(ue)&&(ue.focus(),d==="popup")){ie.request(()=>{ue.focus()});return}const je=te(),Pe=G.current,Ze=(Pe&&je.includes(Pe)?Pe:null)||je[je.length-1]||ue;Ut(Ze)&&Ze.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(O||!f)&&_e&&ye&&!Z.current&&(O||_e!==Cp())&&(F.current=!0,_.setOpen(!1,tt(Md,ke)))})}function ze(){H.current||(R.current.insideReactTree=!0,W.start(0,()=>{R.current.insideReactTree=!1}))}const xe=Ut(E)?E:null;if(!(!k&&!xe))return Xa(xe&&ct(xe,"focusout",Oe),xe&&ct(xe,"pointerdown",Se),k&&ct(k,"focusin",Ee),k&&ct(k,"focusout",Oe),k&&q&&ct(k,"focusout",ze,!0))},[r,E,k,ue,f,D,q,_,g,d,te,O,A,U,R,W,ce,ie,h,x,Ne]),v.useEffect(()=>{if(r||!k||!j)return;const be=Array.from(q?.portalNode?.querySelectorAll(`[${$i("portal")}]`)||[]),Ee=(D?Y0(D.nodesRef.current,A()):[]).find(De=>Og(De.context?.elements.domReference||null))?.context?.elements.domReference,ze=[...[k,...be,Y.current,P.current,q?.beforeOutsideRef.current,q?.afterOutsideRef.current,...Ne()],Ee,_s(x),_s(h),O?E:null].filter(De=>De!=null),xe=Q0(ze,{ariaHidden:f||O,mark:!1}),ke=[k,...be].filter(De=>De!=null),_e=Q0(ke);return()=>{_e(),xe()}},[j,r,E,k,f,q,O,D,A,h,x,Ne]),Re(()=>{if(!j||r||!Ut(ue))return;const be=xt(ue),Se=zn(be);queueMicrotask(()=>{const Ee=I.current,Oe=typeof Ee=="function"?Ee(L.current||""):Ee;if(Oe===void 0||Oe===!1||Ye(ue,Se))return;let xe=null;const ke=()=>(xe==null&&(xe=te(ue)),xe[0]||ue);let _e;Oe===!0||Oe===null?_e=ke():_e=_s(Oe),_e=_e||ke();const De=Ye(ue,zn(be));Yu(_e,{preventScroll:_e===ue,shouldFocus(){if(De)return!0;const Ge=zn(be);return!(Ge!==_e&&Ye(ue,Ge))}})})},[r,j,ue,te,I,L]),Re(()=>{if(r||!ue)return;const be=xt(ue),Se=zn(be);pA(Se);function Ee(ze){if(ze.open||(Q.current=mA(ze.nativeEvent,V.current)),ze.reason===In&&ze.nativeEvent.type==="mouseleave"&&(F.current=!0),ze.reason===Rh)if(ze.nested)F.current=!1;else if(wh(ze.nativeEvent)||Dj(ze.nativeEvent))F.current=!1;else{let xe=!1;xt(ue).createElement("div").focus({get preventScroll(){return xe=!0,!1}}),xe?F.current=!1:F.current=!0}}N.on("openchange",Ee);function Oe(){const ze=B.current;let xe=typeof ze=="function"?ze(Q.current):ze;if(xe===void 0||xe===!1)return null;if(xe===null&&(xe=!0),typeof xe=="boolean")return E?.isConnected?E:Cp()||null;const ke=E?.isConnected?E:Cp();return _s(xe)||ke||null}return()=>{N.off("openchange",Ee);const ze=zn(be),xe=Ne(),ke=Ye(k,ze)||xe.some(Ge=>Ge===ze||Ye(Ge,ze))||D&&mr(D.nodesRef.current,A(),!1).some(Ge=>Ye(Ge.context?.elements.floating,ze)),_e=B.current,De=Oe();queueMicrotask(()=>{const Ge=gA(De),qe=typeof _e!="boolean";_e&&!F.current&&Ut(Ge)&&(!(!qe&&Ge!==ze&&ze!==be.body)||ke)&&Ge.focus({preventScroll:!0}),F.current=!1})}},[r,k,ue,B,N,D,E,A,Ne]),Re(()=>{if(!Sh||j||!k)return;const be=zn(xt(k));!Ut(be)||!Ad(be)||Ye(k,be)&&be.blur()},[j,k]),Re(()=>{if(!(r||!q))return q.setFocusManagerState({modal:f,closeOnFocusOut:g,open:j,onOpenChange:_.setOpen,domReference:E}),()=>{q.setFocusManagerState(null)}},[r,q,f,j,_,g,E]),Re(()=>{if(!(r||!ue))return t1(ue,U),()=>{queueMicrotask(Ih)}},[r,ue,U]);const $e=!r&&(f?!O:!0)&&(oe||f);return l.jsxs(v.Fragment,{children:[$e&&l.jsx(sd,{"data-type":"inside",ref:K,onFocus:be=>{if(f){const Se=te();Yu(Se[Se.length-1])}else q?.portalNode&&(F.current=!1,Ri(be,q.portalNode)?rS(E)?.focus():_s(x??q.beforeOutsideRef)?.focus())}}),s,$e&&l.jsx(sd,{"data-type":"inside",ref:$,onFocus:be=>{f?Yu(te()[0]):q?.portalNode&&(g&&(F.current=!0),Ri(be,q.portalNode)?oS(E)?.focus():_s(h??q.afterOutsideRef)?.focus())}})]})}function hA(e,n={}){const{enabled:s=!0,event:r="click",toggle:i=!0,ignoreMouse:c=!1,stickIfOpen:d=!0,touchOpenDelay:f=0,reason:g=Hi}=n,m="rootStore"in e?e.rootStore:e,h=m.context.dataRef,x=v.useRef(void 0),y=Fo(),w=Zn(),S=v.useMemo(()=>{function _(E,k,N,R){const A=tt(g,k,N);E&&R==="touch"&&f>0?w.start(f,()=>{m.setOpen(!0,A)}):m.setOpen(E,A)}function j(E,k,N){const R=h.current.openEvent,A=m.select("domReferenceElement")!==k;return E&&A||!E||!i?!0:R&&d?!N(R.type):!1}return{onPointerDown(E){x.current=E.pointerType},onMouseDown(E){const k=x.current,N=E.nativeEvent,R=m.select("open");if(E.button!==0||r==="click"||Yr(k,!0)&&c)return;const A=j(R,E.currentTarget,U=>U==="click"||U==="mousedown"),M=En(N);if(Ad(M)){_(A,N,M,k);return}const O=E.currentTarget;y.request(()=>{_(A,N,O,k)})},onClick(E){if(r==="mousedown-only")return;const k=x.current;if(r==="mousedown"&&k){x.current=void 0;return}if(Yr(k,!0)&&c)return;const N=m.select("open"),R=j(N,E.currentTarget,A=>A==="click"||A==="mousedown"||A==="keydown"||A==="keyup");_(R,E.nativeEvent,E.currentTarget,k)},onKeyDown(){x.current=void 0}}},[h,r,c,g,m,d,i,y,w,f]);return v.useMemo(()=>s?{reference:S}:an,[s,S])}function xA(e,n){let s=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){const c=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},d=n.axis==="x"||n.axis==="both",f=n.axis==="y"||n.axis==="both",g=["mouseenter","mousemove"].includes(n.dataRef.current.openEvent?.type||"")&&n.pointerType!=="touch";let m=c.width,h=c.height,x=c.x,y=c.y;return s==null&&n.x&&d&&(s=c.x-n.x),r==null&&n.y&&f&&(r=c.y-n.y),x-=s||0,y-=r||0,m=0,h=0,!i||g?(m=n.axis==="y"?c.width:0,h=n.axis==="x"?c.height:0,x=d&&n.x!=null?n.x:x,y=f&&n.y!=null?n.y:y):i&&!g&&(h=n.axis==="x"?c.height:h,m=n.axis==="y"?c.width:m),i=!0,{width:m,height:h,x,y,top:y,right:x+m,bottom:y+h,left:x}}}}function n1(e){return e!=null&&e.clientX!=null}function bA(e,n={}){const{enabled:s=!0,axis:r="both"}=n,i="rootStore"in e?e.rootStore:e,c=i.useState("open"),d=i.useState("floatingElement"),f=i.useState("domReferenceElement"),g=i.context.dataRef,m=v.useRef(!1),h=v.useRef(null),[x,y]=v.useState(),[w,S]=v.useState([]),_=Ae(R=>{i.set("positionReference",R)}),j=Ae((R,A,M)=>{m.current||g.current.openEvent&&!n1(g.current.openEvent)||i.set("positionReference",xA(M??f,{x:R,y:A,axis:r,dataRef:g,pointerType:x}))}),E=Ae(R=>{c?h.current||(j(R.clientX,R.clientY,R.currentTarget),S([])):j(R.clientX,R.clientY,R.currentTarget)}),k=Yr(x)?d:c;v.useEffect(()=>{if(!s){_(f);return}if(!k)return;function R(){h.current?.(),h.current=null}const A=Ft(d);function M(O){const U=En(O);Ye(d,U)?R():j(O.clientX,O.clientY)}return!g.current.openEvent||n1(g.current.openEvent)?h.current=ct(A,"mousemove",M):_(f),R},[k,s,d,g,f,i,j,_,w]),v.useEffect(()=>()=>{i.set("positionReference",null)},[i]),v.useEffect(()=>{s&&!d&&(m.current=!1)},[s,d]),v.useEffect(()=>{!s&&c&&(m.current=!0)},[s,c]);const N=v.useMemo(()=>{function R(A){y(A.pointerType)}return{onPointerDown:R,onPointerEnter:R,onMouseMove:E,onMouseEnter:E}},[E]);return v.useMemo(()=>s?{reference:N,trigger:N}:{},[s,N])}const vA={intentional:"onClick",sloppy:"onPointerDown"};function yA(){return!1}function _A(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Uh(e,n={}){const{enabled:s=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:c="sloppy",referencePress:d=yA,referencePressEvent:f="sloppy",bubbles:g,externalTree:m}=n,h="rootStore"in e?e.rootStore:e,x=h.useState("open"),y=h.useState("floatingElement"),{dataRef:w}=h.context,S=ul(m),_=Ae(typeof i=="function"?i:()=>!1),j=typeof i=="function"?_:i,E=j!==!1,k=Ae(()=>c),{escapeKey:N,outsidePress:R}=_A(g),A=v.useRef(!1),M=v.useRef(!1),O=v.useRef(!1),U=v.useRef(!1),I=v.useRef(""),B=v.useRef(null),L=Zn(),D=Zn(),q=Ae(()=>{D.clear(),w.current.insideReactTree=!1}),F=Ae($=>{const W=w.current.floatingContext?.nodeId;return(S?mr(S.nodesRef.current,W):[]).some(ie=>ie.context?.open&&!ie.context.dataRef.current[$])}),Z=Ae($=>bp($,h.select("floatingElement"))||bp($,h.select("domReferenceElement"))),H=Ae($=>{d()&&h.setOpen(!1,tt(Hi,$.nativeEvent))}),G=Ae($=>{if(!x||!s||!r||$.key!=="Escape"||U.current||!N&&F("__escapeKeyBubbles"))return;const W=nT($)?$.nativeEvent:$,ce=tt(Nh,W);h.setOpen(!1,ce),ce.isCanceled||$.preventDefault(),!N&&!ce.isPropagationAllowed&&$.stopPropagation()}),Q=Ae(()=>{w.current.insideReactTree=!0,D.start(0,q)}),V=Ae($=>{if(!x||!s||$.button!==0)return;const W=En($.nativeEvent);Ye(h.select("floatingElement"),W)&&(A.current||(A.current=!0,M.current=!1))}),Y=Ae($=>{!x||!s||($.defaultPrevented||$.nativeEvent.defaultPrevented)&&A.current&&(M.current=!0)});v.useEffect(()=>{if(!x||!s)return;w.current.__escapeKeyBubbles=N,w.current.__outsidePressBubbles=R;const $=new Ia,W=new Ia;function ce(){$.clear(),U.current=!0}function ie(){$.start(Nd()?5:0,()=>{U.current=!1})}function oe(){O.current=!0,W.start(0,()=>{O.current=!1})}function ue(){A.current=!1,M.current=!1}function te(){const re=I.current,ye=re==="pen"||!re?"mouse":re,je=k(),Pe=typeof je=="function"?je():je;return typeof Pe=="string"?Pe:Pe[ye]}function Ne(re){const ye=te();return ye==="intentional"&&re.type!=="click"||ye==="sloppy"&&re.type==="click"}function $e(re){const ye=w.current.floatingContext?.nodeId,je=S&&mr(S.nodesRef.current,ye).some(Pe=>bp(re,Pe.context?.elements.floating));return Z(re)||je}function be(re){if(Ne(re)){re.type!=="click"&&!Z(re)&&(W.clear(),O.current=!1),q();return}if(w.current.insideReactTree){q();return}const ye=En(re),je=`[${$i("inert")}]`,Pe=ot(ye)?ye.getRootNode():null,Ze=Array.from((Yo(Pe)?Pe:xt(h.select("floatingElement"))).querySelectorAll(je)),_t=h.context.triggerElements;if(ye&&(_t.hasElement(ye)||_t.hasMatchingElement(vt=>Ye(vt,ye))))return;let Ht=ot(ye)?ye:null;for(;Ht&&!ws(Ht);){const vt=Rs(Ht);if(ws(vt)||!ot(vt))break;Ht=vt}if(!(Ze.length&&ot(ye)&&!iT(ye)&&!Ye(ye,h.select("floatingElement"))&&Ze.every(vt=>!Ye(Ht,vt)))){if(Ut(ye)&&!("touches"in re)){const vt=ws(ye),ut=Wn(ye),it=/auto|scroll/,Et=vt||it.test(ut.overflowX),Bt=vt||it.test(ut.overflowY),pa=Et&&ye.clientWidth>0&&ye.scrollWidth>ye.clientWidth,gn=Bt&&ye.clientHeight>0&&ye.scrollHeight>ye.clientHeight,dt=ut.direction==="rtl",Tt=gn&&(dt?re.offsetX<=ye.offsetWidth-ye.clientWidth:re.offsetX>ye.clientWidth),Xt=pa&&re.offsetY>ye.clientHeight;if(Tt||Xt)return}if(!$e(re)){if(te()==="intentional"&&O.current){W.clear(),O.current=!1;return}typeof j=="function"&&!j(re)||F("__outsidePressBubbles")||(h.setOpen(!1,tt(Rh,re)),q())}}}function Se(re){te()!=="sloppy"||re.pointerType==="touch"||!h.select("open")||!s||Z(re)||be(re)}function Ee(re){if(te()!=="sloppy"||!h.select("open")||!s||Z(re))return;const ye=re.touches[0];ye&&(B.current={startTime:Date.now(),startX:ye.clientX,startY:ye.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},L.start(1e3,()=>{B.current&&(B.current.dismissOnTouchEnd=!1,B.current.dismissOnMouseDown=!1)}))}function Oe(re,ye){const je=En(re);if(!je)return;const Pe=ct(je,re.type,()=>{ye(re),Pe()})}function ze(re){I.current="touch",Oe(re,Ee)}function xe(re){L.clear(),re.type==="pointerdown"&&(I.current=re.pointerType),!(re.type==="mousedown"&&B.current&&!B.current.dismissOnMouseDown)&&Oe(re,ye=>{ye.type==="pointerdown"?Se(ye):be(ye)})}function ke(re){if(!A.current)return;const ye=M.current;if(ue(),te()==="intentional"){if(re.type==="pointercancel"){ye&&oe();return}if(!$e(re)){if(ye){oe();return}typeof j=="function"&&!j(re)||(W.clear(),O.current=!0,q())}}}function _e(re){if(te()!=="sloppy"||!B.current||Z(re))return;const ye=re.touches[0];if(!ye)return;const je=Math.abs(ye.clientX-B.current.startX),Pe=Math.abs(ye.clientY-B.current.startY),Ze=Math.sqrt(je*je+Pe*Pe);Ze>5&&(B.current.dismissOnTouchEnd=!0),Ze>10&&(be(re),L.clear(),B.current=null)}function De(re){Oe(re,_e)}function Ge(re){te()!=="sloppy"||!B.current||Z(re)||(B.current.dismissOnTouchEnd&&be(re),L.clear(),B.current=null)}function qe(re){Oe(re,Ge)}const Me=xt(y),ve=Xa(r&&Xa(ct(Me,"keydown",G),ct(Me,"compositionstart",ce),ct(Me,"compositionend",ie)),E&&Xa(ct(Me,"click",xe,!0),ct(Me,"pointerdown",xe,!0),ct(Me,"pointerup",ke,!0),ct(Me,"pointercancel",ke,!0),ct(Me,"mousedown",xe,!0),ct(Me,"mouseup",ke,!0),ct(Me,"touchstart",ze,!0),ct(Me,"touchmove",De,!0),ct(Me,"touchend",qe,!0)));return()=>{ve(),$.clear(),W.clear(),ue(),O.current=!1}},[w,y,r,E,j,x,s,N,R,G,q,k,F,Z,S,h,L]),v.useEffect(q,[j,q]);const P=v.useMemo(()=>({onKeyDown:G,[vA[f]]:H,...f!=="intentional"&&{onClick:H}}),[G,H,f]),K=v.useMemo(()=>({onKeyDown:G,onPointerDown:Y,onMouseDown:Y,onClickCapture:Q,onMouseDownCapture($){Q(),V($)},onPointerDownCapture($){Q(),V($)},onMouseUpCapture:Q,onTouchEndCapture:Q,onTouchMoveCapture:Q}),[G,Q,V,Y]);return v.useMemo(()=>s?{reference:P,floating:K,trigger:P}:{},[s,P,K])}function a1(e,n,s){let{reference:r,floating:i}=e;const c=Ea(n),d=zh(n),f=Oh(d),g=Jn(n),m=c==="y",h=r.x+r.width/2-i.width/2,x=r.y+r.height/2-i.height/2,y=r[f]/2-i[f]/2;let w;switch(g){case"top":w={x:h,y:r.y-i.height};break;case"bottom":w={x:h,y:r.y+r.height};break;case"right":w={x:r.x+r.width,y:x};break;case"left":w={x:r.x-i.width,y:x};break;default:w={x:r.x,y:r.y}}switch(hr(n)){case"start":w[d]-=y*(s&&m?-1:1);break;case"end":w[d]+=y*(s&&m?-1:1);break}return w}async function jA(e,n){var s;n===void 0&&(n={});const{x:r,y:i,platform:c,rects:d,elements:f,strategy:g}=e,{boundary:m="clippingAncestors",rootBoundary:h="viewport",elementContext:x="floating",altBoundary:y=!1,padding:w=0}=As(n,e),S=Yj(w),j=f[y?x==="floating"?"reference":"floating":x],E=qi(await c.getClippingRect({element:(s=await(c.isElement==null?void 0:c.isElement(j)))==null||s?j:j.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(f.floating)),boundary:m,rootBoundary:h,strategy:g})),k=x==="floating"?{x:r,y:i,width:d.floating.width,height:d.floating.height}:d.reference,N=await(c.getOffsetParent==null?void 0:c.getOffsetParent(f.floating)),R=await(c.isElement==null?void 0:c.isElement(N))?await(c.getScale==null?void 0:c.getScale(N))||{x:1,y:1}:{x:1,y:1},A=qi(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:k,offsetParent:N,strategy:g}):k);return{top:(E.top-A.top+S.top)/R.y,bottom:(A.bottom-E.bottom+S.bottom)/R.y,left:(E.left-A.left+S.left)/R.x,right:(A.right-E.right+S.right)/R.x}}const SA=50,wA=async(e,n,s)=>{const{placement:r="bottom",strategy:i="absolute",middleware:c=[],platform:d}=s,f=d.detectOverflow?d:{...d,detectOverflow:jA},g=await(d.isRTL==null?void 0:d.isRTL(n));let m=await d.getElementRects({reference:e,floating:n,strategy:i}),{x:h,y:x}=a1(m,r,g),y=r,w=0;const S={};for(let _=0;_<c.length;_++){const j=c[_];if(!j)continue;const{name:E,fn:k}=j,{x:N,y:R,data:A,reset:M}=await k({x:h,y:x,initialPlacement:r,placement:y,strategy:i,middlewareData:S,rects:m,platform:f,elements:{reference:e,floating:n}});h=N??h,x=R??x,S[E]={...S[E],...A},M&&w<SA&&(w++,typeof M=="object"&&(M.placement&&(y=M.placement),M.rects&&(m=M.rects===!0?await d.getElementRects({reference:e,floating:n,strategy:i}):M.rects),{x:h,y:x}=a1(m,y,g)),_=-1)}return{x:h,y:x,placement:y,strategy:i,middlewareData:S}},CA=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(n){var s,r;const{placement:i,middlewareData:c,rects:d,initialPlacement:f,platform:g,elements:m}=n,{mainAxis:h=!0,crossAxis:x=!0,fallbackPlacements:y,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:_=!0,...j}=As(e,n);if((s=c.arrow)!=null&&s.alignmentOffset)return{};const E=Jn(i),k=Ea(f),N=Jn(f)===f,R=await(g.isRTL==null?void 0:g.isRTL(m.floating)),A=y||(N||!_?[od(f)]:NT(f)),M=S!=="none";!y&&M&&A.push(...OT(f,_,S,R));const O=[f,...A],U=await g.detectOverflow(n,j),I=[];let B=((r=c.flip)==null?void 0:r.overflows)||[];if(h&&I.push(U[E]),x){const F=RT(i,d,R);I.push(U[F[0]],U[F[1]])}if(B=[...B,{placement:i,overflows:I}],!I.every(F=>F<=0)){var L,D;const F=(((L=c.flip)==null?void 0:L.index)||0)+1,Z=O[F];if(Z&&(!(x==="alignment"?k!==Ea(Z):!1)||B.every(Q=>Ea(Q.placement)===k?Q.overflows[0]>0:!0)))return{data:{index:F,overflows:B},reset:{placement:Z}};let H=(D=B.filter(G=>G.overflows[0]<=0).sort((G,Q)=>G.overflows[1]-Q.overflows[1])[0])==null?void 0:D.placement;if(!H)switch(w){case"bestFit":{var q;const G=(q=B.filter(Q=>{if(M){const V=Ea(Q.placement);return V===k||V==="y"}return!0}).map(Q=>[Q.placement,Q.overflows.filter(V=>V>0).reduce((V,Y)=>V+Y,0)]).sort((Q,V)=>Q[1]-V[1])[0])==null?void 0:q[0];G&&(H=G);break}case"initialPlacement":H=f;break}if(i!==H)return{reset:{placement:H}}}return{}}}};function s1(e,n){return{top:e.top-n.height,right:e.right-n.width,bottom:e.bottom-n.height,left:e.left-n.width}}function r1(e){return ET.some(n=>e[n]>=0)}const EA=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(n){const{rects:s,platform:r}=n,{strategy:i="referenceHidden",...c}=As(e,n);switch(i){case"referenceHidden":{const d=await r.detectOverflow(n,{...c,elementContext:"reference"}),f=s1(d,s.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:r1(f)}}}case"escaped":{const d=await r.detectOverflow(n,{...c,altBoundary:!0}),f=s1(d,s.floating);return{data:{escapedOffsets:f,escaped:r1(f)}}}default:return{}}}}},bS=new Set(["left","top"]);async function kA(e,n){const{placement:s,platform:r,elements:i}=e,c=await(r.isRTL==null?void 0:r.isRTL(i.floating)),d=Jn(s),f=hr(s),g=Ea(s)==="y",m=bS.has(d)?-1:1,h=c&&g?-1:1,x=As(n,e);let{mainAxis:y,crossAxis:w,alignmentAxis:S}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:x.mainAxis||0,crossAxis:x.crossAxis||0,alignmentAxis:x.alignmentAxis};return f&&typeof S=="number"&&(w=f==="end"?S*-1:S),g?{x:w*h,y:y*m}:{x:y*m,y:w*h}}const RA=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(n){var s,r;const{x:i,y:c,placement:d,middlewareData:f}=n,g=await kA(n,e);return d===((s=f.offset)==null?void 0:s.placement)&&(r=f.arrow)!=null&&r.alignmentOffset?{}:{x:i+g.x,y:c+g.y,data:{...g,placement:d}}}}},NA=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(n){const{x:s,y:r,placement:i,platform:c}=n,{mainAxis:d=!0,crossAxis:f=!1,limiter:g={fn:E=>{let{x:k,y:N}=E;return{x:k,y:N}}},...m}=As(e,n),h={x:s,y:r},x=await c.detectOverflow(n,m),y=Ea(Jn(i)),w=Mh(y);let S=h[w],_=h[y];if(d){const E=w==="y"?"top":"left",k=w==="y"?"bottom":"right",N=S+x[E],R=S-x[k];S=zg(N,S,R)}if(f){const E=y==="y"?"top":"left",k=y==="y"?"bottom":"right",N=_+x[E],R=_-x[k];_=zg(N,_,R)}const j=g.fn({...n,[w]:S,[y]:_});return{...j,data:{x:j.x-s,y:j.y-r,enabled:{[w]:d,[y]:f}}}}}},TA=function(e){return e===void 0&&(e={}),{options:e,fn(n){const{x:s,y:r,placement:i,rects:c,middlewareData:d}=n,{offset:f=0,mainAxis:g=!0,crossAxis:m=!0}=As(e,n),h={x:s,y:r},x=Ea(i),y=Mh(x);let w=h[y],S=h[x];const _=As(f,n),j=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(g){const N=y==="y"?"height":"width",R=c.reference[y]-c.floating[N]+j.mainAxis,A=c.reference[y]+c.reference[N]-j.mainAxis;w<R?w=R:w>A&&(w=A)}if(m){var E,k;const N=y==="y"?"width":"height",R=bS.has(Jn(i)),A=c.reference[x]-c.floating[N]+(R&&((E=d.offset)==null?void 0:E[x])||0)+(R?0:j.crossAxis),M=c.reference[x]+c.reference[N]+(R?0:((k=d.offset)==null?void 0:k[x])||0)-(R?j.crossAxis:0);S<A?S=A:S>M&&(S=M)}return{[y]:w,[x]:S}}}},AA=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(n){var s,r;const{placement:i,rects:c,platform:d,elements:f}=n,{apply:g=()=>{},...m}=As(e,n),h=await d.detectOverflow(n,m),x=Jn(i),y=hr(i),w=Ea(i)==="y",{width:S,height:_}=c.floating;let j,E;x==="top"||x==="bottom"?(j=x,E=y===(await(d.isRTL==null?void 0:d.isRTL(f.floating))?"start":"end")?"left":"right"):(E=x,j=y==="end"?"top":"bottom");const k=_-h.top-h.bottom,N=S-h.left-h.right,R=Xo(_-h[j],k),A=Xo(S-h[E],N),M=!n.middlewareData.shift;let O=R,U=A;if((s=n.middlewareData.shift)!=null&&s.enabled.x&&(U=N),(r=n.middlewareData.shift)!=null&&r.enabled.y&&(O=k),M&&!y){const B=da(h.left,0),L=da(h.right,0),D=da(h.top,0),q=da(h.bottom,0);w?U=S-2*(B!==0||L!==0?B+L:da(h.left,h.right)):O=_-2*(D!==0||q!==0?D+q:da(h.top,h.bottom))}await g({...n,availableWidth:U,availableHeight:O});const I=await d.getDimensions(f.floating);return S!==I.width||_!==I.height?{reset:{rects:!0}}:{}}}};function vS(e){const n=Wn(e);let s=parseFloat(n.width)||0,r=parseFloat(n.height)||0;const i=Ut(e),c=i?e.offsetWidth:s,d=i?e.offsetHeight:r,f=rd(s)!==c||rd(r)!==d;return f&&(s=c,r=d),{width:s,height:r,$:f}}function Hh(e){return ot(e)?e:e.contextElement}function Vo(e){const n=Hh(e);if(!Ut(n))return Ka(1);const s=n.getBoundingClientRect(),{width:r,height:i,$:c}=vS(n);let d=(c?rd(s.width):s.width)/r,f=(c?rd(s.height):s.height)/i;return(!d||!Number.isFinite(d))&&(d=1),(!f||!Number.isFinite(f))&&(f=1),{x:d,y:f}}const MA=Ka(0);function yS(e){const n=Ft(e);return!Nd()||!n.visualViewport?MA:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function OA(e,n,s){return n===void 0&&(n=!1),!s||n&&s!==Ft(e)?!1:n}function Fr(e,n,s,r){n===void 0&&(n=!1),s===void 0&&(s=!1);const i=e.getBoundingClientRect(),c=Hh(e);let d=Ka(1);n&&(r?ot(r)&&(d=Vo(r)):d=Vo(e));const f=OA(c,s,r)?yS(c):Ka(0);let g=(i.left+f.x)/d.x,m=(i.top+f.y)/d.y,h=i.width/d.x,x=i.height/d.y;if(c){const y=Ft(c),w=r&&ot(r)?Ft(r):r;let S=y,_=Ag(S);for(;_&&r&&w!==S;){const j=Vo(_),E=_.getBoundingClientRect(),k=Wn(_),N=E.left+(_.clientLeft+parseFloat(k.paddingLeft))*j.x,R=E.top+(_.clientTop+parseFloat(k.paddingTop))*j.y;g*=j.x,m*=j.y,h*=j.x,x*=j.y,g+=N,m+=R,S=Ft(_),_=Ag(S)}}return qi({width:h,height:x,x:g,y:m})}function Pd(e,n){const s=Td(e).scrollLeft;return n?n.left+s:Fr(Ja(e)).left+s}function _S(e,n){const s=e.getBoundingClientRect(),r=s.left+n.scrollLeft-Pd(e,s),i=s.top+n.scrollTop;return{x:r,y:i}}function zA(e){let{elements:n,rect:s,offsetParent:r,strategy:i}=e;const c=i==="fixed",d=Ja(r),f=n?Rd(n.floating):!1;if(r===d||f&&c)return s;let g={scrollLeft:0,scrollTop:0},m=Ka(1);const h=Ka(0),x=Ut(r);if((x||!x&&!c)&&((Pn(r)!=="body"||gr(d))&&(g=Td(r)),x)){const w=Fr(r);m=Vo(r),h.x=w.x+r.clientLeft,h.y=w.y+r.clientTop}const y=d&&!x&&!c?_S(d,g):Ka(0);return{width:s.width*m.x,height:s.height*m.y,x:s.x*m.x-g.scrollLeft*m.x+h.x+y.x,y:s.y*m.y-g.scrollTop*m.y+h.y+y.y}}function DA(e){return Array.from(e.getClientRects())}function LA(e){const n=Ja(e),s=Td(e),r=e.ownerDocument.body,i=da(n.scrollWidth,n.clientWidth,r.scrollWidth,r.clientWidth),c=da(n.scrollHeight,n.clientHeight,r.scrollHeight,r.clientHeight);let d=-s.scrollLeft+Pd(e);const f=-s.scrollTop;return Wn(r).direction==="rtl"&&(d+=da(n.clientWidth,r.clientWidth)-i),{width:i,height:c,x:d,y:f}}const o1=25;function PA(e,n){const s=Ft(e),r=Ja(e),i=s.visualViewport;let c=r.clientWidth,d=r.clientHeight,f=0,g=0;if(i){c=i.width,d=i.height;const h=Nd();(!h||h&&n==="fixed")&&(f=i.offsetLeft,g=i.offsetTop)}const m=Pd(r);if(m<=0){const h=r.ownerDocument,x=h.body,y=getComputedStyle(x),w=h.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,S=Math.abs(r.clientWidth-x.clientWidth-w);S<=o1&&(c-=S)}else m<=o1&&(c+=m);return{width:c,height:d,x:f,y:g}}function BA(e,n){const s=Fr(e,!0,n==="fixed"),r=s.top+e.clientTop,i=s.left+e.clientLeft,c=Ut(e)?Vo(e):Ka(1),d=e.clientWidth*c.x,f=e.clientHeight*c.y,g=i*c.x,m=r*c.y;return{width:d,height:f,x:g,y:m}}function l1(e,n,s){let r;if(n==="viewport")r=PA(e,s);else if(n==="document")r=LA(Ja(e));else if(ot(n))r=BA(n,s);else{const i=yS(e);r={x:n.x-i.x,y:n.y-i.y,width:n.width,height:n.height}}return qi(r)}function jS(e,n){const s=Rs(e);return s===n||!ot(s)||ws(s)?!1:Wn(s).position==="fixed"||jS(s,n)}function IA(e,n){const s=n.get(e);if(s)return s;let r=Ii(e,[],!1).filter(f=>ot(f)&&Pn(f)!=="body"),i=null;const c=Wn(e).position==="fixed";let d=c?Rs(e):e;for(;ot(d)&&!ws(d);){const f=Wn(d),g=Eh(d);!g&&f.position==="fixed"&&(i=null),(c?!g&&!i:!g&&f.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||gr(d)&&!g&&jS(e,d))?r=r.filter(h=>h!==d):i=f,d=Rs(d)}return n.set(e,r),r}function UA(e){let{element:n,boundary:s,rootBoundary:r,strategy:i}=e;const d=[...s==="clippingAncestors"?Rd(n)?[]:IA(n,this._c):[].concat(s),r],f=l1(n,d[0],i);let g=f.top,m=f.right,h=f.bottom,x=f.left;for(let y=1;y<d.length;y++){const w=l1(n,d[y],i);g=da(w.top,g),m=Xo(w.right,m),h=Xo(w.bottom,h),x=da(w.left,x)}return{width:m-x,height:h-g,x,y:g}}function HA(e){const{width:n,height:s}=vS(e);return{width:n,height:s}}function qA(e,n,s){const r=Ut(n),i=Ja(n),c=s==="fixed",d=Fr(e,!0,c,n);let f={scrollLeft:0,scrollTop:0};const g=Ka(0);function m(){g.x=Pd(i)}if(r||!r&&!c)if((Pn(n)!=="body"||gr(i))&&(f=Td(n)),r){const w=Fr(n,!0,c,n);g.x=w.x+n.clientLeft,g.y=w.y+n.clientTop}else i&&m();c&&!r&&i&&m();const h=i&&!r&&!c?_S(i,f):Ka(0),x=d.left+f.scrollLeft-g.x-h.x,y=d.top+f.scrollTop-g.y-h.y;return{x,y,width:d.width,height:d.height}}function Ep(e){return Wn(e).position==="static"}function i1(e,n){if(!Ut(e)||Wn(e).position==="fixed")return null;if(n)return n(e);let s=e.offsetParent;return Ja(e)===s&&(s=s.ownerDocument.body),s}function SS(e,n){const s=Ft(e);if(Rd(e))return s;if(!Ut(e)){let i=Rs(e);for(;i&&!ws(i);){if(ot(i)&&!Ep(i))return i;i=Rs(i)}return s}let r=i1(e,n);for(;r&&sT(r)&&Ep(r);)r=i1(r,n);return r&&ws(r)&&Ep(r)&&!Eh(r)?s:r||lT(e)||s}const VA=async function(e){const n=this.getOffsetParent||SS,s=this.getDimensions,r=await s(e.floating);return{reference:qA(e.reference,await n(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $A(e){return Wn(e).direction==="rtl"}const wS={convertOffsetParentRelativeRectToViewportRelativeRect:zA,getDocumentElement:Ja,getClippingRect:UA,getOffsetParent:SS,getElementRects:VA,getClientRects:DA,getDimensions:HA,getScale:Vo,isElement:ot,isRTL:$A};function CS(e,n){return e.x===n.x&&e.y===n.y&&e.width===n.width&&e.height===n.height}function GA(e,n){let s=null,r;const i=Ja(e);function c(){var f;clearTimeout(r),(f=s)==null||f.disconnect(),s=null}function d(f,g){f===void 0&&(f=!1),g===void 0&&(g=1),c();const m=e.getBoundingClientRect(),{left:h,top:x,width:y,height:w}=m;if(f||n(),!y||!w)return;const S=Hr(x),_=Hr(i.clientWidth-(h+y)),j=Hr(i.clientHeight-(x+w)),E=Hr(h),N={rootMargin:-S+"px "+-_+"px "+-j+"px "+-E+"px",threshold:da(0,Xo(1,g))||1};let R=!0;function A(M){const O=M[0].intersectionRatio;if(O!==g){if(!R)return d();O?d(!1,O):r=setTimeout(()=>{d(!1,1e-7)},1e3)}O===1&&!CS(m,e.getBoundingClientRect())&&d(),R=!1}try{s=new IntersectionObserver(A,{...N,root:i.ownerDocument})}catch{s=new IntersectionObserver(A,N)}s.observe(e)}return d(!0),c}function c1(e,n,s,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:c=!0,elementResize:d=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:g=!1}=r,m=Hh(e),h=i||c?[...m?Ii(m):[],...n?Ii(n):[]]:[];h.forEach(E=>{i&&E.addEventListener("scroll",s,{passive:!0}),c&&E.addEventListener("resize",s)});const x=m&&f?GA(m,s):null;let y=-1,w=null;d&&(w=new ResizeObserver(E=>{let[k]=E;k&&k.target===m&&w&&n&&(w.unobserve(n),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var N;(N=w)==null||N.observe(n)})),s()}),m&&!g&&w.observe(m),n&&w.observe(n));let S,_=g?Fr(e):null;g&&j();function j(){const E=Fr(e);_&&!CS(_,E)&&s(),_=E,S=requestAnimationFrame(j)}return s(),()=>{var E;h.forEach(k=>{i&&k.removeEventListener("scroll",s),c&&k.removeEventListener("resize",s)}),x?.(),(E=w)==null||E.disconnect(),w=null,g&&cancelAnimationFrame(S)}}const YA=RA,FA=NA,XA=CA,KA=AA,QA=EA,ZA=TA,JA=(e,n,s)=>{const r=new Map,i={platform:wS,...s},c={...i.platform,_c:r};return wA(e,n,{...i,platform:c})};var WA=typeof document<"u",eM=function(){},Fu=WA?v.useLayoutEffect:eM;function cd(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(typeof e=="function"&&e.toString()===n.toString())return!0;let s,r,i;if(e&&n&&typeof e=="object"){if(Array.isArray(e)){if(s=e.length,s!==n.length)return!1;for(r=s;r--!==0;)if(!cd(e[r],n[r]))return!1;return!0}if(i=Object.keys(e),s=i.length,s!==Object.keys(n).length)return!1;for(r=s;r--!==0;)if(!{}.hasOwnProperty.call(n,i[r]))return!1;for(r=s;r--!==0;){const c=i[r];if(!(c==="_owner"&&e.$$typeof)&&!cd(e[c],n[c]))return!1}return!0}return e!==e&&n!==n}function ES(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function u1(e,n){const s=ES(e);return Math.round(n*s)/s}function kp(e){const n=v.useRef(e);return Fu(()=>{n.current=e}),n}function tM(e){e===void 0&&(e={});const{placement:n="bottom",strategy:s="absolute",middleware:r=[],platform:i,elements:{reference:c,floating:d}={},transform:f=!0,whileElementsMounted:g,open:m}=e,[h,x]=v.useState({x:0,y:0,strategy:s,placement:n,middlewareData:{},isPositioned:!1}),[y,w]=v.useState(r);cd(y,r)||w(r);const[S,_]=v.useState(null),[j,E]=v.useState(null),k=v.useCallback(Q=>{Q!==M.current&&(M.current=Q,_(Q))},[]),N=v.useCallback(Q=>{Q!==O.current&&(O.current=Q,E(Q))},[]),R=c||S,A=d||j,M=v.useRef(null),O=v.useRef(null),U=v.useRef(h),I=g!=null,B=kp(g),L=kp(i),D=kp(m),q=v.useCallback(()=>{if(!M.current||!O.current)return;const Q={placement:n,strategy:s,middleware:y};L.current&&(Q.platform=L.current),JA(M.current,O.current,Q).then(V=>{const Y={...V,isPositioned:D.current!==!1};F.current&&!cd(U.current,Y)&&(U.current=Y,Qr.flushSync(()=>{x(Y)}))})},[y,n,s,L,D]);Fu(()=>{m===!1&&U.current.isPositioned&&(U.current.isPositioned=!1,x(Q=>({...Q,isPositioned:!1})))},[m]);const F=v.useRef(!1);Fu(()=>(F.current=!0,()=>{F.current=!1}),[]),Fu(()=>{if(R&&(M.current=R),A&&(O.current=A),R&&A){if(B.current)return B.current(R,A,q);q()}},[R,A,q,B,I]);const Z=v.useMemo(()=>({reference:M,floating:O,setReference:k,setFloating:N}),[k,N]),H=v.useMemo(()=>({reference:R,floating:A}),[R,A]),G=v.useMemo(()=>{const Q={position:s,left:0,top:0};if(!H.floating)return Q;const V=u1(H.floating,h.x),Y=u1(H.floating,h.y);return f?{...Q,transform:"translate("+V+"px, "+Y+"px)",...ES(H.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:V,top:Y}},[s,f,H.floating,h.x,h.y]);return v.useMemo(()=>({...h,update:q,refs:Z,elements:H,floatingStyles:G}),[h,q,Z,H,G])}const nM=(e,n)=>{const s=YA(e);return{name:s.name,fn:s.fn,options:[e,n]}},aM=(e,n)=>{const s=FA(e);return{name:s.name,fn:s.fn,options:[e,n]}},sM=(e,n)=>({fn:ZA(e).fn,options:[e,n]}),rM=(e,n)=>{const s=XA(e);return{name:s.name,fn:s.fn,options:[e,n]}},oM=(e,n)=>{const s=KA(e);return{name:s.name,fn:s.fn,options:[e,n]}},lM=(e,n)=>{const s=QA(e);return{name:s.name,fn:s.fn,options:[e,n]}},Te=(e,n,s,r,i,c,...d)=>{if(d.length>0)throw new Error(Nn(1));let f;if(e)f=e;else throw new Error("Missing arguments");return f};var Rp={exports:{}},Np={};/**
|
|
506
|
+
* @license React
|
|
507
|
+
* use-sync-external-store-shim.production.js
|
|
508
|
+
*
|
|
509
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
510
|
+
*
|
|
511
|
+
* This source code is licensed under the MIT license found in the
|
|
512
|
+
* LICENSE file in the root directory of this source tree.
|
|
513
|
+
*/var d1;function iM(){if(d1)return Np;d1=1;var e=Xi();function n(x,y){return x===y&&(x!==0||1/x===1/y)||x!==x&&y!==y}var s=typeof Object.is=="function"?Object.is:n,r=e.useState,i=e.useEffect,c=e.useLayoutEffect,d=e.useDebugValue;function f(x,y){var w=y(),S=r({inst:{value:w,getSnapshot:y}}),_=S[0].inst,j=S[1];return c(function(){_.value=w,_.getSnapshot=y,g(_)&&j({inst:_})},[x,w,y]),i(function(){return g(_)&&j({inst:_}),x(function(){g(_)&&j({inst:_})})},[x]),d(w),w}function g(x){var y=x.getSnapshot;x=x.value;try{var w=y();return!s(x,w)}catch{return!0}}function m(x,y){return y()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:f;return Np.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,Np}var f1;function kS(){return f1||(f1=1,Rp.exports=iM()),Rp.exports}var ud=kS(),Tp={exports:{}},Ap={};/**
|
|
514
|
+
* @license React
|
|
515
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
516
|
+
*
|
|
517
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
518
|
+
*
|
|
519
|
+
* This source code is licensed under the MIT license found in the
|
|
520
|
+
* LICENSE file in the root directory of this source tree.
|
|
521
|
+
*/var m1;function cM(){if(m1)return Ap;m1=1;var e=Xi(),n=kS();function s(m,h){return m===h&&(m!==0||1/m===1/h)||m!==m&&h!==h}var r=typeof Object.is=="function"?Object.is:s,i=n.useSyncExternalStore,c=e.useRef,d=e.useEffect,f=e.useMemo,g=e.useDebugValue;return Ap.useSyncExternalStoreWithSelector=function(m,h,x,y,w){var S=c(null);if(S.current===null){var _={hasValue:!1,value:null};S.current=_}else _=S.current;S=f(function(){function E(M){if(!k){if(k=!0,N=M,M=y(M),w!==void 0&&_.hasValue){var O=_.value;if(w(O,M))return R=O}return R=M}if(O=R,r(N,M))return O;var U=y(M);return w!==void 0&&w(O,U)?(N=M,O):(N=M,R=U)}var k=!1,N,R,A=x===void 0?null:x;return[function(){return E(h())},A===null?void 0:function(){return E(A())}]},[h,x,y,w]);var j=i(m,S[0],S[1]);return d(function(){_.hasValue=!0,_.value=j},[j]),g(j),j},Ap}var p1;function uM(){return p1||(p1=1,Tp.exports=cM()),Tp.exports}var dM=uM();const fM=Lh(19),mM=fM?gM:hM;function Ke(e,n,s,r,i){return mM(e,n,s,r,i)}function pM(e,n,s,r,i){const c=v.useCallback(()=>n(e.getSnapshot(),s,r,i),[e,n,s,r,i]);return ud.useSyncExternalStore(e.subscribe,c,c)}YN({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let n=!1;for(let s=0;s<e.syncHooks.length;s+=1){const r=e.syncHooks[s],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(n=!0,r.value=i,r.didChange=!1)}return n&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=n=>{const s=new Set;for(const i of e.syncHooks)s.add(i.store);const r=[];for(const i of s)r.push(i.subscribe(n));return()=>{for(const i of r)i()}}),ud.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function gM(e,n,s,r,i){const c=GN();if(!c)return pM(e,n,s,r,i);const d=c.syncIndex;c.syncIndex+=1;let f;return c.didInitialize?(f=c.syncHooks[d],(f.store!==e||f.selector!==n||!Object.is(f.a1,s)||!Object.is(f.a2,r)||!Object.is(f.a3,i))&&(f.store!==e&&(c.didChangeStore=!0),f.store=e,f.selector=n,f.a1=s,f.a2=r,f.a3=i,f.didChange=!0)):(f={store:e,selector:n,a1:s,a2:r,a3:i,value:n(e.getSnapshot(),s,r,i),didChange:!1},c.syncHooks.push(f)),f.value}function hM(e,n,s,r,i){return dM.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,c=>n(c,s,r,i))}class RS{constructor(n){this.state=n,this.listeners=new Set,this.updateTick=0}subscribe=n=>(this.listeners.add(n),()=>{this.listeners.delete(n)});getSnapshot=()=>this.state;setState(n){if(this.state===n)return;this.state=n,this.updateTick+=1;const s=this.updateTick;for(const r of this.listeners){if(s!==this.updateTick)return;r(n)}}update(n){for(const s in n)if(!Object.is(this.state[s],n[s])){this.setState({...this.state,...n});return}}set(n,s){Object.is(this.state[n],s)||this.setState({...this.state,[n]:s})}notifyAll(){const n={...this.state};this.setState(n)}use(n,s,r,i){return Ke(this,n,s,r,i)}}class qh extends RS{constructor(n,s={},r){super(n),this.context=s,this.selectors=r}useSyncedValue(n,s){v.useDebugValue(n);const r=this;Re(()=>{r.state[n]!==s&&r.set(n,s)},[r,n,s])}useSyncedValueWithCleanup(n,s){const r=this;Re(()=>(r.state[n]!==s&&r.set(n,s),()=>{r.set(n,void 0)}),[r,n,s])}useSyncedValues(n){const s=this,r=Object.values(n);Re(()=>{s.update(n)},[s,...r])}useControlledProp(n,s){v.useDebugValue(n);const r=this,i=s!==void 0;Re(()=>{i&&!Object.is(r.state[n],s)&&r.setState({...r.state,[n]:s})},[r,n,s,i])}select(n,s,r,i){const c=this.selectors[n];return c(this.state,s,r,i)}useState(n,s,r,i){return v.useDebugValue(n),Ke(this,this.selectors[n],s,r,i)}useContextCallback(n,s){v.useDebugValue(n);const r=Ae(s??Dn);this.context[n]=r}useStateSetter(n){const s=v.useRef(void 0);return s.current===void 0&&(s.current=r=>{this.set(n,r)}),s.current}observe(n,s){let r;typeof n=="function"?r=n:r=this.selectors[n];let i=r(this.state);return s(i,i,this),this.subscribe(c=>{const d=r(c);if(!Object.is(i,d)){const f=i;i=d,s(d,f,this)}})}}const xM={open:Te(e=>e.open),transitionStatus:Te(e=>e.transitionStatus),domReferenceElement:Te(e=>e.domReferenceElement),referenceElement:Te(e=>e.positionReference??e.referenceElement),floatingElement:Te(e=>e.floatingElement),floatingId:Te(e=>e.floatingId)};class Bd extends qh{constructor(n){const{syncOnly:s,nested:r,onOpenChange:i,triggerElements:c,...d}=n;super({...d,positionReference:d.referenceElement,domReferenceElement:d.referenceElement},{onOpenChange:i,dataRef:{current:{}},events:uA(),nested:r,triggerElements:c},xM),this.syncOnly=s}syncOpenEvent=(n,s)=>{(!n||!this.state.open||s!=null&&aT(s))&&(this.context.dataRef.current.openEvent=n?s:void 0)};dispatchOpenChange=(n,s)=>{this.syncOpenEvent(n,s.event);const r={open:n,reason:s.reason,nativeEvent:s.event,nested:this.context.nested,triggerElement:s.trigger};this.context.events.emit("openchange",r)};setOpen=(n,s)=>{if(this.syncOnly){this.context.onOpenChange?.(n,s);return}this.dispatchOpenChange(n,s),this.context.onOpenChange?.(n,s)}}function bM(e){const{popupStore:n,treatPopupAsFloatingElement:s=!1,floatingRootContext:r,floatingId:i,nested:c,onOpenChange:d}=e,f=n.useState("open"),g=n.useState("activeTriggerElement"),m=n.useState(s?"popupElement":"positionerElement"),h=n.context.triggerElements,x=d,y=v.useRef(null);r===void 0&&y.current===null&&(y.current=new Bd({open:f,transitionStatus:void 0,referenceElement:g,floatingElement:m,triggerElements:h,onOpenChange:x,floatingId:i,syncOnly:!0,nested:c}));const w=r??y.current;return n.useSyncedValue("floatingId",i),Re(()=>{const S={open:f,floatingId:i,referenceElement:g,floatingElement:m};ot(g)&&(S.domReferenceElement=g),w.state.positionReference===w.state.referenceElement&&(S.positionReference=g),w.update(S)},[f,i,g,m,w]),w.context.onOpenChange=x,w.context.nested=c,w}function tc(e,n=!1,s=!1){const[r,i]=v.useState(e&&n?"idle":void 0),[c,d]=v.useState(e);return e&&!c&&(d(!0),i("starting")),!e&&c&&r!=="ending"&&!s&&i("ending"),!e&&!c&&r==="ending"&&i(void 0),Re(()=>{if(!e&&c&&r!=="ending"&&s){const f=Ya.request(()=>{i("ending")});return()=>{Ya.cancel(f)}}},[e,c,r,s]),Re(()=>{if(!e||n)return;const f=Ya.request(()=>{i(void 0)});return()=>{Ya.cancel(f)}},[n,e]),Re(()=>{if(!e||!n)return;e&&c&&r!=="idle"&&i("starting");const f=Ya.request(()=>{i("idle")});return()=>{Ya.cancel(f)}},[n,e,c,r]),{mounted:c,setMounted:d,transitionStatus:r}}let Xr=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const vM={[Xr.startingStyle]:""},yM={[Xr.endingStyle]:""},dl={transitionStatus(e){return e==="starting"?vM:e==="ending"?yM:null}};function _M(e,n=!1,s=!0){const r=Fo();return Ae((i,c=null)=>{r.cancel();const d=_s(e);if(d==null)return;const f=d,g=()=>{Qr.flushSync(i)};if(typeof f.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function m(){Promise.all(f.getAnimations().map(h=>h.finished)).then(()=>{c?.aborted||g()}).catch(()=>{if(s){c?.aborted||g();return}const h=f.getAnimations();!c?.aborted&&h.length>0&&h.some(x=>x.pending||x.playState!=="finished")&&m()})}if(n){const h=Xr.startingStyle;if(!f.hasAttribute(h)){r.request(m);return}const x=new MutationObserver(()=>{f.hasAttribute(h)||(x.disconnect(),m())});x.observe(f,{attributes:!0,attributeFilter:[h]}),c?.addEventListener("abort",()=>x.disconnect(),{once:!0});return}r.request(m)})}function xr(e){const{enabled:n=!0,open:s,ref:r,onComplete:i}=e,c=Ae(i),d=_M(r,s,!1);v.useEffect(()=>{if(!n)return;const f=new AbortController;return d(c,f.signal),()=>{f.abort()}},[n,s,c,d])}const Id={tabIndex:-1,[Mg]:""};function NS(e,n,s=!1){const r=Dd(),i=Ld()!=null,c=v.useRef(null);e===void 0&&c.current===null&&(c.current=n(r,i));const d=e??c.current;return bM({popupStore:d,treatPopupAsFloatingElement:s,floatingRootContext:d.state.floatingRootContext,floatingId:r,nested:i,onOpenChange:d.setOpen}),{store:d,internalStore:c.current}}function jM(e,n){const s=v.useRef(null),r=v.useRef(null);return v.useCallback(i=>{if(e===void 0)return;let c=!1;if(s.current!==null){const d=s.current,f=r.current,g=n.context.triggerElements.getById(d);f&&g===f&&(n.context.triggerElements.delete(d),c=!0),s.current=null,r.current=null}if(i!==null&&(s.current=e,r.current=i,n.context.triggerElements.add(e,i),c=!0),c){const d=n.context.triggerElements.size;n.select("open")&&n.state.triggerCount!==d&&n.set("triggerCount",d)}},[n,e])}function TS(e,n,s){const r=s?.id??null;(r||n)&&(e.activeTriggerId=r,e.activeTriggerElement=s??null)}function SM(e,n,s,r){const i=s.useState("isMountedByTrigger",e),c=jM(e,s),d=Ae(f=>{if(c(f),!f)return;const g=s.select("open"),m=s.select("activeTriggerId");if(m===e){s.update({activeTriggerElement:f,...g?r:null});return}m==null&&g&&s.update({activeTriggerId:e,activeTriggerElement:f,...r})});return Re(()=>{i&&s.update({activeTriggerElement:n.current,...r})},[i,s,n,...Object.values(r)]),{registerTrigger:d,isMountedByThisTrigger:i}}function AS(e){const n=e.useState("open"),s=e.useState("triggerCount");Re(()=>{if(!n){e.state.triggerCount!==0&&e.set("triggerCount",0);return}const r=e.context.triggerElements.size,i={};if(e.state.triggerCount!==r&&(i.triggerCount=r),!e.select("activeTriggerId")&&r===1){const c=e.context.triggerElements.entries().next();if(!c.done){const[d,f]=c.value;i.activeTriggerId=d,i.activeTriggerElement=f}}(i.triggerCount!==void 0||i.activeTriggerId!==void 0)&&e.update(i)},[n,e,s])}function MS(e,n,s){const{mounted:r,setMounted:i,transitionStatus:c}=tc(e);n.useSyncedValues({mounted:r,transitionStatus:c});const d=Ae(()=>{i(!1),n.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n.context.onOpenChangeComplete?.(!1)}),f=n.useState("preventUnmountingOnClose");return xr({enabled:r&&!e&&!f,open:e,ref:n.context.popupRef,onComplete(){e||d()}}),{forceUnmount:d,transitionStatus:c}}function OS(e,n){e.useSyncedValues(n),Re(()=>()=>{e.update({activeTriggerProps:an,inactiveTriggerProps:an,popupProps:an})},[e])}function wM(e,n){Re(()=>{!n&&e.state.openMethod!==null&&e.set("openMethod",null)},[n,e]),Re(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class Ud{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(n,s){const r=this.idMap.get(n);r!==s&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(s),this.idMap.set(n,s))}delete(n){const s=this.idMap.get(n);s&&(this.elementsSet.delete(s),this.idMap.delete(n))}hasElement(n){return this.elementsSet.has(n)}hasMatchingElement(n){for(const s of this.elementsSet)if(n(s))return!0;return!1}getById(n){return this.idMap.get(n)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function CM(){return new Bd({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Ud,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function zS(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:CM(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:an,inactiveTriggerProps:an,popupProps:an}}function DS(e,n,s=!1){return new Bd({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:n,syncOnly:!0,nested:s,onOpenChange:void 0})}const Ni=Te(e=>e.triggerIdProp??e.activeTriggerId),Vh=Te(e=>e.openProp??e.open),g1=Te(e=>(e.popupElement?.id??e.floatingId)||void 0);function LS(e,n){return n!==void 0&&Vh(e)&&Ni(e)===n}function EM(e,n){return LS(e,n)?!0:n!==void 0&&Vh(e)&&Ni(e)==null&&e.triggerCount===1}const PS={open:Vh,mounted:Te(e=>e.mounted),transitionStatus:Te(e=>e.transitionStatus),floatingRootContext:Te(e=>e.floatingRootContext),triggerCount:Te(e=>e.triggerCount),preventUnmountingOnClose:Te(e=>e.preventUnmountingOnClose),payload:Te(e=>e.payload),activeTriggerId:Ni,activeTriggerElement:Te(e=>e.mounted?e.activeTriggerElement:null),popupId:g1,isTriggerActive:Te((e,n)=>n!==void 0&&Ni(e)===n),isOpenedByTrigger:Te((e,n)=>LS(e,n)),isMountedByTrigger:Te((e,n)=>n!==void 0&&Ni(e)===n&&e.mounted),triggerProps:Te((e,n)=>n?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:Te((e,n)=>EM(e,n)?g1(e):void 0),popupProps:Te(e=>e.popupProps),popupElement:Te(e=>e.popupElement),positionerElement:Te(e=>e.positionerElement)};function BS(e){const{open:n=!1,onOpenChange:s,elements:r={}}=e,i=Dd(),c=Ld()!=null,d=fa(()=>new Bd({open:n,transitionStatus:void 0,onOpenChange:s,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Ud,floatingId:i,syncOnly:!1,nested:c})).current;return Re(()=>{const f={open:n,floatingId:i};r.reference!==void 0&&(f.referenceElement=r.reference,f.domReferenceElement=ot(r.reference)?r.reference:null),r.floating!==void 0&&(f.floatingElement=r.floating),d.update(f)},[n,i,r.reference,r.floating,d]),d.context.onOpenChange=s,d.context.nested=c,d}function kM(e={}){const{nodeId:n,externalTree:s}=e,r=BS(e),i=e.rootContext||r,c=i.useState("referenceElement"),d=i.useState("floatingElement"),f=i.useState("domReferenceElement"),g=i.useState("open"),m=i.useState("floatingId"),[h,x]=v.useState(null),[y,w]=v.useState(void 0),[S,_]=v.useState(void 0),j=v.useRef(null),E=ul(s),k=v.useMemo(()=>({reference:c,floating:d,domReference:f}),[c,d,f]),N=tM({...e,elements:{...k,...h&&{reference:h}}}),R=ot(y)?y:null,A=S===void 0?i.state.floatingElement:S;i.useSyncedValue("referenceElement",y??null),i.useSyncedValue("domReferenceElement",y===void 0?f:R),i.useSyncedValue("floatingElement",A);const M=v.useCallback(D=>{const q=ot(D)?{getBoundingClientRect:()=>D.getBoundingClientRect(),getClientRects:()=>D.getClientRects(),contextElement:D}:D;x(q),N.refs.setReference(q)},[N.refs]),O=v.useCallback(D=>{(ot(D)||D===null)&&(j.current=D,w(D)),(ot(N.refs.reference.current)||N.refs.reference.current===null||D!==null&&!ot(D))&&N.refs.setReference(D)},[N.refs,w]),U=v.useCallback(D=>{_(D),N.refs.setFloating(D)},[N.refs]),I=v.useMemo(()=>({...N.refs,setReference:O,setFloating:U,setPositionReference:M,domReference:j}),[N.refs,O,U,M]),B=v.useMemo(()=>({...N.elements,domReference:f}),[N.elements,f]),L=v.useMemo(()=>({...N,dataRef:i.context.dataRef,open:g,onOpenChange:i.setOpen,events:i.context.events,floatingId:m,refs:I,elements:B,nodeId:n,rootStore:i}),[N,I,B,n,i,g,m]);return Re(()=>{f&&(j.current=f)},[f]),Re(()=>{i.context.dataRef.current.floatingContext=L;const D=E?.nodesRef.current.find(q=>q.id===n);D&&(D.context=L)}),v.useMemo(()=>({...N,context:L,refs:I,elements:B,rootStore:i}),[N,I,B,L,i])}const Mp=JN&&Oj;function RM(e,n={}){const{enabled:s=!0,delay:r}=n,i="rootStore"in e?e.rootStore:e,{events:c,dataRef:d}=i.context,f=v.useRef(!1),g=v.useRef(null),m=v.useRef(!0),h=Zn();v.useEffect(()=>{const y=i.select("domReferenceElement");if(!s)return;const w=Ft(y);function S(){const E=i.select("domReferenceElement");!i.select("open")&&Ut(E)&&E===zn(xt(E))&&(f.current=!0)}function _(){m.current=!0}function j(){m.current=!1}return Xa(ct(w,"blur",S),Mp&&ct(w,"keydown",_,!0),Mp&&ct(w,"pointerdown",j,!0))},[i,s]),v.useEffect(()=>{if(!s)return;function y(w){if(w.reason===Hi||w.reason===Nh){const S=i.select("domReferenceElement");ot(S)&&(g.current=S,f.current=!0)}}return c.on("openchange",y),()=>{c.off("openchange",y)}},[c,s,i]);const x=v.useMemo(()=>{function y(){f.current=!1,g.current=null}return{onMouseLeave(){y()},onFocus(w){const S=w.currentTarget;if(f.current){if(g.current===S)return;y()}const _=En(w.nativeEvent);if(ot(_)){if(Mp&&!w.relatedTarget){if(!m.current&&!Ad(_))return}else if(!uT(_))return}const j=td(w.relatedTarget,i.context.triggerElements),{nativeEvent:E,currentTarget:k}=w,N=typeof r=="function"?r():r;if(i.select("open")&&j||N===0||N===void 0){i.setOpen(!0,tt($u,E,k));return}h.start(N,()=>{f.current||i.setOpen(!0,tt($u,E,k))})},onBlur(w){y();const S=w.relatedTarget,_=w.nativeEvent,j=ot(S)&&S.hasAttribute($i("focus-guard"))&&S.getAttribute("data-type")==="outside";h.start(0,()=>{const E=i.select("domReferenceElement"),k=zn(xt(E));!S&&k===E||Ye(d.current.floatingContext?.refs.floating.current,k)||Ye(E,k)||j||td(S??k,i.context.triggerElements)||i.setOpen(!1,tt($u,_))})}}},[d,r,i,h]);return v.useMemo(()=>s?{reference:x,trigger:x}:{},[s,x])}class $h{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 Ia,this.restTimeout=new Ia,this.handleCloseOptions=void 0}static create(){return new $h}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const dd=new WeakMap;function fd(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&dd.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),dd.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function IS(e,n){const{scopeElement:s,referenceElement:r,floatingElement:i}=n,c=dd.get(s);c&&c!==e&&fd(c),fd(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=s,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,dd.set(s,e),s.style.pointerEvents="none",r.style.pointerEvents="auto",i.style.pointerEvents="auto"}function Gh(e){const n=e.context.dataRef.current,s=fa(()=>n.hoverInteractionState??$h.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=s),jh(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function NM(e,n={}){const{enabled:s=!0,closeDelay:r=0,nodeId:i}=n,c="rootStore"in e?e.rootStore:e,d=c.useState("open"),f=c.useState("floatingElement"),g=c.useState("domReferenceElement"),{dataRef:m}=c.context,h=ul(),x=Ld(),y=Gh(c),w=Zn(),S=Ae(()=>Bj(m.current.openEvent?.type,y.interactedInside)),_=Ae(()=>fT(m.current.openEvent?.type)),j=Ae(()=>{fd(y)});Re(()=>{d||(y.pointerType=void 0,y.restTimeoutPending=!1,y.interactedInside=!1,j())},[d,y,j]),v.useEffect(()=>j,[j]),Re(()=>{if(s&&d&&y.handleCloseOptions?.blockPointerEvents&&_()&&ot(g)&&f){const E=g,k=f,N=xt(f),R=h?.nodesRef.current.find(U=>U.id===x)?.context?.elements.floating;R&&(R.style.pointerEvents="");const A=y.pointerEventsScopeElement!==k?y.pointerEventsScopeElement:null,M=R!==k?R:null,O=y.handleCloseOptions?.getScope?.()??A??M??E.closest("[data-rootownerid]")??N.body;return IS(y,{scopeElement:O,referenceElement:E,floatingElement:k}),()=>{j()}}},[s,d,g,f,y,_,h,x,j]),v.useEffect(()=>{if(!s)return;function E(){return!!(h&&x&&mr(h.nodesRef.current,x).length>0)}function k(U){const I=ad(r,"close",y.pointerType),B=()=>{c.setOpen(!1,tt(In,U)),h?.events.emit("floating.closed",U)};I?y.openChangeTimeout.start(I,B):(y.openChangeTimeout.clear(),B())}function N(U){const I=En(U);if(!cT(I)){y.interactedInside=!1;return}y.interactedInside=I?.closest("[aria-haspopup]")!=null}function R(){y.openChangeTimeout.clear(),w.clear(),h?.events.off("floating.closed",M),j()}function A(U){if(E()&&h){h.events.on("floating.closed",M);return}if(td(U.relatedTarget,c.context.triggerElements))return;const I=m.current.floatingContext?.nodeId??i,B=U.relatedTarget;if(!(h&&I&&ot(B)&&mr(h.nodesRef.current,I,!1).some(D=>Ye(D.context?.elements.floating,B)))){if(y.handler){y.handler(U);return}j(),S()||k(U)}}function M(U){!h||!x||E()||w.start(0,()=>{h.events.off("floating.closed",M),c.setOpen(!1,tt(In,U)),h.events.emit("floating.closed",U)})}const O=f;return Xa(O&&ct(O,"mouseenter",R),O&&ct(O,"mouseleave",A),O&&ct(O,"pointerdown",N,!0),()=>{h?.events.off("floating.closed",M)})},[s,f,c,m,r,i,S,j,y,h,x,w])}const TM={current:null};function AM(e,n={}){const{enabled:s=!0,delay:r=0,handleClose:i=null,mouseOnly:c=!1,restMs:d=0,move:f=!0,triggerElementRef:g=TM,externalTree:m,isActiveTrigger:h=!0,getHandleCloseContext:x,isClosing:y,shouldOpen:w}=n,S="rootStore"in e?e.rootStore:e,{dataRef:_,events:j}=S.context,E=ul(m),k=Gh(S),N=v.useRef(!1),R=cn(i),A=cn(r),M=cn(d),O=cn(s),U=cn(w),I=cn(y),B=Ae(()=>Bj(_.current.openEvent?.type,k.interactedInside)),L=Ae(()=>U.current?.()!==!1),D=Ae((Z,H,G)=>{const Q=S.context.triggerElements;if(Q.hasElement(H))return!Z||!Ye(Z,H);if(!ot(G))return!1;const V=G;return Q.hasMatchingElement(Y=>Ye(Y,V))&&(!Z||!Ye(Z,V))}),q=Ae(()=>{if(!k.handler)return;xt(S.select("domReferenceElement")).removeEventListener("mousemove",k.handler),k.handler=void 0}),F=Ae(()=>{fd(k)});return h&&(k.handleCloseOptions=R.current?.__options),v.useEffect(()=>q,[q]),v.useEffect(()=>{if(!s)return;function Z(H){H.open?N.current=!1:(N.current=H.reason===In,q(),k.openChangeTimeout.clear(),k.restTimeout.clear(),k.blockMouseMove=!0,k.restTimeoutPending=!1)}return j.on("openchange",Z),()=>{j.off("openchange",Z)}},[s,j,k,q]),v.useEffect(()=>{if(!s)return;function Z(V,Y=!0){const P=ad(A.current,"close",k.pointerType);P?k.openChangeTimeout.start(P,()=>{S.setOpen(!1,tt(In,V)),E?.events.emit("floating.closed",V)}):Y&&(k.openChangeTimeout.clear(),S.setOpen(!1,tt(In,V)),E?.events.emit("floating.closed",V))}const H=g.current??(h?S.select("domReferenceElement"):null);if(!ot(H))return;function G(V){if(k.openChangeTimeout.clear(),k.blockMouseMove=!1,c&&!Yr(k.pointerType))return;const Y=I0(M.current),P=ad(A.current,"open",k.pointerType),K=En(V),$=V.currentTarget??null,W=S.select("domReferenceElement");let ce=$;if(ot(K)&&!S.context.triggerElements.hasElement(K)){for(const Ee of S.context.triggerElements.elements())if(Ye(Ee,K)){ce=Ee;break}}ot($)&&ot(W)&&!S.context.triggerElements.hasElement($)&&Ye($,W)&&(ce=W);const ie=ce==null?!1:D(W,ce,K),oe=S.select("open"),ue=I.current?.()??S.select("transitionStatus")==="ending",te=!oe&&ue&&N.current,Ne=!ie&&ot(ce)&&ot(W)&&Ye(W,ce)&&te,$e=Y>0&&!P,be=ie&&(oe||te)||Ne,Se=!oe||ie;if(be){L()&&S.setOpen(!0,tt(In,V,ce));return}$e||(P?k.openChangeTimeout.start(P,()=>{Se&&L()&&S.setOpen(!0,tt(In,V,ce))}):Se&&L()&&S.setOpen(!0,tt(In,V,ce)))}function Q(V){if(B()){F();return}q();const Y=S.select("domReferenceElement"),P=xt(Y);k.restTimeout.clear(),k.restTimeoutPending=!1;const K=_.current.floatingContext??x?.();if(td(V.relatedTarget,S.context.triggerElements))return;if(R.current&&K){S.select("open")||k.openChangeTimeout.clear();const W=g.current;k.handler=R.current({...K,tree:E,x:V.clientX,y:V.clientY,onClose(){F(),q(),O.current&&!B()&&W===S.select("domReferenceElement")&&Z(V,!0)}}),P.addEventListener("mousemove",k.handler),k.handler(V);return}(k.pointerType==="touch"?!Ye(S.select("floatingElement"),V.relatedTarget):!0)&&Z(V)}return f?Xa(ct(H,"mousemove",G,{once:!0}),ct(H,"mouseenter",G),ct(H,"mouseleave",Q)):Xa(ct(H,"mouseenter",G),ct(H,"mouseleave",Q))},[q,F,_,A,S,s,R,k,h,D,B,c,f,M,g,E,O,x,I,L]),v.useMemo(()=>{if(!s)return;function Z(H){k.pointerType=H.pointerType}return{onPointerDown:Z,onPointerEnter:Z,onMouseMove(H){const{nativeEvent:G}=H,Q=H.currentTarget,V=S.select("domReferenceElement"),Y=S.select("open"),P=D(V,Q,H.target);if(c&&!Yr(k.pointerType))return;if(Y&&P&&k.handleCloseOptions?.blockPointerEvents){const W=S.select("floatingElement");if(W){const ce=k.handleCloseOptions?.getScope?.()??Q.ownerDocument.body;IS(k,{scopeElement:ce,referenceElement:Q,floatingElement:W})}}const K=I0(M.current);if(Y&&!P||K===0||!P&&k.restTimeoutPending&&H.movementX**2+H.movementY**2<2)return;k.restTimeout.clear();function $(){if(k.restTimeoutPending=!1,B())return;const W=S.select("open");!k.blockMouseMove&&(!W||P)&&L()&&S.setOpen(!0,tt(In,G,Q))}k.pointerType==="touch"?Qr.flushSync(()=>{$()}):P&&Y?$():(k.restTimeoutPending=!0,k.restTimeout.start(K,$))}}},[s,k,B,D,c,S,M,L])}const MM="Escape";function Hd(e,n,s){switch(e){case"vertical":return n;case"horizontal":return s;default:return n||s}}function wu(e,n){return Hd(n,e===kh||e===ec,e===ur||e===dr)}function Op(e,n,s){return Hd(n,e===ec,s?e===ur:e===dr)||e==="Enter"||e===" "||e===""}function OM(e,n,s){return Hd(n,s?e===ur:e===dr,e===ec)}function zM(e,n,s,r){const i=s?e===dr:e===ur,c=e===kh;return n==="both"||n==="horizontal"&&r&&r>1?e===MM:Hd(n,i,c)}function DM(e,n){const{listRef:s,activeIndex:r,onNavigate:i=()=>{},enabled:c=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:g=!1,nested:m=!1,rtl:h=!1,virtual:x=!1,focusItemOnOpen:y="auto",focusItemOnHover:w=!0,openOnArrowKeyDown:S=!0,disabledIndices:_=void 0,orientation:j="vertical",parentOrientation:E,cols:k=1,id:N,resetOnPointerLeave:R=!0,externalTree:A}=n,M="rootStore"in e?e.rootStore:e,O=M.useState("open"),U=M.useState("floatingElement"),I=M.useState("domReferenceElement"),B=M.context.dataRef,L=nd(U),D=Og(I),q=cn(L),F=Ld(),Z=ul(A),H=v.useRef(y),G=v.useRef(d??-1),Q=v.useRef(null),V=v.useRef(!0),Y=Ae(ve=>{i(G.current===-1?null:G.current,ve)}),P=v.useRef(Y),K=v.useRef(!!U),$=v.useRef(O),W=v.useRef(!1),ce=v.useRef(!1),ie=v.useRef(null),oe=cn(_),ue=cn(O),te=cn(d),Ne=cn(R),$e=Fo(),be=Fo(),Se=Ae(()=>{function ve(Pe){x?Z?.events.emit("virtualfocus",Pe):ie.current=Yu(Pe,{sync:W.current,preventScroll:!0})}const re=s.current[G.current],ye=ce.current;re&&ve(re),(W.current?Pe=>Pe():Pe=>$e.request(Pe))(()=>{const Pe=s.current[G.current]||re;if(!Pe)return;re||ve(Pe),_e&&(ye||!V.current)&&Pe.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Re(()=>{B.current.orientation=j},[B,j]),Re(()=>{c&&(O&&U?(G.current=d??-1,H.current&&d!=null&&(ce.current=!0,Y())):K.current&&(G.current=-1,P.current()))},[c,O,U,d,Y]),Re(()=>{if(c){if(!O){W.current=!1;return}if(U)if(r==null){if(W.current=!1,te.current!=null)return;if(K.current&&(G.current=-1,Se()),(!$.current||!K.current)&&H.current&&(Q.current!=null||H.current===!0&&Q.current==null)){let ve=0;const re=()=>{s.current[0]==null?(ve<2&&(ve?je=>be.request(je):queueMicrotask)(re),ve+=1):(G.current=Q.current==null||Op(Q.current,j,h)||m?Gu(s):Lg(s),Q.current=null,Y())};re()}}else Vi(s.current,r)||(G.current=r,Se(),ce.current=!1)}},[c,O,U,r,te,m,s,j,h,Y,Se,be]),Re(()=>{if(!c||U||!Z||x||!K.current)return;const ve=Z.nodesRef.current,re=ve.find(Pe=>Pe.id===F)?.context?.elements.floating,ye=zn(xt(U)),je=ve.some(Pe=>Pe.context&&Ye(Pe.context.elements.floating,ye));re&&!je&&V.current&&re.focus({preventScroll:!0})},[c,U,Z,F,x]),Re(()=>{P.current=Y,$.current=O,K.current=!!U}),Re(()=>{O||(Q.current=null,H.current=y)},[O,y]);const Ee=r!=null,Oe=Ae(ve=>{if(!ue.current)return;const re=s.current.indexOf(ve.currentTarget);re!==-1&&(G.current!==re||r!==re)&&(G.current=re,Y(ve))}),ze=Ae(()=>E??Z?.nodesRef.current.find(ve=>ve.id===F)?.context?.dataRef?.current.orientation),xe=Ae(()=>Gu(s,oe.current)),ke=Ae(ve=>{if(V.current=!1,W.current=!0,ve.which===229||!ue.current&&ve.currentTarget===q.current)return;if(m&&zM(ve.key,j,h,k)){wu(ve.key,ze())||ua(ve),M.setOpen(!1,tt(U0,ve.nativeEvent)),Ut(I)&&(x?Z?.events.emit("virtualfocus",I):I.focus());return}const re=G.current,ye=Gu(s,_),je=Lg(s,_);if(D||(ve.key==="Home"&&(ua(ve),G.current=ye,Y(ve)),ve.key==="End"&&(ua(ve),G.current=je,Y(ve))),k>1){const Pe=Array.from({length:s.current.length},()=>({width:1,height:1})),Ze=Xj(Pe,k,!1),_t=Ze.findIndex(ut=>ut!=null&&!Cs(s.current,ut,_)),Ht=Ze.reduce((ut,it,Et)=>it!=null&&!Cs(s.current,it,_)?Et:ut,-1),vt=Ze[Fj(Ze.map(ut=>ut!=null?s.current[ut]:null),{event:ve,orientation:j,loopFocus:g,rtl:h,cols:k,disabledIndices:Qj([...(typeof _!="function"?_:null)||s.current.map((ut,it)=>Cs(s.current,it,_)?it:void 0),void 0],Ze),minIndex:_t,maxIndex:Ht,prevIndex:Kj(G.current>je?ye:G.current,Pe,Ze,k,ve.key===ec?"bl":ve.key===(h?ur:dr)?"tr":"tl"),stopEvent:!0})];if(vt!=null&&(G.current=vt,Y(ve)),j==="both")return}if(wu(ve.key,j)){if(ua(ve),O&&!x&&zn(ve.currentTarget.ownerDocument)===ve.currentTarget){G.current=Op(ve.key,j,h)?ye:je,Y(ve);return}Op(ve.key,j,h)?g?re>=je?f&&re!==s.current.length?G.current=-1:(W.current=!1,G.current=ye):G.current=On(s.current,{startingIndex:re,disabledIndices:_}):G.current=Math.min(je,On(s.current,{startingIndex:re,disabledIndices:_})):g?re<=ye?f&&re!==-1?G.current=s.current.length:(W.current=!1,G.current=je):G.current=On(s.current,{startingIndex:re,decrement:!0,disabledIndices:_}):G.current=Math.max(ye,On(s.current,{startingIndex:re,decrement:!0,disabledIndices:_})),Vi(s.current,G.current)&&(G.current=-1),Y(ve)}}),_e=v.useMemo(()=>({onFocus(re){W.current=!0,Oe(re)},onClick:({currentTarget:re})=>re.focus({preventScroll:!0}),onMouseMove(re){W.current=!0,ce.current=!1,w&&Oe(re)},onPointerLeave(re){if(!ue.current||!V.current||re.pointerType==="touch")return;W.current=!0;const ye=re.relatedTarget;if(!(!w||s.current.includes(ye))&&Ne.current&&(ie.current?.(),ie.current=null,G.current=-1,Y(re),!x)){const je=q.current,Pe=zn(xt(je));je&&Ye(je,Pe)&&je.focus({preventScroll:!0})}}}),[Oe,ue,q,w,s,Y,Ne,x]),De=v.useMemo(()=>x&&O&&Ee&&{"aria-activedescendant":`${N}-${r}`},[x,O,Ee,N,r]),Ge=v.useMemo(()=>({"aria-orientation":j==="both"?void 0:j,...D?{}:De,onKeyDown(ve){if(ve.key==="Tab"&&ve.shiftKey&&O&&!x){const re=En(ve.nativeEvent);if(re&&!Ye(q.current,re))return;ua(ve),M.setOpen(!1,tt(Md,ve.nativeEvent)),Ut(I)&&I.focus();return}ke(ve)},onPointerMove(){V.current=!0}}),[De,ke,q,j,D,M,O,x,I]),qe=v.useMemo(()=>{function ve(je){M.setOpen(!0,tt(U0,je.nativeEvent,je.currentTarget))}function re(je){y==="auto"&&wh(je.nativeEvent)&&(H.current=!x)}function ye(je){H.current=y,y==="auto"&&Dj(je.nativeEvent)&&(H.current=!0)}return{onKeyDown(je){const Pe=M.select("open");V.current=!1;const Ze=je.key.startsWith("Arrow"),_t=OM(je.key,ze(),h),Ht=wu(je.key,j),vt=(m?_t:Ht)||je.key==="Enter"||je.key.trim()==="";if(x&&Pe)return ke(je);if(!(!Pe&&!S&&Ze)){if(vt){const ut=wu(je.key,ze());Q.current=m&&ut?null:je.key}if(m){_t&&(ua(je),Pe?(G.current=xe(),Y(je)):ve(je));return}Ht&&(te.current!=null&&(G.current=te.current),ua(je),!Pe&&S?ve(je):ke(je),Pe&&Y(je))}},onFocus(je){M.select("open")&&!x&&(G.current=-1,Y(je))},onPointerDown:ye,onPointerEnter:ye,onMouseDown:re,onClick:re}},[ke,y,xe,m,Y,M,S,j,ze,h,te,x]),Me=v.useMemo(()=>({...De,...qe}),[De,qe]);return v.useMemo(()=>c?{reference:Me,floating:Ge,item:_e,trigger:qe}:{},[c,Me,Ge,qe,_e])}function LM(e,n){const{listRef:s,elementsRef:r,activeIndex:i,onMatch:c,onTyping:d,enabled:f=!0,resetMs:g=750,selectedIndex:m=null}=n,h="rootStore"in e?e.rootStore:e,x=h.useState("open"),y=Zn(),w=v.useRef(""),S=v.useRef(m??i??-1),_=v.useRef(null),j=Ae(N=>{function R(D){const q=r?.current[D];return!q||Od(q)}function A(D,q,F=0){if(D.length===0)return-1;const Z=(F%D.length+D.length)%D.length,H=q.toLocaleLowerCase();for(let G=0;G<D.length;G+=1){const Q=(Z+G)%D.length;if(!(!D[Q]?.toLocaleLowerCase().startsWith(H)||!R(Q)))return Q}return-1}const M=s.current;if(w.current.length>0&&N.key===" "&&(ua(N),d?.(!0)),w.current.length>0&&w.current[0]!==" "&&A(M,w.current)===-1&&N.key!==" "&&d?.(!1),M==null||N.key.length!==1||N.ctrlKey||N.metaKey||N.altKey)return;x&&N.key!==" "&&(ua(N),d?.(!0));const O=w.current==="";O&&(S.current=m??i??-1),M.every(D=>D?D[0]?.toLocaleLowerCase()!==D[1]?.toLocaleLowerCase():!0)&&w.current===N.key&&(w.current="",S.current=_.current),w.current+=N.key,y.start(g,()=>{w.current="",S.current=_.current,d?.(!1)});const B=((O?m??i??-1:S.current)??0)+1,L=A(M,w.current,B);L!==-1?(c?.(L),_.current=L):N.key!==" "&&(w.current="",d?.(!1))}),E=Ae(N=>{const R=N.relatedTarget,A=h.select("domReferenceElement"),M=h.select("floatingElement");Ye(A,R)||Ye(M,R)||(y.clear(),w.current="",S.current=_.current,d?.(!1))});Re(()=>{!x&&m!==null||(y.clear(),_.current=null,w.current!==""&&(w.current=""))},[x,m,y]),Re(()=>{x&&w.current===""&&(S.current=m??i??-1)},[x,m,i]);const k=v.useMemo(()=>({onKeyDown:j,onBlur:E}),[j,E]);return v.useMemo(()=>f?{reference:k,floating:k}:{},[f,k])}const h1=.1,PM=h1*h1,Dt=.5;function Cu(e,n,s,r,i,c){return r>=n!=c>=n&&e<=(i-s)*(n-r)/(c-r)+s}function Eu(e,n,s,r,i,c,d,f,g,m){let h=!1;return Cu(e,n,s,r,i,c)&&(h=!h),Cu(e,n,i,c,d,f)&&(h=!h),Cu(e,n,d,f,g,m)&&(h=!h),Cu(e,n,g,m,s,r)&&(h=!h),h}function BM(e,n,s){return e>=s.x&&e<=s.x+s.width&&n>=s.y&&n<=s.y+s.height}function ku(e,n,s,r,i,c){const d=Math.min(s,i),f=Math.max(s,i),g=Math.min(r,c),m=Math.max(r,c);return e>=d&&e<=f&&n>=g&&n<=m}function IM(e={}){const{blockPointerEvents:n=!1}=e,s=new Ia,r=({x:i,y:c,placement:d,elements:f,onClose:g,nodeId:m,tree:h})=>{const x=d?.split("-")[0];let y=!1,w=null,S=null,_=typeof performance<"u"?performance.now():0;function j(k,N){const R=performance.now(),A=R-_;if(w===null||S===null||A===0)return w=k,S=N,_=R,!1;const M=k-w,O=N-S,U=M*M+O*O,I=A*A*PM;return w=k,S=N,_=R,U<I}function E(){s.clear(),g()}return function(N){s.clear();const R=f.domReference,A=f.floating;if(!R||!A||x==null||i==null||c==null)return;const{clientX:M,clientY:O}=N,U=En(N),I=N.type==="mouseleave",B=Ye(A,U),L=Ye(R,U);if(B&&(y=!0,!I))return;if(L&&(y=!1,!I)){y=!0;return}if(I&&ot(N.relatedTarget)&&Ye(A,N.relatedTarget))return;function D(){return!!(h&&mr(h.nodesRef.current,m).length>0)}function q(){D()||E()}if(D())return;const F=R.getBoundingClientRect(),Z=A.getBoundingClientRect(),H=i>Z.right-Z.width/2,G=c>Z.bottom-Z.height/2,Q=Z.width>F.width,V=Z.height>F.height,Y=(Q?F:Z).left,P=(Q?F:Z).right,K=(V?F:Z).top,$=(V?F:Z).bottom;if(x==="top"&&c>=F.bottom-1||x==="bottom"&&c<=F.top+1||x==="left"&&i>=F.right-1||x==="right"&&i<=F.left+1){q();return}let W=!1;switch(x){case"top":W=ku(M,O,Y,F.top+1,P,Z.bottom-1);break;case"bottom":W=ku(M,O,Y,Z.top+1,P,F.bottom-1);break;case"left":W=ku(M,O,Z.right-1,$,F.left+1,K);break;case"right":W=ku(M,O,F.right-1,$,Z.left+1,K);break}if(W)return;if(y&&!BM(M,O,F)){q();return}if(!I&&j(M,O)){q();return}let ce=!1;switch(x){case"top":{const ie=Q?Dt/2:Dt*4,oe=Q||H?i+ie:i-ie,ue=Q?i-ie:H?i+ie:i-ie,te=c+Dt+1,Ne=H||Q?Z.bottom-Dt:Z.top,$e=H?Q?Z.bottom-Dt:Z.top:Z.bottom-Dt;ce=Eu(M,O,oe,te,ue,te,Z.left,Ne,Z.right,$e);break}case"bottom":{const ie=Q?Dt/2:Dt*4,oe=Q||H?i+ie:i-ie,ue=Q?i-ie:H?i+ie:i-ie,te=c-Dt,Ne=H||Q?Z.top+Dt:Z.bottom,$e=H?Q?Z.top+Dt:Z.bottom:Z.top+Dt;ce=Eu(M,O,oe,te,ue,te,Z.left,Ne,Z.right,$e);break}case"left":{const ie=V?Dt/2:Dt*4,oe=V||G?c+ie:c-ie,ue=V?c-ie:G?c+ie:c-ie,te=i+Dt+1,Ne=G||V?Z.right-Dt:Z.left,$e=G?V?Z.right-Dt:Z.left:Z.right-Dt;ce=Eu(M,O,Ne,Z.top,$e,Z.bottom,te,oe,te,ue);break}case"right":{const ie=V?Dt/2:Dt*4,oe=V||G?c+ie:c-ie,ue=V?c-ie:G?c+ie:c-ie,te=i-Dt,Ne=G||V?Z.left+Dt:Z.right,$e=G?V?Z.left+Dt:Z.right:Z.left+Dt;ce=Eu(M,O,te,oe,te,ue,Ne,Z.top,$e,Z.bottom);break}}ce?y||s.start(40,q):q()}};return r.__options={...e,blockPointerEvents:n},r}const UM={...PS,disabled:Te(e=>e.disabled),instantType:Te(e=>e.instantType),isInstantPhase:Te(e=>e.isInstantPhase),trackCursorAxis:Te(e=>e.trackCursorAxis),disableHoverablePopup:Te(e=>e.disableHoverablePopup),lastOpenChangeReason:Te(e=>e.openChangeReason),closeOnClick:Te(e=>e.closeOnClick),closeDelay:Te(e=>e.closeDelay),hasViewport:Te(e=>e.hasViewport)};class Yh extends qh{constructor(n,s,r=!1){const i=new Ud,c={...HM(),...n};c.floatingRootContext=DS(i,s,r),super(c,{popupRef:v.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:i},UM)}setOpen=(n,s)=>{const r=s.reason,i=r===In,c=n&&r===$u,d=!n&&(r===Hi||r===Nh);if(s.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(n,s),s.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,s);const f=()=>{const g={open:n,openChangeReason:r};c?g.instantType="focus":d?g.instantType="dismiss":r===In&&(g.instantType=void 0),TS(g,n,s.trigger),this.update(g)};i?Qr.flushSync(f):f()};cancelPendingOpen(n){this.state.floatingRootContext.dispatchOpenChange(!1,tt(Hi,n))}static useStore(n,s){return NS(n,(i,c)=>new Yh(s,i,c)).store}}function HM(){return{...zS(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}const qM=Rj(function(n){const{disabled:s=!1,defaultOpen:r=!1,open:i,disableHoverablePopup:c=!1,trackCursorAxis:d="none",actionsRef:f,onOpenChange:g,onOpenChangeComplete:m,handle:h,triggerId:x,defaultTriggerId:y=null,children:w}=n,S=Yh.useStore(h?.store,{open:r,openProp:i,activeTriggerId:y,triggerIdProp:x});_h(()=>{i===void 0&&S.state.open===!1&&r===!0&&S.update({open:!0,activeTriggerId:y})}),S.useControlledProp("openProp",i),S.useControlledProp("triggerIdProp",x),S.useContextCallback("onOpenChange",g),S.useContextCallback("onOpenChangeComplete",m);const _=S.useState("open"),j=!s&&_,E=S.useState("activeTriggerId"),k=S.useState("mounted"),N=S.useState("payload");S.useSyncedValues({trackCursorAxis:d,disableHoverablePopup:c}),S.useSyncedValue("disabled",s),AS(S);const{forceUnmount:R,transitionStatus:A}=MS(j,S),M=S.useState("isInstantPhase"),O=S.useState("instantType"),U=S.useState("lastOpenChangeReason"),I=v.useRef(null);Re(()=>{_&&s&&S.setOpen(!1,tt(Ij))},[_,s,S]),Re(()=>{A==="ending"&&U===Ns||A!=="ending"&&M?(O!=="delay"&&(I.current=O),S.set("instantType","delay")):I.current!==null&&(S.set("instantType",I.current),I.current=null)},[A,M,U,O,S]),Re(()=>{j&&E==null&&S.set("payload",void 0)},[S,E,j]);const B=v.useCallback(()=>{S.setOpen(!1,tt(Uj))},[S]);v.useImperativeHandle(f,()=>({unmount:R,close:B}),[R,B]);const L=j||k||!s&&d!=="none";return l.jsxs(Nj.Provider,{value:S,children:[L&&l.jsx(VM,{store:S,disabled:s,trackCursorAxis:d}),typeof w=="function"?w({payload:N}):w]})});function VM({store:e,disabled:n,trackCursorAxis:s}){const r=e.useState("floatingRootContext"),i=Uh(r,{enabled:!n,referencePress:()=>e.select("closeOnClick")}),c=bA(r,{enabled:!n&&s!=="none",axis:s==="none"?void 0:s}),d=v.useMemo(()=>ka(c.reference,i.reference),[c.reference,i.reference]),f=v.useMemo(()=>ka(c.trigger,i.trigger),[c.trigger,i.trigger]),g=v.useMemo(()=>ka(Id,c.floating,i.floating),[c.floating,i.floating]);return OS(e,{activeTriggerProps:d,inactiveTriggerProps:f,popupProps:g}),null}let qr=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Xr.startingStyle]="startingStyle",e[e.endingStyle=Xr.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),md=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const $M={[md.popupOpen]:""},GM={[md.popupOpen]:"",[md.pressed]:""},YM={[qr.open]:""},FM={[qr.closed]:""},XM={[qr.anchorHidden]:""},US={open(e){return e?$M:null}},KM={open(e){return e?GM:null}},fl={open(e){return e?YM:FM},anchorHidden(e){return e?XM:null}};function br(e){return Dd(e,"base-ui")}const HS=v.createContext(void 0);function QM(){return v.useContext(HS)}let ZM=(function(e){return e[e.popupOpen=md.popupOpen]="popupOpen",e.triggerDisabled="data-trigger-disabled",e})({});const JM=600,qS="data-base-ui-tooltip-trigger";function x1(e){if("composedPath"in e){const s=e.composedPath();for(let r=0;r<s.length;r+=1){const i=s[r];if(ot(i))return i}}const n=e.target;return ot(n)?n:null}function WM(e){let n=e;for(;n;){if(n.hasAttribute(qS))return n;const s=n.parentElement;if(s){n=s;continue}const r=n.getRootNode();n="host"in r&&ot(r.host)?r.host:null}return null}const e3=FN(function(n,s){const{render:r,className:i,style:c,handle:d,payload:f,disabled:g,delay:m,closeOnClick:h=!0,closeDelay:x,id:y,...w}=n,S=Wi(!0),_=d?.store??S;if(!_)throw new Error(Nn(82));const j=br(y),E=_.useState("isTriggerActive",j),k=_.useState("isOpenedByTrigger",j),N=_.useState("floatingRootContext"),R=v.useRef(null),A=m??JM,M=x??0,{registerTrigger:O,isMountedByThisTrigger:U}=SM(j,R,_,{payload:f,closeOnClick:h,closeDelay:M}),I=QM(),{delayRef:B,isInstantPhase:L,hasProvider:D}=xT(N,{open:k}),q=Gh(N);_.useSyncedValue("isInstantPhase",L);const F=_.useState("disabled"),Z=g??F,H=cn(Z),G=_.useState("trackCursorAxis"),Q=_.useState("disableHoverablePopup"),V=v.useRef(!1),Y=Zn(),P=v.useRef(void 0);function K(){const be=I?.delay,Se=typeof B.current=="object"?B.current.open:void 0;let Ee=A;return D&&(Se!==0?Ee=m??be??A:Ee=0),Ee}function $(be){const Se=R.current;if(!Se||!be)return!1;const Ee=WM(be);return Ee!==null&&Ee!==Se&&Ye(Se,Ee)}function W(be){const Se=$(be);return V.current=Se,Se&&(q.openChangeTimeout.clear(),q.restTimeout.clear(),q.restTimeoutPending=!1,Y.clear()),Se}const ce=AM(N,{enabled:!Z,mouseOnly:!0,move:!1,handleClose:!Q&&G!=="both"?IM():null,restMs:K,delay(){const be=typeof B.current=="object"?B.current.close:void 0;let Se=M;return x==null&&D&&(Se=be),{close:Se}},triggerElementRef:R,isActiveTrigger:E,isClosing:()=>_.select("transitionStatus")==="ending",shouldOpen(){return!V.current}}),ie=RM(N,{enabled:!Z}).reference,oe=be=>{const Se=V.current,Ee=x1(be),Oe=W(Ee),ze=R.current,xe=ze&&Ee&&Ye(ze,Ee);if(Oe&&_.select("open")&&_.select("lastOpenChangeReason")===In){_.setOpen(!1,tt(In,be));return}if(Se&&!Oe&&xe&&!H.current&&!_.select("open")&&ze&&Yr(P.current)){const ke=()=>{!V.current&&!H.current&&!_.select("open")&&_.setOpen(!0,tt(In,be,ze))},_e=K();_e===0?(Y.clear(),ke()):Y.start(_e,ke)}},ue=_.useState("triggerProps",U);return Lt("button",n,{state:{open:k},ref:[s,O,R],props:[ce,ie,U||G!=="none"?ue:void 0,{onMouseOver(be){oe(be.nativeEvent)},onFocus(be){$(x1(be.nativeEvent))&&be.preventBaseUIHandler()},onMouseLeave(){V.current=!1,Y.clear(),P.current=void 0},onPointerEnter(be){P.current=be.pointerType},onPointerDown(be){P.current=be.pointerType,_.set("closeOnClick",h),h&&!_.select("open")&&_.cancelPendingOpen(be.nativeEvent)},onClick(be){h&&!_.select("open")&&_.cancelPendingOpen(be.nativeEvent)},id:j,[ZM.triggerDisabled]:Z?"":void 0,[qS]:Z?void 0:""},w],stateAttributesMapping:US})}),VS=v.createContext(void 0);function t3(){const e=v.useContext(VS);if(e===void 0)throw new Error(Nn(70));return e}const n3=v.forwardRef(function(n,s){const{children:r,container:i,className:c,render:d,style:f,...g}=n,{portalNode:m,portalSubtree:h}=gS({container:i,ref:s,componentProps:n,elementProps:g});return!h&&!m?null:l.jsxs(v.Fragment,{children:[h,m&&Qr.createPortal(r,m)]})}),a3=v.forwardRef(function(n,s){const{keepMounted:r=!1,...i}=n;return Wi().useState("mounted")||r?l.jsx(VS.Provider,{value:r,children:l.jsx(n3,{ref:s,...i})}):null}),$S=v.createContext(void 0);function GS(){const e=v.useContext($S);if(e===void 0)throw new Error(Nn(71));return e}const s3=v.createContext(void 0);function Fh(){return v.useContext(s3)?.direction??"ltr"}const r3=e=>({name:"arrow",options:e,async fn(n){const{x:s,y:r,placement:i,rects:c,platform:d,elements:f,middlewareData:g}=n,{element:m,padding:h=0,offsetParent:x="real"}=As(e,n)||{};if(m==null)return{};const y=Yj(h),w={x:s,y:r},S=zh(i),_=Oh(S),j=await d.getDimensions(m),E=S==="y",k=E?"top":"left",N=E?"bottom":"right",R=E?"clientHeight":"clientWidth",A=c.reference[_]+c.reference[S]-w[S]-c.floating[_],M=w[S]-c.reference[S],O=x==="real"?await d.getOffsetParent?.(m):f.floating;let U=f.floating[R]||c.floating[_];(!U||!await d.isElement?.(O))&&(U=f.floating[R]||c.floating[_]);const I=A/2-M/2,B=U/2-j[_]/2-1,L=Math.min(y[k],B),D=Math.min(y[N],B),q=L,F=U-j[_]-D,Z=U/2-j[_]/2+I,H=zg(q,Z,F),G=!g.arrow&&hr(i)!=null&&Z!==H&&c.reference[_]/2-(Z<q?L:D)-j[_]/2<0,Q=G?Z<q?Z-q:Z-F:0;return{[S]:w[S]+Q,data:{[S]:H,centerOffset:Z-H-Q,...G&&{alignmentOffset:Q}},reset:G}}}),o3=(e,n)=>({...r3(e),options:[e,n]}),l3={name:"hide",async fn(e){const{width:n,height:s,x:r,y:i}=e.rects.reference,c=n===0&&s===0&&r===0&&i===0;return{data:{referenceHidden:(await lM().fn(e)).data?.referenceHidden||c}}}},Xu={sideX:"left",sideY:"top"},i3={name:"adaptiveOrigin",async fn(e){const{x:n,y:s,rects:{floating:r},elements:{floating:i},platform:c,strategy:d,placement:f}=e,g=Ft(i),m=g.getComputedStyle(i);if(!(m.transitionDuration!=="0s"&&m.transitionDuration!==""))return{x:n,y:s,data:Xu};const x=await c.getOffsetParent?.(i);let y={width:0,height:0};if(d==="fixed"&&g?.visualViewport)y={width:g.visualViewport.width,height:g.visualViewport.height};else if(x===g){const k=xt(i);y={width:k.documentElement.clientWidth,height:k.documentElement.clientHeight}}else await c.isElement?.(x)&&(y=await c.getDimensions(x));const w=Jn(f);let S=n,_=s;w==="left"&&(S=y.width-(n+r.width)),w==="top"&&(_=y.height-(s+r.height));const j=w==="left"?"right":Xu.sideX,E=w==="top"?"bottom":Xu.sideY;return{x:S,y:_,data:{sideX:j,sideY:E}}}};function YS(e,n,s){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?s?"inline-start":"inline-end":"right",bottom:"bottom",left:r?s?"inline-end":"inline-start":"left"}[n]}function b1(e,n,s){const{rects:r,placement:i}=e;return{side:YS(n,Jn(i),s),align:hr(i)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function FS(e){const{anchor:n,positionMethod:s="absolute",side:r="bottom",sideOffset:i=0,align:c="center",alignOffset:d=0,collisionBoundary:f,collisionPadding:g=5,sticky:m=!1,arrowPadding:h=5,disableAnchorTracking:x=!1,inline:y,keepMounted:w=!1,floatingRootContext:S,mounted:_,collisionAvoidance:j,shiftCrossAxis:E=!1,nodeId:k,adaptiveOrigin:N,lazyFlip:R=!1,externalTree:A}=e,[M,O]=v.useState(null);!_&&M!==null&&O(null);const U=j.side||"flip",I=j.align||"flip",B=j.fallbackAxisSide||"end",L=typeof n=="function"?n:void 0,D=Ae(L),q=L?D:n,F=cn(n),Z=cn(_),G=Fh()==="rtl",Q=M||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":G?"left":"right","inline-start":G?"right":"left"}[r],V=c==="center"?Q:`${Q}-${c}`;let Y=g;const P=1,K=r==="bottom"?P:0,$=r==="top"?P:0,W=r==="right"?P:0,ce=r==="left"?P:0;typeof Y=="number"?Y={top:Y+K,right:Y+ce,bottom:Y+$,left:Y+W}:Y&&(Y={top:(Y.top||0)+K,right:(Y.right||0)+ce,bottom:(Y.bottom||0)+$,left:(Y.left||0)+W});const ie={boundary:f==="clipping-ancestors"?"clippingAncestors":f,padding:Y},oe=v.useRef(null),ue=cn(i),te=cn(d),Ne=typeof i!="function"?i:0,$e=typeof d!="function"?d:0,be=[];y&&be.push(y),be.push(nM(dt=>{const Tt=b1(dt,r,G),Xt=typeof ue.current=="function"?ue.current(Tt):ue.current,yt=typeof te.current=="function"?te.current(Tt):te.current;return{mainAxis:Xt,crossAxis:yt,alignmentAxis:yt}},[Ne,$e,G,r]));const Se=I==="none"&&U!=="shift",Ee=!Se&&(m||E||U==="shift"),Oe=U==="none"?null:rM({...ie,padding:{top:Y.top+P,right:Y.right+P,bottom:Y.bottom+P,left:Y.left+P},mainAxis:!E&&U==="flip",crossAxis:I==="flip"?"alignment":!1,fallbackAxisSideDirection:B}),ze=Se?null:aM(dt=>{const Tt=xt(dt.elements.floating).documentElement;return{...ie,rootBoundary:E?{x:0,y:0,width:Tt.clientWidth,height:Tt.clientHeight}:void 0,mainAxis:I!=="none",crossAxis:Ee,limiter:m||E?void 0:sM(Xt=>{if(!oe.current)return{};const{width:yt,height:Wt}=oe.current.getBoundingClientRect(),Vt=Ea(Jn(Xt.placement)),rn=Vt==="y"?yt:Wt,Tn=Vt==="y"?Y.left+Y.right:Y.top+Y.bottom;return{offset:rn/2+Tn/2}})}},[ie,m,E,Y,I]);U==="shift"||I==="shift"||c==="center"?be.push(ze,Oe):be.push(Oe,ze),be.push(oM({...ie,apply({elements:{floating:dt},availableWidth:Tt,availableHeight:Xt,rects:yt}){if(!Z.current)return;const Wt=dt.style;Wt.setProperty("--available-width",`${Tt}px`),Wt.setProperty("--available-height",`${Xt}px`);const Vt=Ft(dt).devicePixelRatio||1,{x:rn,y:Tn,width:qn,height:ta}=yt.reference,Vn=(Math.round((rn+qn)*Vt)-Math.round(rn*Vt))/Vt,es=(Math.round((Tn+ta)*Vt)-Math.round(Tn*Vt))/Vt;Wt.setProperty("--anchor-width",`${Vn}px`),Wt.setProperty("--anchor-height",`${es}px`)}}),o3(dt=>({element:oe.current||xt(dt.elements.floating).createElement("div"),padding:h,offsetParent:"floating"}),[h]),{name:"transformOrigin",fn(dt){const{elements:Tt,middlewareData:Xt,placement:yt,rects:Wt,y:Vt}=dt,rn=Jn(yt),Tn=Ea(rn),qn=oe.current,ta=Xt.arrow?.x||0,Vn=Xt.arrow?.y||0,es=qn?.clientWidth||0,An=qn?.clientHeight||0,na=ta+es/2,Na=Vn+An/2,ts=Math.abs(Xt.shift?.y||0),nt=Wt.reference.height/2,At=typeof i=="function"?i(b1(dt,r,G)):i,yn=ts>At,en={top:`${na}px calc(100% + ${At}px)`,bottom:`${na}px ${-At}px`,left:`calc(100% + ${At}px) ${Na}px`,right:`${-At}px ${Na}px`}[rn],kt=`${na}px ${Wt.reference.y+nt-Vt}px`;return Tt.floating.style.setProperty("--transform-origin",Ee&&Tn==="y"&&yn?kt:en),{}}},l3,N),Re(()=>{!_&&S&&S.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[_,S]);const xe=v.useMemo(()=>({elementResize:!x&&typeof ResizeObserver<"u",layoutShift:!x&&typeof IntersectionObserver<"u"}),[x]),{refs:ke,elements:_e,x:De,y:Ge,middlewareData:qe,update:Me,placement:ve,context:re,isPositioned:ye,floatingStyles:je}=kM({rootContext:S,open:w?_:void 0,placement:V,middleware:be,strategy:s,whileElementsMounted:w?void 0:(...dt)=>c1(...dt,xe),nodeId:k,externalTree:A}),{sideX:Pe,sideY:Ze}=qe.adaptiveOrigin||Xu,_t=ye?s:"fixed",Ht=v.useMemo(()=>{const dt=N?{position:_t,[Pe]:De,[Ze]:Ge}:{position:_t,...je};return ye||(dt.opacity=0),dt},[N,_t,Pe,De,Ze,Ge,je,ye]),vt=v.useRef(null);Re(()=>{if(!_)return;const dt=F.current,Tt=typeof dt=="function"?dt():dt,yt=(v1(Tt)?Tt.current:Tt)||null||null;yt!==vt.current&&(ke.setPositionReference(yt),vt.current=yt)},[_,ke,q,F]),v.useEffect(()=>{if(!_)return;const dt=F.current;typeof dt!="function"&&v1(dt)&&dt.current!==vt.current&&(ke.setPositionReference(dt.current),vt.current=dt.current)},[_,ke,q,F]),v.useEffect(()=>{if(w&&_&&_e.domReference&&_e.floating)return c1(_e.domReference,_e.floating,Me,xe)},[w,_,_e,Me,xe]);const ut=Jn(ve),it=YS(r,ut,G),Et=hr(ve)||"center",Bt=!!qe.hide?.referenceHidden;Re(()=>{R&&_&&ye&&O(ut)},[R,_,ye,ut]);const pa=v.useMemo(()=>({position:"absolute",top:qe.arrow?.y,left:qe.arrow?.x}),[qe.arrow]),gn=qe.arrow?.centerOffset!==0;return v.useMemo(()=>({positionerStyles:Ht,arrowStyles:pa,arrowRef:oe,arrowUncentered:gn,side:it,align:Et,physicalSide:ut,anchorHidden:Bt,refs:ke,context:re,isPositioned:ye,update:Me}),[Ht,pa,oe,gn,it,Et,ut,Bt,ke,re,ye,Me])}function v1(e){return e!=null&&"current"in e}function Xh(e){return e==="starting"?sA:an}function XS(e,n,{styles:s,transitionStatus:r,props:i,refs:c,hidden:d,inert:f=!1}){const g={...s};return f&&(g.pointerEvents="none"),Lt("div",e,{state:n,ref:c,props:[{role:"presentation",hidden:d,style:g},Xh(r),i],stateAttributesMapping:fl})}const c3=v.forwardRef(function(n,s){const{render:r,className:i,anchor:c,positionMethod:d="absolute",side:f="top",align:g="center",sideOffset:m=0,alignOffset:h=0,collisionBoundary:x="clipping-ancestors",collisionPadding:y=5,arrowPadding:w=5,sticky:S=!1,disableAnchorTracking:_=!1,collisionAvoidance:j=lA,style:E,...k}=n,N=Wi(),R=t3(),A=N.useState("open"),M=N.useState("mounted"),O=N.useState("trackCursorAxis"),U=N.useState("disableHoverablePopup"),I=N.useState("floatingRootContext"),B=N.useState("instantType"),L=N.useState("transitionStatus"),D=N.useState("hasViewport"),q=FS({anchor:c,positionMethod:d,floatingRootContext:I,mounted:M,side:f,sideOffset:m,align:g,alignOffset:h,collisionBoundary:x,collisionPadding:y,sticky:S,arrowPadding:w,disableAnchorTracking:_,keepMounted:R,collisionAvoidance:j,adaptiveOrigin:D?i3:void 0}),F=v.useMemo(()=>({open:A,side:q.side,align:q.align,anchorHidden:q.anchorHidden,instant:O!=="none"?"tracking-cursor":B}),[A,q.side,q.align,q.anchorHidden,O,B]),Z=XS(n,F,{styles:q.positionerStyles,transitionStatus:L,props:k,refs:[s,N.useStateSetter("positionerElement")],hidden:!M,inert:!A||O==="both"||U});return l.jsx($S.Provider,{value:q,children:Z})}),u3={...fl,...dl},d3=v.forwardRef(function(n,s){const{render:r,className:i,style:c,...d}=n,f=Wi(),{side:g,align:m}=GS(),h=f.useState("open"),x=f.useState("instantType"),y=f.useState("transitionStatus"),w=f.useState("popupProps"),S=f.useState("floatingRootContext"),_=f.useState("disabled"),j=f.useState("closeDelay");xr({open:h,ref:f.context.popupRef,onComplete(){h&&f.context.onOpenChangeComplete?.(!0)}}),NM(S,{enabled:!_,closeDelay:j});const E=f.useStateSetter("popupElement");return Lt("div",n,{state:{open:h,side:g,align:m,instant:x,transitionStatus:y},ref:[s,f.context.popupRef,E],props:[w,Xh(y),d],stateAttributesMapping:u3})}),f3=v.forwardRef(function(n,s){const{render:r,className:i,style:c,...d}=n,f=Wi(),{arrowRef:g,side:m,align:h,arrowUncentered:x,arrowStyles:y}=GS(),w=f.useState("open"),S=f.useState("instantType");return Lt("div",n,{state:{open:w,side:m,align:h,uncentered:x,instant:S},ref:[s,g],props:[{style:y,"aria-hidden":!0},d],stateAttributesMapping:fl})}),m3=function(n){const{delay:s,closeDelay:r,timeout:i=400}=n,c=v.useMemo(()=>({delay:s,closeDelay:r}),[s,r]),d=v.useMemo(()=>({open:s,close:r}),[s,r]);return l.jsx(HS.Provider,{value:c,children:l.jsx(hT,{delay:d,timeoutMs:i,children:n.children})})};function Kh(e){return Lh(19)?e:e?"true":void 0}function p3(e){const[n,s]=v.useState({current:e,previous:null});return e!==n.current&&s({current:e,previous:n.current}),n.previous}function Pt(...e){return kj(vh(e))}function g3({delay:e=0,...n}){return l.jsx(m3,{"data-slot":"tooltip-provider",delay:e,...n})}function Qh({...e}){return l.jsx(qM,{"data-slot":"tooltip",...e})}function Zh({...e}){return l.jsx(e3,{"data-slot":"tooltip-trigger",...e})}function Jh({className:e,side:n="top",sideOffset:s=4,align:r="center",alignOffset:i=0,children:c,...d}){return l.jsx(a3,{children:l.jsx(c3,{align:r,alignOffset:i,side:n,sideOffset:s,className:"isolate z-50",children:l.jsxs(d3,{"data-slot":"tooltip-content",className:Pt("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:[c,l.jsx(f3,{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 ui({label:e,active:n,onClick:s,isAdd:r,isSettings:i,isDefault:c,icon:d,title:f,testId:g}){const m=e.trim()||"·",{initials:h,subLabel:x}=h3(m),y=r||i?"indigo":b3(m),w=x&&!r&&!i&&!c;return l.jsxs(Qh,{children:[l.jsx(Zh,{render:l.jsxs("button",{type:"button",onClick:s,"data-testid":g,className:"group relative flex w-full cursor-pointer flex-col items-center gap-1",children:[l.jsx("span",{className:Ie("flex size-10 items-center justify-center rounded-xl text-sm font-bold transition-all",n&&"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",c&&"overflow-hidden bg-muted",!r&&!i&&!c&&n&&j3(y),!r&&!i&&!c&&!n&&_3(y)),children:d??h}),w&&l.jsx("span",{className:"block max-w-[3.6rem] truncate text-[9px] leading-tight text-muted-fg group-hover:text-foreground",children:x})]})}),l.jsx(Jh,{side:"right",children:f||e})]})}function h3(e){const n=e.trim().replace(/[_\-.]+/g," ").replace(/\s+/g," ");if(!n)return{initials:"·",subLabel:null};const s=n.split(" ");if(s.length>=2)return{initials:(s[0][0]+s[1][0]).toUpperCase(),subLabel:x3(n)};const r=s[0];return r.length<=4?{initials:r[0].toUpperCase(),subLabel:r}:{initials:r[0].toUpperCase(),subLabel:r.slice(0,4)+"…"}}function x3(e){return e.length>6?e.slice(0,5)+"…":e}function b3(e){let n=0;for(let s=0;s<e.length;s++)n=n*31+e.charCodeAt(s)|0;return D0[Math.abs(n)%D0.length]}const v3={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"},y3={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 _3(e){return v3[e]}function j3(e){return y3[e]}function Ko({content:e,side:n="top",children:s}){return e?l.jsxs(Qh,{children:[l.jsx(Zh,{render:s}),l.jsx(Jh,{side:n,children:e})]}):s}const KS=0,QS=1,ZS=2,y1=3;var _1=Object.prototype.hasOwnProperty;function Ug(e,n){var s,r;if(e===n)return!0;if(e&&n&&(s=e.constructor)===n.constructor){if(s===Date)return e.getTime()===n.getTime();if(s===RegExp)return e.toString()===n.toString();if(s===Array){if((r=e.length)===n.length)for(;r--&&Ug(e[r],n[r]););return r===-1}if(!s||typeof e=="object"){r=0;for(s in e)if(_1.call(e,s)&&++r&&!_1.call(n,s)||!(s in n)||!Ug(e[s],n[s]))return!1;return Object.keys(n).length===r}}return e!==e&&n!==n}const js=new WeakMap,Ss=()=>{},Ln=Ss(),Hg=Object,ht=e=>e===Ln,Fa=e=>typeof e=="function",pr=(e,n)=>({...e,...n}),JS=e=>Fa(e.then),zp={},Ru={},Wh="undefined",nc=typeof window!=Wh,qg=typeof document!=Wh,S3=nc&&"Deno"in window,w3=()=>nc&&typeof window.requestAnimationFrame!=Wh,WS=(e,n)=>{const s=js.get(e);return[()=>!ht(n)&&e.get(n)||zp,r=>{if(!ht(n)){const i=e.get(n);n in Ru||(Ru[n]=i),s[5](n,pr(i,r),i||zp)}},s[6],()=>!ht(n)&&n in Ru?Ru[n]:!ht(n)&&e.get(n)||zp]};let Vg=!0;const C3=()=>Vg,[$g,Gg]=nc&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Ss,Ss],E3=()=>{const e=qg&&document.visibilityState;return ht(e)||e!=="hidden"},k3=e=>(qg&&document.addEventListener("visibilitychange",e),$g("focus",e),()=>{qg&&document.removeEventListener("visibilitychange",e),Gg("focus",e)}),R3=e=>{const n=()=>{Vg=!0,e()},s=()=>{Vg=!1};return $g("online",n),$g("offline",s),()=>{Gg("online",n),Gg("offline",s)}},N3={isOnline:C3,isVisible:E3},T3={initFocus:k3,initReconnect:R3},j1=!Ki.useId,$o=!nc||S3,A3=e=>w3()?window.requestAnimationFrame(e):setTimeout(e,1),Dp=$o?v.useEffect:v.useLayoutEffect,Lp=typeof navigator<"u"&&navigator.connection,S1=!$o&&Lp&&(["slow-2g","2g"].includes(Lp.effectiveType)||Lp.saveData),Nu=new WeakMap,M3=e=>Hg.prototype.toString.call(e),Pp=(e,n)=>e===`[object ${n}]`;let O3=0;const Yg=e=>{const n=typeof e,s=M3(e),r=Pp(s,"Date"),i=Pp(s,"RegExp"),c=Pp(s,"Object");let d,f;if(Hg(e)===e&&!r&&!i){if(d=Nu.get(e),d)return d;if(d=++O3+"~",Nu.set(e,d),Array.isArray(e)){for(d="@",f=0;f<e.length;f++)d+=Yg(e[f])+",";Nu.set(e,d)}if(c){d="#";const g=Hg.keys(e).sort();for(;!ht(f=g.pop());)ht(e[f])||(d+=f+":"+Yg(e[f])+",");Nu.set(e,d)}}else d=r?e.toJSON():n=="symbol"?e.toString():n=="string"?JSON.stringify(e):""+e;return d},ex=e=>{if(Fa(e))try{e=e()}catch{e=""}const n=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Yg(e):"",[e,n]};let z3=0;const Fg=()=>++z3;async function ew(...e){const[n,s,r,i]=e,c=pr({populateCache:!0,throwOnError:!0},typeof i=="boolean"?{revalidate:i}:i||{});let d=c.populateCache;const f=c.rollbackOnError;let g=c.optimisticData;const m=y=>typeof f=="function"?f(y):f!==!1,h=c.throwOnError;if(Fa(s)){const y=s,w=[],S=n.keys();for(const _ of S)!/^\$(inf|sub)\$/.test(_)&&y(n.get(_)._k)&&w.push(_);return Promise.all(w.map(x))}return x(s);async function x(y){const[w]=ex(y);if(!w)return;const[S,_]=WS(n,w),[j,E,k,N]=js.get(n),R=()=>{const F=j[w];return(Fa(c.revalidate)?c.revalidate(S().data,y):c.revalidate!==!1)&&(delete k[w],delete N[w],F&&F[0])?F[0](ZS).then(()=>S().data):S().data};if(e.length<3)return R();let A=r,M,O=!1;const U=Fg();E[w]=[U,0];const I=!ht(g),B=S(),L=B.data,D=B._c,q=ht(D)?L:D;if(I&&(g=Fa(g)?g(q,L):g,_({data:g,_c:q})),Fa(A))try{A=A(q)}catch(F){M=F,O=!0}if(A&&JS(A))if(A=await A.catch(F=>{M=F,O=!0}),U!==E[w][0]){if(O)throw M;return A}else O&&I&&m(M)&&(d=!0,_({data:q,_c:Ln}));if(d&&!O)if(Fa(d)){const F=d(A,q);_({data:F,error:Ln,_c:Ln})}else _({data:A,error:Ln,_c:Ln});if(E[w][1]=Fg(),Promise.resolve(R()).then(()=>{_({_c:Ln})}),O){if(h)throw M;return}return A}}const w1=(e,n)=>{for(const s in e)e[s][0]&&e[s][0](n)},D3=(e,n)=>{if(!js.has(e)){const s=pr(T3,n),r=Object.create(null),i=ew.bind(Ln,e);let c=Ss;const d=Object.create(null),f=(h,x)=>{const y=d[h]||[];return d[h]=y,y.push(x),()=>y.splice(y.indexOf(x),1)},g=(h,x,y)=>{e.set(h,x);const w=d[h];if(w)for(const S of w)S(x,y)},m=()=>{if(!js.has(e)&&(js.set(e,[r,Object.create(null),Object.create(null),Object.create(null),i,g,f]),!$o)){const h=s.initFocus(setTimeout.bind(Ln,w1.bind(Ln,r,KS))),x=s.initReconnect(setTimeout.bind(Ln,w1.bind(Ln,r,QS)));c=()=>{h&&h(),x&&x(),js.delete(e)}}};return m(),[e,i,m,c]}return[e,js.get(e)[4]]},L3=(e,n,s,r,i)=>{const c=s.errorRetryCount,d=i.retryCount,f=~~((Math.random()+.5)*(1<<(d<8?d:8)))*s.errorRetryInterval;!ht(c)&&d>c||setTimeout(r,f,i)},P3=Ug,[tw,B3]=D3(new Map),I3=pr({onLoadingSlow:Ss,onSuccess:Ss,onError:Ss,onErrorRetry:L3,onDiscarded:Ss,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:S1?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:S1?5e3:3e3,compare:P3,isPaused:()=>!1,cache:tw,mutate:B3,fallback:{}},N3),U3=(e,n)=>{const s=pr(e,n);if(n){const{use:r,fallback:i}=e,{use:c,fallback:d}=n;r&&c&&(s.use=r.concat(c)),i&&d&&(s.fallback=pr(i,d))}return s},H3=v.createContext({}),q3="$inf$",nw=nc&&window.__SWR_DEVTOOLS_USE__,V3=nw?window.__SWR_DEVTOOLS_USE__:[],$3=()=>{nw&&(window.__SWR_DEVTOOLS_REACT__=Ki)},G3=e=>Fa(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],aw=()=>{const e=v.useContext(H3);return v.useMemo(()=>pr(I3,e),[e])},Y3=e=>(n,s,r)=>e(n,s&&((...c)=>{const[d]=ex(n),[,,,f]=js.get(tw);if(d.startsWith(q3))return s(...c);const g=f[d];return ht(g)?s(...c):(delete f[d],g)}),r),F3=V3.concat(Y3),X3=e=>function(...s){const r=aw(),[i,c,d]=G3(s),f=U3(r,d);let g=e;const{use:m}=f,h=(m||[]).concat(F3);for(let x=h.length;x--;)g=h[x](g);return g(i,c||f.fetcher||null,f)},K3=(e,n,s)=>{const r=n[e]||(n[e]=[]);return r.push(s),()=>{const i=r.indexOf(s);i>=0&&(r[i]=r[r.length-1],r.pop())}};$3();const Bp=Ki.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(n=>{e.status="fulfilled",e.value=n},n=>{e.status="rejected",e.reason=n}),e}}),Ip={dedupe:!0},C1=Promise.resolve(Ln),Q3=()=>Ss,Z3=(e,n,s)=>{const{cache:r,compare:i,suspense:c,fallbackData:d,revalidateOnMount:f,revalidateIfStale:g,refreshInterval:m,refreshWhenHidden:h,refreshWhenOffline:x,keepPreviousData:y,strictServerPrefetchWarning:w}=s,[S,_,j,E]=js.get(r),[k,N]=ex(e),R=v.useRef(!1),A=v.useRef(!1),M=v.useRef(k),O=v.useRef(n),U=v.useRef(s),I=()=>U.current,B=()=>I().isVisible()&&I().isOnline(),[L,D,q,F]=WS(r,k),Z=v.useRef({}).current,H=ht(d)?ht(s.fallback)?Ln:s.fallback[k]:d,G=(xe,ke)=>{for(const _e in Z){const De=_e;if(De==="data"){if(!i(xe[De],ke[De])&&(!ht(xe[De])||!i(ie,ke[De])))return!1}else if(ke[De]!==xe[De])return!1}return!0},Q=!R.current,V=v.useMemo(()=>{const xe=L(),ke=F(),_e=Me=>{const ve=pr(Me);return delete ve._k,(()=>{if(!k||!n||I().isPaused())return!1;if(Q&&!ht(f))return f;const ye=ht(H)?ve.data:H;return ht(ye)||g})()?{isValidating:!0,isLoading:!0,...ve}:ve},De=_e(xe),Ge=xe===ke?De:_e(ke);let qe=De;return[()=>{const Me=_e(L());return G(Me,qe)?(qe.data=Me.data,qe.isLoading=Me.isLoading,qe.isValidating=Me.isValidating,qe.error=Me.error,qe):(qe=Me,Me)},()=>Ge]},[r,k]),Y=ud.useSyncExternalStore(v.useCallback(xe=>q(k,(ke,_e)=>{G(_e,ke)||xe()}),[r,k]),V[0],V[1]),P=S[k]&&S[k].length>0,K=Y.data,$=ht(K)?H&&JS(H)?Bp(H):H:K,W=Y.error,ce=v.useRef($),ie=y?ht(K)?ht(ce.current)?$:ce.current:K:$,oe=k&&ht($),ue=v.useRef(null);!$o&&ud.useSyncExternalStore(Q3,()=>(ue.current=!1,ue),()=>(ue.current=!0,ue));const te=ue.current;w&&te&&!c&&oe&&console.warn(`Missing pre-initiated data for serialized key "${k}" 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 Ne=!k||!n||I().isPaused()||P&&!ht(W)?!1:Q&&!ht(f)?f:c?ht($)?!1:g:ht($)||g,$e=Q&&Ne,be=ht(Y.isValidating)?$e:Y.isValidating,Se=ht(Y.isLoading)?$e:Y.isLoading,Ee=v.useCallback(async xe=>{const ke=O.current;if(!k||!ke||A.current||I().isPaused())return!1;let _e,De,Ge=!0;const qe=xe||{},Me=!j[k]||!qe.dedupe,ve=()=>j1?!A.current&&k===M.current&&R.current:k===M.current,re={isValidating:!1,isLoading:!1},ye=()=>{D(re)},je=()=>{const Ze=j[k];Ze&&Ze[1]===De&&delete j[k]},Pe={isValidating:!0};ht(L().data)&&(Pe.isLoading=!0);try{if(Me&&(D(Pe),s.loadingTimeout&&ht(L().data)&&setTimeout(()=>{Ge&&ve()&&I().onLoadingSlow(k,s)},s.loadingTimeout),j[k]=[ke(N),Fg()]),[_e,De]=j[k],_e=await _e,Me&&setTimeout(je,s.dedupingInterval),!j[k]||j[k][1]!==De)return Me&&ve()&&I().onDiscarded(k),!1;re.error=Ln;const Ze=_[k];if(!ht(Ze)&&(De<=Ze[0]||De<=Ze[1]||Ze[1]===0))return ye(),Me&&ve()&&I().onDiscarded(k),!1;const _t=L().data;re.data=i(_t,_e)?_t:_e,Me&&ve()&&I().onSuccess(_e,k,s)}catch(Ze){je();const _t=I(),{shouldRetryOnError:Ht}=_t;_t.isPaused()||(re.error=Ze,Me&&ve()&&(_t.onError(Ze,k,_t),(Ht===!0||Fa(Ht)&&Ht(Ze))&&(!I().revalidateOnFocus||!I().revalidateOnReconnect||B())&&_t.onErrorRetry(Ze,k,_t,vt=>{const ut=S[k];ut&&ut[0]&&ut[0](y1,vt)},{retryCount:(qe.retryCount||0)+1,dedupe:!0})))}return Ge=!1,ye(),!0},[k,r]),Oe=v.useCallback((...xe)=>ew(r,M.current,...xe),[]);if(Dp(()=>{O.current=n,U.current=s,ht(K)||(ce.current=K)}),Dp(()=>{if(!k)return;const xe=Ee.bind(Ln,Ip);let ke=0;I().revalidateOnFocus&&(ke=Date.now()+I().focusThrottleInterval);const De=K3(k,S,(Ge,qe={})=>{if(Ge==KS){const Me=Date.now();I().revalidateOnFocus&&Me>ke&&B()&&(ke=Me+I().focusThrottleInterval,xe())}else if(Ge==QS)I().revalidateOnReconnect&&B()&&xe();else{if(Ge==ZS)return Ee();if(Ge==y1)return Ee(qe)}});return A.current=!1,M.current=k,R.current=!0,D({_k:N}),Ne&&(j[k]||(ht($)||$o?xe():A3(xe))),()=>{A.current=!0,De()}},[k]),Dp(()=>{let xe;function ke(){const De=Fa(m)?m(L().data):m;De&&xe!==-1&&(xe=setTimeout(_e,De))}function _e(){!L().error&&(h||I().isVisible())&&(x||I().isOnline())?Ee(Ip).then(ke):ke()}return ke(),()=>{xe&&(clearTimeout(xe),xe=-1)}},[m,h,x,k]),v.useDebugValue(ie),c){if(!j1&&$o&&oe)throw new Error("Fallback data is required when using Suspense in SSR.");oe&&(O.current=n,U.current=s,A.current=!1);const xe=E[k],ke=!ht(xe)&&oe?Oe(xe):C1;if(Bp(ke),!ht(W)&&oe)throw W;const _e=oe?Ee(Ip):C1;!ht(ie)&&oe&&(_e.status="fulfilled",_e.value=!0),Bp(_e)}return{mutate:Oe,get data(){return Z.data=!0,ie},get error(){return Z.error=!0,W},get isValidating(){return Z.isValidating=!0,be},get isLoading(){return Z.isLoading=!0,Se}}},Qe=X3(Z3);let Qo=null;function Ur(e){Qo=e}function tx(){return Qo}class ac extends Error{status;body;constructor(n,s,r){super(s),this.status=n,this.body=r}}async function di(e,n,s,r={}){const i={"content-type":"application/json",...Qo?{authorization:`Bearer ${Qo}`}:{},...r.headers||{}},c=await fetch(n,{...r,method:e,headers:i,body:s!==void 0?JSON.stringify(s):void 0});if(!c.ok){let d="",f=null;try{f=await c.json(),d=f?.error||JSON.stringify(f)}catch{d=await c.text()}throw new ac(c.status,`${e} ${n} → ${c.status}: ${d}`,f)}if(c.status!==204)return await c.json()}const ge={get:e=>di("GET",e),post:(e,n)=>di("POST",e,n),put:(e,n)=>di("PUT",e,n),patch:(e,n)=>di("PATCH",e,n),del:e=>di("DELETE",e)};async function sw(e,n,s,r){const i=await fetch(e,{method:"POST",signal:r,headers:{"content-type":"application/json",...Qo?{authorization:`Bearer ${Qo}`}:{}},body:JSON.stringify(n)});if(!i.ok||!i.body){const g=await i.text().catch(()=>"");throw new ac(i.status,`POST ${e} → ${i.status}: ${g||"stream failed"}`)}const c=i.body.getReader(),d=new TextDecoder("utf-8");let f="";for(;;){const{value:g,done:m}=await c.read();if(m)break;f+=d.decode(g,{stream:!0});let h=f.indexOf(`
|
|
522
|
+
`);for(;h>=0;){const x=f.slice(0,h).trim();if(f=f.slice(h+1),x)try{s(JSON.parse(x))}catch{}h=f.indexOf(`
|
|
523
|
+
`)}}if(f.trim())try{s(JSON.parse(f.trim()))}catch{}}const J3={get:()=>ge.get("/health")},Qn={list:()=>ge.get("/projects"),register:e=>ge.post("/projects",{path:e}),remove:e=>ge.del(`/projects/${encodeURIComponent(e)}`),rebuild:e=>ge.post(`/projects/${encodeURIComponent(e)}/rebuild`),config:{show:e=>ge.get(`/projects/${e}/config`),set:(e,n)=>ge.patch(`/projects/${e}/config`,{set:n}),unset:(e,n)=>ge.patch(`/projects/${e}/config`,{unset:n}),put:(e,n)=>ge.put(`/projects/${e}/config`,n)},apcProject:{set:(e,n,s)=>ge.patch(`/projects/${e}/apc-project`,{set:n,unset:s}),put:(e,n)=>ge.put(`/projects/${e}/apc-project`,n)},memory:{get:e=>ge.get(`/projects/${e}/memory`),put:(e,n)=>ge.put(`/projects/${e}/memory`,{body:n})}},Jt={list:e=>ge.get(`/projects/${e}/agents`),get:(e,n)=>ge.get(`/projects/${e}/agents/${n}`),create:(e,n)=>ge.post(`/projects/${e}/agents`,n),update:(e,n,s)=>ge.patch(`/projects/${e}/agents/${encodeURIComponent(n)}`,s),remove:(e,n)=>ge.del(`/projects/${e}/agents/${encodeURIComponent(n)}`),chat:(e,n,s)=>ge.post(`/projects/${e}/agents/${encodeURIComponent(n)}/chat`,s),memory:{get:(e,n)=>ge.get(`/projects/${e}/agents/${n}/memory`),put:(e,n,s)=>ge.put(`/projects/${e}/agents/${n}/memory`,{body:s})},vault:e=>ge.get(e?.includeRemoved?"/agents/vault?include_removed=1":"/agents/vault"),vaultCreate:(e,n={},s="")=>ge.post("/agents/vault",{slug:e,fields:n,body:s}),vaultPatch:(e,n)=>ge.patch(`/agents/vault/${encodeURIComponent(e)}`,n),vaultRemove:e=>ge.del(`/agents/vault/${encodeURIComponent(e)}`),vaultRestore:e=>ge.post(`/agents/vault/${encodeURIComponent(e)}/restore`),import:(e,n)=>ge.post(`/projects/${e}/agents/import`,{slug:n})},nx={list:(e,n)=>ge.get(`/projects/${e}/agents/${n}/conversations`),get:(e,n,s)=>ge.get(`/projects/${e}/agents/${n}/conversations/${s}`),compact:(e,n,s)=>ge.post(s?`/projects/${e}/agents/${n}/conversations/${s}/compact`:`/projects/${e}/agents/${n}/compact`,{})},or={list:e=>ge.get(`/projects/${e}/routines`),get:(e,n)=>ge.get(`/projects/${e}/routines/${n}`),run:(e,n)=>ge.post(`/projects/${e}/routines/${n}/run`),enable:(e,n)=>ge.post(`/projects/${e}/routines/${n}/enable`),disable:(e,n)=>ge.post(`/projects/${e}/routines/${n}/disable`),upsert:(e,n)=>ge.post(`/projects/${e}/routines`,n),remove:(e,n)=>ge.del(`/projects/${e}/routines/${encodeURIComponent(n)}`)},lr={list:(e,n="open")=>ge.get(`/projects/${e}/tasks?state=${n}`),global:(e="open")=>ge.get(`/tasks?state=${e}`),add:(e,n)=>ge.post(`/projects/${e}/tasks`,n),done:(e,n)=>ge.post(`/projects/${e}/tasks/${n}/done`),drop:(e,n)=>ge.post(`/projects/${e}/tasks/${n}/drop`),reopen:(e,n)=>ge.post(`/projects/${e}/tasks/${n}/reopen`)},Ti={list:e=>ge.get(`/projects/${e}/mcps`),check:e=>ge.get(`/projects/${e}/mcps/check`),add:(e,n,s)=>ge.post(`/projects/${e}/mcps?scope=${n}`,s),remove:(e,n,s="shared")=>ge.del(`/projects/${e}/mcps/${encodeURIComponent(n)}?scope=${s}`)},Up=e=>{const n=new URLSearchParams;for(const[r,i]of Object.entries(e))i!==void 0&&i!==""&&n.set(r,String(i));const s=n.toString();return s?`?${s}`:""},Xg={global:(e={})=>ge.get(`/messages/global${Up(e)}`),project:(e,n={})=>ge.get(`/projects/${e}/messages${Up(n)}`),search:(e,n,s=50)=>ge.get(`/projects/${e}/messages/search${Up({q:n,limit:s})}`)},W3={global:e=>ge.get(`/sessions${e?`?engine=${encodeURIComponent(e)}`:""}`)},e5={list:()=>ge.get("/tools")},kn={channels:{list:()=>ge.get("/telegram/channels"),upsert:e=>ge.post("/telegram/channels",e),patch:(e,n)=>ge.patch(`/telegram/channels/${e}`,n),remove:e=>ge.del(`/telegram/channels/${encodeURIComponent(e)}`)},contacts:{list:()=>ge.get("/telegram/contacts"),patch:(e,n)=>ge.patch(`/telegram/contacts/${encodeURIComponent(String(e))}`,n),remove:e=>ge.del(`/telegram/contacts/${encodeURIComponent(String(e))}`)},roles:{list:()=>ge.get("/telegram/roles"),set:(e,n)=>ge.put(`/telegram/roles/${encodeURIComponent(e)}`,{tools:n}),remove:e=>ge.del(`/telegram/roles/${encodeURIComponent(e)}`)},status:()=>ge.get("/telegram/status"),start:()=>ge.post("/telegram/start"),stop:()=>ge.post("/telegram/stop"),send:e=>ge.post("/telegram/send",e)},pd={list:()=>ge.get("/engines"),models:e=>ge.post("/engines/models",e)},Zo={reload:()=>ge.post("/admin/reload"),shutdown:()=>ge.post("/admin/shutdown"),config:{get:()=>ge.get("/admin/config"),patch:e=>ge.patch("/admin/config",e)},superAgent:()=>ge.get("/admin/super-agent"),logs:(e="errors",n=200)=>ge.get(`/admin/logs?file=${e}&limit=${n}`)},Jo={list:()=>ge.get("/pair/list"),revoke:e=>ge.del(`/pair/revoke/${encodeURIComponent(e)}`),init:()=>ge.post("/pair/init",{}),status:e=>ge.get(`/pair/status/${encodeURIComponent(e)}`),confirm:e=>ge.post("/pair/confirm",e)},E1={get:()=>ge.get("/identity"),patch:e=>ge.patch("/identity",e)},rw={send:(e,n)=>ge.post(`/projects/${e}/super-agent/chat`,n),stream:(e,n,s,r)=>sw(`/projects/${e}/super-agent/chat/stream`,n,s,r),summarize:e=>ge.post("/super-agent/summarize",e)},t5={dirs:e=>ge.get(`/admin/fs/dirs?path=${encodeURIComponent(e)}`)},n5=["alloy","echo","fable","onyx","nova","shimmer"],a5=["Kore","Puck","Charon","Fenrir","Aoede"],s5=["eleven_multilingual_v2","eleven_turbo_v2_5","eleven_flash_v2_5"],r5=["tts-1","tts-1-hd"],o5=["tiny","base","small","medium","large-v2","large-v3"],gd={piper:{name:"Piper",note:"Local, offline (CLI + modelo .onnx). Sin API key.",local:!0},elevenlabs:{name:"ElevenLabs",note:"Cloud, multilingüe. Requiere API key."},openai:{name:"OpenAI",note:"Cloud (tts-1 / tts-1-hd). Usa la key de OpenAI."},gemini:{name:"Gemini",note:"Cloud (preview). Usa la key de Gemini."},mock:{name:"Mock",note:"Silencio de prueba. Fallback siempre disponible.",local:!0}};async function l5(e){const n=tx(),s=await fetch(`/voice/tts?path=${encodeURIComponent(e)}`,{headers:n?{authorization:`Bearer ${n}`}:{}});if(!s.ok){const i=await s.text().catch(()=>"");throw new Error(`No se pudo leer el audio (${s.status}): ${i.slice(0,160)}`)}const r=await s.blob();return URL.createObjectURL(r)}const ow={providers:()=>ge.get("/tts/providers"),say:e=>ge.post("/tts/say",e),turn:e=>ge.post("/voice/turn",e)},k1={manifest:()=>ge.get("/deck/manifest"),setWidget:(e,n)=>ge.patch(`/deck/widgets/${encodeURIComponent(e)}`,n),exec:e=>ge.post("/deck/exec",e)},Ir=e=>`/projects/${e}/code/sessions`,sr={sessions:{list:e=>ge.get(Ir(e)).then(n=>n.sessions),get:(e,n)=>ge.get(`${Ir(e)}/${n}`),create:(e,n={})=>ge.post(Ir(e),n),update:(e,n,s)=>ge.patch(`${Ir(e)}/${n}`,s),remove:(e,n)=>ge.del(`${Ir(e)}/${n}`)},changes:(e,n)=>ge.get(`${Ir(e)}/${n}/changes`),stream:(e,n,s,r,i)=>sw(`${Ir(e)}/${n}/chat/stream`,s,r,i)};function sc(){const{data:e,error:n,isLoading:s,mutate:r}=Qe("/projects",()=>Qn.list(),{refreshInterval:Ed.projects});return{projects:(e||[]).slice().sort((c,d)=>{const f=Number(c.id),g=Number(d.id);return f===0&&g!==0?-1:g===0&&f!==0?1:f-g}),error:n,isLoading:s,mutate:r}}function lw(e){const{projects:n,isLoading:s,mutate:r}=sc();return{project:n.find(c=>String(c.id)===e)??null,isLoading:s,mutate:r}}const i5={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"},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",modules:{voice:"Voces",desktop:"Escritorio",deck:"Deck",code:"Code"}},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",browser_unavailable:"Explorador no disponible hasta reiniciar daemon. Pegá ruta manual.",no_folders:"Sin carpetas."},settings:{title:"Settings",subtitle:"Preferencias del panel + diagnóstico del daemon local.",appearance:"Apariencia",light_mode:"Claro",dark_mode:"Oscuro",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",channels_section:"Canales & dispositivos",advanced_section:"Avanzado",tabs:{identity:"Identidad",super_agent:"Super-agente",engines:"Engines & modelos",telegram:"Telegram",devices:"Dispositivos",advanced:"Avanzado"},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:"ej. America/Argentina/Buenos_Aires",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.",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:"Proyecto {pid} no encontrado.",rebuild:"Rebuild context",rebuild_done:"Rebuild OK.",unregister_confirm:"¿Desregistrar {label}? La carpeta no se borra.",unregistered:"Desregistrado.",base_subtitle:"Espacio general · super-agente",nav:{overview:"Overview",chat:"Chat",config:"Config",telegram:"Telegram",agents:"Agents",routines:"Rutinas",tasks:"Tasks",mcps:"MCPs",threads:"Chats",logs:"Logs",memories:"Memorias"},sections:{workspace:"Workspace",automation:"Automatización",knowledge:"Conversaciones",config:"Config"},overview:{tasks_open:"Tasks abiertas",routines:"Rutinas",agents:"Agents",mcps:"MCPs",chat:"Chat (super-agent)",chat_value:"abrir"},chat:{title:"Chat con agente",subtitle:"Conversaciones directas con agentes del proyecto. El super-agent no interviene.",roby_title:"Chat con Roby",roby_subtitle:"Chat con Roby — el super-agente APX. Puede usar tools (proyectos, tasks, mcps, agentes).",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",clear:"Limpiar",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"},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:{title:"Tasks (todos los proyectos)",subtitle:"Tareas agregadas de todos los proyectos registrados.",empty:"Sin tasks.",due:"vence",go_project:"Ir al proyecto"},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}?",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",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:"Texto (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.",delete_success:"borrada."},agents:{title:"Agents",subtitle:"Definidos en AGENTS.md + .apc/agents/<slug>/.",subtitle_full:"Definidos en AGENTS.md + .apc/agents/<slug>/. La jerarquía (orquestador → subagentes) vive en el frontmatter (Master / Parent).",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. claude-sonnet-4.5, ollama:gemma2:9b",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 copian a este proyecto (.apc/agents/).",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 su carpeta.',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}",new_title:"Nuevo 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, opcional)",url_label:"url",url_ph:"https://example.com/mcp",enabled_label:"Habilitado",add_btn:"Agregar",name_required:"name requerido",env_invalid:"env debe ser JSON válido",removed:"eliminado",added:"MCP agregado."},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."},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:{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
|
|
524
|
+
|
|
525
|
+
Hechos estables que cualquier agente debería saber…`,agents_title:"Memorias de agentes",agents_desc:"Memoria individual por agente. .apc/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_all:"Todos los engines",sessions_empty:"Sin sesiones.",sessions_error:"No pude leer las sesiones: {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",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"},roby:{title:"Roby",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 Roby para arrancar.",thinking:"Roby está pensando…",talk:"Hablar con Roby",new_chat:"Nuevo chat",placeholder:"Escribí y enter para enviar (shift+enter = nueva línea)…"},not_found:{title:"404",message:"Esa ruta no existe."},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",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]"}},c5={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"},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",modules:{voice:"Voices",desktop:"Desktop",deck:"Deck",code:"Code"}},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",browser_unavailable:"Browser unavailable until daemon restarts. Paste path manually.",no_folders:"No folders."},settings:{title:"Settings",subtitle:"Panel preferences + local daemon diagnostics.",appearance:"Appearance",light_mode:"Light",dark_mode:"Dark",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",channels_section:"Channels & devices",advanced_section:"Advanced",tabs:{identity:"Identity",super_agent:"Super-agent",engines:"Engines & models",telegram:"Telegram",devices:"Devices",advanced:"Advanced"},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:"e.g. America/New_York",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.",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:"Project {pid} not found.",rebuild:"Rebuild context",rebuild_done:"Rebuild OK.",unregister_confirm:"Unregister {label}? The folder is not deleted.",unregistered:"Unregistered.",base_subtitle:"General workspace · super-agent",nav:{overview:"Overview",chat:"Chat",config:"Config",telegram:"Telegram",agents:"Agents",routines:"Routines",tasks:"Tasks",mcps:"MCPs",threads:"Chats",logs:"Logs",memories:"Memories"},sections:{workspace:"Workspace",automation:"Automation",knowledge:"Conversations",config:"Config"},overview:{tasks_open:"Open tasks",routines:"Routines",agents:"Agents",mcps:"MCPs",chat:"Chat (super-agent)",chat_value:"open"},chat:{title:"Chat with agent",subtitle:"Direct conversations with project agents. The super-agent does not intervene.",roby_title:"Chat with Roby",roby_subtitle:"Chat with Roby — the APX super-agent. Can use tools (projects, tasks, mcps, agents).",empty:"Send a message to start the conversation.",placeholder:"Type something and press enter to send (shift+enter = new line)",send:"Send",stop:"Stop",clear:"Clear",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"},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:{title:"Tasks (all projects)",subtitle:"Aggregated tasks from all registered projects.",empty:"No tasks.",due:"due",go_project:"Go to project"},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}?",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",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:"Text (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.",delete_success:"deleted."},agents:{title:"Agents",subtitle:"Defined in AGENTS.md + .apc/agents/<slug>/.",subtitle_full:"Defined in AGENTS.md + .apc/agents/<slug>/. Hierarchy (orchestrator → sub-agents) lives in frontmatter (Master / Parent).",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. claude-sonnet-4.5, ollama:gemma2:9b",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. Copied to this project (.apc/agents/).",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 its folder.',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}",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."},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."},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:{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
|
|
526
|
+
|
|
527
|
+
Stable facts that any agent should know…`,agents_title:"Agent memories",agents_desc:"Individual memory per agent. .apc/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_all:"All engines",sessions_empty:"No sessions.",sessions_error:"Could not read sessions: {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",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"},roby:{title:"Roby",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 Roby a message to get started.",thinking:"Roby is thinking…",talk:"Talk to Roby",new_chat:"New chat",placeholder:"Type and press enter to send (shift+enter = new line)…"},not_found:{title:"404",message:"That route does not exist."},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",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]"}},ax={es:i5,en:c5};function u5(){try{const e=localStorage.getItem(Cn.language);if(e&&e in ax)return e}catch{}return"es"}let qd=u5();function d5(e){qd=e;try{localStorage.setItem(Cn.language,e)}catch{}}const f5=[{value:"es",label:"Español"},{value:"en",label:"English"}];function m5(){return qd}function p5(e){const n=ax[qd],s=e.split(".");let r=n;for(const i of s)if(r&&typeof r=="object"&&i in r)r=r[i];else return;return typeof r=="string"?r:void 0}function g5(e,n){return n?e.replace(/\{(\w+)\}/g,(s,r)=>r in n?String(n[r]):`{${r}}`):e}function h5(e){const n=p5(e);if(n!==void 0)return n;if(qd!=="es"){const s=ax.es,r=e.split(".");let i=s;for(const c of r)if(i&&typeof i=="object"&&c in i)i=i[c];else return;return typeof i=="string"?i:void 0}}function C(e,n){const s=h5(e);return s===void 0?e:g5(s,n)}function x5(){return[{id:"voice",label:C("nav.modules.voice"),href:"/m/voice",icon:QR},{id:"desktop",label:C("nav.modules.desktop"),href:"/m/desktop",icon:ZR},{id:"deck",label:C("nav.modules.deck"),href:"/m/deck",icon:YR},{id:"code",label:C("nav.modules.code"),href:"/m/code",icon:Pi}]}function b5({onSelect:e,onOpenRoby:n}){const{projects:s,isLoading:r}=sc(),i=ea(),c=x5(),d=m=>i.pathname===m||i.pathname.startsWith(`${m}/`),f=s.find(m=>String(m.id)==="0"),g=s.filter(m=>String(m.id)!=="0");return l.jsxs("aside",{className:"flex h-full w-20 flex-col items-center gap-3 overflow-y-auto bg-transparent py-3",children:[l.jsx(Ko,{content:C("nav.apx_admin"),side:"right",children:l.jsx("button",{type:"button",onClick:()=>e("/"),"data-testid":"nav-home",className:"mb-2 cursor-pointer",children:l.jsx(mN,{size:36})})}),r&&l.jsx("div",{className:"size-10 animate-pulse rounded-xl bg-muted"}),f&&l.jsx(ui,{label:C("base.title"),testId:"project-avatar-0",title:C("base.subtitle"),active:d("/p/0"),isDefault:!0,icon:l.jsx("img",{src:"/modules/superagent.png",alt:C("base.title"),className:"size-7 object-contain",draggable:!1}),onClick:()=>e("/p/0")}),l.jsx("div",{className:"my-0.5 h-px w-8 rounded-full bg-border"}),c.map(m=>l.jsx(ui,{label:m.label,testId:`module-avatar-${m.id}`,title:m.label,active:d(m.href),icon:l.jsx(m.icon,{size:18}),onClick:()=>e(m.href)},m.id)),g.length>0&&l.jsx("div",{className:"my-0.5 h-px w-8 rounded-full bg-border"}),g.map(m=>{const h=m.name||m.path.split("/").pop()||String(m.id),x=`/p/${m.id}`;return l.jsx(ui,{label:h,testId:`project-avatar-${m.id}`,title:`${h} — ${m.path}`,active:d(x),onClick:()=>e(x)},m.id)}),l.jsx(ui,{label:"Add",isAdd:!0,testId:"nav-add-project",icon:l.jsx(Rn,{size:18}),active:!1,onClick:()=>e("/?action=add-project"),title:C("nav.add_project")}),l.jsx("div",{className:"flex-1"}),l.jsx(ui,{label:"Settings",isSettings:!0,testId:"nav-settings",icon:l.jsx(ed,{size:16}),active:i.pathname==="/settings"||i.pathname.startsWith("/settings/"),onClick:()=>e("/settings"),title:C("nav.settings")}),l.jsx(Ko,{content:C("roby.talk"),side:"right",children:l.jsx("button",{type:"button",onClick:n,"data-testid":"nav-roby","aria-label":C("roby.talk"),className:"mt-1 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:l.jsx(vn,{size:18})})})]})}function iw(e){switch(e){case"personal":return"Personal";case"company":return"Company";case"app":return"App";case"software":return"Software";case"default":return"Default";case"other":return"Other";default:return C("nav.project")}}function He({title:e,description:n,action:s,className:r,children:i}){return l.jsxs("section",{className:Ie("rounded-xl border border-border bg-card p-5",r),children:[l.jsxs("header",{className:"mb-4 flex items-start justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:e}),n&&l.jsx("p",{className:"mt-0.5 text-sm text-muted-fg",children:n})]}),s]}),l.jsx("div",{children:i})]})}function R1({children:e}){return l.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 Vd({ok:e}){return l.jsx("span",{className:Ie("inline-block size-2 rounded-full",e===null?"bg-muted-fg":e?"bg-emerald-500":"bg-red-500")})}const cw=v.createContext(void 0);function uw(e=!1){const n=v.useContext(cw);if(n===void 0&&!e)throw new Error(Nn(16));return n}function v5(e){const{focusableWhenDisabled:n,disabled:s,composite:r=!1,tabIndex:i=0,isNativeButton:c}=e,d=r&&n!==!1,f=r&&n===!1;return{props:v.useMemo(()=>{const m={onKeyDown(h){s&&n&&h.key!=="Tab"&&h.preventDefault()}};return r||(m.tabIndex=i,!c&&s&&(m.tabIndex=n?i:-1)),(c&&(n||d)||!c&&s)&&(m["aria-disabled"]=s),c&&(!n||f)&&(m.disabled=s),m},[r,s,n,d,f,c,i])}}function ml(e={}){const{disabled:n=!1,focusableWhenDisabled:s,tabIndex:r=0,native:i=!0,composite:c}=e,d=v.useRef(null),f=uw(!0),g=c??f!==void 0,{props:m}=v5({focusableWhenDisabled:s,disabled:n,composite:g,tabIndex:r,isNativeButton:i}),h=v.useCallback(()=>{const w=d.current;Hp(w)&&g&&n&&m.disabled===void 0&&w.disabled&&(w.disabled=!1)},[n,m.disabled,g]);Re(h,[h]);const x=v.useCallback((w={})=>{const{onClick:S,onMouseDown:_,onKeyUp:j,onKeyDown:E,onPointerDown:k,...N}=w;return ka({onClick(R){if(n){R.preventDefault();return}S?.(R)},onMouseDown(R){n||_?.(R)},onKeyDown(R){if(n||(id(R),E?.(R),R.baseUIHandlerPrevented))return;const A=R.target===R.currentTarget,M=R.currentTarget,O=Hp(M),U=!i&&y5(M),I=A&&(i?O:!U),B=R.key==="Enter",L=R.key===" ",D=M.getAttribute("role"),q=D?.startsWith("menuitem")||D==="option"||D==="gridcell";if(A&&g&&L){if(R.defaultPrevented&&q)return;R.preventDefault(),U||i&&O?(M.click(),R.preventBaseUIHandler()):I&&(S?.(R),R.preventBaseUIHandler());return}I&&(!i&&(L||B)&&R.preventDefault(),!i&&B&&S?.(R))},onKeyUp(R){if(!n){if(id(R),j?.(R),R.target===R.currentTarget&&i&&g&&Hp(R.currentTarget)&&R.key===" "){R.preventDefault();return}R.baseUIHandlerPrevented||R.target===R.currentTarget&&!i&&!g&&R.key===" "&&S?.(R)}},onPointerDown(R){if(n){R.preventDefault();return}k?.(R)}},i?{type:"button"}:{role:"button"},m,N)},[n,m,g,i]),y=Ae(w=>{d.current=w,h()});return{getButtonProps:x,buttonRef:y}}function Hp(e){return Ut(e)&&e.tagName==="BUTTON"}function y5(e){return!!(e?.tagName==="A"&&e?.href)}const _5=v.forwardRef(function(n,s){const{render:r,className:i,disabled:c=!1,focusableWhenDisabled:d=!1,nativeButton:f=!0,style:g,...m}=n,{getButtonProps:h,buttonRef:x}=ml({disabled:c,focusableWhenDisabled:d,native:f});return Lt("button",n,{state:{disabled:c},ref:[s,x],props:[m,h]})}),N1=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,T1=vh,sx=(e,n)=>s=>{var r;if(n?.variants==null)return T1(e,s?.class,s?.className);const{variants:i,defaultVariants:c}=n,d=Object.keys(i).map(m=>{const h=s?.[m],x=c?.[m];if(h===null)return null;const y=N1(h)||N1(x);return i[m][y]}),f=s&&Object.entries(s).reduce((m,h)=>{let[x,y]=h;return y===void 0||(m[x]=y),m},{}),g=n==null||(r=n.compoundVariants)===null||r===void 0?void 0:r.reduce((m,h)=>{let{class:x,className:y,...w}=h;return Object.entries(w).every(S=>{let[_,j]=S;return Array.isArray(j)?j.includes({...c,...f}[_]):{...c,...f}[_]===j})?[...m,x,y]:m},[]);return T1(e,d,g,s?.class,s?.className)},j5=sx("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 Wo({className:e,variant:n="default",size:s="default",...r}){return l.jsx(_5,{"data-slot":"button",className:Pt(j5({variant:n,size:s,className:e})),...r})}let A1=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const S5={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},ji={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},w5={disabled:!1,...ji},rx={valid(e){return e===null?null:e?{[A1.valid]:""}:{[A1.invalid]:""}}},C5={invalid:void 0,name:void 0,validityData:{state:S5,errors:[],error:"",value:"",initialValue:null},setValidityData:Dn,disabled:void 0,touched:ji.touched,setTouched:Dn,dirty:ji.dirty,setDirty:Dn,filled:ji.filled,setFilled:Dn,focused:ji.focused,setFocused:Dn,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:w5,markedDirtyRef:{current:!1},registerFieldControl:Dn,validation:{getValidationProps:(e=an)=>e,getInputValidationProps:(e=an)=>e,inputRef:{current:null},commit:async()=>{}}},E5=v.createContext(C5);function rc(e=!0){const n=v.useContext(E5);if(n.setValidityData===Dn&&!e)throw new Error(Nn(28));return n}const k5=v.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Dn,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function dw(){return v.useContext(k5)}const R5=v.createContext({controlId:void 0,registerControlId:Dn,labelId:void 0,setLabelId:Dn,messageIds:[],setMessageIds:Dn,getDescriptionProps:e=>e});function $d(){return v.useContext(R5)}function N5(e,n,s,r=!0,i){const[c,d]=v.useState(),f=br(i?`${i}-label`:void 0),g=e??n??c;return Re(()=>{const m=e||n||!r?void 0:T5(s.current,f);c!==m&&d(m)}),g}function T5(e,n){const s=A5(e);if(s)return!s.id&&n&&(s.id=n),s.id||void 0}function A5(e){if(!e)return;const n=e.parentElement;if(n&&n.tagName==="LABEL")return n;const s=e.id;if(s){const i=e.nextElementSibling;if(i&&i.htmlFor===s)return i}const r=e.labels;return r&&r[0]}function Gd(e={}){const{id:n,implicit:s=!1,controlRef:r}=e,{controlId:i,registerControlId:c}=$d(),d=br(n),f=s?i:void 0,g=fa(()=>Symbol("labelable-control")),m=v.useRef(!1),h=v.useRef(n!=null),x=Ae(()=>{!m.current||c===Dn||(m.current=!1,c(g.current,void 0))});return Re(()=>{if(c===Dn)return;let y;if(s){const w=r?.current;ot(w)&&w.closest("label")!=null?y=n??null:y=f??d}else if(n!=null)h.current=!0,y=n;else if(h.current)y=d;else{x();return}if(y===void 0){x();return}m.current=!0,c(g.current,y)},[n,r,f,c,s,d,g,x]),v.useEffect(()=>x,[x]),i??d}function Gi({controlled:e,default:n,name:s,state:r="value"}){const{current:i}=v.useRef(e!==void 0),[c,d]=v.useState(n),f=i?e:c,g=v.useCallback(m=>{i||d(m)},[]);return[f,g]}function ox(e,n,s,r,i=!0){const{registerFieldControl:c}=rc(),d=v.useRef(null);d.current||(d.current=Symbol()),Re(()=>{const f=d.current;return!f||!i?void 0:(c(f,{controlRef:e,getValue:r,id:n,value:s}),()=>{c(f,void 0)})},[e,i,r,n,c,s])}const M5=v.forwardRef(function(n,s){const{render:r,className:i,id:c,name:d,value:f,disabled:g=!1,onValueChange:m,defaultValue:h,autoFocus:x=!1,style:y,...w}=n,{state:S,name:_,disabled:j,setTouched:E,setDirty:k,validityData:N,setFocused:R,setFilled:A,validationMode:M,validation:O}=rc(),U=j||g,I=_??d,B={...S,disabled:U},{labelId:L}=$d(),D=Gd({id:c});Re(()=>{const V=f!=null;O.inputRef.current?.value||V&&f!==""?A(!0):V&&f===""&&A(!1)},[O.inputRef,A,f]);const q=v.useRef(null);Re(()=>{x&&q.current===zn(xt(q.current))&&R(!0)},[x,R]);const[F]=Gi({controlled:f,default:h,name:"FieldControl",state:"value"}),Z=f!==void 0,H=Z?F:void 0,G=Ae(()=>O.inputRef.current?.value);return ox(O.inputRef,D,H,G),Lt("input",n,{ref:[s,q],state:B,props:[{id:D,disabled:U,name:I,ref:O.inputRef,"aria-labelledby":L,autoFocus:x,...Z?{value:H}:{defaultValue:h},onChange(V){const Y=V.currentTarget.value;m?.(Y,tt(Ns,V.nativeEvent)),k(Y!==N.initialValue),A(Y!=="")},onFocus(){R(!0)},onBlur(V){E(!0),R(!1),M==="onBlur"&&O.commit(V.currentTarget.value)},onKeyDown(V){V.currentTarget.tagName==="INPUT"&&V.key==="Enter"&&(E(!0),O.commit(V.currentTarget.value))}},O.getInputValidationProps(),w],stateAttributesMapping:rx})}),O5=v.forwardRef(function(n,s){return l.jsx(M5,{ref:s,...n})});function z5({className:e,type:n,...s}){return l.jsx(O5,{type:n,"data-slot":"input",className:Pt("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),...s})}function D5({className:e,...n}){return l.jsx("textarea",{"data-slot":"textarea",className:Pt("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),...n})}function L5(e){return Lt(e.defaultTagName??"div",e,e)}const P5=sx("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 B5({className:e,variant:n="default",render:s,...r}){return L5({defaultTagName:"span",props:ka({className:Pt(P5({variant:n}),e)},r),render:s,state:{slot:"badge",variant:n}})}const fw=v.createContext(void 0);function I5(){const e=v.useContext(fw);if(e===void 0)throw new Error(Nn(63));return e}let M1=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const mw={...rx,checked(e){return e?{[M1.checked]:""}:{[M1.unchecked]:""}}};function lx(e,n){const s=v.useRef(e),r=Ae(n);Re(()=>{s.current!==e&&r(s.current)},[e,r]),Re(()=>{s.current=e},[e])}const U5=v.forwardRef(function(n,s){const{checked:r,className:i,defaultChecked:c,"aria-labelledby":d,form:f,id:g,inputRef:m,name:h,nativeButton:x=!1,onCheckedChange:y,readOnly:w=!1,required:S=!1,disabled:_=!1,render:j,uncheckedValue:E,value:k,style:N,...R}=n,{clearErrors:A}=dw(),{state:M,setTouched:O,setDirty:U,validityData:I,setFilled:B,setFocused:L,shouldValidateOnChange:D,validationMode:q,disabled:F,name:Z,validation:H}=rc(),{labelId:G}=$d(),Q=F||_,V=Z??h,Y=v.useRef(null),P=Ts(Y,m,H.inputRef),K=v.useRef(null),$=br(),W=Gd({id:g,implicit:!1,controlRef:K}),ce=x?void 0:W,[ie,oe]=Gi({controlled:r,default:!!c,name:"Switch",state:"checked"});ox(K,$,ie),Re(()=>{Y.current&&B(Y.current.checked)},[Y,B]),lx(ie,()=>{A(V),U(ie!==I.initialValue),B(ie),D()?H.commit(ie):H.commit(ie,!0)});const{getButtonProps:ue,buttonRef:te}=ml({disabled:Q,native:x}),Ne=N5(d,G,Y,!x,ce),$e={id:x?W:$,role:"switch","aria-checked":ie,"aria-readonly":w||void 0,"aria-required":S||void 0,"aria-labelledby":Ne,onFocus(){Q||L(!0)},onBlur(){const Oe=Y.current;!Oe||Q||(O(!0),L(!1),q==="onBlur"&&H.commit(Oe.checked))},onClick(Oe){if(w||Q)return;Oe.preventDefault();const ze=Y.current;ze&&ze.dispatchEvent(new(Ft(ze)).PointerEvent("click",{bubbles:!0,shiftKey:Oe.shiftKey,ctrlKey:Oe.ctrlKey,altKey:Oe.altKey,metaKey:Oe.metaKey}))}},be=ka({checked:ie,disabled:Q,form:f,id:ce,name:V,required:S,style:V?Gj:Ah,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:P,onChange(Oe){if(Oe.nativeEvent.defaultPrevented)return;if(w){Oe.preventDefault();return}const ze=Oe.currentTarget.checked,xe=tt(Ns,Oe.nativeEvent);y?.(ze,xe),!xe.isCanceled&&oe(ze)},onFocus(){K.current?.focus()}},H.getInputValidationProps,k!==void 0?{value:k}:an),Se=v.useMemo(()=>({...M,checked:ie,disabled:Q,readOnly:w,required:S}),[M,ie,Q,w,S]),Ee=Lt("span",n,{state:Se,ref:[s,K,te],props:[$e,H.getValidationProps,R,ue],stateAttributesMapping:mw});return l.jsxs(fw.Provider,{value:Se,children:[Ee,!ie&&V&&E!==void 0&&l.jsx("input",{type:"hidden",form:f,name:V,value:E}),l.jsx("input",{...be,suppressHydrationWarning:!0})]})}),H5=v.forwardRef(function(n,s){const{render:r,className:i,style:c,...d}=n,f=I5();return Lt("span",n,{state:f,ref:s,stateAttributesMapping:mw,props:d})});function q5({className:e,size:n="default",...s}){return l.jsx(U5,{"data-slot":"switch","data-size":n,className:Pt("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),...s,children:l.jsx(H5,{"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 V5({className:e,...n}){return l.jsx(ph,{role:"status","aria-label":"Loading",className:Pt("size-4 animate-spin",e),...n})}const pw=v.createContext(!1),gw=v.createContext(void 0);function Jr(e){const n=v.useContext(gw);if(e===!1&&n===void 0)throw new Error(Nn(27));return n}const $5={...fl,...dl},hw=v.forwardRef(function(n,s){const{render:r,className:i,style:c,forceRender:d=!1,...f}=n,{store:g}=Jr(),m=g.useState("open"),h=g.useState("nested"),x=g.useState("mounted"),y=g.useState("transitionStatus");return Lt("div",n,{state:{open:m,transitionStatus:y},ref:[g.context.backdropRef,s],stateAttributesMapping:$5,props:[{role:"presentation",hidden:!x,style:{userSelect:"none",WebkitUserSelect:"none"}},f],enabled:d||!h})}),xw=v.forwardRef(function(n,s){const{render:r,className:i,style:c,disabled:d=!1,nativeButton:f=!0,...g}=n,{store:m}=Jr(),h=m.useState("open"),{getButtonProps:x,buttonRef:y}=ml({disabled:d,native:f}),w={disabled:d};function S(_){h&&m.setOpen(!1,tt(mT,_.nativeEvent))}return Lt("button",n,{state:w,ref:[s,y],props:[{onClick:S},g,x]})}),bw=v.forwardRef(function(n,s){const{render:r,className:i,style:c,id:d,...f}=n,{store:g}=Jr(),m=br(d);return g.useSyncedValueWithCleanup("descriptionElementId",m),Lt("p",n,{ref:s,props:[{id:m},f]})});let G5=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),Y5=(function(e){return e[e.open=qr.open]="open",e[e.closed=qr.closed]="closed",e[e.startingStyle=qr.startingStyle]="startingStyle",e[e.endingStyle=qr.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const vw=v.createContext(void 0);function F5(){const e=v.useContext(vw);if(e===void 0)throw new Error(Nn(26));return e}const Ai="ArrowUp",Ho="ArrowDown",hd="ArrowLeft",Mi="ArrowRight",Yd="Home",Fd="End",yw=new Set([hd,Mi]),X5=new Set([hd,Mi,Yd,Fd]),_w=new Set([Ai,Ho]),K5=new Set([Ai,Ho,Yd,Fd]),jw=new Set([...yw,..._w]),ix=new Set([...jw,Yd,Fd]),Q5="Shift",Z5="Control",J5="Alt",W5="Meta",e4=new Set([Q5,Z5,J5,W5]);function t4(e){return Ut(e)&&e.tagName==="INPUT"}function O1(e){return!!(t4(e)&&e.selectionStart!=null||Ut(e)&&e.tagName==="TEXTAREA")}function z1(e,n,s,r){if(!e||!n||!n.scrollTo)return;let i=e.scrollLeft,c=e.scrollTop;const d=e.clientWidth<e.scrollWidth,f=e.clientHeight<e.scrollHeight;if(d&&r!=="vertical"){const g=D1(e,n,"left"),m=Tu(e),h=Tu(n);s==="ltr"&&(g+n.offsetWidth+h.scrollMarginRight>e.scrollLeft+e.clientWidth-m.scrollPaddingRight?i=g+n.offsetWidth+h.scrollMarginRight-e.clientWidth+m.scrollPaddingRight:g-h.scrollMarginLeft<e.scrollLeft+m.scrollPaddingLeft&&(i=g-h.scrollMarginLeft-m.scrollPaddingLeft)),s==="rtl"&&(g-h.scrollMarginRight<e.scrollLeft+m.scrollPaddingLeft?i=g-h.scrollMarginLeft-m.scrollPaddingLeft:g+n.offsetWidth+h.scrollMarginRight>e.scrollLeft+e.clientWidth-m.scrollPaddingRight&&(i=g+n.offsetWidth+h.scrollMarginRight-e.clientWidth+m.scrollPaddingRight))}if(f&&r!=="horizontal"){const g=D1(e,n,"top"),m=Tu(e),h=Tu(n);g-h.scrollMarginTop<e.scrollTop+m.scrollPaddingTop?c=g-h.scrollMarginTop-m.scrollPaddingTop:g+n.offsetHeight+h.scrollMarginBottom>e.scrollTop+e.clientHeight-m.scrollPaddingBottom&&(c=g+n.offsetHeight+h.scrollMarginBottom-e.clientHeight+m.scrollPaddingBottom)}e.scrollTo({left:i,top:c,behavior:"auto"})}function D1(e,n,s){const r=s==="left"?"offsetLeft":"offsetTop";let i=0;for(;n.offsetParent&&(i+=n[r],n.offsetParent!==e);)n=n.offsetParent;return i}function Tu(e){const n=getComputedStyle(e);return{scrollMarginTop:parseFloat(n.scrollMarginTop)||0,scrollMarginRight:parseFloat(n.scrollMarginRight)||0,scrollMarginBottom:parseFloat(n.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(n.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(n.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(n.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(n.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(n.scrollPaddingLeft)||0}}const n4={...fl,...dl,nestedDialogOpen(e){return e?{[Y5.nestedDialogOpen]:""}:null}},Sw=v.forwardRef(function(n,s){const{render:r,className:i,style:c,finalFocus:d,initialFocus:f,...g}=n,{store:m}=Jr(),h=m.useState("descriptionElementId"),x=m.useState("disablePointerDismissal"),y=m.useState("floatingRootContext"),w=m.useState("popupProps"),S=m.useState("modal"),_=m.useState("mounted"),j=m.useState("nested"),E=m.useState("nestedOpenDialogCount"),k=m.useState("open"),N=m.useState("openMethod"),R=m.useState("titleElementId"),A=m.useState("transitionStatus"),M=m.useState("role"),O=y.useState("floatingId"),U=g.id??O;F5(),xr({open:k,ref:m.context.popupRef,onComplete(){k&&m.context.onOpenChangeComplete?.(!0)}});function I(Z){return Z==="touch"?m.context.popupRef.current:!0}const B=f===void 0?I:f,L=E>0,D=m.useStateSetter("popupElement"),F=Lt("div",n,{state:{open:k,nested:j,transitionStatus:A,nestedDialogOpen:L},props:[w,{id:U,"aria-labelledby":R??void 0,"aria-describedby":h??void 0,role:M,...Id,hidden:!_,onKeyDown(Z){ix.has(Z.key)&&Z.stopPropagation()},style:{[G5.nestedDialogs]:E}},g],ref:[s,m.context.popupRef,D],stateAttributesMapping:n4});return l.jsx(xS,{context:y,openInteractionType:N,disabled:!_,closeOnFocusOut:!x,initialFocus:B,returnFocus:d,modal:S!==!1,restoreFocus:"popup",children:F})}),ww=v.forwardRef(function(n,s){const{cutout:r,...i}=n;let c;if(r){const d=r.getBoundingClientRect();c=`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 l.jsx("div",{ref:s,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})}),Cw=v.forwardRef(function(n,s){const{keepMounted:r=!1,...i}=n,{store:c}=Jr(),d=c.useState("mounted"),f=c.useState("modal"),g=c.useState("open");return d||r?l.jsx(vw.Provider,{value:r,children:l.jsxs(hS,{ref:s,...i,children:[d&&f===!0&&l.jsx(ww,{ref:c.context.internalBackdropRef,inert:Kh(!g)}),n.children]})}):null});let L1={},P1={},B1="";function a4(e){if(typeof document>"u")return!1;const n=xt(e);return Ft(n).innerWidth-n.documentElement.clientWidth>0}function s4(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const s=xt(e),r=s.documentElement,i=s.body,c=gr(r)?r:i,d=c.style.overflowY,f=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",c.style.overflowY="scroll";const g=c.offsetWidth;c.style.overflowY="hidden";const m=c.offsetWidth;return c.style.overflowY=d,r.style.scrollbarGutter=f,g===m}function r4(e){const n=xt(e),s=n.documentElement,r=n.body,i=gr(s)?s:r,c={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(i.style,c)}}function o4(e){const n=xt(e),s=n.documentElement,r=n.body,i=Ft(s);let c=0,d=0,f=!1;const g=Ya.create();if(Sh&&(i.visualViewport?.scale??1)!==1)return()=>{};function m(){const w=i.getComputedStyle(s),S=i.getComputedStyle(r),E=(w.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=s.scrollTop,d=s.scrollLeft,L1={scrollbarGutter:s.style.scrollbarGutter,overflowY:s.style.overflowY,overflowX:s.style.overflowX},B1=s.style.scrollBehavior,P1={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 k=s.scrollHeight>s.clientHeight,N=s.scrollWidth>s.clientWidth,R=w.overflowY==="scroll"||S.overflowY==="scroll",A=w.overflowX==="scroll"||S.overflowX==="scroll",M=Math.max(0,i.innerWidth-r.clientWidth),O=Math.max(0,i.innerHeight-r.clientHeight),U=parseFloat(S.marginTop)+parseFloat(S.marginBottom),I=parseFloat(S.marginLeft)+parseFloat(S.marginRight),B=gr(s)?s:r;if(f=s4(e),f){s.style.scrollbarGutter=E,B.style.overflowY="hidden",B.style.overflowX="hidden";return}Object.assign(s.style,{scrollbarGutter:E,overflowY:"hidden",overflowX:"hidden"}),(k||R)&&(s.style.overflowY="scroll"),(N||A)&&(s.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:U||O?`calc(100dvh - ${U+O}px)`:"100dvh",width:I||M?`calc(100vw - ${I+M}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=c,r.scrollLeft=d,s.setAttribute("data-base-ui-scroll-locked",""),s.style.scrollBehavior="unset"}function h(){Object.assign(s.style,L1),Object.assign(r.style,P1),f||(s.scrollTop=c,s.scrollLeft=d,s.removeAttribute("data-base-ui-scroll-locked"),s.style.scrollBehavior=B1)}function x(){h(),g.request(m)}m();const y=ct(i,"resize",x);return()=>{g.cancel(),h(),typeof i.removeEventListener=="function"&&y()}}class l4{lockCount=0;restore=null;timeoutLock=Ia.create();timeoutUnlock=Ia.create();acquire(n){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(n)),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(n){if(this.lockCount===0||this.restore!==null)return;const r=xt(n).documentElement,i=Ft(r).getComputedStyle(r).overflowY;if(i==="hidden"||i==="clip"){this.restore=Dn;return}const c=Mj||!a4(n);this.restore=c?r4(n):o4(n)}}const i4=new l4;function Ew(e=!0,n=null){Re(()=>{if(e)return i4.acquire(n)},[e,n])}function c4(e){const{store:n,parentContext:s,actionsRef:r,isDrawer:i}=e,c=n.useState("open");wM(n,c),AS(n);const{forceUnmount:d}=MS(c,n),f=v.useCallback(()=>{n.setOpen(!1,tt(Uj))},[n]);return v.useImperativeHandle(r,()=>({unmount:d,close:f}),[d,f]),{parentContext:s,isDrawer:i}}function u4({store:e,dialogRoot:n}){const{parentContext:s,isDrawer:r}=n,i=e.useState("open"),c=e.useState("disablePointerDismissal"),d=e.useState("modal"),f=e.useState("popupElement"),g=e.useState("floatingRootContext"),[m,h]=v.useState(0),[x,y]=v.useState(0),w=m===0,S=Uh(g,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:d==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(k){if(!e.context.outsidePressEnabledRef.current||"button"in k&&k.button!==0||"touches"in k&&k.touches.length!==1)return!1;const N=En(k);if(w&&!c){const R=N;return d&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===R||e.context.backdropRef.current===R||Ye(R,f)&&!R?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:w});Ew(i&&d===!0,f),e.useContextCallback("onNestedDialogOpen",(k,N)=>{h(k),y(N)}),e.useContextCallback("onNestedDialogClose",()=>{h(0),y(0)}),v.useEffect(()=>(s?.onNestedDialogOpen&&i&&s.onNestedDialogOpen(m+1,x+(r?1:0)),s?.onNestedDialogClose&&!i&&s.onNestedDialogClose(),()=>{s?.onNestedDialogClose&&i&&s.onNestedDialogClose()}),[r,i,m,x,s]);const _=S.reference??an,j=S.trigger??an,E=v.useMemo(()=>ka(Id,S.floating),[S.floating]);return OS(e,{activeTriggerProps:_,inactiveTriggerProps:j,popupProps:E,nestedOpenDialogCount:m,nestedOpenDrawerCount:x}),null}const d4={...PS,modal:Te(e=>e.modal),nested:Te(e=>e.nested),nestedOpenDialogCount:Te(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:Te(e=>e.nestedOpenDrawerCount),disablePointerDismissal:Te(e=>e.disablePointerDismissal),openMethod:Te(e=>e.openMethod),descriptionElementId:Te(e=>e.descriptionElementId),titleElementId:Te(e=>e.titleElementId),viewportElement:Te(e=>e.viewportElement),role:Te(e=>e.role)};class cx extends qh{constructor(n,s,r=!1){const i=new Ud,c=f4(n);c.floatingRootContext=DS(i,s,r),super(c,{popupRef:v.createRef(),backdropRef:v.createRef(),internalBackdropRef:v.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:i,onOpenChange:void 0,onOpenChangeComplete:void 0},d4)}setOpen=(n,s)=>{if(s.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&s.trigger==null&&this.state.activeTriggerId!=null&&(s.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(n,s),s.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,s);const r={open:n};TS(r,n,s.trigger),this.update(r)};static useStore(n,s){return NS(n,(i,c)=>new cx(s,i,c),!0).store}}function f4(e={}){return{...zS(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function m4(e,n="dialog"){const{children:s,open:r,defaultOpen:i=!1,onOpenChange:c,onOpenChangeComplete:d,disablePointerDismissal:f=!1,modal:g=!0,actionsRef:m,handle:h,triggerId:x,defaultTriggerId:y=null}=e,w=n==="drawer",S=n==="alert-dialog",_=S?!0:g,j=S||f,E=S?"alertdialog":"dialog",k=Jr(!0),R={modal:_,disablePointerDismissal:j,nested:!!k,role:E},A=cx.useStore(h?.store,{open:i,openProp:r,activeTriggerId:y,triggerIdProp:x,...R});_h(()=>{const D=r===void 0&&A.state.open===!1&&i===!0?{open:!0,activeTriggerId:y}:null;S?A.update(D?{...R,...D}:R):D&&A.update(D)}),A.useControlledProp("openProp",r),A.useControlledProp("triggerIdProp",x),A.useSyncedValues(R),A.useContextCallback("onOpenChange",c),A.useContextCallback("onOpenChangeComplete",d);const M=A.useState("open"),O=A.useState("mounted"),U=A.useState("payload"),I=c4({store:A,actionsRef:m,parentContext:k?.store.context,isDrawer:w}),B=M||O,L=v.useMemo(()=>({store:A}),[A]);return l.jsx(pw.Provider,{value:!1,children:l.jsxs(gw.Provider,{value:L,children:[B&&l.jsx(u4,{store:A,dialogRoot:I}),typeof s=="function"?s({payload:U}):s]})})}function kw(e){const n=v.useContext(pw)?"drawer":"dialog";return m4(e,n)}const Rw=v.forwardRef(function(n,s){const{render:r,className:i,style:c,id:d,...f}=n,{store:g}=Jr(),m=br(d);return g.useSyncedValueWithCleanup("titleElementId",m),Lt("h2",n,{ref:s,props:[{id:m},f]})});function p4(e){const n=v.useRef(""),s=v.useCallback(i=>{i.defaultPrevented||(n.current=i.pointerType,e(i,i.pointerType))},[e]);return{onClick:v.useCallback(i=>{if(i.detail===0){e(i,"keyboard");return}"pointerType"in i?e(i,i.pointerType):e(i,n.current),n.current=""},[e]),onPointerDown:s}}function g4(e,n){const s=Ae((c,d)=>{(typeof e=="function"?e():e)||n(d||(Mj?"touch":""))}),{onClick:r,onPointerDown:i}=p4(s);return v.useMemo(()=>({onClick:r,onPointerDown:i}),[r,i])}function h4(e){const[n,s]=v.useState(null),r=g4(e,s);return lx(e,i=>{i&&!e&&s(null)}),v.useMemo(()=>({openMethod:n,triggerProps:r}),[n,r])}function x4({...e}){return l.jsx(kw,{"data-slot":"dialog",...e})}function b4({...e}){return l.jsx(Cw,{"data-slot":"dialog-portal",...e})}function v4({className:e,...n}){return l.jsx(hw,{"data-slot":"dialog-overlay",className:Pt("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),...n})}function y4({className:e,children:n,showCloseButton:s=!0,...r}){return l.jsxs(b4,{children:[l.jsx(v4,{}),l.jsxs(Sw,{"data-slot":"dialog-content",className:Pt("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:[n,s&&l.jsxs(xw,{"data-slot":"dialog-close",render:l.jsx(Wo,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[l.jsx(Cd,{}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function _4({className:e,...n}){return l.jsx("div",{"data-slot":"dialog-header",className:Pt("flex flex-col gap-2",e),...n})}function j4({className:e,...n}){return l.jsx(Rw,{"data-slot":"dialog-title",className:Pt("font-heading text-base leading-none font-medium",e),...n})}function S4({className:e,...n}){return l.jsx(bw,{"data-slot":"dialog-description",className:Pt("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...n})}const w4={primary:"default",secondary:"outline",ghost:"ghost",destructive:"destructive"},C4={sm:"sm",md:"default"};function he({variant:e="secondary",size:n="md",loading:s,className:r,children:i,disabled:c,type:d="button",...f}){return l.jsxs(Wo,{type:d,variant:w4[e],size:C4[n],disabled:c||s,className:r,...f,children:[s?l.jsx(Yi,{size:14}):null,i]})}function Ce(e){return l.jsx(z5,{...e})}function Qt(e){return l.jsx(D5,{...e})}function E4(e){return l.jsx("select",{...e,className:Ie("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 fe({label:e,hint:n,badge:s,children:r}){return l.jsxs("label",{className:"block space-y-1",children:[l.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[e,s&&l.jsx("span",{className:"rounded bg-muted px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground",children:s})]}),r,n&&l.jsx("span",{className:"block text-[11px] text-muted-foreground/70",children:n})]})}function sn({checked:e,onChange:n,label:s,disabled:r}){return l.jsxs("label",{className:Ie("inline-flex items-center gap-2",r&&"opacity-50"),children:[l.jsx(q5,{checked:e,onCheckedChange:n,disabled:r}),s&&l.jsx("span",{className:"text-sm",children:s})]})}function Ue({children:e,tone:n="muted",className:s}){const r=n==="danger"?"destructive":n==="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 l.jsx(B5,{variant:r,className:Ie("rounded-md",i[n],s),children:e})}function ma({open:e,onClose:n,title:s,description:r,children:i,footer:c,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 l.jsx(x4,{open:e,onOpenChange:g=>{g||n()},children:l.jsxs(y4,{className:Ie("flex max-h-[88vh] w-full flex-col gap-0 p-0",f[d]),children:[(s||r)&&l.jsxs(_4,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[s&&l.jsx(j4,{children:s}),r&&l.jsx(S4,{children:r})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-5 py-4",children:i}),c&&l.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t border-border px-5 py-4",children:c})]})})}function Yi({size:e=14}){return l.jsx(V5,{style:{width:e,height:e}})}function lt({children:e}){return l.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 Je({label:e="Cargando…"}){return l.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[l.jsx(Yi,{})," ",e]})}const Nw=v.createContext(null);let k4=1;function R4({children:e}){const[n,s]=v.useState([]),r=v.useCallback((c,d)=>{const f=k4++;s(g=>[...g,{id:f,kind:c,message:d}]),setTimeout(()=>{s(g=>g.filter(m=>m.id!==f))},4500)},[]),i=v.useMemo(()=>({show:r,success:c=>r("success",c),error:c=>r("error",c),info:c=>r("info",c)}),[r]);return v.useEffect(()=>(window.__apxToast=i,()=>{delete window.__apxToast}),[i]),l.jsxs(Nw.Provider,{value:i,children:[e,l.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:n.map(c=>l.jsx("div",{className:Ie("pointer-events-auto overflow-hidden rounded-lg border bg-card px-3 py-2 text-sm shadow-lg",c.kind==="success"&&"border-emerald-500/40",c.kind==="error"&&"border-destructive/60",c.kind==="info"&&"border-border"),children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("span",{className:Ie("mt-1 size-2 shrink-0 rounded-full",c.kind==="success"&&"bg-emerald-500",c.kind==="error"&&"bg-destructive",c.kind==="info"&&"bg-sky-500")}),l.jsx("span",{className:"flex-1 break-words",children:c.message})]})},c.id))})]})}function rt(){const e=v.useContext(Nw);if(!e)throw new Error("useToast must be used inside <ToastProvider>");return e}function Tw(){const{data:e,error:n,isLoading:s}=Qe("/health",()=>J3.get(),{refreshInterval:Ed.health});return{health:e,error:n,isLoading:s,isUp:!n&&!!e}}function N4(){const{data:e,error:n,isLoading:s,mutate:r}=Qe("/engines",()=>pd.list());return{engines:e?.engines||[],error:n,isLoading:s,mutate:r}}function T4(){const{data:e,error:n,isLoading:s,mutate:r}=Qe("/telegram/status",()=>kn.status(),{refreshInterval:Ed.telegramStatus});return{status:e,error:n,isLoading:s,mutate:r}}function ux(){const{data:e,error:n,isLoading:s,mutate:r}=Qe("/telegram/channels",()=>kn.channels.list());return{channels:e?.channels||[],error:n,isLoading:s,mutate:r}}function dx(){const{data:e,error:n,isLoading:s,mutate:r}=Qe("/telegram/contacts",()=>kn.contacts.list());return{contacts:e?.contacts||[],roles:e?.roles||{},channelOwners:e?.channel_owners||[],error:n,isLoading:s,mutate:r}}function za(e){return typeof e=="string"&&e.startsWith("*** set ***")}function fr(e,n="(no seteada)"){return za(e)?e:n}function el(e){if(typeof e!="string")return null;const n=e.match(/\(\.\.\.([^)]+)\)/);return n?n[1]:null}function Aw({channel:e,onClose:n,onSaved:s}){const r=rt(),[i,c]=v.useState(!1),[d,f]=v.useState({name:""});v.useEffect(()=>{f(e?{...e,bot_token:""}:{name:""})},[e?.name]);const g=async()=>{if(!d.name?.trim()){r.error("name requerido");return}c(!0);try{e&&e.name!==""&&e?.name===d.name?await kn.channels.patch(e.name,d):await kn.channels.upsert(d),r.success("Canal guardado."),s()}catch(m){r.error(m.message)}finally{c(!1)}};return l.jsx(ma,{open:!!e,onClose:n,title:e?.name?`Editar canal: ${e.name}`:"Nuevo canal de Telegram",description:"POST /telegram/channels (upsert) — PATCH /telegram/channels/:name (parcial).",footer:l.jsxs(l.Fragment,{children:[l.jsx(he,{variant:"ghost",onClick:n,disabled:i,children:C("common.cancel")}),l.jsx(he,{variant:"primary",onClick:g,loading:i,children:C("common.save")})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(fe,{label:"name (slug interno)",children:l.jsx(Ce,{value:d.name,onChange:m=>f({...d,name:m.target.value}),disabled:!!e?.name})}),l.jsx(fe,{label:"bot_token",hint:e?.bot_token?fr(e.bot_token):"Token del BotFather. Se guarda en ~/.apx/config.json.",children:l.jsx(Ce,{type:"password",value:d.bot_token||"",onChange:m=>f({...d,bot_token:m.target.value}),placeholder:e?.bot_token?fr(e.bot_token):""})}),l.jsx(fe,{label:"chat_id",children:l.jsx(Ce,{value:d.chat_id||"",onChange:m=>f({...d,chat_id:m.target.value})})}),l.jsx(fe,{label:"project",hint:"Slug o id del proyecto al que pinear este canal (opcional).",children:l.jsx(Ce,{value:d.project||"",onChange:m=>f({...d,project:m.target.value})})}),l.jsx(fe,{label:"route_to_agent",hint:"Agente que contesta; vacío = super-agent APX.",children:l.jsx(Ce,{value:d.route_to_agent||"",onChange:m=>f({...d,route_to_agent:m.target.value})})}),l.jsx(fe,{label:"owner_user_id",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.",children:l.jsx(Ce,{value:d.owner_user_id!=null?String(d.owner_user_id):"",onChange:m=>{const h=m.target.value.trim();f({...d,owner_user_id:h===""?void 0:/^\d+$/.test(h)?Number(h):h})},placeholder:"889721252"})}),l.jsx(sn,{checked:!!d.respond_with_engine,onChange:m=>f({...d,respond_with_engine:m}),label:"Responder con engine (no echo)"})]})})}function Mw({channel:e,onClose:n}){const s=rt(),[r,i]=v.useState(C("admin.telegram_default_message")),[c,d]=v.useState(!1),f=async()=>{if(!(!r.trim()||!e)){d(!0);try{await kn.send({text:r,channel:e.name}),s.success("Mensaje enviado."),n()}catch(g){s.error(g.message)}finally{d(!1)}}};return l.jsx(ma,{open:!!e,onClose:n,title:e?`${C("admin.telegram_send_test_title")} ${e.name}`:"",description:e?`chat_id: ${e.chat_id||"—"}`:"",footer:l.jsxs(l.Fragment,{children:[l.jsx(he,{variant:"ghost",onClick:n,disabled:c,children:C("common.cancel")}),l.jsx(he,{variant:"primary",onClick:f,loading:c,children:"Enviar"})]}),children:l.jsx(fe,{label:"Texto",children:l.jsx(Qt,{rows:4,value:r,onChange:g=>i(g.target.value)})})})}function Ow({bare:e=!1}){const n=rt(),{contacts:s,roles:r,channelOwners:i,isLoading:c,mutate:d}=dx(),f=new Set(i.filter(y=>y.owner_user_id!=null).map(y=>String(y.owner_user_id))),g=Array.from(new Set(["owner","guest",...Object.keys(r)])),m=async(y,w)=>{try{await kn.contacts.patch(y.user_id,{role:w}),n.success(`${y.name||y.user_id} → ${w}`),d()}catch(S){n.error(S.message)}},h=async y=>{if(confirm(C("telegram_contacts.delete_confirm",{name:y.name||String(y.user_id)})))try{await kn.contacts.remove(y.user_id),n.success(C("telegram_contacts.removed")),d()}catch(w){n.error(w.message)}},x=l.jsxs(l.Fragment,{children:[c&&l.jsx(Je,{}),!c&&s.length===0&&l.jsx(lt,{children:C("telegram_contacts.empty")}),s.length>0&&l.jsx("ul",{className:"space-y-2 text-sm",children:s.map(y=>{const w=f.has(String(y.user_id)),S=w?"owner":y.role||"guest";return l.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("span",{className:"font-medium",children:y.name||"—"}),y.username&&l.jsxs("span",{className:"ml-2 text-xs text-muted-fg",children:["@",y.username]}),w&&l.jsx(Ue,{tone:"success",children:C("telegram_contacts.owner_badge")})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(E4,{value:S,disabled:w,onChange:_=>m(y,_.target.value),title:C(w?"telegram_contacts.owner_hint":"telegram_contacts.assign_role"),children:g.map(_=>l.jsx("option",{value:_,children:_},_))}),l.jsx(he,{size:"sm",variant:"destructive",onClick:()=>h(y),children:C("common.delete")})]})]}),l.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[l.jsxs("span",{children:["user_id: ",String(y.user_id)]}),l.jsxs("span",{children:[C("telegram_contacts.last_seen")," ",y.last_seen?y.last_seen.slice(0,10):"—"]}),l.jsx("span",{children:A4(r[S])})]})]},String(y.user_id))})})]});return e?x:l.jsx(He,{title:C("telegram_contacts.title"),description:C("telegram_contacts.desc"),children:x})}function A4(e){return!e||e.tools===void 0?"":e.tools==="*"?C("telegram_contacts.tools_all"):Array.isArray(e.tools)?e.tools.length?`${C("telegram_contacts.tools_label")} ${e.tools.join(", ")}`:C("telegram_contacts.tools_none"):""}function M4(){const e=Ua(),n=rt(),{health:s,isUp:r}=Tw(),{projects:i,isLoading:c,mutate:d}=sc(),{engines:f,isLoading:g}=N4(),{status:m,mutate:h}=T4(),{channels:x,isLoading:y,mutate:w}=ux(),[S,_]=v.useState(null),[j,E]=v.useState(null),k=async()=>{try{await Zo.reload(),n.success(C("admin.reload_success"))}catch(M){n.error(M.message)}},N=async()=>{try{m?.enabled?(await kn.stop(),n.info(C("admin.telegram_polling_stopped"))):(await kn.start(),n.success(C("admin.telegram_polling_started"))),h()}catch(M){n.error(M.message)}},R=async M=>{if(confirm(C("telegram_channels.delete_confirm",{name:M})))try{await kn.channels.remove(M),n.success(C("admin.telegram_channel_removed")),w()}catch(O){n.error(O.message)}},A=async(M,O)=>{if(confirm(C("admin.unregister_confirm",{label:O})))try{await Qn.remove(M),n.success(C("project.unregistered")),d()}catch(U){n.error(U.message)}};return l.jsxs("div",{className:"mx-auto max-w-5xl space-y-6 p-6","data-testid":"screen-admin",children:[l.jsxs("header",{className:"flex items-end justify-between",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:C("admin.title")}),l.jsx("p",{className:"text-sm text-muted-fg",children:C("admin.subtitle")})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(he,{size:"sm",onClick:k,title:C("daemon.reload_hint"),children:[C("common.reload")," config"]}),l.jsxs(he,{size:"sm",variant:"primary",onClick:()=>e("/?action=add-project"),children:[l.jsx(Rn,{size:14})," ",C("nav.project")]})]})]}),l.jsx(He,{title:C("daemon.version"),children:l.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[l.jsx(qp,{label:C("daemon.version"),value:s?.version||"—"}),l.jsx(qp,{label:C("daemon.uptime"),value:s?`${s.uptime_s}s`:"—"}),l.jsx(qp,{label:C("daemon.status"),value:C(r?"daemon.running":"daemon.down"),ok:r})]})}),l.jsxs(He,{title:C("admin.engines_title"),description:C("admin.engines_subtitle"),children:[g&&l.jsx(Je,{}),l.jsx("div",{className:"flex flex-wrap gap-1.5",children:f.map(M=>l.jsx(Ue,{tone:"info",children:M},M))})]}),l.jsxs(He,{title:C("admin.telegram_title"),description:C("admin.telegram_subtitle"),action:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(sn,{checked:!!m?.enabled,onChange:N,label:m?.enabled?C("admin.telegram_polling_on"):C("admin.telegram_polling_off")}),l.jsxs(he,{size:"sm",onClick:()=>_({name:""}),children:[l.jsx(Rn,{size:14})," ",C("admin.telegram_add_channel")]})]}),children:[y&&l.jsx(Je,{}),x.length===0&&l.jsx(lt,{children:C("common.none_yet")}),l.jsx("ul",{className:"space-y-2 text-sm",children:x.map(M=>l.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:"font-medium",children:M.name}),l.jsxs("div",{className:"flex items-center gap-2",children:[M.project&&l.jsxs(Ue,{tone:"success",children:["project = ",M.project]}),l.jsxs(he,{size:"sm",variant:"ghost",onClick:()=>E(M),children:[l.jsx(Za,{size:13})," ",C("admin.telegram_send_test")]}),l.jsx(he,{size:"sm",variant:"secondary",onClick:()=>_(M),children:C("common.edit")}),l.jsx(he,{size:"sm",variant:"destructive",onClick:()=>R(M.name),children:C("common.delete")})]})]}),l.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[l.jsxs("span",{children:["chat_id: ",M.chat_id||"—"]}),l.jsxs("span",{children:["route_to_agent: ",M.route_to_agent||"default APX"]}),l.jsxs("span",{children:["engine: ",M.respond_with_engine?C("admin.engine_badge"):C("admin.engine_badge_no")]})]})]},M.name))})]}),l.jsx(Ow,{}),l.jsxs(He,{title:C("admin.projects_title"),description:C("admin.projects_subtitle"),children:[c&&l.jsx(Je,{}),l.jsx("ul",{className:"divide-y divide-border",children:i.map(M=>l.jsxs("li",{className:"flex items-center gap-3 py-2",children:[l.jsxs("span",{className:"w-10 font-mono text-xs text-muted-fg",children:["#",M.id]}),l.jsxs("button",{type:"button",className:"flex-1 text-left hover:underline",onClick:()=>e(`/p/${M.id}`),children:[l.jsx("span",{className:"font-medium",children:M.name||M.path.split("/").pop()}),l.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:M.path})]}),l.jsxs(Ue,{children:[M.agents??0," ",C("admin.agents_badge")]}),Number(M.id)!==0&&l.jsx(he,{size:"sm",variant:"destructive",onClick:()=>A(String(M.id),M.name||M.path),children:C("admin.unregister")})]},M.id))})]}),l.jsx(Aw,{channel:S,onClose:()=>_(null),onSaved:()=>{_(null),w()}}),l.jsx(Mw,{channel:j,onClose:()=>E(null)})]})}function qp({label:e,value:n,ok:s}){return l.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[l.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),l.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[s!==void 0&&l.jsx(Vd,{ok:s}),l.jsx("span",{children:n})]})]})}function zw(e){const[n,s]=v.useState(!1);return v.useEffect(()=>{try{s(localStorage.getItem(e)==="true")}catch{}},[e]),{collapsed:n,toggle:()=>s(i=>{const c=!i;try{localStorage.setItem(e,String(c))}catch{}return c})}}function O4({collapsed:e,onToggle:n}){return l.jsx(Ko,{content:e?"Expandir menú":"Colapsar menú",side:"bottom",children:l.jsx("button",{type:"button",onClick:n,"aria-label":e?"Expandir menú":"Colapsar menú",className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:l.jsx(eN,{className:Ie("size-4 transition-transform",e&&"rotate-180")})})})}function z4({sections:e,active:n,onChange:s,collapsed:r=!1}){return l.jsx("nav",{className:Ie("hidden md:flex shrink-0 flex-col gap-1 py-3 transition-all",r?"w-12 items-center px-1":"w-52 px-2"),children:e.map((i,c)=>l.jsxs("div",{className:Ie("w-full",c>0&&"mt-2"),children:[!r&&i.title&&l.jsx("p",{className:"mb-1 px-2 text-[9px] font-semibold uppercase tracking-wider text-muted-fg/70",children:i.title}),l.jsx("div",{className:"space-y-0.5",children:i.items.map(({key:d,label:f,icon:g,badge:m})=>{const h=n===d,x=l.jsxs("button",{type:"button",onClick:()=>s(d),"data-testid":`tabnav-${d||"index"}`,className:Ie("flex cursor-pointer items-center rounded-lg transition-colors",r?"size-9 justify-center":"w-full gap-2 px-2.5 py-1.5",h?"bg-accent text-accent-fg":"text-muted-fg hover:bg-accent/60 hover:text-foreground"),children:[l.jsx(g,{className:"size-4 shrink-0"}),!r&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"flex-1 truncate text-left text-xs",children:f}),m!==void 0&&l.jsx("span",{className:"rounded-full bg-muted px-1.5 text-[9px] text-muted-fg",children:m})]})]});return r?l.jsx(Ko,{content:f,side:"right",children:x},d):l.jsx(v.Fragment,{children:x},d)})})]},c))})}function Dw({sections:e,active:n,onChange:s,collapsed:r,onToggleCollapse:i,actions:c,contentClassName:d,testId:f,children:g}){return l.jsxs("div",{className:"flex h-full",children:[l.jsx(z4,{sections:e,active:n,onChange:s,collapsed:r}),l.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-y-auto",children:[l.jsxs("div",{className:"flex items-center justify-between px-6 pt-3",children:[l.jsx(O4,{collapsed:r,onToggle:i}),c?l.jsx("div",{className:"flex gap-2",children:c}):null]}),l.jsx("div",{className:Ie(d),"data-testid":f,children:g})]})]})}function I1({pid:e}){const n=Qe(`/projects/${e}/tasks?state=open`,()=>lr.list(e)),s=Qe(`/projects/${e}/routines`,()=>or.list(e)),r=Qe(`/projects/${e}/agents`,()=>Jt.list(e)),i=Qe(`/projects/${e}/mcps`,()=>Ti.list(e));return l.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-3",children:[l.jsx(fi,{title:C("project.overview.tasks_open"),value:n.data?.length??"…",href:`/p/${e}/tasks`,icon:Bi}),l.jsx(fi,{title:C("project.overview.routines"),value:s.data?.length??"…",href:`/p/${e}/routines`,icon:Go}),l.jsx(fi,{title:C("project.overview.agents"),value:r.data?.length??"…",href:`/p/${e}/agents`,icon:vn}),l.jsx(fi,{title:C("project.overview.mcps"),value:i.data?.length??"…",href:`/p/${e}/mcps`,icon:Cg}),l.jsx(fi,{title:C("project.overview.chat"),value:C("project.overview.chat_value"),href:`/p/${e}/chat`,icon:ki})]})}function fi({title:e,value:n,href:s,icon:r}){return l.jsxs(nj,{to:s,className:"flex items-center gap-3 rounded-xl border border-border bg-card p-4 hover:bg-accent/40",children:[l.jsx("span",{className:"grid size-10 place-items-center rounded-lg bg-muted text-muted-fg",children:l.jsx(r,{size:20})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),l.jsx("div",{className:"text-2xl font-semibold",children:n})]})]})}function D4(){const e=Ua(),{projects:n,isLoading:s}=sc();return l.jsxs(He,{title:C("base.workspaces_title"),description:C("base.workspaces_desc"),action:l.jsxs(he,{size:"sm",variant:"primary",onClick:()=>e("/p/0/workspaces?action=add-project"),children:[l.jsx(Rn,{size:14})," ",C("base.workspaces_new")]}),children:[s&&l.jsx(Je,{}),!s&&n.length===0&&l.jsx(lt,{children:C("base.workspaces_empty")}),l.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:n.map(r=>{const i=String(r.id)==="0",c=i?C("base.title"):r.name||r.path.split("/").pop()||String(r.id);return l.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:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(mj,{className:"size-4 text-muted-fg"}),l.jsx("span",{className:"truncate text-sm font-semibold",children:c}),l.jsx(Ue,{tone:i?"success":"info",children:i?C("base.title"):iw(r.kind)})]}),l.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:r.path})]},r.id)})})]})}const Lw=v.createContext(null),Pw=v.createContext(null);function Wa(){const e=v.useContext(Lw);if(e===null)throw new Error(Nn(60));return e}function Bw(){const e=v.useContext(Pw);if(e===null)throw new Error(Nn(61));return e}const L4=(e,n)=>Object.is(e,n);function tl(e,n,s){return e==null||n==null?Object.is(e,n):s(e,n)}function P4(e,n,s){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:tl(n,r,s))}function Oi(e,n,s){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:tl(r,n,s))}function B4(e,n,s){return e.filter(r=>!tl(n,r,s))}function Kg(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Iw(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function I4(e){if(!Array.isArray(e))return e!=null&&"null"in e;const n=e;if(Iw(n)){for(const s of n)for(const r of s.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const s of n)if(s&&s.value==null&&s.label!=null)return!0;return!1}function Uw(e,n){if(n&&e!=null)return n(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 Kg(e)}function Uo(e,n){return n&&e!=null?n(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Kg(e.value):Kg(e)}function Hw(e,n,s){function r(){return Uw(e,s)}if(s&&e!=null)return s(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(n&&!Array.isArray(n))return n[e]??r();if(Array.isArray(n)){const i=n,c=Iw(i)?i.flatMap(d=>d.items):i;if(e==null||typeof e!="object"){const d=c.find(f=>f.value===e);return d&&d.label!=null?d.label:r()}if("value"in e){const d=c.find(f=>f&&f.value===e.value);if(d&&d.label!=null)return d.label}}return r()}function U4(e,n,s){return e.reduce((r,i,c)=>(c>0&&r.push(", "),r.push(l.jsx(v.Fragment,{children:Hw(i,n,s)},c)),r),[])}const Fe={id:Te(e=>e.id),labelId:Te(e=>e.labelId),modal:Te(e=>e.modal),multiple:Te(e=>e.multiple),items:Te(e=>e.items),itemToStringLabel:Te(e=>e.itemToStringLabel),itemToStringValue:Te(e=>e.itemToStringValue),isItemEqualToValue:Te(e=>e.isItemEqualToValue),value:Te(e=>e.value),hasSelectedValue:Te(e=>{const{value:n,multiple:s,itemToStringValue:r}=e;return n==null?!1:s&&Array.isArray(n)?n.length>0:Uo(n,r)!==""}),hasNullItemLabel:Te((e,n)=>n?I4(e.items):!1),open:Te(e=>e.open),mounted:Te(e=>e.mounted),forceMount:Te(e=>e.forceMount),transitionStatus:Te(e=>e.transitionStatus),openMethod:Te(e=>e.openMethod),activeIndex:Te(e=>e.activeIndex),selectedIndex:Te(e=>e.selectedIndex),isActive:Te((e,n)=>e.activeIndex===n),isSelected:Te((e,n,s)=>{const r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(c=>tl(s,c,r)):e.selectedIndex===n&&e.selectedIndex!==null?!0:tl(s,i,r)}),isSelectedByFocus:Te((e,n)=>e.selectedIndex===n),popupProps:Te(e=>e.popupProps),triggerProps:Te(e=>e.triggerProps),triggerElement:Te(e=>e.triggerElement),positionerElement:Te(e=>e.positionerElement),listElement:Te(e=>e.listElement),popupSide:Te(e=>e.popupSide),scrollUpArrowVisible:Te(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Te(e=>e.scrollDownArrowVisible),hasScrollArrows:Te(e=>e.hasScrollArrows)};function Si(e,n=Number.MIN_SAFE_INTEGER,s=Number.MAX_SAFE_INTEGER){return Math.max(n,Math.min(e,s))}const Oa=1;function fx(e,n){return Math.max(0,e-n)}function xd(e,n){if(n<=0)return 0;const s=Si(e,0,n),r=s,i=n-s,c=r<=Oa,d=i<=Oa;return c&&d?r<=i?0:n:c?0:d?n:s}function H4(e){const{id:n,value:s,defaultValue:r=null,onValueChange:i,open:c,defaultOpen:d=!1,onOpenChange:f,name:g,form:m,autoComplete:h,disabled:x=!1,readOnly:y=!1,required:w=!1,modal:S=!0,actionsRef:_,inputRef:j,onOpenChangeComplete:E,items:k,multiple:N=!1,itemToStringLabel:R,itemToStringValue:A,isItemEqualToValue:M=L4,highlightItemOnHover:O=!0,children:U}=e,{clearErrors:I}=dw(),{setDirty:B,setTouched:L,setFocused:D,shouldValidateOnChange:q,validityData:F,setFilled:Z,name:H,disabled:G,validation:Q,validationMode:V}=rc(),Y=Gd({id:n}),P=G||x,K=H??g,[$,W]=Gi({controlled:s,default:N?r??Ui:r,name:"Select",state:"value"}),[ce,ie]=Gi({controlled:c,default:d,name:"Select",state:"open"}),oe=v.useRef([]),ue=v.useRef([]),te=v.useRef(null),Ne=v.useRef(null),$e=v.useRef(0),be=v.useRef(null),Se=v.useRef([]),Ee=v.useRef(!1),Oe=v.useRef(!1),ze=v.useRef(null),xe=v.useRef(null),ke=v.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),_e=v.useRef(!1),{mounted:De,setMounted:Ge,transitionStatus:qe}=tc(ce),{openMethod:Me,triggerProps:ve}=h4(ce),re=fa(()=>new RS({id:Y,labelId:void 0,modal:S,multiple:N,itemToStringLabel:R,itemToStringValue:A,isItemEqualToValue:M,value:$,open:ce,mounted:De,transitionStatus:qe,items:k,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,ye=Ke(re,Fe.activeIndex),je=Ke(re,Fe.selectedIndex),Pe=Ke(re,Fe.triggerElement),Ze=Ke(re,Fe.positionerElement),_t=p3(Me),Ht=Me??_t,vt=v.useMemo(()=>N&&Array.isArray($)&&$.length===0?"":Uo($,A),[N,$,A]),ut=v.useMemo(()=>N&&Array.isArray($)?$.map(nt=>Uo(nt,A)):Uo($,A),[N,$,A]),it=cn(re.state.triggerElement),Et=Ae(()=>ut);ox(it,Y,$,Et);const Bt=v.useRef($),pa=N?Array.isArray($)&&$.length>0:$!=null;Re(()=>{$!==Bt.current&&re.set("forceMount",!0)},[re,$]),Re(()=>{Z(pa)},[pa,Z]),Re(function(){const At=Se.current;let yn;if(N){const en=Array.isArray($)?$:[];if(en.length===0)yn=null;else{const kt=en[en.length-1],un=Oi(At,kt,M);yn=un===-1?null:un}}else{const en=Oi(At,$,M);yn=en===-1?null:en}yn===null&&(xe.current=null),!ce&&re.set("selectedIndex",yn)},[pa,N,ce,$,Se,M,re,xe]),lx($,()=>{I(K),B($!==F.initialValue),q()?Q.commit($):Q.commit($,!0)});const gn=Ae((nt,At)=>{if(f?.(nt,At),!At.isCanceled&&(ie(nt),!nt&&(At.reason===Md||At.reason===Rh)&&(L(!0),D(!1),V==="onBlur"&&Q.commit($)),!nt&&re.state.activeIndex!==null)){const yn=oe.current[re.state.activeIndex];queueMicrotask(()=>{yn?.setAttribute("tabindex","-1")})}}),dt=Ae(()=>{Ge(!1),re.update({activeIndex:null,openMethod:null}),E?.(!1)});xr({enabled:!_,open:ce,ref:te,onComplete(){ce||dt()}}),v.useImperativeHandle(_,()=>({unmount:dt}),[dt]);const Tt=Ae((nt,At)=>{i?.(nt,At),!At.isCanceled&&W(nt)}),Xt=Ae(()=>{const nt=re.state.listElement||te.current;if(!nt)return;const At=fx(nt.scrollHeight,nt.clientHeight),yn=xd(nt.scrollTop,At),en=yn>0,kt=yn<At;re.state.scrollUpArrowVisible!==en&&re.set("scrollUpArrowVisible",en),re.state.scrollDownArrowVisible!==kt&&re.set("scrollDownArrowVisible",kt)}),yt=BS({open:ce,onOpenChange:gn,elements:{reference:Pe,floating:Ze}}),Wt=hA(yt,{enabled:!y&&!P,event:"mousedown"}),Vt=Uh(yt),rn=DM(yt,{enabled:!y&&!P,listRef:oe,activeIndex:ye,selectedIndex:je,disabledIndices:Ui,onNavigate(nt){nt===null&&!ce||re.set("activeIndex",nt)},focusItemOnHover:O}),Tn=LM(yt,{enabled:!y&&!P&&(ce||!N),listRef:ue,activeIndex:ye,selectedIndex:je,onMatch(nt){ce?re.set("activeIndex",nt):Tt(Se.current[nt],tt("none"))},onTyping(nt){Ee.current=nt}}),qn=v.useMemo(()=>{const nt=ka(Tn.reference,rn.reference,Vt.reference,Wt.reference,ve);return Y&&(nt.id=Y),nt},[Wt.reference,Tn.reference,rn.reference,Vt.reference,ve,Y]),ta=v.useMemo(()=>ka(Id,Tn.floating,rn.floating,Vt.floating),[Tn.floating,rn.floating,Vt.floating]),Vn=rn.item??an;_h(()=>{re.update({popupProps:ta,triggerProps:qn})}),Re(()=>{re.update({id:Y,modal:S,multiple:N,value:$,open:ce,mounted:De,transitionStatus:qe,popupProps:ta,triggerProps:qn,items:k,itemToStringLabel:R,itemToStringValue:A,isItemEqualToValue:M,openMethod:Ht})},[re,Y,S,N,$,ce,De,qe,ta,qn,k,R,A,M,Ht]);const es=v.useMemo(()=>({store:re,name:K,required:w,disabled:P,readOnly:y,multiple:N,highlightItemOnHover:O,setValue:Tt,setOpen:gn,listRef:oe,popupRef:te,scrollHandlerRef:Ne,handleScrollArrowVisibility:Xt,scrollArrowsMountedCountRef:$e,itemProps:Vn,events:yt.context.events,valueRef:be,valuesRef:Se,labelsRef:ue,typingRef:Ee,selectionRef:ke,firstItemTextRef:ze,selectedItemTextRef:xe,validation:Q,onOpenChangeComplete:E,keyboardActiveRef:Oe,alignItemWithTriggerActiveRef:_e,initialValueRef:Bt}),[re,K,w,P,y,N,O,Tt,gn,Vn,yt.context.events,Q,E,Xt]),An=Ts(j,Q.inputRef),na=N&&Array.isArray($)&&$.length>0,Na=N?void 0:K,ts=v.useMemo(()=>!N||!Array.isArray($)||!K?null:$.map(nt=>{const At=Uo(nt,A);return l.jsx("input",{type:"hidden",form:m,name:K,value:At},At)}),[N,$,m,K,A]);return l.jsx(Lw.Provider,{value:es,children:l.jsxs(Pw.Provider,{value:yt,children:[U,l.jsx("input",{...Q.getInputValidationProps({onFocus(){re.state.triggerElement?.focus({focusVisible:!0})},onChange(nt){if(nt.nativeEvent.defaultPrevented||P||y){nt.preventBaseUIHandler?.();return}const At=nt.currentTarget.value,yn=tt(Ns,nt.nativeEvent);function en(){if(N)return;const kt=Se.current.find(un=>Uo(un,A).toLowerCase()===At.toLowerCase()||Uw(un,R).toLowerCase()===At.toLowerCase());kt!=null&&(B(kt!==F.initialValue),Tt(kt,yn),q()&&Q.commit(kt))}re.set("forceMount",!0),queueMicrotask(en)}}),id:Y&&Na==null?`${Y}-hidden-input`:void 0,form:m,name:Na,autoComplete:h,value:vt,disabled:P,required:w&&!na,readOnly:y,ref:An,style:K?Gj:Ah,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ts]})})}function q4(e,n){return e??n}function V4(e){const n=e.getBoundingClientRect(),s=Ft(e),r=s.getComputedStyle(e,"::before"),i=s.getComputedStyle(e,"::after");if(!(r.content!=="none"||i.content!=="none"))return n;const d=parseFloat(r.width)||0,f=parseFloat(r.height)||0,g=parseFloat(i.width)||0,m=parseFloat(i.height)||0,h=Math.max(n.width,d,g),x=Math.max(n.height,f,m),y=h-n.width,w=x-n.height;return{left:n.left-y/2,right:n.right+y/2,top:n.top-w/2,bottom:n.bottom+w/2}}const Au=2,$4=400,G4={...KM,...rx,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},Y4=v.forwardRef(function(n,s){const{render:r,className:i,id:c,disabled:d=!1,nativeButton:f=!0,style:g,...m}=n,{setTouched:h,setFocused:x,validationMode:y,state:w,disabled:S}=rc(),{labelId:_}=$d(),{store:j,setOpen:E,selectionRef:k,validation:N,readOnly:R,required:A,alignItemWithTriggerActiveRef:M,disabled:O,keyboardActiveRef:U}=Wa(),I=S||O||d,B=Ke(j,Fe.open),L=Ke(j,Fe.mounted),D=Ke(j,Fe.value),q=Ke(j,Fe.triggerProps),F=Ke(j,Fe.positionerElement),Z=Ke(j,Fe.listElement),H=Ke(j,Fe.popupSide),G=Ke(j,Fe.id),Q=Ke(j,Fe.labelId),V=Ke(j,Fe.hasSelectedValue),Y=L&&F?H:null,P=c??G,K=q4(_,Q);Gd({id:P});const $=cn(F),W=v.useRef(null),{getButtonProps:ce,buttonRef:ie}=ml({disabled:I,native:f}),oe=Ae(Ee=>{j.set("triggerElement",Ee)}),ue=Ts(s,W,ie,oe),te=Zn(),Ne=Zn(),$e=Zn();v.useEffect(()=>{if(B)return $e.start($4,()=>{k.current.allowUnselectedMouseUp=!0,k.current.allowSelectedMouseUp=!0}),()=>{$e.clear()};k.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},Ne.clear()},[B,k,Ne,$e]);const be=ka(q,{id:P,role:"combobox","aria-expanded":B?"true":"false","aria-haspopup":"listbox","aria-controls":B?Z?.id??nd(F)?.id:void 0,"aria-labelledby":K,"aria-readonly":R||void 0,"aria-required":A||void 0,tabIndex:I?-1:0,ref:ue,onFocus(Ee){x(!0),B&&M.current&&E(!1,tt(Ns,Ee.nativeEvent)),te.start(0,()=>{j.set("forceMount",!0)})},onBlur(Ee){Ye(F,Ee.relatedTarget)||(h(!0),x(!1),y==="onBlur"&&N.commit(D))},onPointerMove(){U.current=!1},onKeyDown(){U.current=!0},onMouseDown(Ee){if(B)return;const Oe=xt(Ee.currentTarget);function ze(xe){if(!W.current)return;const ke=xe.target;if(Ye(W.current,ke)||Ye($.current,ke)||ke===W.current)return;const _e=V4(W.current);xe.clientX>=_e.left-Au&&xe.clientX<=_e.right+Au&&xe.clientY>=_e.top-Au&&xe.clientY<=_e.bottom+Au||E(!1,tt(pT,xe))}Ne.start(0,()=>{Oe.addEventListener("mouseup",ze,{once:!0})})}},N.getValidationProps,m,ce);be.role="combobox";const Se={...w,open:B,disabled:I,value:D,readOnly:R,popupSide:Y,placeholder:!V};return Lt("button",n,{ref:[s,W],state:Se,stateAttributesMapping:G4,props:be})}),F4={value:()=>null},X4=v.forwardRef(function(n,s){const{className:r,render:i,children:c,placeholder:d,style:f,...g}=n,{store:m,valueRef:h}=Wa(),x=Ke(m,Fe.value),y=Ke(m,Fe.items),w=Ke(m,Fe.itemToStringLabel),S=Ke(m,Fe.hasSelectedValue),_=!S&&d!=null&&c==null,j=Ke(m,Fe.hasNullItemLabel,_),E={value:x,placeholder:!S};let k=null;return typeof c=="function"?k=c(x):c!=null?k=c:!S&&d!=null&&!j?k=d:Array.isArray(x)?k=U4(x,y,w):k=Hw(x,y,w),Lt("span",n,{state:E,ref:[s,h],props:[{children:k},g],stateAttributesMapping:F4})}),K4=v.forwardRef(function(n,s){const{render:r,className:i,style:c,...d}=n,{store:f}=Wa(),m={open:Ke(f,Fe.open)};return Lt("span",n,{state:m,ref:s,props:[{"aria-hidden":!0,children:"▼"},d],stateAttributesMapping:US})}),Q4=v.createContext(void 0),Z4=v.forwardRef(function(n,s){const{store:r}=Wa(),i=Ke(r,Fe.mounted),c=Ke(r,Fe.forceMount);return i||c?l.jsx(Q4.Provider,{value:!0,children:l.jsx(hS,{ref:s,...n})}):null}),qw=v.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function J4(){return v.useContext(qw)}function mx(e){const{children:n,elementsRef:s,labelsRef:r,onMapChange:i}=e,c=Ae(i),d=v.useRef(0),f=fa(eO).current,g=fa(W4).current,[m,h]=v.useState(0),x=v.useRef(m),y=Ae((E,k)=>{g.set(E,k??null),x.current+=1,h(x.current)}),w=Ae(E=>{g.delete(E),x.current+=1,h(x.current)}),S=v.useMemo(()=>{const E=new Map;return Array.from(g.keys()).filter(N=>N.isConnected).sort(tO).forEach((N,R)=>{const A=g.get(N)??{};E.set(N,{...A,index:R})}),E},[g,m]);Re(()=>{if(typeof MutationObserver!="function"||S.size===0)return;const E=new MutationObserver(k=>{const N=new Set,R=A=>N.has(A)?N.delete(A):N.add(A);k.forEach(A=>{A.removedNodes.forEach(R),A.addedNodes.forEach(R)}),N.size===0&&(x.current+=1,h(x.current))});return S.forEach((k,N)=>{N.parentElement&&E.observe(N.parentElement,{childList:!0})}),()=>{E.disconnect()}},[S]),Re(()=>{x.current===m&&(s.current.length!==S.size&&(s.current.length=S.size),r&&r.current.length!==S.size&&(r.current.length=S.size),d.current=S.size),c(S)},[c,S,s,r,m]),Re(()=>()=>{s.current=[]},[s]),Re(()=>()=>{r&&(r.current=[])},[r]);const _=Ae(E=>(f.add(E),()=>{f.delete(E)}));Re(()=>{f.forEach(E=>E(S))},[f,S]);const j=v.useMemo(()=>({register:y,unregister:w,subscribeMapChange:_,elementsRef:s,labelsRef:r,nextIndexRef:d}),[y,w,_,s,r,d]);return l.jsx(qw.Provider,{value:j,children:n})}function W4(){return new Map}function eO(){return new Set}function tO(e,n){const s=e.compareDocumentPosition(n);return s&Node.DOCUMENT_POSITION_FOLLOWING||s&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:s&Node.DOCUMENT_POSITION_PRECEDING||s&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Vw=v.createContext(void 0);function px(){const e=v.useContext(Vw);if(!e)throw new Error(Nn(59));return e}function bd(e,n){e&&Object.assign(e.style,n)}const $w={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},nO=20;function aO(e,n,s,r){const[i,c]=v.useState(!1);Re(()=>{if(!e||!n||s==null){c(!1);return}const d=xt(s).documentElement.clientWidth,f=s.offsetWidth;c(d>0&&f>0&&f>=d-nO)},[e,n,s]),Ew(e&&(!n||i),r)}const sO={position:"fixed"},rO=v.forwardRef(function(n,s){const{anchor:r,positionMethod:i="absolute",className:c,render:d,side:f="bottom",align:g="center",sideOffset:m=0,alignOffset:h=0,collisionBoundary:x="clipping-ancestors",collisionPadding:y,arrowPadding:w=5,sticky:S=!1,disableAnchorTracking:_,alignItemWithTrigger:j=!0,collisionAvoidance:E=oA,style:k,...N}=n,{store:R,listRef:A,labelsRef:M,alignItemWithTriggerActiveRef:O,selectedItemTextRef:U,valuesRef:I,initialValueRef:B,popupRef:L,setValue:D}=Wa(),q=Bw(),F=Ke(R,Fe.open),Z=Ke(R,Fe.mounted),H=Ke(R,Fe.modal),G=Ke(R,Fe.value),Q=Ke(R,Fe.openMethod),V=Ke(R,Fe.positionerElement),Y=Ke(R,Fe.triggerElement),P=Ke(R,Fe.isItemEqualToValue),K=Ke(R,Fe.transitionStatus),$=v.useRef(null),W=v.useRef(null),[ce,ie]=v.useState(j),oe=Z&&ce&&Q!=="touch";!Z&&ce!==j&&ie(j),Re(()=>{Z||(Fe.scrollUpArrowVisible(R.state)&&R.set("scrollUpArrowVisible",!1),Fe.scrollDownArrowVisible(R.state)&&R.set("scrollDownArrowVisible",!1))},[R,Z]),v.useImperativeHandle(O,()=>oe),aO((oe||H)&&F,Q==="touch",V,Y);const ue=FS({anchor:r,floatingRootContext:q,positionMethod:i,mounted:Z,side:f,sideOffset:m,align:g,alignOffset:h,arrowPadding:w,collisionBoundary:x,collisionPadding:y,sticky:S,disableAnchorTracking:_??oe,collisionAvoidance:E,keepMounted:!0}),te=oe?"none":ue.side,Ne=oe?sO:ue.positionerStyles,$e={open:F,side:te,align:ue.align,anchorHidden:ue.anchorHidden};Re(()=>{R.set("popupSide",ue.side)},[R,ue.side]);const be=Ae(xe=>{R.set("positionerElement",xe)}),Se=XS(n,$e,{styles:Ne,transitionStatus:K,props:N,refs:[s,be],hidden:!Z,inert:!F}),Ee=v.useRef(0),Oe=Ae(xe=>{if(xe.size===0&&Ee.current===0||I.current.length===0)return;const ke=Ee.current;if(Ee.current=xe.size,xe.size===ke)return;const _e=tt(Ns);if(ke!==0&&!R.state.multiple&&G!==null&&Oi(I.current,G,P)===-1){const Ge=B.current,Me=Ge!=null&&Oi(I.current,Ge,P)!==-1?Ge:null;D(Me,_e),Me===null&&(R.set("selectedIndex",null),U.current=null)}if(ke!==0&&R.state.multiple&&Array.isArray(G)){const De=qe=>Oi(I.current,qe,P)!==-1,Ge=G.filter(qe=>De(qe));(Ge.length!==G.length||Ge.some(qe=>!P4(G,qe,P)))&&(D(Ge,_e),Ge.length===0&&(R.set("selectedIndex",null),U.current=null))}if(F&&oe){R.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const De={height:""};bd(V,De),bd(L.current,De)}}),ze=v.useMemo(()=>({...ue,side:te,alignItemWithTriggerActive:oe,setControlledAlignItemWithTrigger:ie,scrollUpArrowRef:$,scrollDownArrowRef:W}),[ue,te,oe,ie]);return l.jsx(mx,{elementsRef:A,labelsRef:M,onMapChange:Oe,children:l.jsxs(Vw.Provider,{value:ze,children:[Z&&H&&l.jsx(ww,{inert:Kh(!F),cutout:Y}),Se]})})}),Mu="base-ui-disable-scrollbar",Qg={className:Mu,getElement(e){return l.jsx("style",{nonce:e,href:Mu,precedence:"base-ui:low",children:`.${Mu}{scrollbar-width:none}.${Mu}::-webkit-scrollbar{display:none}`})}},oO=v.createContext(void 0);function lO(e){return v.useContext(oO)}const iO=v.createContext(void 0),cO={disableStyleElements:!1};function uO(){return v.useContext(iO)??cO}const dO={...fl,...dl},fO=v.forwardRef(function(n,s){const{render:r,className:i,style:c,finalFocus:d,...f}=n,{store:g,popupRef:m,onOpenChangeComplete:h,setOpen:x,valueRef:y,firstItemTextRef:w,selectedItemTextRef:S,keyboardActiveRef:_,multiple:j,handleScrollArrowVisibility:E,scrollHandlerRef:k,listRef:N,highlightItemOnHover:R}=Wa(),{side:A,align:M,alignItemWithTriggerActive:O,isPositioned:U,setControlledAlignItemWithTrigger:I,scrollDownArrowRef:B,scrollUpArrowRef:L}=px(),D=lO()!=null,q=Bw(),F=Fh(),{nonce:Z,disableStyleElements:H}=uO(),G=Ke(g,Fe.id),Q=Ke(g,Fe.open),V=Ke(g,Fe.mounted),Y=Ke(g,Fe.popupProps),P=Ke(g,Fe.transitionStatus),K=Ke(g,Fe.triggerElement),$=Ke(g,Fe.positionerElement),W=Ke(g,Fe.listElement),ce=v.useRef(!1),ie=v.useRef(!1),oe=v.useRef({}),ue=Fo(),te=Ae(Se=>{if(!$||!m.current||!ie.current)return;if(ce.current||!O){E();return}const Ee=$.style.top==="0px",Oe=$.style.bottom==="0px";if(!Ee&&!Oe){E();return}const ze=H1($),xe=wi($.getBoundingClientRect().height,"y",ze),ke=xt($),_e=getComputedStyle($),De=parseFloat(_e.marginTop),Ge=parseFloat(_e.marginBottom),qe=U1(getComputedStyle(m.current)),Me=Math.min(ke.documentElement.clientHeight-De-Ge,qe),ve=Se.scrollTop,re=Ou(Se);let ye=0,je=null,Pe=!1,Ze=!1;const _t=it=>{$.style.height=`${it}px`},Ht=(it,Et)=>{const Bt=Si(it,0,Me-xe);Bt>0&&_t(xe+Bt),Se.scrollTop=Et,Me-(xe+Bt)<=Oa&&(ce.current=!0),E()},vt=Ee?re-ve:ve,ut=Math.min(xe+vt,Me);if(ye=ut,vt<=Oa){Ht(vt,Ee?re:0);return}if(Me-ut>Oa)Ee?Ze=!0:je=0;else if(Pe=!0,Oe&&ve<re){const it=xe+vt-Me;je=ve-(vt-it)}if(ye=Math.ceil(ye),ye!==0&&_t(ye),Ze||je!=null){const it=Ou(Se),Et=Ze?it:Si(je,0,it);Math.abs(Se.scrollTop-Et)>Oa&&(Se.scrollTop=Et)}(Pe||ye>=Me-Oa)&&(ce.current=!0),E()});v.useImperativeHandle(k,()=>te,[te]),xr({open:Q,ref:m,onComplete(){Q&&h?.(!0)}});const Ne={open:Q,transitionStatus:P,side:A,align:M};Re(()=>{!$||!m.current||Object.keys(oe.current).length||(oe.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})},[m,$]),Re(()=>{Q||O||(ie.current=!1,ce.current=!1,bd($,oe.current))},[Q,O,$,m]),Re(()=>{const Se=m.current;if(!Q||!K||!$||!Se||O&&!U||g.state.transitionStatus==="ending")return;if(!O){ie.current=!0,ue.request(E),Se.style.removeProperty("--transform-origin");return}const Ee=mO(Se);Se.style.removeProperty("--transform-origin");try{let Oe=S.current;Oe?.isConnected||(Oe=!Fe.hasSelectedValue(g.state)&&w.current?.isConnected?w.current:null);const ze=y.current,xe=getComputedStyle($),ke=getComputedStyle(Se),_e=xt(K),De=Ft($),Ge=H1(K),qe=zu(K.getBoundingClientRect(),Ge),Me=zu($.getBoundingClientRect(),Ge),ve=qe.height,re=W||Se,ye=re.scrollHeight,je=parseFloat(ke.borderBottomWidth),Pe=parseFloat(xe.marginTop)||10,Ze=parseFloat(xe.marginBottom)||10,_t=parseFloat(xe.minHeight)||100,Ht=U1(ke),vt=5,ut=5,it=20,Et=_e.documentElement.clientHeight-Pe-Ze,Bt=_e.documentElement.clientWidth,pa=Et-qe.bottom+ve;let gn,dt=F==="rtl"?qe.right-Me.width:qe.left,Tt=0;if(Oe&&ze){const An=zu(ze.getBoundingClientRect(),Ge);gn=zu(Oe.getBoundingClientRect(),Ge),dt=Me.left+(F==="rtl"?An.right-gn.right:An.left-gn.left);const na=An.top-qe.top+An.height/2;Tt=gn.top-Me.top+gn.height/2-na}const Xt=pa+Tt+Ze+je;let yt=Math.min(Et,Xt);const Wt=Et-Pe-Ze,Vt=Xt-yt,rn=Bt-ut;$.style.left=`${Si(dt,vt,rn-Me.width)}px`,$.style.height=`${yt}px`,$.style.maxHeight="auto",$.style.marginTop=`${Pe}px`,$.style.marginBottom=`${Ze}px`,Se.style.height="100%";const Tn=Ou(re),qn=Vt>=Tn-Oa;qn&&(yt=Math.min(Et,Me.height)-(Vt-Tn));const ta=qe.top<it||qe.bottom>Et-it||Math.ceil(yt)+Oa<Math.min(ye,_t),Vn=(De.visualViewport?.scale??1)!==1&&Sh;if(ta||Vn){ie.current=!0,bd($,oe.current),I(!1);return}const es=Math.max(_t,yt);if(qn){const An=Math.max(0,Et-Xt);$.style.top=Me.height>=Wt?"0":`${An}px`,$.style.height=`${yt}px`,re.scrollTop=Ou(re)}else $.style.bottom="0",re.scrollTop=Vt;if(gn){const An=Me.top,na=Me.height,Na=gn.top+gn.height/2,ts=na>0?(Na-An)/na*100:50,nt=Si(ts,0,100);Se.style.setProperty("--transform-origin",`50% ${nt}%`)}(es===Et||yt>=Ht)&&(ce.current=!0),E(),R&&g.state.selectedIndex===null&&g.state.activeIndex===null&&N.current[0]!=null&&g.set("activeIndex",0),ie.current=!0}finally{Ee()}},[g,Q,$,K,y,w,S,m,E,O,I,ue,B,L,W,N,R,F,U]),v.useEffect(()=>{if(!O||!$||!Q)return;const Se=Ft($);function Ee(Oe){x(!1,tt(gT,Oe))}return ct(Se,"resize",Ee)},[x,O,$,Q]);const $e={...W?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":j||void 0,id:`${G}-list`},onKeyDown(Se){_.current=!0,D&&ix.has(Se.key)&&Se.stopPropagation()},onMouseMove(){_.current=!1},onScroll(Se){W||te(Se.currentTarget)},...O&&{style:W?{height:"100%"}:$w}},be=Lt("div",n,{ref:[s,m],state:Ne,stateAttributesMapping:dO,props:[Y,$e,Xh(P),{className:!W&&O?Qg.className:void 0},f]});return l.jsxs(v.Fragment,{children:[!H&&Qg.getElement(Z),l.jsx(xS,{context:q,modal:!1,disabled:!V,returnFocus:d,restoreFocus:!0,children:be})]})});function U1(e){const n=e.maxHeight||"";return n.endsWith("px")&&parseFloat(n)||1/0}function Ou(e){return fx(e.scrollHeight,e.clientHeight)}function H1(e){return wS.getScale(e)}function wi(e,n,s){return e/s[n]}function zu(e,n){return qi({x:wi(e.x,"x",n),y:wi(e.y,"y",n),width:wi(e.width,"x",n),height:wi(e.height,"y",n)})}const q1=[["transform","none"],["scale","1"],["translate","0 0"]];function mO(e){const{style:n}=e,s={};for(const[r,i]of q1)s[r]=n.getPropertyValue(r),n.setProperty(r,i,"important");return()=>{for(const[r]of q1){const i=s[r];i?n.setProperty(r,i):n.removeProperty(r)}}}const pO=v.forwardRef(function(n,s){const{render:r,className:i,style:c,...d}=n,{store:f,scrollHandlerRef:g}=Wa(),{alignItemWithTriggerActive:m}=px(),h=Ke(f,Fe.hasScrollArrows),x=Ke(f,Fe.openMethod),y=Ke(f,Fe.multiple),S={id:`${Ke(f,Fe.id)}-list`,role:"listbox","aria-multiselectable":y||void 0,onScroll(j){g.current?.(j.currentTarget)},...m&&{style:$w},className:h&&x!=="touch"?Qg.className:void 0},_=Ae(j=>{f.set("listElement",j)});return Lt("div",n,{ref:[s,_],props:[S,d]})});let Gw=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function gx(e={}){const{label:n,metadata:s,textRef:r,indexGuessBehavior:i,index:c}=e,{register:d,unregister:f,subscribeMapChange:g,elementsRef:m,labelsRef:h,nextIndexRef:x}=J4(),y=v.useRef(-1),[w,S]=v.useState(c??(i===Gw.GuessFromOrder?()=>{if(y.current===-1){const E=x.current;x.current+=1,y.current=E}return y.current}:-1)),_=v.useRef(null),j=v.useCallback(E=>{if(_.current=E,w!==-1&&E!==null&&(m.current[w]=E,h)){const k=n!==void 0;h.current[w]=k?n:r?.current?.textContent??E.textContent}},[w,m,h,n,r]);return Re(()=>{if(c!=null)return;const E=_.current;if(E)return d(E,s),()=>{f(E)}},[c,d,f,s]),Re(()=>{if(c==null)return g(E=>{const k=_.current?E.get(_.current)?.index:null;k!=null&&S(k)})},[c,g,S]),v.useMemo(()=>({ref:j,index:w}),[w,j])}const Yw=v.createContext(void 0);function hx(){const e=v.useContext(Yw);if(!e)throw new Error(Nn(57));return e}const gO=v.memo(v.forwardRef(function(n,s){const{render:r,className:i,style:c,value:d=null,label:f,disabled:g=!1,nativeButton:m=!1,...h}=n,x=v.useRef(null),y=gx({label:f,textRef:x,indexGuessBehavior:Gw.GuessFromOrder}),{store:w,itemProps:S,setOpen:_,setValue:j,selectionRef:E,typingRef:k,valuesRef:N,multiple:R,selectedItemTextRef:A}=Wa(),M=Ke(w,Fe.isActive,y.index),O=Ke(w,Fe.isSelected,y.index,d),U=Ke(w,Fe.isSelectedByFocus,y.index),I=Ke(w,Fe.isItemEqualToValue),B=y.index,L=B!==-1,D=v.useRef(null);Re(()=>{if(!L)return;const W=N.current;return W[B]=d,()=>{delete W[B]}},[L,B,d,N]),Re(()=>{if(!L)return;const W=w.state.value;let ce=W;R&&Array.isArray(W)&&W.length>0&&(ce=W[W.length-1]),ce!==void 0&&tl(d,ce,I)&&(w.set("selectedIndex",B),x.current&&(A.current=x.current))},[L,B,R,I,w,d,A]);const q=v.useRef(null),F=v.useRef("mouse"),Z=v.useRef(!1),{getButtonProps:H,buttonRef:G}=ml({disabled:g,focusableWhenDisabled:!0,native:m,composite:!0}),Q={disabled:g,selected:O,highlighted:M};function V(W){const ce=w.state.value;if(R){const ie=Array.isArray(ce)?ce:[],oe=O?B4(ie,d,I):[...ie,d];j(oe,tt(vp,W))}else j(d,tt(vp,W)),_(!1,tt(vp,W))}function Y(){E.current.dragY=0}const P={role:"option","aria-selected":O,tabIndex:M?0:-1,onKeyDown(W){q.current=W.key,w.set("activeIndex",B),W.key===" "&&k.current&&W.preventDefault()},onClick(W){const ce=W.type==="click"&&F.current!=="touch",ie=W.nativeEvent.pointerType,oe=ce&&wh(W.nativeEvent)&&(ie!==void 0||M),ue=ce&&!oe&&!Z.current;Z.current=!1,!(W.type==="keydown"&&q.current===null)&&(g||W.type==="keydown"&&q.current===" "&&k.current||ue||(q.current=null,V(W.nativeEvent)))},onPointerEnter(W){F.current=W.pointerType},onPointerMove(W){if(W.pointerType==="mouse"&&W.buttons===1){const ce=E.current;ce.dragY+=W.movementY,ce.dragY**2>=64&&(ce.allowUnselectedMouseUp=!0)}},onPointerDown(W){F.current=W.pointerType,Z.current=!0,Y()},onMouseUp(){if(Y(),g||F.current==="touch"||Z.current)return;const W=!E.current.allowSelectedMouseUp&&O,ce=!E.current.allowUnselectedMouseUp&&!O;W||ce||(Z.current=!0,D.current?.click(),Z.current=!1)}},K=Lt("div",n,{ref:[G,s,y.ref,D],state:Q,props:[S,P,h,H]}),$=v.useMemo(()=>({selected:O,index:B,textRef:x,selectedByFocus:U,hasRegistered:L}),[O,B,x,U,L]);return l.jsx(Yw.Provider,{value:$,children:K})})),hO=v.forwardRef(function(n,s){const r=n.keepMounted??!1,{selected:i}=hx();return r||i?l.jsx(xO,{...n,ref:s}):null}),xO=v.memo(v.forwardRef((e,n)=>{const{render:s,className:r,style:i,keepMounted:c,...d}=e,{selected:f}=hx(),g=v.useRef(null),{transitionStatus:m,setMounted:h}=tc(f),y=Lt("span",e,{ref:[n,g],state:{selected:f,transitionStatus:m},props:[{"aria-hidden":!0,children:"✔️"},d],stateAttributesMapping:dl});return xr({open:f,ref:g,onComplete(){f||h(!1)}}),y})),bO=v.memo(v.forwardRef(function(n,s){const{index:r,textRef:i,selectedByFocus:c,hasRegistered:d}=hx(),{firstItemTextRef:f,selectedItemTextRef:g}=Wa(),{render:m,className:h,style:x,...y}=n,w=v.useCallback(_=>{_&&(d&&r===0&&(f.current=_),d&&c&&(g.current=_))},[f,g,r,c,d]);return Lt("div",n,{ref:[w,s,i],props:y})})),Fw=v.forwardRef(function(n,s){const{render:r,className:i,style:c,direction:d,keepMounted:f=!1,...g}=n,m=d==="up",{store:h,popupRef:x,listRef:y,handleScrollArrowVisibility:w,scrollArrowsMountedCountRef:S}=Wa(),{side:_,scrollDownArrowRef:j,scrollUpArrowRef:E}=px(),k=m?Fe.scrollUpArrowVisible:Fe.scrollDownArrowVisible,N=Ke(h,k),R=Ke(h,Fe.openMethod),A=N&&R!=="touch",M=Zn(),O=m?E:j,{transitionStatus:U,setMounted:I}=tc(A);Re(()=>(S.current+=1,h.state.hasScrollArrows||h.set("hasScrollArrows",!0),()=>{S.current=Math.max(0,S.current-1),S.current===0&&h.state.hasScrollArrows&&h.set("hasScrollArrows",!1)}),[h,S]),xr({open:A,ref:O,onComplete(){A||I(!1)}});const D=Lt("div",n,{ref:[s,O],state:{direction:d,visible:A,side:_,transitionStatus:U},props:[{"aria-hidden":!0,children:m?"▲":"▼",style:{position:"absolute"},onMouseMove(F){if(F.movementX===0&&F.movementY===0||M.isStarted())return;h.set("activeIndex",null);function Z(){const H=h.state.listElement??x.current;if(!H)return;h.set("activeIndex",null),w();const G=fx(H.scrollHeight,H.clientHeight),Q=xd(H.scrollTop,G),V=Q===(m?0:G),Y=y.current;if(Q!==H.scrollTop&&(H.scrollTop=Q),Y.length===0&&h.set(m?"scrollUpArrowVisible":"scrollDownArrowVisible",!V),V){M.clear();return}if(Y.length>0){const P=O.current?.offsetHeight||0;H.scrollTop=vO(Y,m,Q,H.clientHeight,P,G)}M.start(40,Z)}M.start(40,Z)},onMouseLeave(){M.clear()}},g]});return A||f?D:null});function vO(e,n,s,r,i,c){if(n){let h=0;const x=s+i-Oa;for(let S=0;S<e.length;S+=1){const _=e[S];if(_&&_.offsetTop>=x){h=S;break}}const y=Math.max(0,h-1),w=e[y];return y<h&&w?xd(w.offsetTop-i,c):0}let d=e.length-1;const f=s+r-i+Oa;for(let h=0;h<e.length;h+=1){const x=e[h];if(x&&x.offsetTop+x.offsetHeight>f){d=Math.max(0,h-1);break}}const g=Math.min(e.length-1,d+1),m=e[g];return g>d&&m?xd(m.offsetTop+m.offsetHeight-r+i,c):c}const yO=v.forwardRef(function(n,s){return l.jsx(Fw,{...n,ref:s,direction:"down"})}),_O=v.forwardRef(function(n,s){return l.jsx(Fw,{...n,ref:s,direction:"up"})}),jO=H4;function SO({className:e,...n}){return l.jsx(X4,{"data-slot":"select-value",className:Pt("flex flex-1 text-left",e),...n})}function wO({className:e,size:n="default",children:s,...r}){return l.jsxs(Y4,{"data-slot":"select-trigger","data-size":n,className:Pt("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:[s,l.jsx(K4,{render:l.jsx(Zr,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function CO({className:e,children:n,side:s="bottom",sideOffset:r=4,align:i="center",alignOffset:c=0,alignItemWithTrigger:d=!0,...f}){return l.jsx(Z4,{children:l.jsx(rO,{side:s,sideOffset:r,align:i,alignOffset:c,alignItemWithTrigger:d,className:"isolate z-50",children:l.jsxs(fO,{"data-slot":"select-content","data-align-trigger":d,className:Pt("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:[l.jsx(kO,{}),l.jsx(pO,{children:n}),l.jsx(RO,{})]})})})}function EO({className:e,children:n,...s}){return l.jsxs(gO,{"data-slot":"select-item",className:Pt("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),...s,children:[l.jsx(bO,{className:"flex min-w-0 flex-1 gap-2 overflow-hidden whitespace-nowrap",children:n}),l.jsx(hO,{render:l.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:l.jsx(Li,{className:"pointer-events-none"})})]})}function kO({className:e,...n}){return l.jsx(_O,{"data-slot":"select-scroll-up-button",className:Pt("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...n,children:l.jsx(uj,{})})}function RO({className:e,...n}){return l.jsx(yO,{"data-slot":"select-scroll-down-button",className:Pt("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...n,children:l.jsx(Zr,{})})}function Ct({value:e,onChange:n,options:s,placeholder:r="— elegir —",disabled:i,className:c}){return l.jsxs(jO,{value:e,onValueChange:d=>n(d??""),disabled:i,children:[l.jsx(wO,{className:Ie("h-9 w-full",c),children:l.jsx(SO,{placeholder:r,children:d=>s.find(f=>f.value===d)?.label??d})}),l.jsx(CO,{side:"bottom",sideOffset:6,align:"start",alignItemWithTrigger:!1,className:"max-w-[min(20rem,var(--available-width))] p-1.5",children:s.map(d=>{const f=d.icon;return l.jsx(EO,{value:d.value,children:l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[f?l.jsx(f,{className:"size-4 shrink-0 text-muted-fg"}):null,d.description?l.jsxs("span",{className:"flex min-w-0 flex-col leading-tight",children:[l.jsx("span",{className:"truncate font-medium",children:d.label}),l.jsx("span",{className:"truncate text-[11px] text-muted-fg",children:d.description})]}):l.jsx("span",{className:"truncate",children:d.label})]})},d.value)})})]})}const V1=320;function NO(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleString(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function TO(e){return e.agent_slug||e.actor_id||e.author||e.actor_kind||"—"}function AO({m:e}){const[n,s]=v.useState(!1),r=(e.body?.length||0)>V1,i=!r||n?e.body:`${e.body.slice(0,V1)}…`;return l.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[l.jsx("span",{className:"mt-0.5 shrink-0",children:e.direction==="in"?l.jsx(lj,{size:14,className:"text-blue-400"}):l.jsx(cj,{size:14,className:"text-emerald-400"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[l.jsx("span",{className:"font-mono",children:NO(e.ts)}),l.jsx(Ue,{tone:"info",children:e.channel}),e.type&&l.jsx(Ue,{children:e.type}),l.jsx("span",{className:"font-medium text-foreground",children:TO(e)})]}),e.body&&l.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs",children:i}),r&&l.jsx("button",{type:"button",onClick:()=>s(c=>!c),className:"mt-1 text-[11px] font-medium text-sky-400 hover:underline",children:C(n?"logs.show_less":"logs.show_more")})]})]})}function MO(){const[e,n]=v.useState(!1),s=Qe(e?"/admin/logs?errors":null,()=>Zo.logs("errors",200)),r=s.data?.entries||[];return l.jsxs("details",{className:"mb-3 rounded-lg border border-border bg-muted/20",onToggle:i=>n(i.target.open),children:[l.jsxs("summary",{className:"cursor-pointer px-3 py-2 text-xs font-medium text-muted-fg",children:[C("logs.daemon_errors"),r.length?` · ${r.length}`:""]}),l.jsxs("div",{className:"border-t border-border p-3",children:[s.isLoading&&l.jsx(Je,{}),e&&!s.isLoading&&r.length===0&&l.jsx("p",{className:"text-xs text-muted-fg",children:C("logs.no_errors")}),l.jsx("ul",{className:"space-y-1",children:r.map((i,c)=>l.jsxs("li",{className:"rounded-md bg-card px-2 py-1 text-[11px]",children:[l.jsxs("div",{className:"flex items-center gap-2 text-muted-fg",children:[typeof i.ts=="string"&&l.jsx("span",{className:"font-mono",children:new Date(i.ts).toLocaleString()}),typeof i.level=="string"&&l.jsx("span",{className:"text-destructive",children:i.level})]}),l.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)})]},c))})]})]})}function OO({pid:e}){const n=!e||String(e)==="0",[s,r]=v.useState(""),[i,c]=v.useState(""),[d,f]=v.useState(""),[g,m]=v.useState(""),h=s.trim()||void 0,x=n?`/messages/global?channel=${h??""}`:`/projects/${e}/messages?channel=${h??""}`,y=Qe(x,()=>n?Xg.global({channel:h,limit:300}):Xg.project(e,{channel:h,limit:300})),w=v.useMemo(()=>[...y.data||[]].sort((j,E)=>(E.ts||"").localeCompare(j.ts||"")),[y.data]),S=v.useMemo(()=>Array.from(new Set(w.map(j=>j.type).filter(Boolean))),[w]),_=v.useMemo(()=>w.filter(j=>!(i&&j.direction!==i||d&&j.type!==d||g&&!(j.body||"").toLowerCase().includes(g.toLowerCase()))),[w,i,d,g]);return l.jsxs(He,{title:C("logs.title"),description:C(n?"logs.desc_global":"logs.desc_project"),action:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ce,{placeholder:C("logs.filter_channel"),value:s,onChange:j=>r(j.target.value),className:"w-44"}),l.jsx(he,{size:"sm",variant:"secondary",onClick:()=>y.mutate(),children:l.jsx(rl,{size:13})})]}),children:[n&&l.jsx(MO,{}),l.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[l.jsx("div",{className:"w-36",children:l.jsx(Ct,{value:i,onChange:c,placeholder:C("logs.filter_dir"),options:[{value:"",label:C("logs.all_directions")},{value:"in",label:C("logs.in")},{value:"out",label:C("logs.out")}]})}),l.jsx("div",{className:"w-40",children:l.jsx(Ct,{value:d,onChange:f,placeholder:C("logs.filter_type"),options:[{value:"",label:C("logs.all_types")},...S.map(j=>({value:j,label:j}))]})}),l.jsx(Ce,{placeholder:C("logs.search_text"),value:g,onChange:j=>m(j.target.value),className:"w-56"}),l.jsxs("span",{className:"text-[11px] text-muted-fg",children:[_.length," ",C("logs.count_of")," ",w.length]})]}),y.isLoading&&l.jsx(Je,{}),y.error&&l.jsx(lt,{children:C("logs.error",{msg:y.error.message})}),!y.isLoading&&!y.error&&_.length===0&&l.jsx(lt,{children:h?C("logs.no_activity_ch",{ch:h}):C("logs.no_activity")}),l.jsx("ul",{className:"space-y-1 text-sm",children:_.map((j,E)=>l.jsx(AO,{m:j},`${j.ts}-${E}`))})]})}function Xw({value:e,onChange:n,options:s,placeholder:r="elegí o escribí un modelo…",invalid:i,invalidHint:c,className:d}){const[f,g]=v.useState(!1),[m,h]=v.useState(e),x=v.useRef(null);v.useEffect(()=>{h(e)},[e]),v.useEffect(()=>{if(!f)return;const _=j=>{x.current&&!x.current.contains(j.target)&&g(!1)};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[f]);const y=m.trim().toLowerCase(),w=y?s.filter(_=>_.toLowerCase().includes(y)):s,S=_=>{n(_),h(_),g(!1)};return l.jsxs("div",{ref:x,className:Ie("relative",d),children:[l.jsxs("div",{className:Ie("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&&l.jsx("span",{title:c||"Modelo/proveedor no disponible",children:l.jsx(bj,{className:"size-3.5 shrink-0 text-amber-400"})}),l.jsx("input",{value:m,placeholder:r,onChange:_=>{h(_.target.value),n(_.target.value),g(!0)},onFocus:()=>g(!0),className:"w-full bg-transparent py-1.5 text-sm outline-none placeholder:text-muted-fg/60"}),l.jsx("button",{type:"button",tabIndex:-1,onClick:()=>g(_=>!_),className:"shrink-0 text-muted-fg hover:text-foreground",children:l.jsx(Zr,{className:"size-4"})})]}),f&&w.length>0&&l.jsx("ul",{className:"absolute z-50 mt-1 max-h-56 w-full overflow-y-auto rounded-lg border border-border bg-popover p-1 shadow-md ring-1 ring-foreground/10",children:w.map(_=>l.jsx("li",{children:l.jsx("button",{type:"button",onMouseDown:j=>{j.preventDefault(),S(_)},className:Ie("flex w-full items-center rounded-md px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-fg",_===e&&"bg-accent/50"),children:l.jsx("span",{className:"truncate font-mono text-xs",children:_})})},_))})]})}function vr(){const{data:e,error:n,isLoading:s,mutate:r}=Qe("/admin/config",()=>Zo.config.get()),i=async(c,d)=>{const f=await Zo.config.patch({set:c,unset:d});return await r({config:f.config},{revalidate:!1}),f.config};return{config:e?.config||{},error:n,isLoading:s,mutate:r,patch:i}}function Kw(){const{data:e,error:n,isLoading:s,mutate:r}=Qe("/admin/super-agent",()=>Zo.superAgent());return{superAgent:e,error:n,isLoading:s,mutate:r}}const zO={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"},DO={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"},zi=[{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 Vp(e,n){return n&&n in e?e[n]:e.custom}const vd={anthropic:ol,openai:vn,gemini:BR,groq:Bi,openrouter:mh,ollama:hj,azure:kR,mock:zR,custom:ll},Vr={anthropic:{base_url:"",default_model:"claude-sonnet-4.6",api_key_env:"ANTHROPIC_API_KEY",known_models:["claude-opus-4.8","claude-opus-4.7","claude-opus-4.6","claude-sonnet-4.6","claude-sonnet-4.5","claude-haiku-4.5"]},openai:{base_url:"https://api.openai.com/v1",default_model:"gpt-4o-mini",api_key_env:"OPENAI_API_KEY",known_models:["gpt-4o","gpt-4o-mini","gpt-4.1","gpt-4.1-mini","o3-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-pro","gemini-3.5-flash","gemini-3.1-pro","gemini-3.1-flash","gemini-2.5-pro","gemini-2.5-flash","gemini-2.5-flash-lite"]},groq:{base_url:"https://api.groq.com/openai/v1",default_model:"llama-3.3-70b-versatile",api_key_env:"GROQ_API_KEY",known_models:["llama-3.3-70b-versatile","llama-3.1-8b-instant","meta-llama/llama-4-scout-17b-16e-instruct","openai/gpt-oss-120b","openai/gpt-oss-20b","groq/compound","groq/compound-mini","qwen/qwen3-32b","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","deepseek/deepseek-r1:free","meta-llama/llama-3.3-70b-instruct:free","google/gemini-2.0-flash-exp:free","qwen/qwen3-235b-a22b:free","anthropic/claude-sonnet-4.5","openai/gpt-4o-mini"]},ollama:{base_url:"http://127.0.0.1:11434",default_model:"gemma2:9b",api_key_env:"",known_models:[]},azure:{base_url:"",default_model:"gpt-4o-mini",api_key_env:"AZURE_OPENAI_API_KEY",known_models:["gpt-4o","gpt-4o-mini"]},mock:{base_url:"",default_model:"mock",api_key_env:"",known_models:["mock"]},custom:{base_url:"",default_model:"",api_key_env:"",known_models:[]}};function Qw(e){const n=e.indexOf(":");return n<0?{provider:e,model:""}:{provider:e.slice(0,n),model:e.slice(n+1)}}function $p({value:e,onChange:n,providers:s}){const{provider:r,model:i}=Qw(e),c=s.find(h=>h.slug===r),d=!!r&&!c,f=v.useMemo(()=>{const h=c?Vr[c.engine]?.known_models||[]:[];return Array.from(new Set([...c?.default_model?[c.default_model]:[],...h]))},[c]),g=h=>{const x=s.find(w=>w.slug===h),y=x?.default_model||Vr[x?.engine]?.default_model||"";n(y?`${h}:${y}`:`${h}:`)},m=h=>n(`${r}:${h}`);return l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsx(Ct,{value:r,onChange:g,placeholder:d?`⚠ ${r} (no existe)`:"— proveedor —",options:s.map(h=>({value:h.slug,label:h.slug,icon:vd[h.engine]}))}),l.jsx(Xw,{value:i,onChange:m,options:f,invalid:d,invalidHint:`El proveedor "${r}" no está configurado.`})]})}function LO(){const e=rt(),{superAgent:n,isLoading:s,mutate:r}=Kw(),{config:i,patch:c}=vr(),[d,f]=v.useState(""),[g,m]=v.useState([]),[h,x]=v.useState(""),[y,w]=v.useState(null),[S,_]=v.useState(!1),[j,E]=v.useState({model:"",fallback:[]});v.useEffect(()=>{if(!n)return;const B=n.model_fallback?.models||[],L=Array.isArray(B)?B:[];f(n.model||""),m(L),E({model:n.model||"",fallback:L})},[n]);const k=v.useMemo(()=>{const B=i.engines||{};return Object.entries(B).map(([L,D])=>({slug:L,engine:D?.engine||L,default_model:D?.default_model||Vr[D?.engine||L]?.default_model}))},[i.engines]),N=B=>{const{provider:L}=Qw(B);return k.some(D=>D.slug===L)};if(s||!n)return l.jsx(Je,{});const R=d!==j.model||JSON.stringify(g)!==JSON.stringify(j.fallback),A=async()=>{_(!0);try{await c({"super_agent.model":d,"super_agent.model_fallback.enabled":g.length>0,"super_agent.model_fallback.models":g}),e.success("Router guardado."),E({model:d,fallback:g}),r()}catch(B){e.error(B.message)}finally{_(!1)}},M=()=>{const B=h.trim().replace(/:$/,"");!B||!B.includes(":")||g.includes(B)||(m([...g,B]),x(""))},O=(B,L)=>{const D=[...g];D[B]=L,m(D)},U=B=>{m(g.filter((L,D)=>D!==B)),y===B&&w(null)},I=(B,L)=>{const D=B+L;if(D<0||D>=g.length)return;const q=[...g];[q[B],q[D]]=[q[D],q[B]],m(q)};return l.jsx(He,{title:"Router de modelos",description:"Un solo router general (sin casos por tarea). Elegí proveedor y modelo; si el activo falla, prueba la cadena de fallback en orden.",children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-muted/20 p-3",children:[l.jsxs(Ue,{tone:"success",children:[l.jsx(mh,{size:11})," default"]}),l.jsx("span",{className:`font-mono text-xs ${!N(d)&&d?"text-amber-400":""}`,children:d||"—"}),g.map(B=>l.jsxs("span",{className:"flex items-center gap-2 text-muted-fg",children:[l.jsx(ij,{size:12}),l.jsx("span",{className:`font-mono text-xs ${N(B)?"":"text-amber-400"}`,children:B})]},B))]}),k.length===0?l.jsx("p",{className:"text-xs text-muted-fg",children:"Agregá un proveedor abajo para poder elegir modelos."}):l.jsx(fe,{label:"Modelo activo (default)",hint:"Proveedor + modelo. Se guarda como provider:model.",children:l.jsx($p,{value:d,onChange:f,providers:k})}),l.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[l.jsxs("div",{className:"mb-2",children:[l.jsx("div",{className:"text-sm font-medium",children:"Cadena de fallback"}),l.jsx("div",{className:"text-xs text-muted-fg",children:"Si el modelo activo falla, prueba estos en orden. Click en uno para editarlo."})]}),l.jsxs("ul",{className:"mb-3 space-y-1",children:[g.map((B,L)=>{const D=!N(B),q=y===L;return l.jsx("li",{className:"rounded-md bg-card px-2 py-1.5 text-xs",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("span",{className:"w-6 text-muted-fg",children:["#",L+1]}),q?l.jsx("div",{className:"flex-1",children:l.jsx($p,{value:B,onChange:F=>O(L,F),providers:k})}):l.jsxs("button",{type:"button",onClick:()=>w(L),className:"flex flex-1 items-center gap-1.5 text-left",children:[D&&l.jsx(bj,{size:12,className:"text-amber-400"}),l.jsx("span",{className:`font-mono ${D?"text-amber-400":""}`,children:B})]}),q?l.jsx(he,{size:"sm",variant:"secondary",onClick:()=>w(null),children:"listo"}):l.jsx(he,{size:"sm",variant:"ghost",onClick:()=>w(L),children:l.jsx(gh,{size:12})}),l.jsx(he,{size:"sm",variant:"ghost",onClick:()=>I(L,-1),disabled:L===0,children:"↑"}),l.jsx(he,{size:"sm",variant:"ghost",onClick:()=>I(L,1),disabled:L===g.length-1,children:"↓"}),l.jsx(he,{size:"sm",variant:"destructive",onClick:()=>U(L),children:l.jsx(Ms,{size:12})})]})},`${L}-${B}`)}),g.length===0&&l.jsx("li",{className:"text-xs text-muted-fg",children:"Sin fallback configurado."})]}),k.length>0&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("div",{className:"text-xs text-muted-fg",children:"Agregar a la cadena"}),l.jsx($p,{value:h,onChange:x,providers:k}),l.jsxs(he,{size:"sm",variant:"secondary",onClick:M,disabled:!h.includes(":")||h.endsWith(":"),children:[l.jsx(Rn,{size:13})," Agregar a la cadena"]})]})]}),l.jsx(he,{variant:"primary",loading:S,disabled:!R,onClick:A,children:R?"Guardar router":"Guardado"})]})})}function PO({provider:e,onEdit:n,onDelete:s,onToggle:r}){const i=Vp(zO,e.engine),c=Vp(DO,e.engine),d=Vp(vd,e.engine),f=zi.find(x=>x.value===e.engine)?.label||e.engine,g=typeof e.api_key=="string"&&e.api_key.length>0,m=el(e.api_key),h=e.is_active!==!1;return l.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:n,children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:Ie("flex size-10 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",i),children:l.jsx(d,{className:"size-5 text-white"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("h3",{className:"truncate text-sm font-semibold",children:e.name||e.slug}),l.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:e.slug}),l.jsxs("span",{className:Ie("mt-1 inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium",c),children:[l.jsx(d,{className:"size-3"})," ",f]})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[l.jsx(Ko,{content:h?"Activo · click para desactivar":"Inactivo · click para activar",children:l.jsxs("button",{type:"button",onClick:x=>{x.stopPropagation(),r()},className:Ie("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:[l.jsx("span",{className:Ie("size-1.5 rounded-full",h?"bg-emerald-400":"bg-muted-fg/40")}),h?"Active":"Off"]})}),l.jsx(Ko,{content:"Borrar",children:l.jsx("button",{type:"button",onClick:x=>{x.stopPropagation(),s()},className:"rounded-md p-1 text-muted-fg hover:bg-destructive/10 hover:text-destructive",children:l.jsx(Ms,{className:"size-3.5"})})})]})]}),l.jsxs("div",{className:"mt-auto space-y-1 text-xs",children:[l.jsx(mi,{label:"Modelo",value:e.default_model||"—",mono:!0}),e.base_url&&l.jsx(mi,{label:"Base URL",value:e.base_url,mono:!0,truncate:!0}),l.jsx(mi,{label:"API key",value:g?m?`…${m}`:"✓ seteada":"—",mono:!!m}),e.default_temperature!==void 0&&l.jsx(mi,{label:"Temp",value:e.default_temperature.toFixed(1)}),e.pricing?.input_per_million!==void 0&&l.jsx(mi,{label:"$ in/out (1M)",value:`${e.pricing.input_per_million??0} / ${e.pricing.output_per_million??0}`})]})]})}function mi({label:e,value:n,mono:s,truncate:r}){return l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:"text-muted-fg",children:e}),l.jsx("span",{className:Ie("text-foreground",s&&"font-mono",r&&"max-w-[180px] truncate"),children:n})]})}const $1={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:""},BO=["anthropic","openai","gemini","groq","openrouter","ollama","custom"];function pi(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Du(e){if(e==null)return"";const n=Number(e);return Number.isFinite(n)?String(n):""}function IO(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:Du(e.pricing?.input_per_million),p_output:Du(e.pricing?.output_per_million),p_cache_read:Du(e.pricing?.cache_read_per_million),p_cache_write:Du(e.pricing?.cache_write_per_million)}}function UO({open:e,initial:n,existingSlugs:s,onClose:r,onSave:i}){const c=!!n,[d,f]=v.useState($1),[g,m]=v.useState(!1),[h,x]=v.useState(null),[y,w]=v.useState([]),[S,_]=v.useState(!1),[j,E]=v.useState(null),[k,N]=v.useState(!1),[R,A]=v.useState("");v.useEffect(()=>{if(!e)return;const V=n?IO(n):$1;f(V),x(null),E(null),N(!1);const Y=Vr[V.engine];w(Y?.known_models||[])},[e,n]);const M=V=>f(Y=>({...Y,...V})),O=V=>{const Y=Vr[V];M({engine:V,name:V==="custom"?d.name:zi.find(P=>P.value===V)?.label||V,slug:V==="custom"?d.slug:V,base_url:Y.base_url,default_model:Y.default_model}),w(Y.known_models),E(null)},U=V=>{const Y=Vr[V];M({engine:V,base_url:d.base_url||Y.base_url,default_model:d.default_model||Y.default_model}),w(Y.known_models)},I=async()=>{_(!0),E(null);try{const V=await pd.models({engine:d.engine,slug:d.slug||pi(d.name),base_url:d.base_url||void 0,api_key:d.api_key_value||void 0});if(V.error){E(V.error);return}w(V.models),V.models.length===0&&E("Sin modelos. ¿Key/URL correctas?")}catch(V){E(V.message||"No se pudo listar modelos.")}finally{_(!1)}},B=v.useMemo(()=>d.default_model&&!y.includes(d.default_model)?[d.default_model,...y]:y,[y,d.default_model]),L=()=>{const V=(d.slug||pi(d.name)).trim();if(!V)return x("Slug requerido."),null;if(!c&&s.includes(V))return x(`Ya existe un provider "${V}".`),null;let Y;if(d.model_context_limits_json.trim())try{const $=JSON.parse(d.model_context_limits_json);if(!$||typeof $!="object"||Array.isArray($))throw new Error;Y=$}catch{return x("Límites de contexto por modelo: JSON inválido."),null}const K=[d.p_input,d.p_output,d.p_cache_read,d.p_cache_write].map($=>$.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:V,name:d.name.trim()||V,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:Y,pricing:K},modelLimits:Y}},D=()=>{const V=L();if(!V)return;const{provider:Y}=V,P={name:Y.name,engine:Y.engine,is_active:Y.is_active!==!1,default_temperature:Y.default_temperature,default_max_tokens:Y.default_max_tokens};Y.base_url&&(P.base_url=Y.base_url),Y.default_model&&(P.default_model=Y.default_model),Y.context_limit_tokens&&(P.context_limit_tokens=Y.context_limit_tokens),Y.model_context_limits&&(P.model_context_limits=Y.model_context_limits),Y.pricing&&(P.pricing=Y.pricing),d.api_key_value.trim()&&(P.api_key=d.api_key_value.trim()),A(JSON.stringify(P,null,2)),x(null),N(!0)},q=async()=>{m(!0),x(null);try{if(k){const Y=(d.slug||pi(d.name)).trim();if(!Y){x("Slug requerido (en el formulario).");return}let P;try{P=JSON.parse(R)}catch{x("JSON inválido: revisá la sintaxis.");return}if(!P||typeof P!="object"||Array.isArray(P)){x("El JSON debe ser un objeto con la config del provider.");return}const K=P;if(!K.engine||typeof K.engine!="string"){x('Falta "engine" (ej. "anthropic", "ollama").');return}const $={slug:Y,name:typeof K.name=="string"?K.name:Y,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:$,raw:K,originalSlug:n?.slug}),r();return}const V=L();if(!V)return;await i({provider:V.provider,apiKeyValue:d.api_key_value.trim()||void 0,originalSlug:n?.slug}),r()}catch(V){x(V.message||"Error al guardar.")}finally{m(!1)}},F=c&&za(n?.api_key),Z=el(n?.api_key),H=F?`…${Z??""} (ya seteada)`:"sk-…",G=d.engine==="ollama",Q=Vr[d.engine]?.api_key_env;return l.jsx(ma,{open:e,onClose:r,title:c?`Editar ${n?.name||n?.slug}`:"Nuevo provider",description:"Proveedor LLM. El motor (engine) define qué adapter usa (openai, ollama, …).",size:"lg",footer:l.jsxs(l.Fragment,{children:[l.jsx(he,{variant:"ghost",onClick:r,disabled:g,children:"Cancelar"}),l.jsx(he,{variant:"primary",onClick:q,loading:g,children:c?"Guardar":"Crear"})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[c?l.jsx("span",{}):l.jsx("div",{className:"flex flex-wrap gap-1.5",children:BO.map(V=>{const Y=vd[V],P=V==="custom"?"Custom":zi.find($=>$.value===V)?.label||V,K=d.engine===V;return l.jsxs("button",{type:"button",onClick:()=>O(V),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:[l.jsx(Y,{className:"size-3.5"})," ",P]},V)})}),l.jsxs("button",{type:"button",onClick:()=>k?N(!1):D(),className:`flex shrink-0 items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${k?"border-sky-500/50 bg-sky-500/10 text-sky-400":"border-border text-muted-fg hover:text-foreground"}`,children:[l.jsx(SR,{className:"size-3.5"})," ",k?"Volver al formulario":"JSON"]})]}),k?l.jsxs("div",{className:"space-y-2",children:[l.jsx(fe,{label:"Config del provider (JSON)",hint:`Se guarda como engines.${d.slug||pi(d.name)||"<slug>"} en config.json`,children:l.jsx(Qt,{rows:14,className:"font-mono text-xs",value:R,onChange:V=>A(V.target.value),spellCheck:!1})}),l.jsxs("p",{className:"text-[11px] text-muted-fg",children:["Debe ser un objeto JSON válido con al menos ",l.jsx("code",{children:"engine"}),". El slug se toma del formulario."]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(fe,{label:"Nombre",children:l.jsx(Ce,{value:d.name,onChange:V=>M({name:V.target.value,slug:c?d.slug:pi(V.target.value)}),placeholder:"Mi provider"})}),l.jsx(fe,{label:"Motor (engine)",children:l.jsx(Ct,{value:d.engine,onChange:V=>U(V),options:zi.map(V=>({value:V.value,label:V.label,icon:vd[V.value]}))})})]}),l.jsx(fe,{label:"URL base (base_url)",hint:"Se completa sola al elegir un proveedor.",children:l.jsx(Ce,{value:d.base_url,onChange:V=>M({base_url:V.target.value}),placeholder:"https://api.openai.com/v1"})}),!G&&l.jsx(fe,{label:"API key",hint:F?"Dejá en blanco para mantener la actual.":Q?`Se guarda como secreto. Env sugerida: ${Q}`:"Se guarda como secreto.",children:l.jsx(Ce,{type:"password",autoComplete:"new-password",value:d.api_key_value,onChange:V=>M({api_key_value:V.target.value}),placeholder:H})}),l.jsx(fe,{label:"Modelo por defecto",children:l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx(Xw,{value:d.default_model,onChange:V=>M({default_model:V}),options:B,className:"flex-1"}),l.jsxs(he,{size:"sm",variant:"secondary",onClick:I,disabled:S,title:"Lista los modelos reales del proveedor",children:[S?l.jsx(ph,{className:"size-3.5 animate-spin"}):l.jsx(rl,{className:"size-3.5"}),"Cargar modelos"]})]}),j&&l.jsx("p",{className:"text-[11px] text-amber-400",children:j})]})}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(fe,{label:"Máx. tokens (max_tokens)",children:l.jsx(Ce,{type:"number",min:256,step:256,value:d.default_max_tokens,onChange:V=>M({default_max_tokens:parseInt(V.target.value)||4096})})}),l.jsx(fe,{label:`Temperatura: ${d.default_temperature.toFixed(1)}`,children:l.jsx("input",{type:"range",min:0,max:2,step:.1,value:d.default_temperature,onChange:V=>M({default_temperature:parseFloat(V.target.value)}),className:"mt-2 w-full accent-foreground"})})]}),l.jsxs("details",{className:"rounded-md border border-border bg-muted/20 p-3",children:[l.jsx("summary",{className:"cursor-pointer text-xs font-medium text-muted-fg",children:"Análisis de tokens / pricing (opcional)"}),l.jsxs("div",{className:"mt-3 space-y-3",children:[l.jsx(fe,{label:"Límite de contexto (tokens)",children:l.jsx(Ce,{type:"number",min:0,step:1024,value:d.context_limit_tokens,onChange:V=>M({context_limit_tokens:parseInt(V.target.value)||0})})}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(fe,{label:"$ entrada / 1M",children:l.jsx(Ce,{type:"number",min:0,step:1e-4,value:d.p_input,onChange:V=>M({p_input:V.target.value}),placeholder:"0.15"})}),l.jsx(fe,{label:"$ salida / 1M",children:l.jsx(Ce,{type:"number",min:0,step:1e-4,value:d.p_output,onChange:V=>M({p_output:V.target.value}),placeholder:"0.60"})}),l.jsx(fe,{label:"$ cache read / 1M",children:l.jsx(Ce,{type:"number",min:0,step:1e-4,value:d.p_cache_read,onChange:V=>M({p_cache_read:V.target.value}),placeholder:"0.03"})}),l.jsx(fe,{label:"$ cache write / 1M",children:l.jsx(Ce,{type:"number",min:0,step:1e-4,value:d.p_cache_write,onChange:V=>M({p_cache_write:V.target.value}),placeholder:"0.00"})})]}),l.jsx(fe,{label:"Límites de contexto por modelo (JSON)",hint:'{"gpt-4o-mini":128000}',children:l.jsx(Qt,{rows:3,className:"font-mono text-xs",value:d.model_context_limits_json,onChange:V=>M({model_context_limits_json:V.target.value})})})]})]}),l.jsx(sn,{checked:d.is_active,onChange:V=>M({is_active:V}),label:"Activo (los agentes pueden usarlo)"})]}),h&&l.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:h})]})})}const HO=new Set(zi.map(e=>e.value));function qO(e,n){const s=typeof n.engine=="string"&&n.engine||(HO.has(e)?e:"custom");return{slug:e,name:typeof n.name=="string"?n.name:void 0,engine:s,base_url:typeof n.base_url=="string"?n.base_url:void 0,api_key:typeof n.api_key=="string"?n.api_key:void 0,default_model:typeof n.default_model=="string"?n.default_model:void 0,default_temperature:typeof n.default_temperature=="number"?n.default_temperature:void 0,default_max_tokens:typeof n.default_max_tokens=="number"?n.default_max_tokens:void 0,is_active:typeof n.is_active=="boolean"?n.is_active:void 0,context_limit_tokens:typeof n.context_limit_tokens=="number"?n.context_limit_tokens:void 0,model_context_limits:n.model_context_limits||void 0,pricing:n.pricing||void 0}}function VO(){const e=rt(),{config:n,isLoading:s,patch:r,mutate:i}=vr(),[c,d]=v.useState(!1),[f,g]=v.useState(null);if(s)return l.jsx(Je,{});const m=n.engines||{},h=Object.entries(m).map(([E,k])=>qO(E,k||{})),x=h.map(E=>E.slug),y=()=>{g(null),d(!0)},w=E=>{g(E),d(!0)},S=async({provider:E,apiKeyValue:k,raw:N})=>{if(N){await r({[`engines.${E.slug}`]:N}),e.success("Provider guardado (JSON)."),i();return}const R=`engines.${E.slug}`,A={[`${R}.name`]:E.name,[`${R}.engine`]:E.engine,[`${R}.is_active`]:E.is_active!==!1,[`${R}.default_temperature`]:E.default_temperature,[`${R}.default_max_tokens`]:E.default_max_tokens},M=[],O=(U,I)=>{I===void 0||I===""?M.push(`${R}.${U}`):A[`${R}.${U}`]=I};O("base_url",E.base_url),O("default_model",E.default_model),O("context_limit_tokens",E.context_limit_tokens),O("pricing",E.pricing),O("model_context_limits",E.model_context_limits),k&&(A[`${R}.api_key`]=k),await r(A,M),e.success("Provider guardado."),i()},_=async E=>{try{await r({[`engines.${E.slug}.is_active`]:E.is_active===!1}),i()}catch(k){e.error(k.message)}},j=async E=>{if(confirm(`Borrar provider ${E.name||E.slug}?`))try{await r(void 0,[`engines.${E.slug}`]),e.success("Provider borrado."),i()}catch(k){e.error(k.message)}};return l.jsxs(He,{title:"Proveedores",description:"Proveedores LLM (API). Cada provider usa un engine/adapter (openai, ollama, …) con su key y URL.",action:l.jsxs(he,{size:"sm",variant:"primary",onClick:y,children:[l.jsx(Rn,{size:14})," Nuevo provider"]}),children:[h.length===0?l.jsx(lt,{children:"Sin providers. Agregá uno con el botón de arriba."}):l.jsxs("div",{className:"grid grid-cols-1 items-stretch gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[h.map(E=>l.jsx(PO,{provider:E,onEdit:()=>w(E),onDelete:()=>j(E),onToggle:()=>_(E)},E.slug)),l.jsxs("button",{type:"button",onClick:y,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:[l.jsx(Rn,{size:20}),l.jsx("span",{className:"text-sm font-medium",children:"Agregar provider"})]})]}),l.jsx(UO,{open:c,initial:f,existingSlugs:x,onClose:()=>{d(!1),g(null)},onSave:S})]})}function Zw(){return l.jsxs("div",{className:"space-y-6",children:[l.jsx(LO,{}),l.jsx(VO,{})]})}function $O(){const e=rt(),[n,s]=v.useState(!1),i=Qe(n?"/agents/vault?include_removed=1":"/agents/vault",()=>Jt.vault({includeRemoved:n})),c=i.data||[],[d,f]=v.useState(null),g=async h=>{const x=h.source!=="user",y=x?C("base.defaults_tombstone_msg",{slug:h.slug}):C("base.defaults_delete_msg",{slug:h.slug});if(confirm(y))try{await Jt.vaultRemove(h.slug),e.success(C(x?"base.defaults_hidden":"base.defaults_deleted")),i.mutate()}catch(w){e.error(w.message)}},m=async h=>{try{await Jt.vaultRestore(h),e.success(C("base.defaults_restored")),i.mutate()}catch(x){e.error(x.message)}};return l.jsxs(He,{title:C("base.defaults_title"),description:C("base.defaults_desc"),action:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(sn,{checked:n,onChange:s,label:C("base.defaults_show_removed")}),l.jsxs(he,{size:"sm",onClick:()=>f("new"),children:[l.jsx(Rn,{size:14})," ",C("base.defaults_new")]})]}),children:[i.isLoading&&l.jsx(Je,{}),!i.isLoading&&c.length===0&&l.jsx(lt,{children:C("base.defaults_empty")}),l.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:c.map(h=>{const x=n&&h.tombstoned;return l.jsxs("div",{className:`flex flex-col gap-2 rounded-xl border bg-card p-4 ${x?"border-dashed border-border opacity-60":"border-border"}`,children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.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?l.jsx(ks,{className:"size-4 text-white"}):l.jsx(vn,{className:"size-4 text-white"})}),l.jsx("span",{className:"truncate text-sm font-semibold",children:h.slug}),l.jsx(GO,{source:h.source})]}),l.jsx("div",{className:"flex shrink-0 items-center gap-0.5",children:x?l.jsx(Gp,{label:C("base.defaults_restore"),onClick:()=>m(h.slug),variant:"secondary",children:l.jsx(gj,{size:13})}):l.jsxs(l.Fragment,{children:[l.jsx(Gp,{label:C("base.defaults_edit"),onClick:()=>f(h),variant:"ghost",children:l.jsx(gh,{size:13})}),l.jsx(Gp,{label:h.source==="user"?C("base.defaults_delete"):C("base.defaults_hide"),onClick:()=>g(h),variant:"ghost-destructive",children:l.jsx(Ms,{size:13})})]})})]}),h.model?l.jsx(Ue,{tone:"info",children:h.model}):l.jsx("span",{className:"text-[10px] text-muted-fg",children:"modelo: default del router"}),h.description&&l.jsx("p",{className:"line-clamp-3 text-xs text-muted-fg",children:h.description}),l.jsxs("div",{className:"flex flex-wrap gap-1",children:[h.role&&l.jsx(Ue,{children:h.role}),h.skills?.map(y=>l.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[l.jsx(ol,{size:9})," ",y]},y)),h.tools?.map(y=>l.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[l.jsx(ll,{size:9})," ",y]},y))]})]},h.slug)})}),d!==null&&l.jsx(YO,{agent:d==="new"?null:d,onClose:()=>f(null),onSaved:()=>{f(null),i.mutate()}})]})}function GO({source:e}){return e==="user"?l.jsx(Ue,{tone:"success",children:"user"}):e==="user-override"?l.jsx(Ue,{tone:"warning",children:"override"}):l.jsx(Ue,{tone:"muted",children:"bundled"})}function Gp({label:e,onClick:n,variant:s="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",c={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 l.jsxs(Qh,{children:[l.jsx(Zh,{render:l.jsx("button",{type:"button",onClick:n,"aria-label":e,className:`${i} ${c[s]}`,children:r})}),l.jsx(Jh,{children:e})]})}function YO({agent:e,onClose:n,onSaved:s}){const r=rt(),[i,c]=v.useState(!1),d=!e,[f,g]=v.useState(e?.slug??""),[m,h]=v.useState(e?.role??""),[x,y]=v.useState(e?.model??""),[w,S]=v.useState(e?.description??""),[_,j]=v.useState(e?.language??"es"),[E,k]=v.useState((e?.skills??[]).join(", ")),[N,R]=v.useState((e?.tools??[]).join(", ")),[A,M]=v.useState(!!e?.is_master),[O,U]=v.useState(e?.body??""),I=async()=>{const B={role:m||void 0,model:x||void 0,description:w||void 0,language:_||void 0,skills:E,tools:N,is_master:A};c(!0);try{if(d){if(!/^[a-z][a-z0-9_-]*$/.test(f))throw new Error(C("base.defaults_slug_invalid"));await Jt.vaultCreate(f,B,O),r.success(C("base.defaults_created",{slug:f}))}else await Jt.vaultPatch(e.slug,{fields:B,body:O}),r.success(C("base.defaults_saved",{slug:e.slug}));s()}catch(L){r.error(L.message)}finally{c(!1)}};return l.jsx(ma,{open:!0,onClose:n,title:d?C("base.defaults_new_title"):C("base.defaults_edit_title",{slug:e.slug}),description:d?C("base.defaults_new_desc"):e.source==="bundled"?C("base.defaults_bundled_desc"):C("base.defaults_user_desc"),size:"lg",footer:l.jsxs(l.Fragment,{children:[l.jsx(he,{variant:"ghost",onClick:n,disabled:i,children:C("common.cancel")}),l.jsx(he,{variant:"primary",onClick:I,loading:i,children:C("common.save")})]}),children:l.jsxs("div",{className:"space-y-3",children:[d&&l.jsx(fe,{label:"slug",hint:"kebab-case, ej. reviewer, my-agent, content-writer",children:l.jsx(Ce,{autoFocus:!0,value:f,onChange:B=>g(B.target.value),placeholder:"reviewer"})}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(fe,{label:"role",children:l.jsx(Ce,{value:m,onChange:B=>h(B.target.value),placeholder:"Code reviewer"})}),l.jsx(fe,{label:"model",children:l.jsx(Ce,{value:x,onChange:B=>y(B.target.value),placeholder:"openrouter:..."})}),l.jsx(fe,{label:"language",children:l.jsx(Ce,{value:_,onChange:B=>j(B.target.value),placeholder:"es"})}),l.jsx(fe,{label:"is_master",children:l.jsx("div",{className:"flex h-9 items-center",children:l.jsx(sn,{checked:A,onChange:M,label:C("base.defaults_master_label")})})})]}),l.jsx(fe,{label:"description",children:l.jsx(Ce,{value:w,onChange:B=>S(B.target.value)})}),l.jsx(fe,{label:"skills",hint:"separadas por coma",children:l.jsx(Ce,{value:E,onChange:B=>k(B.target.value),placeholder:"code-review, git"})}),l.jsx(fe,{label:"tools",hint:"separadas por coma",children:l.jsx(Ce,{value:N,onChange:B=>R(B.target.value),placeholder:"read, write, run"})}),l.jsx(fe,{label:"body",hint:"markdown — extiende el system prompt del agente",children:l.jsx(Qt,{value:O,onChange:B=>U(B.target.value),rows:10,placeholder:"# Mission\\n..."})})]})})}const FO={apx:"success",claude:"info",codex:"warning"};function XO(){const[e,n]=v.useState(""),s=Qe(`/sessions?engine=${e}`,()=>W3.global(e||void 0)),r=s.data?.sessions||[];return l.jsxs(He,{title:C("base.sessions_title"),description:C("base.sessions_desc"),action:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"w-40",children:l.jsx(Ct,{value:e,onChange:n,options:[{value:"",label:C("base.sessions_all")},{value:"apx",label:"apx"},{value:"claude",label:"claude"},{value:"codex",label:"codex"}]})}),l.jsx(he,{size:"sm",variant:"secondary",onClick:()=>s.mutate(),children:l.jsx(rl,{size:13})})]}),children:[s.isLoading&&l.jsx(Je,{}),s.error&&l.jsx(lt,{children:C("base.sessions_error",{msg:s.error.message})}),!s.isLoading&&!s.error&&r.length===0&&l.jsx(lt,{children:C("base.sessions_empty")}),l.jsx("ul",{className:"space-y-1 text-sm",children:r.map((i,c)=>l.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[l.jsx(Ue,{tone:FO[i.engine]||"muted",children:i.engine}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("div",{className:"truncate",children:i.title||i.id}),l.jsx("div",{className:"truncate font-mono text-[10px] text-muted-fg",children:i.cwd})]}),i.mtime>0&&l.jsx("span",{className:"shrink-0 text-[11px] text-muted-fg",children:new Date(i.mtime).toLocaleString()})]},`${i.engine}-${i.id}-${c}`))})]})}function KO(){const e=Ua(),[n,s]=v.useState("open"),r=Qe(`/tasks?state=${n}`,()=>lr.global(n));return l.jsxs(He,{title:C("project.global_tasks.title"),description:C("project.global_tasks.subtitle"),action:l.jsx("div",{className:"flex gap-1",children:["open","done","dropped","all"].map(i=>l.jsx(he,{size:"sm",variant:n===i?"primary":"ghost",onClick:()=>s(i),children:i},i))}),children:[r.isLoading&&l.jsx(Je,{}),!r.isLoading&&(r.data?.length??0)===0&&l.jsx(lt,{children:C("project.global_tasks.empty")}),l.jsx("ul",{className:"space-y-2 text-sm",children:(r.data||[]).map(i=>l.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[l.jsx("button",{type:"button",onClick:()=>e(`/p/${i.project_id}/tasks`),title:C("project.global_tasks.go_project"),children:l.jsx(Ue,{tone:"info",children:(i.project_name||"").split("/").pop()||i.project_id})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("div",{className:"font-medium",children:i.title}),l.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[l.jsx("span",{children:i.state}),i.agent&&l.jsxs(Ue,{tone:"muted",children:["@",i.agent]}),i.tags?.map(c=>l.jsxs("span",{children:["#",c]},c)),i.due&&l.jsxs("span",{children:[C("project.global_tasks.due")," ",i.due]})]})]})]},`${i.project_id}-${i.id}`))})]})}const Jw=v.createContext(void 0);function xx(){const e=v.useContext(Jw);if(e===void 0)throw new Error(Nn(64));return e}let QO=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const bx={tabActivationDirection:e=>({[QO.activationDirection]:e})},ZO=v.forwardRef(function(n,s){const{className:r,defaultValue:i=0,onValueChange:c,orientation:d="horizontal",render:f,value:g,style:m,...h}=n,x=n.defaultValue!==void 0,y=v.useRef([]),[w,S]=v.useState(()=>new Map),[_,j]=Gi({controlled:g,default:i,name:"Tabs",state:"value"}),E=g!==void 0,[k,N]=v.useState(()=>new Map),R=v.useCallback(oe=>{if(oe===void 0)return null;for(const[ue,te]of k.entries())if(te!=null&&oe===(te.value??te.index))return ue;return null},[k]),[A,M]=v.useState(()=>({previousValue:_,tabActivationDirection:"none"})),{previousValue:O,tabActivationDirection:U}=A;let I=U,B=!1;O!==_&&(I=G1(O,_,d,k),B=O!=null&&_!=null&&R(_)==null);const L=B?O:_,D=O!==L||U!==I;Re(()=>{D&&M({previousValue:L,tabActivationDirection:I})},[L,D,I]);const q=Ae((oe,ue)=>{const te=G1(_,oe,d,k);ue.activationDirection=te,c?.(oe,ue),!ue.isCanceled&&j(oe)}),F=Ae((oe,ue)=>{c?.(oe,tt(ue,void 0,void 0,{activationDirection:"none"}))}),Z=Ae((oe,ue)=>{S(te=>{if(te.get(oe)===ue)return te;const Ne=new Map(te);return Ne.set(oe,ue),Ne})}),H=Ae((oe,ue)=>{S(te=>{if(!te.has(oe)||te.get(oe)!==ue)return te;const Ne=new Map(te);return Ne.delete(oe),Ne})}),G=v.useCallback(oe=>w.get(oe),[w]),Q=v.useCallback(oe=>{for(const ue of k.values())if(oe===ue?.value)return ue?.id},[k]),V=v.useMemo(()=>({getTabElementBySelectedValue:R,getTabIdByPanelValue:Q,getTabPanelIdByValue:G,onValueChange:q,orientation:d,registerMountedTabPanel:Z,setTabMap:N,unregisterMountedTabPanel:H,tabActivationDirection:I,value:_}),[R,Q,G,q,d,Z,N,H,I,_]),Y=v.useMemo(()=>{for(const oe of k.values())if(oe!=null&&oe.value===_)return oe},[k,_]),P=v.useMemo(()=>{for(const oe of k.values())if(oe!=null&&!oe.disabled)return oe.value},[k]),K=v.useRef(!x),$=v.useRef(x),W=v.useRef(!1);Re(()=>{if(E)return;function oe($e,be){j($e),M(Se=>Se.previousValue===$e&&Se.tabActivationDirection==="none"?Se:{previousValue:$e,tabActivationDirection:"none"}),F($e,be),K.current=!1}if(k.size===0){if(!W.current||_===null)return;oe(null,H0);return}W.current=!0;const ue=Y?.disabled,te=Y==null&&_!==null;if(!ue&&_===i&&($.current=!1),$.current&&ue&&_===i)return;const Ne=K.current;if(ue||te){const $e=P??null;if(_===$e){K.current=!1;return}let be=H0;Ne?be=q0:ue&&(be=Ij),oe($e,be);return}Ne&&Y!=null&&(F(_,q0),K.current=!1)},[i,P,E,F,Y,j,k,_]);const ie=Lt("div",n,{state:{orientation:d,tabActivationDirection:I},ref:s,props:h,stateAttributesMapping:bx});return l.jsx(Jw.Provider,{value:V,children:l.jsx(mx,{elementsRef:y,children:ie})})});function G1(e,n,s,r){if(e==null||n==null)return"none";let i=null,c=null;for(const[g,m]of r.entries()){if(m==null)continue;const h=m.value??m.index;if(e===h&&(i=g),n===h&&(c=g),i!=null&&c!=null)break}if(i==null||c==null)return i!==c&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof n?s==="horizontal"?n>e?"right":"left":n>e?"down":"up":"none";const d=i.getBoundingClientRect(),f=c.getBoundingClientRect();if(s==="horizontal"){if(f.left<d.left)return"left";if(f.left>d.left)return"right"}else{if(f.top<d.top)return"up";if(f.top>d.top)return"down"}return"none"}const Ww="data-composite-item-active";function JO(e={}){const{highlightItemOnHover:n,highlightedIndex:s,onHighlightedIndexChange:r}=uw(),{ref:i,index:c}=gx(e),d=s===c,f=v.useRef(null),g=Ts(i,f);return{compositeProps:v.useMemo(()=>({tabIndex:d?0:-1,onFocus(){r(c)},onMouseMove(){const h=f.current;if(!n||!h)return;const x=h.hasAttribute("disabled")||h.ariaDisabled==="true";!d&&!x&&h.focus()}}),[d,r,c,n]),compositeRef:g,index:c}}const e2=v.createContext(void 0);function WO(){const e=v.useContext(e2);if(e===void 0)throw new Error(Nn(65));return e}const ez=v.forwardRef(function(n,s){const{className:r,disabled:i=!1,render:c,value:d,id:f,nativeButton:g=!0,style:m,...h}=n,{value:x,getTabPanelIdByValue:y,orientation:w}=xx(),{activateOnFocus:S,highlightedTabIndex:_,onTabActivation:j,registerTabResizeObserverElement:E,setHighlightedTabIndex:k,tabsListElement:N}=WO(),R=br(f),A=v.useMemo(()=>({disabled:i,id:R,value:d}),[i,R,d]),{compositeProps:M,compositeRef:O,index:U}=JO({metadata:A}),I=d===x,B=v.useRef(!1),L=v.useRef(null);v.useEffect(()=>{const K=L.current;if(K)return E(K)},[E]),Re(()=>{if(B.current){B.current=!1;return}if(!(I&&U>-1&&_!==U))return;const K=N;if(K!=null){const $=zn(xt(K));if($&&Ye(K,$))return}i||k(U)},[I,U,_,k,i,N]);const{getButtonProps:D,buttonRef:q}=ml({disabled:i,native:g,focusableWhenDisabled:!0}),F=y(d),Z=v.useRef(!1),H=v.useRef(!1);function G(K){I||i||j(d,tt(Ns,K.nativeEvent,void 0,{activationDirection:"none"}))}function Q(K){I||(U>-1&&!i&&k(U),!i&&S&&(!Z.current||Z.current&&H.current)&&j(d,tt(Ns,K.nativeEvent,void 0,{activationDirection:"none"})))}function V(K){if(I||i)return;Z.current=!0;function $(){Z.current=!1,H.current=!1}(!K.button||K.button===0)&&(H.current=!0,xt(K.currentTarget).addEventListener("pointerup",$,{once:!0}))}return Lt("button",n,{state:{disabled:i,active:I,orientation:w},ref:[s,q,O,L],props:[M,{role:"tab","aria-controls":F,"aria-selected":I,id:R,onClick:G,onFocus:Q,onPointerDown:V,[Ww]:I?"":void 0,onKeyDownCapture(){B.current=!0}},h,D]})});let tz=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e[e.startingStyle=Xr.startingStyle]="startingStyle",e[e.endingStyle=Xr.endingStyle]="endingStyle",e})({});const nz={...bx,...dl},az=v.forwardRef(function(n,s){const{className:r,value:i,render:c,keepMounted:d=!1,style:f,...g}=n,{value:m,getTabIdByPanelValue:h,orientation:x,tabActivationDirection:y,registerMountedTabPanel:w,unregisterMountedTabPanel:S}=xx(),_=br(),j=v.useMemo(()=>({id:_,value:i}),[_,i]),{ref:E,index:k}=gx({metadata:j}),N=i===m,{mounted:R,transitionStatus:A,setMounted:M}=tc(N),O=!R,U=h(i),I={hidden:O,orientation:x,tabActivationDirection:y,transitionStatus:A},B=v.useRef(null),L=Lt("div",n,{state:I,ref:[s,E,B],props:[{"aria-labelledby":U,hidden:O,id:_,role:"tabpanel",tabIndex:N?0:-1,inert:Kh(!N),[tz.index]:k},g],stateAttributesMapping:nz});return xr({open:N,ref:B,onComplete(){N||M(!1)}}),Re(()=>{if(!(O&&!d)&&_!=null)return w(i,_),()=>{S(i,_)}},[O,d,i,_,w,S]),d||R?L:null});function sz(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}const rz=[];function oz(e){const{itemSizes:n,cols:s=1,loopFocus:r=!0,onLoop:i,dense:c=!1,orientation:d="both",direction:f,highlightedIndex:g,onHighlightedIndexChange:m,rootRef:h,enableHomeAndEndKeys:x=!1,stopEventPropagation:y=!1,disabledIndices:w,modifierKeys:S=rz}=e,[_,j]=v.useState(0),E=s>1,k=v.useRef(null),N=Ts(k,h),R=v.useRef([]),A=v.useRef(!1),M=g??_,O=Ae((L,D=!1)=>{if((m??j)(L),D){const q=R.current[L];z1(k.current,q,f,d)}}),U=Ae(L=>{if(L.size===0||A.current)return;A.current=!0;const D=Array.from(L.keys()),q=D.find(Z=>Z?.hasAttribute(Ww))??null,F=q?D.indexOf(q):-1;F!==-1&&O(F),z1(k.current,q,f,d)}),I=Ae((L,D,q)=>i?i?.(L,D,q,R):q),B=v.useMemo(()=>({"aria-orientation":d==="both"?void 0:d,ref:N,onFocus(L){const D=k.current,q=En(L.nativeEvent);!D||q==null||!O1(q)||q.setSelectionRange(0,q.value.length??0)},onKeyDown(L){const D=x?ix:jw;if(!D.has(L.key)||lz(L,S)||!k.current)return;const F=f==="rtl",Z=F?hd:Mi,H={horizontal:Z,vertical:Ho,both:Z}[d],G=F?Mi:hd,Q={horizontal:G,vertical:Ai,both:G}[d],V=En(L.nativeEvent);if(V!=null&&O1(V)&&!sz(V)){const ie=V.selectionStart,oe=V.selectionEnd,ue=V.value??"";if(ie==null||L.shiftKey||ie!==oe||L.key!==Q&&ie<ue.length||L.key!==H&&ie>0)return}let Y=M;const P=Gu(R,w),K=Lg(R,w);if(E){const ie=n||Array.from({length:R.current.length},()=>({width:1,height:1})),oe=Xj(ie,s,c),ue=oe.findIndex(Ne=>Ne!=null&&!Cs(R.current,Ne,w)),te=oe.reduce((Ne,$e,be)=>$e!=null&&!Cs(R.current,$e,w)?be:Ne,-1);Y=oe[Fj(oe.map(Ne=>Ne!=null?R.current[Ne]:null),{event:L,orientation:d,loopFocus:r,onLoop:I,cols:s,disabledIndices:Qj([...w||R.current.map((Ne,$e)=>Cs(R.current,$e)?$e:void 0),void 0],oe),minIndex:ue,maxIndex:te,prevIndex:Kj(M>K?P:M,ie,oe,s,L.key===Ho?"bl":L.key===Mi?"tr":"tl"),rtl:F})]}const $={horizontal:[Z],vertical:[Ho],both:[Z,Ho]}[d],W={horizontal:[G],vertical:[Ai],both:[G,Ai]}[d],ce=E?D:{horizontal:x?X5:yw,vertical:x?K5:_w,both:D}[d];x&&(L.key===Yd?Y=P:L.key===Fd&&(Y=K)),Y===M&&($.includes(L.key)||W.includes(L.key))&&(r&&Y===K&&$.includes(L.key)?(Y=P,i&&(Y=i(L,M,Y,R))):r&&Y===P&&W.includes(L.key)?(Y=K,i&&(Y=i(L,M,Y,R))):Y=On(R.current,{startingIndex:Y,decrement:W.includes(L.key),disabledIndices:w})),Y!==M&&!Vi(R.current,Y)&&(y&&L.stopPropagation(),ce.has(L.key)&&L.preventDefault(),O(Y,!0),queueMicrotask(()=>{R.current[Y]?.focus()}))}}),[s,c,f,w,R,x,M,E,n,r,i,I,N,S,O,d,y]);return v.useMemo(()=>({props:B,highlightedIndex:M,onHighlightedIndexChange:O,elementsRef:R,disabledIndices:w,onMapChange:U,relayKeyboardEvent:B.onKeyDown}),[B,M,O,R,w,U])}function lz(e,n){for(const s of e4.values())if(!n.includes(s)&&e.getModifierState(s))return!0;return!1}function iz(e){const{render:n,className:s,style:r,refs:i=Ui,props:c=Ui,state:d=an,stateAttributesMapping:f,highlightedIndex:g,onHighlightedIndexChange:m,orientation:h,dense:x,itemSizes:y,loopFocus:w,onLoop:S,cols:_,enableHomeAndEndKeys:j,onMapChange:E,stopEventPropagation:k=!0,rootRef:N,disabledIndices:R,modifierKeys:A,highlightItemOnHover:M=!1,tag:O="div",...U}=e,I=Fh(),{props:B,highlightedIndex:L,onHighlightedIndexChange:D,elementsRef:q,onMapChange:F,relayKeyboardEvent:Z}=oz({itemSizes:y,cols:_,loopFocus:w,onLoop:S,dense:x,orientation:h,highlightedIndex:g,onHighlightedIndexChange:m,rootRef:N,stopEventPropagation:k,enableHomeAndEndKeys:j,direction:I,disabledIndices:R,modifierKeys:A}),H=Lt(O,e,{state:d,ref:i,props:[B,...c,U],stateAttributesMapping:f}),G=v.useMemo(()=>({highlightedIndex:L,onHighlightedIndexChange:D,highlightItemOnHover:M,relayKeyboardEvent:Z}),[L,D,M,Z]);return l.jsx(cw.Provider,{value:G,children:l.jsx(mx,{elementsRef:q,onMapChange:Q=>{E?.(Q),F(Q)},children:H})})}const cz=v.forwardRef(function(n,s){const{activateOnFocus:r=!1,className:i,loopFocus:c=!0,render:d,style:f,...g}=n,{onValueChange:m,orientation:h,value:x,setTabMap:y,tabActivationDirection:w}=xx(),[S,_]=v.useState(0),[j,E]=v.useState(null),k=v.useRef(new Set),N=v.useRef(new Set),R=v.useRef(null);v.useEffect(()=>{if(typeof ResizeObserver>"u")return;const L=new ResizeObserver(()=>{k.current.forEach(D=>{D()})});return R.current=L,j&&L.observe(j),N.current.forEach(D=>{L.observe(D)}),()=>{L.disconnect(),R.current=null}},[j]);const A=Ae(L=>(k.current.add(L),()=>{k.current.delete(L)})),M=Ae(L=>(N.current.add(L),R.current?.observe(L),()=>{N.current.delete(L),R.current?.unobserve(L)})),O=Ae((L,D)=>{L!==x&&m(L,D)}),U={orientation:h,tabActivationDirection:w},I={"aria-orientation":h==="vertical"?"vertical":void 0,role:"tablist"},B=v.useMemo(()=>({activateOnFocus:r,highlightedTabIndex:S,registerIndicatorUpdateListener:A,registerTabResizeObserverElement:M,onTabActivation:O,setHighlightedTabIndex:_,tabsListElement:j}),[r,S,A,M,O,_,j]);return l.jsx(e2.Provider,{value:B,children:l.jsx(iz,{render:d,className:i,style:f,state:U,refs:[s,E],props:[I,g],stateAttributesMapping:bx,highlightedIndex:S,enableHomeAndEndKeys:!0,loopFocus:c,orientation:h,onHighlightedIndexChange:_,onMapChange:y,disabledIndices:Ui})})});function Xd({className:e,...n}){return l.jsx(ZO,{"data-slot":"tabs",className:Pt("flex flex-col gap-4",e),...n})}const uz=sx("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 Kd({className:e,variant:n="default",...s}){return l.jsx(cz,{"data-slot":"tabs-list","data-variant":n,className:Pt(uz({variant:n}),e),...s})}function Da({className:e,...n}){return l.jsx(ez,{"data-slot":"tabs-trigger",className:Pt("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),...n})}function La({className:e,...n}){return l.jsx(az,{"data-slot":"tabs-content",className:Pt("text-sm outline-none",e),...n})}function Y1(e,n){let s=e;for(const r of n.split(".")){if(!s||typeof s!="object"||Array.isArray(s))return;s=s[r]}return s}function vx(e,n=""){const s={};for(const[r,i]of Object.entries(e)){const c=n?`${n}.${r}`:r;i&&typeof i=="object"&&!Array.isArray(i)?Object.assign(s,vx(i,c)):s[c]=i}return s}function dz(e){const n=JSON.parse(e);if(!n||typeof n!="object"||Array.isArray(n))throw new Error("JSON debe ser objeto.");return n}function Zg({sections:e,source:n,placeholderSource:s,jsonTitle:r,jsonDescription:i,saveLabel:c="Guardar",onSaveFields:d,onSaveJson:f,busy:g}){const m=e[0]?.key||"json",[h,x]=v.useState({}),[y,w]=v.useState(""),[S,_]=v.useState("");v.useEffect(()=>{const N={};for(const R of e.flatMap(A=>A.fields))N[R.path]=Y1(n,R.path)??"";x(N),w(JSON.stringify(n||{},null,2)),_("")},[n,e]);const j=v.useMemo(()=>new Set(e.flatMap(N=>N.fields.map(R=>R.path))),[e]),E=async()=>{const N={},R=[];for(const A of e.flatMap(M=>M.fields)){const M=h[A.path];if(!za(M)){if(M===""||M===void 0||M===null){R.push(A.path);continue}if(A.kind==="number"){const O=Number(M);Number.isFinite(O)&&(N[A.path]=O)}else N[A.path]=M}}await d(N,R.filter(A=>j.has(A)))},k=async()=>{_("");try{await f(dz(y))}catch(N){_(N.message)}};return l.jsxs(Xd,{defaultValue:m,className:"space-y-4",children:[l.jsxs(Kd,{className:"flex flex-wrap",children:[e.map(N=>l.jsx(Da,{value:N.key,children:N.label},N.key)),l.jsx(Da,{value:"json",children:"JSON"})]}),e.map(N=>l.jsx(La,{value:N.key,children:l.jsxs("div",{className:"space-y-4",children:[N.description&&l.jsx("p",{className:"text-sm text-muted-fg",children:N.description}),l.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:N.fields.map(R=>l.jsx(fz,{field:R,value:h[R.path],inherited:Y1(s,R.path),onChange:A=>x(M=>({...M,[R.path]:A}))},R.path))}),l.jsx(he,{variant:"primary",loading:g,onClick:E,children:c})]})},N.key)),l.jsx(La,{value:"json",children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium",children:r}),i&&l.jsx("p",{className:"text-xs text-muted-fg",children:i})]}),l.jsx(Qt,{rows:18,className:"font-mono text-xs",value:y,onChange:N=>w(N.target.value)}),S&&l.jsx("p",{className:"text-xs text-destructive",children:S}),l.jsx(he,{variant:"primary",loading:g,onClick:k,children:"Guardar JSON"})]})})]})}function fz({field:e,value:n,inherited:s,onChange:r}){const i=e.placeholder||F1(s)||(za(n)?fr(n):""),c=e.hint||(s!==void 0?`Heredado: ${F1(s)}`:void 0);return e.kind==="boolean"?l.jsx("div",{className:"flex items-end pb-1",children:l.jsx(sn,{checked:n===!0,onChange:r,label:e.label})}):l.jsx(fe,{label:e.label,hint:c,children:e.kind==="select"?l.jsx(Ct,{value:String(n||""),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"?l.jsx(Qt,{rows:4,value:String(n||""),placeholder:i,onChange:d=>r(d.target.value)}):l.jsx(Ce,{type:e.kind==="password"?"password":e.kind==="number"?"number":"text",value:String(za(n)?"":n||""),placeholder:e.kind==="password"&&za(n)?fr(n):e.kind==="password"&&za(s)?fr(s):i,onChange:d=>r(d.target.value)})})}function F1(e){return e==null||e===""?"":za(e)?fr(e):Array.isArray(e)?e.join(", "):typeof e=="object"?JSON.stringify(e):String(e)}const mz=[{key:"routing",label:"Overrides",description:".apc/config.json. Sólo valores propios del proyecto; vacío hereda global/effective.",fields:[{path:"route_to_agent",label:"Route to agent",placeholder:"master"},{path:"super_agent.model",label:"Super-agent model"},{path:"super_agent.permission_mode",label:"Permission mode",kind:"select",options:xh.map(e=>({value:e,label:e}))},{path:"super_agent.system",label:"Prompt extra",kind:"textarea"}]},{key:"telegram",label:"Telegram",fields:[{path:"telegram.route_to_agent",label:"Route to agent"},{path:"telegram.chat_id",label:"Chat ID"},{path:"telegram.bot_token",label:"Bot token",kind:"password"},{path:"telegram.respond_with_engine",label:"Responder con engine",kind:"boolean"}]},{key:"engines",label:"Engines",fields:[{path:"engines.ollama.base_url",label:"Ollama URL"},{path:"engines.anthropic.api_key",label:"Anthropic API key",kind:"password"},{path:"engines.openai.api_key",label:"OpenAI API key",kind:"password"},{path:"engines.groq.api_key",label:"Groq API key",kind:"password"},{path:"engines.openrouter.api_key",label:"OpenRouter API key",kind:"password"},{path:"engines.gemini.api_key",label:"Gemini API key",kind:"password"}]}],pz=[{key:"identity",label:"Proyecto",description:".apc/project.json. Metadata APC portable; no secrets, no runtime.",fields:[{path:"name",label:"Name"},{path:"version",label:"Version"},{path:"apf",label:"APC spec"},{path:"apx",label:"APX install state"},{path:"apx_id",label:"APX storage id"}]}];function gz({pid:e}){const n=rt(),s=Qe(`/projects/${e}/config`,()=>Qn.config.show(e));if(s.isLoading)return l.jsx(Je,{});if(!s.data)return l.jsx(lt,{children:C("project.config.no_data")});const r=async c=>{await Qn.apcProject.put(e,c),n.success(C("project.config.save_project")),s.mutate()},i=async c=>{await Qn.config.put(e,c),n.success(C("project.config.save_override")),s.mutate()};return l.jsx("div",{className:"space-y-6",children:l.jsx(He,{title:C("project.config.section_title"),description:C("project.config.section_desc"),children:l.jsxs(Xd,{defaultValue:"override",className:"space-y-4",children:[l.jsxs(Kd,{children:[l.jsx(Da,{value:"override",children:"Override"}),l.jsx(Da,{value:"project",children:"APC project"}),l.jsx(Da,{value:"effective",children:"Effective"})]}),l.jsx(La,{value:"override",children:l.jsx(Zg,{sections:mz,source:s.data.project_only,placeholderSource:s.data.effective,jsonTitle:s.data.project_config_path,jsonDescription:".apc/config.json. Overrides del proyecto.",onSaveFields:async(c,d)=>{await Qn.config.set(e,c),d.length&&await Qn.config.unset(e,d),n.success(C("project.config.save_fields_success")),s.mutate()},onSaveJson:i})}),l.jsx(La,{value:"project",children:l.jsx(Zg,{sections:pz,source:s.data.apc_project||{},jsonTitle:s.data.project_json_path,jsonDescription:".apc/project.json. Metadata APC portable.",onSaveFields:async(c,d)=>{await Qn.apcProject.set(e,hz(c),d),n.success(C("project.config.save_meta_success")),s.mutate()},onSaveJson:r})}),l.jsx(La,{value:"effective",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-xs text-muted-fg",children:C("project.config.effective_read")}),l.jsx("pre",{className:"max-h-96 overflow-auto rounded-lg border border-border bg-muted/40 p-3 text-xs",children:JSON.stringify(s.data.effective,null,2)})]})})]})})})}function hz(e){const n={};for(const[s,r]of Object.entries(vx(e)))za(r)||(n[s]=r);return n}const xz=["","es","en","pt","fr","it","de"],X1=e=>e.split(",").map(n=>n.trim()).filter(Boolean);function t2(e){return e.is_master?{gradient:"from-violet-600 to-indigo-600",Icon:ks}:{gradient:"from-slate-600 to-gray-600",Icon:vn}}function bz(e){const n=e.filter(d=>d.is_master),s=n.length===1?n[0]:null,r=d=>d.parent?d.parent:s&&!d.is_master&&d.slug!==s.slug?s.slug:null,i=new Map,c=[];for(const d of e){const f=r(d);f&&e.some(g=>g.slug===f)?(i.has(f)||i.set(f,[]),i.get(f).push(d)):c.push(d)}return{roots:c,childrenByParent:i}}function vz({pid:e}){const n=Ua();rt();const s=Qe(`/projects/${e}/agents`,()=>Jt.list(e)),[r,i]=v.useState("hierarchy"),[c,d]=v.useState(!1),[f,g]=v.useState(!1),m=s.data||[],h=S=>n(`/p/${e}/agents/${S}`),x=S=>n(S?`/p/${e}/chat?agent=${S}`:`/p/${e}/chat`),{roots:y,childrenByParent:w}=v.useMemo(()=>bz(m),[m]);return l.jsxs(He,{title:C("project.agents.title"),description:C("project.agents.subtitle_full"),action:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("div",{className:"flex rounded-lg border border-border p-0.5",children:[l.jsxs("button",{onClick:()=>i("hierarchy"),className:Ie("flex items-center gap-1 rounded-md px-2 py-1 text-xs",r==="hierarchy"?"bg-accent text-accent-fg":"text-muted-fg"),children:[l.jsx(mh,{size:13})," ",C("project.agents.hierarchy")]}),l.jsxs("button",{onClick:()=>i("list"),className:Ie("flex items-center gap-1 rounded-md px-2 py-1 text-xs",r==="list"?"bg-accent text-accent-fg":"text-muted-fg"),children:[l.jsx(XR,{size:13})," ",C("project.agents.list_view")]})]}),l.jsxs(he,{size:"sm",variant:"ghost",onClick:()=>g(!0),children:[l.jsx(oN,{size:13})," ",C("project.agents.import")]}),l.jsxs(he,{size:"sm",variant:"secondary",onClick:()=>x(),children:[l.jsx(Za,{size:13})," ",C("project.agents.chat")]}),l.jsxs(he,{size:"sm",variant:"primary","data-testid":"agent-new",onClick:()=>d(!0),children:[l.jsx(Rn,{size:14})," ",C("project.agents.new")]})]}),children:[s.isLoading&&l.jsx(Je,{}),!s.isLoading&&m.length===0&&l.jsx(lt,{children:C("project.agents.empty_text")}),!s.isLoading&&m.length>0&&(r==="hierarchy"?l.jsx(_z,{roots:y,childrenByParent:w,onOpen:h,onChat:x}):l.jsx(jz,{agents:m,onOpen:h,onChat:x})),l.jsx(Sz,{open:c,pid:e,agents:m,onClose:()=>d(!1),onCreated:()=>{d(!1),s.mutate()}}),l.jsx(yz,{open:f,pid:e,existing:m.map(S=>S.slug),onClose:()=>g(!1),onImported:()=>s.mutate()})]})}function yz({open:e,onClose:n,onImported:s,pid:r,existing:i}){const c=rt(),d=Qe(e?"/agents/vault":null,()=>Jt.vault()),[f,g]=v.useState(""),m=d.data||[],h=async x=>{g(x);try{await Jt.import(r,x),c.success(C("project.agents.import_success",{slug:x})),s()}catch(y){c.error(y.message)}finally{g("")}};return l.jsxs(ma,{open:e,onClose:n,title:C("project.agents.import_title"),description:C("project.agents.import_desc"),size:"lg",footer:l.jsx(he,{variant:"ghost",onClick:n,children:C("common.close")}),children:[d.isLoading&&l.jsx(Je,{}),!d.isLoading&&m.length===0&&l.jsx(lt,{children:C("project.agents.import_empty")}),l.jsx("ul",{className:"space-y-2",children:m.map(x=>{const y=i.includes(x.slug);return l.jsxs("li",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted/30 p-3",children:[l.jsx(vn,{size:16,className:"shrink-0 text-muted-fg"}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("span",{className:"text-sm font-medium",children:x.slug}),x.is_master&&l.jsxs(Ue,{tone:"success",children:[l.jsx(ks,{size:9})," ",C("project.agents.orchestrator")]}),x.model&&l.jsx(Ue,{tone:"info",children:x.model})]}),x.description&&l.jsx("p",{className:"truncate text-xs text-muted-fg",children:x.description})]}),l.jsx(he,{size:"sm",variant:"primary",disabled:y||f===x.slug,loading:f===x.slug,onClick:()=>h(x.slug),children:C(y?"project.agents.import_already":"project.agents.import_btn")})]},x.slug)})})]})}function _z({roots:e,childrenByParent:n,onOpen:s,onChat:r}){return l.jsx("div",{className:"space-y-8",children:e.map(i=>{const c=n.get(i.slug)||[];return l.jsxs("div",{className:"flex flex-col items-center",children:[l.jsx(Yp,{agent:i,onOpen:s,onChat:r,wide:!0}),c.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-5 w-px bg-border"}),l.jsx("div",{className:"flex flex-wrap items-start justify-center gap-4 border-t border-border pt-5",children:c.map(d=>l.jsxs("div",{className:"flex flex-col items-center",children:[l.jsx(Yp,{agent:d,onOpen:s,onChat:r}),(n.get(d.slug)||[]).length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-4 w-px bg-border"}),l.jsx("div",{className:"flex flex-wrap justify-center gap-3 border-t border-border pt-4",children:(n.get(d.slug)||[]).map(f=>l.jsx(Yp,{agent:f,onOpen:s,onChat:r,compact:!0},f.slug))})]})]},d.slug))})]})]},i.slug)})})}function Yp({agent:e,onOpen:n,onChat:s,wide:r,compact:i}){const{gradient:c,Icon:d}=t2(e);return l.jsxs("div",{"data-testid":`agent-card-${e.slug}`,className:Ie("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:()=>n(e.slug),children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:Ie("flex size-8 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br",c),children:l.jsx(d,{className:"size-4 text-white"})}),l.jsx("span",{className:"truncate text-sm font-semibold",children:e.slug})]}),l.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1",children:[e.is_master&&l.jsxs(Ue,{tone:"success",children:[l.jsx(ks,{size:9})," ",C("project.agents.orchestrator")]}),e.role&&l.jsx(Ue,{children:e.role}),e.model&&!i&&l.jsx(Ue,{tone:"info",children:e.model})]}),l.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:[l.jsxs("button",{onClick:()=>n(e.slug),className:"flex items-center gap-1 hover:text-foreground",children:[l.jsx(fj,{size:12})," ",C("project.agents.view")]}),l.jsxs("button",{onClick:()=>s(e.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[l.jsx(Za,{size:12})," ",C("project.agents.chat")]})]})]})}function jz({agents:e,onOpen:n,onChat:s}){const r=[...e].sort((i,c)=>+!!c.is_master-+!!i.is_master||i.slug.localeCompare(c.slug));return l.jsx("div",{className:"space-y-2",children:r.map(i=>{const{gradient:c,Icon:d}=t2(i);return l.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:()=>n(i.slug),children:[l.jsx("div",{className:Ie("flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",c),children:l.jsx(d,{className:"size-4 text-white"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("span",{className:"text-sm font-semibold",children:i.slug}),i.is_master&&l.jsxs(Ue,{tone:"success",children:[l.jsx(ks,{size:10})," ",C("project.agents.orchestrator")]}),i.role&&l.jsx(Ue,{children:i.role}),i.model&&l.jsx(Ue,{tone:"info",children:i.model}),i.parent&&l.jsxs("span",{className:"text-[10px] text-violet-400",children:["↳ ",i.parent]})]}),i.description&&l.jsx("p",{className:"mt-1 truncate text-xs text-muted-fg",children:i.description}),l.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[i.skills?.map(f=>l.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[l.jsx(ol,{size:9})," ",f]},f)),i.tools?.map(f=>l.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[l.jsx(ll,{size:9})," ",f]},f))]})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-3 text-xs text-muted-fg",onClick:f=>f.stopPropagation(),children:[l.jsxs("button",{onClick:()=>n(i.slug),className:"flex items-center gap-1 hover:text-foreground",children:[l.jsx(fj,{size:12})," ",C("project.agents.view")]}),l.jsxs("button",{onClick:()=>s(i.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[l.jsx(Za,{size:12})," ",C("project.agents.chat")]})]})]},i.slug)})})}function Sz({open:e,onClose:n,onCreated:s,pid:r,agents:i}){const c=rt(),[d,f]=v.useState(""),[g,m]=v.useState(""),[h,x]=v.useState(""),[y,w]=v.useState(""),[S,_]=v.useState(""),[j,E]=v.useState(""),[k,N]=v.useState(""),[R,A]=v.useState(!1),[M,O]=v.useState(""),[U,I]=v.useState(!1),B=()=>{f(""),m(""),x(""),w(""),_(""),E(""),N(""),A(!1),O("")},L=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(d)){c.error(C("project.agents.slug_invalid"));return}I(!0);try{await Jt.create(r,{slug:d,role:g||void 0,model:h||void 0,language:y||void 0,description:S||void 0,skills:X1(j),tools:X1(k),is_master:R,parent:M||void 0}),c.success(C("project.agents.create_success",{slug:d})),s(),B()}catch(D){c.error(D?.message||C("project.agents.create_error"))}finally{I(!1)}};return l.jsx(ma,{open:e,onClose:n,title:C("project.agents.new_title"),description:C("project.agents.new_desc"),size:"lg",footer:l.jsxs(l.Fragment,{children:[l.jsx(he,{variant:"ghost",onClick:n,disabled:U,children:C("common.cancel")}),l.jsx(he,{variant:"primary","data-testid":"agent-create-submit",onClick:L,loading:U,children:C("common.create")})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(fe,{label:C("project.agents.slug_label"),children:l.jsx(Ce,{autoFocus:!0,"data-testid":"agent-slug",value:d,onChange:D=>f(D.target.value),placeholder:C("project.agents.slug_ph")})}),l.jsx(fe,{label:C("project.agents.role_label"),children:l.jsx(Ce,{value:g,onChange:D=>m(D.target.value),placeholder:C("project.agents.role_ph")})})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(fe,{label:C("project.agents.model_label"),hint:C("project.agents.model_hint"),children:l.jsx(Ce,{value:h,onChange:D=>x(D.target.value)})}),l.jsx(fe,{label:C("project.agents.lang_label"),children:l.jsx(Ct,{value:y,onChange:w,options:xz.map(D=>({value:D,label:D||"—"}))})})]}),l.jsx(fe,{label:C("project.agents.desc_label"),children:l.jsx(Qt,{rows:2,value:S,onChange:D=>_(D.target.value),placeholder:C("project.agents.desc_ph")})}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(fe,{label:C("project.agents.skills_label"),children:l.jsx(Ce,{value:j,onChange:D=>E(D.target.value),placeholder:C("project.agents.skills_ph")})}),l.jsx(fe,{label:C("project.agents.tools_label"),children:l.jsx(Ce,{value:k,onChange:D=>N(D.target.value),placeholder:C("project.agents.tools_ph")})})]}),l.jsxs("div",{className:"grid grid-cols-2 items-end gap-3",children:[l.jsx(fe,{label:C("project.agents.parent_label"),hint:C("project.agents.parent_hint"),children:l.jsx(Ct,{value:M,onChange:O,placeholder:C("project.agents.none_parent"),options:[{value:"",label:C("project.agents.none_parent")},...i.filter(D=>D.slug!==d).map(D=>({value:D.slug,label:D.slug}))]})}),l.jsx(sn,{checked:R,onChange:A,label:C("project.agents.master_label")})]})]})})}function Lu(e){return e.split(`
|
|
528
|
+
`).map(n=>n.trim()).filter(Boolean)}const $r={exec_agent:{label:"Agente del proyecto",desc:"Ejecuta un agente del proyecto con un prompt. Elegís cuál.",icon:vn},super_agent:{label:"Super-agente",desc:"Llama al super-agente de APX con un prompt.",icon:ks},telegram:{label:"Telegram",desc:"Manda un mensaje fijo a un canal de Telegram. No usa modelo ni agente.",icon:Za},shell:{label:"Shell",desc:"Corre un comando de shell. Sin prompt ni pre/post — el comando es la acción.",icon:Pi},heartbeat:{label:"Latido (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.",icon:Go}},wz=Object.keys($r).map(e=>({value:e,label:$r[e].label,description:$r[e].desc,icon:$r[e].icon}));function n2(e){if(!e)return"—";if(e.startsWith("every:")){const n=e.slice(6),s=n.match(/^(\d+)(s|m|h|d)$/);if(s){const r=s[1],i={s:"segundos",m:"minutos",h:"horas",d:"días"}[s[2]]||s[2];return`cada ${r} ${i}`}return`cada ${n}`}return e.startsWith("once:")?`una vez · ${new Date(e.slice(5)).toLocaleString()}`:e.startsWith("cron ")?`cron · ${e.slice(5)}`:e}const Cz=[{label:"cada 10 min",value:"every:10m"},{label:"cada hora",value:"every:1h"},{label:"diario 9am",value:"cron 0 9 * * *"},{label:"días hábiles 9am",value:"cron 0 9 * * 1-5"}],Ez=[{v:"{{pre_output}}",where:"prompt",desc:"Salida de los pre-commands, inyectada en el prompt."},{v:"$APX_LLM_OUTPUT",where:"post",desc:"Respuesta del agente / super-agente."},{v:"$APX_STATUS",where:"post",desc:"ok | error."},{v:"$APX_SKIPPED",where:"post",desc:"1 si la acción se salteó."},{v:"$APX_PRE_OUTPUT",where:"post",desc:"Salida de los pre-commands."},{v:"$APX_PRE_OUTPUT_FILE",where:"post",desc:"Archivo con la salida de pre (para outputs grandes)."},{v:"$APX_PRE_EXIT",where:"post",desc:"Exit code de los pre-commands."},{v:"$APX_ROUTINE",where:"pre/post",desc:"Nombre de la rutina."}];function kz(e,n){switch(e){case"exec_agent":return n.agent?`Ejecuta el agente "${n.agent}"`:"Ejecuta un agente (falta elegir)";case"super_agent":return"Llama al super-agente";case"telegram":return`Envía Telegram a "${n.channel||"default"}"`;case"shell":return n.command?`Corre: ${String(n.command).slice(0,40)}`:"Corre un comando shell";case"heartbeat":return"Deja un latido en logs"}}function Rz({pid:e}){const n=rt(),s=Qe(`/projects/${e}/routines`,()=>or.list(e)),[r,i]=v.useState(null),c=async g=>{try{await(g.enabled?or.disable:or.enable)(e,g.name),s.mutate()}catch(m){n.error(m?.message||C("project.routines.toggle_error"))}},d=async g=>{try{await or.run(e,g.name),n.success(C("project.routines.run_success",{name:g.name}))}catch(m){n.error(m?.message||C("project.routines.run_error"))}},f=async g=>{if(confirm(C("project.routines.delete_confirm",{name:g.name})))try{await or.remove(e,g.name),n.success(C("project.routines.delete_success")),s.mutate()}catch(m){n.error(m?.message||C("project.routines.delete_error"))}};return l.jsxs(He,{title:C("project.routines.title"),description:C("project.routines.subtitle"),action:l.jsxs(he,{size:"sm",variant:"primary",onClick:()=>i({kind:"super_agent",schedule:"every:10m",enabled:!0}),children:[l.jsx(Rn,{size:14})," ",C("project.routines.new_btn")]}),children:[s.isLoading&&l.jsx(Je,{}),!s.isLoading&&(s.data?.length??0)===0&&l.jsx(lt,{children:C("project.routines.empty")}),l.jsx("ul",{className:"space-y-2 text-sm",children:(s.data||[]).map(g=>{const m=$r[g.kind],h=m?.icon||Bi,x=g.last_status==="error";return l.jsxs("li",{className:"cursor-pointer rounded-xl border border-border bg-muted/30 p-3 hover:border-muted-fg/50",onClick:()=>i({...g}),children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:Ie("flex size-7 items-center justify-center rounded-lg",g.enabled?"bg-emerald-500/15 text-emerald-400":"bg-muted text-muted-fg"),children:l.jsx(h,{size:14})}),l.jsx("span",{className:"font-medium",children:g.name}),l.jsx(Ue,{tone:g.kind==="shell"?"warning":"info",children:m?.label||g.kind}),!g.enabled&&l.jsx(Ue,{tone:"muted",children:C("project.routines.paused")})]}),l.jsxs("div",{className:"flex items-center gap-2",onClick:y=>y.stopPropagation(),children:[l.jsx(sn,{checked:g.enabled,onChange:()=>c(g)}),l.jsxs(he,{size:"sm",variant:"secondary",onClick:()=>d(g),children:[l.jsx(pj,{size:13})," Run"]}),l.jsx(he,{size:"sm",variant:"destructive",onClick:()=>f(g),children:l.jsx(Ms,{size:13})})]})]}),l.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-fg",children:[l.jsxs("span",{children:["⏱ ",n2(g.schedule)]}),l.jsx("span",{children:kz(g.kind,g.spec||{})}),g.next_run_at&&l.jsxs("span",{children:[C("project.routines.next_run")," ",new Date(g.next_run_at).toLocaleString()]}),l.jsxs("span",{className:Ie(g.last_status==="ok"&&"text-emerald-500",x&&"text-destructive"),children:["última: ",g.last_status||"—"]})]}),g.last_error&&l.jsx("div",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1 text-xs text-destructive",children:g.last_error})]},g.name)})}),l.jsx(Nz,{draft:r,onClose:()=>i(null),onSaved:()=>{i(null),s.mutate()},pid:e})]})}function Nz({draft:e,onClose:n,onSaved:s,pid:r}){const i=rt(),c=Qe(e?`/projects/${r}/agents`:null,()=>Jt.list(r)),[d,f]=v.useState(!1),[g,m]=v.useState(""),[h,x]=v.useState("super_agent"),[y,w]=v.useState("every:10m"),[S,_]=v.useState(!0),[j,E]=v.useState(""),[k,N]=v.useState(""),[R,A]=v.useState("default"),[M,O]=v.useState(""),[U,I]=v.useState(""),[B,L]=v.useState(""),[D,q]=v.useState("heartbeat"),[F,Z]=v.useState(""),[H,G]=v.useState(""),[Q,V]=v.useState("");v.useEffect(()=>{if(!e)return;const te=e.spec&&typeof e.spec=="object"?e.spec:{};m(e.name||""),x(e.kind||"super_agent"),w(e.schedule||"every:10m"),_(e.enabled??!0),E(te.agent||""),N(te.prompt||""),A(te.channel||"default"),O(te.chat_id?String(te.chat_id):""),I(te.text||""),L(te.command||""),q(te.channel||"heartbeat"),Z(te.message||""),G((e.pre_commands||[]).join(`
|
|
529
|
+
`)),V((e.post_commands||[]).join(`
|
|
530
|
+
`))},[e]);const Y=()=>{switch(h){case"exec_agent":return{agent:j,prompt:k};case"super_agent":return{prompt:k};case"telegram":return{channel:R,...M?{chat_id:M}:{},text:U};case"shell":return{command:B};case"heartbeat":return{channel:D,message:F}}},P=async()=>{if(!g){i.error(C("project.routines.name_required"));return}f(!0);try{const te=h==="exec_agent"||h==="super_agent";await or.upsert(r,{name:g,kind:h,schedule:y,enabled:S,spec:Y(),pre_commands:te?Lu(H):[],post_commands:te?Lu(Q):[]}),i.success(C("project.routines.saved")),s()}catch(te){i.error(te?.message||C("project.routines.save_error"))}finally{f(!1)}},K=h==="exec_agent"||h==="super_agent",$=K?Lu(H):[],W=K?Lu(Q):[],ce=(()=>{switch(h){case"exec_agent":return j?`Agente "${j}" responde el prompt`:"Agente (elegí cuál) responde el prompt";case"super_agent":return"El super-agente responde el prompt";case"telegram":return`Manda Telegram al canal "${R}"`;case"shell":return B?`Corre: ${B.slice(0,48)}`:"Corre el comando shell";case"heartbeat":return"Deja un latido en logs"}})(),ie=K,oe=$r[h].icon,ue=[...$.map((te,Ne)=>({id:`pre-${Ne}`,icon:Pi,label:"Pre",detail:te,action:!1})),{id:"action",icon:oe,label:ce,detail:ie&&k?k.slice(0,90):void 0,action:!0},...W.map((te,Ne)=>({id:`post-${Ne}`,icon:Pi,label:"Post",detail:te,action:!1}))];return l.jsx(ma,{open:!!e,onClose:n,title:e?.name?C("project.routines.edit_title",{name:e.name}):C("project.routines.new_title"),description:C("project.routines.dialog_desc"),size:"xl",footer:l.jsxs(l.Fragment,{children:[l.jsx(he,{variant:"ghost",onClick:n,disabled:d,children:C("common.cancel")}),l.jsx(he,{variant:"primary",onClick:P,loading:d,children:C("common.save")})]}),children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 px-3 py-2",children:[l.jsx(sn,{checked:S,onChange:_,label:C("project.routines.enabled_label")}),l.jsx("span",{className:"text-[11px] text-muted-fg",children:C(S?"project.routines.enabled_hint":"project.routines.disabled_hint")})]}),l.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsx(fe,{label:C("project.routines.name_field"),hint:e?.name?C("project.routines.name_no_edit"):void 0,children:l.jsx(Ce,{value:g,disabled:!!e?.name,onChange:te=>m(te.target.value),placeholder:"resumen-diario"})}),l.jsx(fe,{label:C("project.routines.kind_field"),children:l.jsx(Ct,{value:h,onChange:te=>x(te),options:wz})}),l.jsx("p",{className:"-mt-1 text-[11px] text-muted-fg",children:$r[h].desc}),h==="exec_agent"&&l.jsx(fe,{label:C("project.routines.agent_field"),hint:C("project.routines.agent_hint"),children:l.jsx(Ct,{value:j,onChange:E,placeholder:c.isLoading?C("project.routines.agent_loading"):C("project.routines.agent_pick"),options:(c.data||[]).map(te=>({value:te.slug,label:te.slug,description:[te.role,te.model].filter(Boolean).join(" · ")||void 0}))})}),l.jsx(fe,{label:C("project.routines.schedule_field"),hint:C("project.routines.schedule_hint"),children:l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex flex-wrap gap-1",children:[Cz.map(te=>l.jsx("button",{type:"button",onClick:()=>w(te.value),className:Ie("rounded-md border px-2 py-0.5 text-[11px]",y===te.value?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:te.label},te.value)),l.jsx("button",{type:"button",onClick:()=>w("manual"),className:Ie("rounded-md border px-2 py-0.5 text-[11px]",y==="manual"?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:"Manual"})]}),l.jsx(Ce,{value:y,onChange:te=>w(te.target.value),placeholder:"every:10m · cron 0 9 * * 1-5 · once:ISO · manual"})]})})]}),l.jsxs("div",{className:"space-y-3",children:[K&&l.jsx(fe,{label:C("project.routines.pre_field"),hint:C("project.routines.pre_hint"),children:l.jsx(Qt,{rows:2,className:"font-mono text-xs",value:H,onChange:te=>G(te.target.value),placeholder:"curl -s https://wttr.in/Bariloche"})}),h==="exec_agent"&&l.jsx(fe,{label:C("project.routines.prompt_exec"),children:l.jsx(Qt,{rows:4,value:k,onChange:te=>N(te.target.value),placeholder:C("project.routines.prompt_exec_ph")})}),h==="super_agent"&&l.jsx(fe,{label:C("project.routines.prompt_super"),children:l.jsx(Qt,{rows:4,value:k,onChange:te=>N(te.target.value),placeholder:C("project.routines.prompt_super_ph")})}),h==="telegram"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(fe,{label:C("project.routines.tg_channel"),children:l.jsx(Ce,{value:R,onChange:te=>A(te.target.value),placeholder:"default"})}),l.jsx(fe,{label:C("project.routines.tg_chat_id"),children:l.jsx(Ce,{value:M,onChange:te=>O(te.target.value),placeholder:"(usa el del canal)"})})]}),l.jsx(fe,{label:C("project.routines.tg_text"),hint:C("project.routines.tg_text_hint"),children:l.jsx(Qt,{rows:8,value:U,onChange:te=>I(te.target.value),placeholder:"mensaje a enviar"})})]}),h==="shell"&&l.jsx(fe,{label:C("project.routines.shell_field"),hint:C("project.routines.shell_hint"),children:l.jsx(Qt,{rows:11,className:"font-mono text-xs",value:B,onChange:te=>L(te.target.value),placeholder:"cd /repo && git pull && npm test"})}),h==="heartbeat"&&l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(fe,{label:C("project.routines.hb_channel"),children:l.jsx(Ce,{value:D,onChange:te=>q(te.target.value),placeholder:"heartbeat"})}),l.jsx(fe,{label:C("project.routines.hb_message"),children:l.jsx(Ce,{value:F,onChange:te=>Z(te.target.value),placeholder:"sigo vivo"})})]}),K&&l.jsx(fe,{label:C("project.routines.post_field"),hint:C("project.routines.post_hint"),children:l.jsx(Qt,{rows:2,className:"font-mono text-xs",value:Q,onChange:te=>V(te.target.value),placeholder:'apx telegram send "$APX_LLM_OUTPUT"'})})]})]}),l.jsxs("div",{className:"rounded-lg border border-border bg-muted/10 p-3",children:[l.jsx("div",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:C("project.routines.vars_title")}),l.jsx("div",{className:"flex flex-wrap gap-1.5",children:Ez.map(te=>l.jsxs("span",{title:te.desc,className:"inline-flex items-center gap-1 rounded-md border border-border bg-card px-1.5 py-0.5 font-mono text-[10px]",children:[te.v,l.jsxs("span",{className:"not-italic text-muted-fg",children:["· ",te.where]})]},te.v))})]}),l.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[l.jsxs("div",{className:"mb-2 text-xs font-semibold text-muted-fg",children:[C("project.routines.what_happens")," ",l.jsxs("span",{className:"font-normal text-muted-fg",children:["· ⏱ ",n2(y)]})]}),l.jsx("div",{className:"flex flex-wrap items-stretch gap-2",children:ue.map((te,Ne)=>l.jsxs("div",{className:"flex items-stretch gap-2",children:[l.jsxs("div",{className:Ie("flex max-w-[240px] flex-col gap-1 rounded-lg border px-2.5 py-2",te.action?"border-emerald-500/40 bg-emerald-500/5":"border-border bg-card"),children:[l.jsxs("div",{className:Ie("flex items-center gap-1.5 text-[11px] font-medium",te.action?"text-emerald-400":"text-muted-fg"),children:[l.jsx(te.icon,{size:12})," ",te.label]}),te.detail&&l.jsx("div",{className:"line-clamp-2 font-mono text-[10px] text-muted-fg",children:te.detail})]}),Ne<ue.length-1&&l.jsx(ij,{size:14,className:"shrink-0 self-center text-muted-fg"})]},te.id))})]})]})})}function Tz({pid:e}){const[n,s]=v.useState("open"),r=rt(),i=Qe(`/projects/${e}/tasks?state=${n}`,()=>lr.list(e,n),{dedupingInterval:0,revalidateOnFocus:!0}),[c,d]=v.useState(""),[f,g]=v.useState(!1),m=async()=>{if(c.trim()){g(!0);try{await lr.add(e,{title:c.trim()}),d(""),r.success(C("project.tasks.created")),i.mutate()}catch(x){r.error(x?.message||C("project.tasks.create_error"))}finally{g(!1)}}},h=async(x,y)=>{try{await x(),r.success(y),i.mutate()}catch(w){r.error(w?.message||C("common.error_generic"))}};return l.jsxs(He,{title:C("project.tasks.title"),description:C("project.tasks.subtitle"),action:l.jsx("div",{className:"flex gap-1",children:["open","done","dropped"].map(x=>l.jsx(he,{size:"sm","data-testid":`task-filter-${x}`,variant:n===x?"primary":"ghost",onClick:()=>s(x),children:x},x))}),children:[l.jsxs("div",{className:"mb-4 flex items-end gap-2",children:[l.jsx(fe,{label:C("project.tasks.add_label"),children:l.jsx(Ce,{"data-testid":"task-input",placeholder:C("project.tasks.add_placeholder"),value:c,onChange:x=>d(x.target.value),onKeyDown:x=>{x.key==="Enter"&&m()}})}),l.jsxs(he,{variant:"primary","data-testid":"task-add",onClick:m,loading:f,children:[l.jsx(Rn,{size:14})," ",C("project.tasks.add")]})]}),i.isLoading&&l.jsx(Je,{}),!i.isLoading&&(i.data?.length??0)===0&&l.jsxs(lt,{children:[n==="open"?C("project.tasks.empty_open"):C("project.tasks.empty",{state:n})," ",l.jsx("code",{children:'apx task add "…"'})]}),l.jsx("ul",{className:"space-y-2 text-sm","data-testid":"task-list",children:(i.data||[]).map(x=>l.jsxs("li",{"data-testid":`task-${x.id}`,className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[l.jsx("span",{className:"mt-0.5 font-mono text-[10px] text-muted-fg",children:x.id}),l.jsxs("div",{className:"flex-1",children:[l.jsx("div",{className:"font-medium",children:x.title}),l.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[x.tags?.map(y=>l.jsxs(Ue,{children:["#",y]},y)),x.agent&&l.jsxs(Ue,{tone:"info",children:["@",x.agent]}),x.source&&l.jsxs("span",{children:[C("project.tasks.via")," ",x.source]}),x.due&&l.jsxs("span",{children:[C("project.tasks.due")," ",x.due]})]})]}),l.jsxs("div",{className:"flex gap-1",children:[n==="open"&&l.jsxs(l.Fragment,{children:[l.jsx(he,{size:"sm",variant:"secondary","aria-label":C("project.tasks.aria_done"),"data-testid":`task-done-${x.id}`,onClick:()=>h(()=>lr.done(e,x.id),C("project.tasks.done")),children:l.jsx(Li,{size:13})}),l.jsx(he,{size:"sm",variant:"destructive","aria-label":C("project.tasks.aria_drop"),"data-testid":`task-drop-${x.id}`,onClick:()=>h(()=>lr.drop(e,x.id),C("project.tasks.drop")),children:l.jsx(Ms,{size:13})})]}),n!=="open"&&l.jsx(he,{size:"sm",variant:"ghost","aria-label":C("project.tasks.aria_reopen"),"data-testid":`task-reopen-${x.id}`,onClick:()=>h(()=>lr.reopen(e,x.id),C("project.tasks.reopen")),children:l.jsx(gj,{size:13})})]})]},x.id))})]})}function Az({pid:e}){const n=rt(),s=Qe(`/projects/${e}/mcps`,()=>Ti.list(e)),r=Qe(`/projects/${e}/mcps/check`,()=>Ti.check(e)),[i,c]=v.useState(!1),d=async(f,g)=>{if(confirm(C("project.mcps.delete_confirm",{name:f,scope:g})))try{await Ti.remove(e,f,g),n.success(C("project.mcps.removed")),s.mutate()}catch(m){n.error(m?.message||C("common.error_generic"))}};return l.jsxs(He,{title:C("project.mcps.title"),description:C("project.mcps.subtitle"),action:l.jsxs(he,{size:"sm",variant:"primary",onClick:()=>c(!0),children:[l.jsx(Rn,{size:14})," ",C("project.mcps.new")]}),children:[r.data?.conflicts?.length?l.jsx("div",{className:"mb-3 rounded-md border border-amber-500/40 bg-amber-500/10 p-2 text-xs",children:C("project.mcps.conflicts",{names:r.data.conflicts.map(f=>f.name).join(", ")})}):null,s.isLoading&&l.jsx(Je,{}),!s.isLoading&&(s.data?.length??0)===0&&l.jsx(lt,{children:C("project.mcps.empty")}),l.jsx("ul",{className:"space-y-2 text-sm",children:(s.data||[]).map(f=>l.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[l.jsx("span",{className:"font-medium",children:f.name}),l.jsx(Ue,{tone:"info",children:f.source}),l.jsxs("span",{className:"ml-auto text-xs text-muted-fg",children:[f.transport," · ",f.enabled===!1?"disabled":"enabled"]}),l.jsx(he,{size:"sm",variant:"destructive",onClick:()=>d(f.name,f.source),children:l.jsx(Ms,{size:13})})]},`${f.source}-${f.name}`))}),l.jsx(Mz,{open:i,onClose:()=>c(!1),pid:e,onCreated:()=>{c(!1),s.mutate()}})]})}function Mz({open:e,onClose:n,pid:s,onCreated:r}){const i=rt(),[c,d]=v.useState(!1),[f,g]=v.useState("shared"),[m,h]=v.useState(""),[x,y]=v.useState("stdio"),[w,S]=v.useState(""),[_,j]=v.useState(""),[E,k]=v.useState(""),[N,R]=v.useState(""),[A,M]=v.useState(!0),O=async()=>{if(!m){i.error(C("project.mcps.name_required"));return}d(!0);try{let U;if(N.trim())try{U=JSON.parse(N)}catch{i.error(C("project.mcps.env_invalid")),d(!1);return}const I=x==="stdio"?{name:m,command:w,args:_?_.split(/\s+/):void 0,env:U,enabled:A}:{name:m,url:E,enabled:A};await Ti.add(s,f,I),i.success(C("project.mcps.added")),h(""),S(""),j(""),k(""),R(""),r()}catch(U){i.error(U?.message||C("common.error_generic"))}finally{d(!1)}};return l.jsx(ma,{open:e,onClose:n,title:C("project.mcps.new_title"),description:C("project.mcps.new_desc"),footer:l.jsxs(l.Fragment,{children:[l.jsx(he,{variant:"ghost",onClick:n,disabled:c,children:C("common.cancel")}),l.jsx(he,{variant:"primary",onClick:O,loading:c,children:C("project.mcps.add_btn")})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(fe,{label:C("project.mcps.scope_label"),children:l.jsx(Ct,{value:f,onChange:U=>g(U),options:[{value:"shared",label:"shared",description:".apc/mcps.json"},{value:"runtime",label:"runtime",description:"~/.apx, con secrets"},{value:"global",label:"global",description:"estilo ~/.claude/mcp.json"}]})}),l.jsx(fe,{label:C("project.mcps.transport_label"),children:l.jsx(Ct,{value:x,onChange:U=>y(U),options:[{value:"stdio",label:"stdio",description:"command"},{value:"http",label:"http",description:"url"}]})})]}),l.jsx(fe,{label:C("project.mcps.name_label"),children:l.jsx(Ce,{value:m,onChange:U=>h(U.target.value),placeholder:C("project.mcps.name_ph")})}),x==="stdio"?l.jsxs(l.Fragment,{children:[l.jsx(fe,{label:C("project.mcps.cmd_label"),children:l.jsx(Ce,{value:w,onChange:U=>S(U.target.value),placeholder:C("project.mcps.cmd_ph")})}),l.jsx(fe,{label:C("project.mcps.args_label"),hint:C("project.mcps.args_hint"),children:l.jsx(Ce,{value:_,onChange:U=>j(U.target.value),placeholder:C("project.mcps.args_ph")})}),l.jsx(fe,{label:C("project.mcps.env_label"),hint:'{"FOO":"bar"}',children:l.jsx(Qt,{rows:3,className:"font-mono text-xs",value:N,onChange:U=>R(U.target.value)})})]}):l.jsx(fe,{label:C("project.mcps.url_label"),children:l.jsx(Ce,{value:E,onChange:U=>k(U.target.value),placeholder:C("project.mcps.url_ph")})}),l.jsx(sn,{checked:A,onChange:M,label:C("project.mcps.enabled_label")})]})})}function Oz({pid:e}){const n=Qe(`/projects/${e}/agents`,()=>Jt.list(e)),[s,r]=v.useState(null),[i,c]=v.useState(null);return l.jsxs(He,{title:C("project.threads.title"),description:C("project.threads.subtitle"),children:[n.isLoading&&l.jsx(Je,{}),!n.isLoading&&(n.data?.length??0)===0&&l.jsx(lt,{children:C("project.threads.no_agents")}),l.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:[l.jsx("ul",{className:"space-y-1 md:col-span-1",children:(n.data||[]).map(d=>l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>r(d.slug),className:Ie("flex w-full items-center justify-between rounded-md px-2.5 py-1.5 text-sm",s===d.slug?"bg-accent text-accent-fg":"text-foreground hover:bg-accent/60"),children:[l.jsx("span",{children:d.slug}),d.model&&l.jsx(Ue,{tone:"info",children:d.model})]})},d.slug))}),l.jsx("div",{className:"md:col-span-2",children:s?l.jsx(zz,{pid:e,slug:s,onOpen:c}):l.jsx(lt,{children:C("project.threads.pick")})})]}),s&&i&&l.jsx(Dz,{pid:e,slug:s,id:i,onClose:()=>c(null)})]})}function zz({pid:e,slug:n,onOpen:s}){const r=Qe(`/projects/${e}/agents/${n}/conversations`,()=>nx.list(e,n));return r.isLoading?l.jsx(Je,{}):r.data?.length?l.jsx("ul",{className:"space-y-1 text-sm",children:r.data.map(i=>l.jsxs("li",{className:"cursor-pointer rounded-md border border-border bg-muted/30 px-3 py-2 hover:bg-accent/40",onClick:()=>s(i.id),children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"font-medium",children:i.title||i.filename}),l.jsx("span",{className:"text-xs text-muted-fg",children:new Date(i.started_at).toLocaleString()})]}),l.jsxs("div",{className:"mt-0.5 text-xs text-muted-fg",children:[i.channel&&l.jsxs(l.Fragment,{children:[C("project.threads.via")," ",i.channel," · "]}),i.messages??0," ",C("project.threads.messages")]})]},i.id))}):l.jsx(lt,{children:C("project.threads.empty",{slug:n})})}function Dz({pid:e,slug:n,id:s,onClose:r}){const i=Qe(`/projects/${e}/agents/${n}/conversations/${s}`,()=>nx.get(e,n,s));return l.jsxs(ma,{open:!0,onClose:r,title:C("project.threads.conversation_title",{id:s}),size:"lg",children:[i.isLoading&&l.jsx(Je,{}),i.data&&l.jsx("div",{className:"max-h-[60vh] space-y-3 overflow-y-auto pr-2",children:i.data.messages.map((c,d)=>l.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3 text-sm",children:[l.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs text-muted-fg",children:[l.jsxs("span",{className:"uppercase tracking-wide",children:[c.role,c.name?` (${c.name})`:""]}),c.ts&&l.jsx("span",{children:new Date(c.ts).toLocaleString()})]}),l.jsx("div",{className:"whitespace-pre-wrap",children:c.content})]},d))})]})}function yx({value:e,onValueChange:n,onSubmit:s,onStop:r,busy:i=!1,disabled:c=!1,placeholder:d,autoFocus:f,minRows:g=2,maxRows:m=8,footer:h,className:x}){const y=v.useRef(null);v.useLayoutEffect(()=>{const S=y.current;if(!S)return;S.style.height="auto";const _=parseFloat(getComputedStyle(S).lineHeight)||20,j=_*g,E=_*m;S.style.height=`${Math.min(Math.max(S.scrollHeight,j),E)}px`,S.style.overflowY=S.scrollHeight>E?"auto":"hidden"},[e,g,m]);const w=e.trim().length>0&&!c;return l.jsxs("div",{className:Pt("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",c&&"opacity-60",x),children:[l.jsx("textarea",{ref:y,rows:g,value:e,autoFocus:f,disabled:c,placeholder:d,onChange:S=>n(S.target.value),onKeyDown:S=>{if(S.key==="Enter"&&!S.shiftKey){if(S.preventDefault(),i||!w)return;s()}},className:"w-full resize-none bg-transparent px-2 pt-1 text-sm leading-relaxed outline-none placeholder:text-muted-foreground"}),l.jsxs("div",{className:"flex items-center justify-between gap-2 pl-1",children:[l.jsx("div",{className:"flex min-w-0 items-center gap-2 text-[11px] text-muted-foreground",children:h}),i&&r?l.jsx(Wo,{type:"button",size:"icon-sm",variant:"destructive",onClick:r,"aria-label":"Detener",title:"Detener",children:l.jsx(xj,{className:"size-3.5",fill:"currentColor"})}):l.jsx(Wo,{type:"button",size:"icon-sm",variant:"default",onClick:s,disabled:!w,"aria-label":"Enviar",title:"Enviar",children:l.jsx(_R,{className:"size-4"})})]})]})}function _x({value:e,onChange:n,disabled:s}){const[r,i]=v.useState(!1),[c,d]=v.useState(""),[f,g]=v.useState([]),[m,h]=v.useState(!1),x=v.useRef(null);v.useEffect(()=>{if(!r)return;const j=E=>{x.current&&!x.current.contains(E.target)&&i(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[r]),v.useEffect(()=>{if(!r||m)return;let j=!1;return(async()=>{try{const{engines:E}=await pd.list(),k=await Promise.all(E.map(N=>pd.models({engine:N}).then(R=>(R.models||[]).map(A=>A.includes(":")?A:`${N}:${A}`)).catch(()=>[])));if(!j){const N=Array.from(new Set(k.flat())).sort();g(N),h(!0)}}catch{j||h(!0)}})(),()=>{j=!0}},[r,m]);const y=c.trim().toLowerCase(),w=y?f.filter(j=>j.toLowerCase().includes(y)):f,S=e||"Auto",_=j=>{n(j),i(!1),d("")};return l.jsxs("div",{ref:x,className:"relative",children:[l.jsxs("button",{type:"button",disabled:s,onClick:()=>i(j=>!j),"data-testid":"chat-model-picker",className:Ie("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"),title:"Elegir modelo (o Auto)",children:[l.jsx(hj,{className:"size-3 shrink-0"}),l.jsx("span",{className:"truncate font-mono",children:S}),l.jsx(Zr,{className:"size-3 shrink-0 opacity-60"})]}),r&&l.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:[l.jsx("input",{autoFocus:!0,value:c,placeholder:"filtrar o escribir modelo…",onChange:j=>d(j.target.value),onKeyDown:j=>{j.key==="Enter"&&c.trim()&&_(c.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"}),l.jsxs("ul",{className:"max-h-56 overflow-y-auto",children:[l.jsx("li",{children:l.jsxs("button",{type:"button",onMouseDown:j=>{j.preventDefault(),_("")},className:Ie("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:[l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx(Cd,{className:"size-3"})," Auto (router decide)"]}),!e&&l.jsx(Li,{className:"size-3"})]})}),!m&&l.jsx("li",{className:"px-2 py-1 text-[11px] text-muted-fg",children:"cargando modelos…"}),m&&w.length===0&&c.trim()&&l.jsx("li",{children:l.jsxs("button",{type:"button",onMouseDown:j=>{j.preventDefault(),_(c.trim())},className:"w-full rounded-md px-2 py-1 text-left font-mono text-xs hover:bg-accent hover:text-accent-fg",children:["usar “",c.trim(),"”"]})}),w.map(j=>l.jsx("li",{children:l.jsxs("button",{type:"button",onMouseDown:E=>{E.preventDefault(),_(j)},className:Ie("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",j===e&&"bg-accent/50"),children:[l.jsx("span",{className:"truncate",children:j}),j===e&&l.jsx(Li,{className:"size-3 shrink-0"})]})},j))]})]})]})}function Lz({onSend:e,onStop:n,streaming:s,model:r,onModelChange:i}){const[c,d]=v.useState(""),f=()=>{const g=c.trim();g&&(d(""),e(g))};return l.jsx("div",{className:"border-t border-border bg-card/60 p-3",children:l.jsx(yx,{value:c,onValueChange:d,onSubmit:f,onStop:n,busy:s,placeholder:C("project.chat.placeholder"),maxRows:12,footer:i?l.jsx(_x,{value:r||"",onChange:i,disabled:s}):void 0})})}const Pz={read_file:{icon:MR,label:"Leer archivo"},write_file:{icon:AR,label:"Escribir archivo"},edit_file:{icon:Wu,label:"Editar archivo"},list_files:{icon:PR,label:"Listar archivos"},search_files:{icon:Vu,label:"Buscar en archivos"},search_messages:{icon:Vu,label:"Buscar mensajes"},tail_messages:{icon:Vu,label:"Últimos mensajes"},run_shell:{icon:Pi,label:"Ejecutar shell"},send_telegram:{icon:Za,label:"Enviar Telegram"},call_agent:{icon:vn,label:"Llamar agente"},call_mcp:{icon:tN,label:"Llamar MCP"},call_runtime:{icon:vn,label:"Llamar runtime"},create_task:{icon:FR,label:"Crear tarea"}},a2=new Set(["write_file","edit_file"]);function Bz(e){return Pz[e]||{icon:ll,label:e}}function Iz(e,n){if(!n)return"";const s=i=>typeof n[i]=="string"?n[i]:void 0,r=s("path")||s("file")||s("pattern")||s("query")||s("command")||s("slug")||s("name")||s("agent");return r?String(r):""}function K1(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Uz({status:e}){return e==="running"?l.jsx(ph,{className:"size-3 shrink-0 animate-spin text-sky-400"}):e==="error"?l.jsx(Cd,{className:"size-3 shrink-0 text-rose-400"}):e==="deduped"?l.jsx(NR,{className:"size-3 shrink-0 text-amber-400"}):l.jsx(Li,{className:"size-3 shrink-0 text-emerald-400"})}function Hz({part:e}){const[n,s]=v.useState(!1),{icon:r,label:i}=Bz(e.tool),c=Iz(e.tool,e.args),d=a2.has(e.tool),f=!!e.args||e.result!==void 0;return l.jsxs("div",{className:Ie("rounded-lg border bg-muted/30 text-[12px]",e.status==="error"?"border-rose-500/30":"border-border"),children:[l.jsxs("button",{type:"button",onClick:()=>f&&s(g=>!g),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left",children:[f?l.jsx(dh,{className:Ie("size-3 shrink-0 text-muted-foreground transition-transform",n&&"rotate-90")}):l.jsx("span",{className:"size-3 shrink-0"}),l.jsx(r,{className:Ie("size-3.5 shrink-0",d?"text-violet-400":"text-muted-foreground")}),l.jsx("span",{className:"shrink-0 font-medium",children:i}),c&&l.jsx("span",{className:"truncate font-mono text-muted-foreground",children:c}),l.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[e.status==="deduped"&&l.jsx("span",{className:"text-[10px] text-amber-400",children:"dedup"}),l.jsx(Uz,{status:e.status})]})]}),n&&f&&l.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&&l.jsxs("div",{children:[l.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:"args"}),l.jsx("pre",{className:"max-h-48 overflow-auto rounded-md bg-background/60 p-2 font-mono text-[11px] leading-relaxed text-foreground",children:K1(e.args)})]}),e.result!==void 0&&l.jsxs("div",{children:[l.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:"result"}),l.jsx("pre",{className:Ie("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:K1(e.result)})]})]})]})}function jx(e){return e.parts.filter(n=>n.kind==="text").map(n=>n.text).join(`
|
|
531
|
+
|
|
532
|
+
`).trim()}const qz=e=>[{kind:"text",text:e}];function Vz(e){if(!e||typeof e!="object")return!1;const n=e;return"error"in n&&!!n.error}function Sx(e,n){const s=r=>({...e,notes:[...e.notes||[],r]});switch(n.type){case"model_start":return n.model?{...e,model:n.model}:e;case"model_routed":{const r=n.model?{...e,model:n.model}:e;return n.from_fallback?{...r,notes:[...r.notes||[],`routing fell back → ${n.model}`]}:r}case"engine_failed":return s(`engine ${n.model||"?"} failed → ${n.retry_with||"retry"}`);case"model_retry":return s(`retry (${n.reason||"?"})`);case"tools_suppressed":return s(`tools suppressed: ${(n.tools||[]).join(", ")}`);case"assistant_text":return n.text?{...e,parts:[...e.parts,{kind:"text",text:n.text}]}:e;case"tool_start":return n.trace?{...e,parts:[...e.parts,{kind:"tool",id:n.trace.id,tool:n.trace.tool,args:n.trace.args,status:"running"}]}:e;case"tool_deduped":return n.trace?{...e,parts:e.parts.map(r=>r.kind==="tool"&&r.id===n.trace.id?{...r,status:"deduped"}:r)}:e;case"tool_result":if(!n.trace)return e;{const r=Vz(n.trace.result);return{...e,parts:e.parts.map(i=>i.kind==="tool"&&i.id===n.trace.id?{...i,result:n.trace.result,status:r?"error":i.status==="deduped"?"deduped":"done"}:i)}}case"final":return{...e,pending:!1,usage:n.result?.usage??e.usage,model:e.model??n.result?.name,parts:n.result?.text&&!e.parts.some(r=>r.kind==="text")?[...e.parts,{kind:"text",text:n.result.text}]:e.parts};default:{const r=n.delta||n.content||"";if(!r)return e;const i=[...e.parts],c=i[i.length-1];return c&&c.kind==="text"?i[i.length-1]={...c,text:c.text+r}:i.push({kind:"text",text:r}),{...e,parts:i}}}}function $z(e,n){const[s,r]=v.useState([]),[i,c]=v.useState(!1),d=v.useRef(null),f=v.useRef(void 0),g=v.useCallback(w=>{r(S=>{const _=[...S],j=_[_.length-1];return j&&j.role==="assistant"&&(_[_.length-1]=w(j)),_})},[]),m=v.useCallback(w=>{if(w.type==="error"){n?.(w.error||"stream error");return}g(S=>Sx(S,w))},[g,n]),h=v.useCallback(async(w,S={})=>{const _=w.trim();if(!_||i)return;const j=()=>new Date().toISOString(),E=s.map(N=>({role:N.role,content:jx(N)}));if(r(N=>[...N,{role:"user",parts:qz(_),ts:j()},{role:"assistant",parts:[],ts:j(),pending:!0}]),c(!0),S.agentSlug){try{const N=await Jt.chat(e,S.agentSlug,{prompt:_,conversation_id:f.current});f.current=N.conversation_id,g(R=>({...R,pending:!1,model:N.engine,parts:[{kind:"text",text:N.text}]}))}catch(N){n?.(N?.message||"fallo"),r(R=>R.filter((A,M)=>M!==R.length-1))}finally{c(!1)}return}const k=new AbortController;d.current=k;try{await rw.stream(e,{prompt:_,previousMessages:E,model:S.model||void 0,channel:"web"},m,k.signal),g(N=>({...N,pending:!1}))}catch(N){k.signal.aborted?g(R=>({...R,pending:!1,parts:[...R.parts,{kind:"text",text:"[detenido]"}]})):(n?.(N?.message||"stream falló"),r(R=>R.filter((A,M)=>M!==R.length-1)))}finally{c(!1),d.current=null}},[e,s,i,m,g,n]),x=v.useCallback(()=>d.current?.abort(),[]),y=v.useCallback(()=>{i||(f.current=void 0,r([]))},[i]);return{msgs:s,send:h,stop:x,clear:y,streaming:i}}function Gz({msg:e,onCopy:n}){const s=e.role==="user",r=jx(e),i=e.parts.some(c=>c.kind==="tool");return l.jsxs("div",{className:Ie("group flex items-start gap-2",s?"justify-end":"justify-start"),children:[!s&&l.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:l.jsx(vn,{size:14})}),l.jsxs("div",{className:Ie("flex min-w-0 flex-col gap-1.5",s?"items-end":"w-full max-w-[85%]"),children:[!s&&e.notes&&e.notes.length>0&&l.jsx("div",{className:"flex flex-col gap-0.5",children:e.notes.map((c,d)=>l.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-amber-400/80",children:[l.jsx(VR,{size:10})," ",c]},d))}),e.parts.map((c,d)=>c.kind==="tool"?l.jsx(Hz,{part:c},`${c.id}-${d}`):c.text?l.jsx("div",{className:Ie("whitespace-pre-wrap rounded-2xl px-3 py-2 text-sm leading-relaxed shadow-sm",s?"rounded-br-sm bg-primary text-primary-fg":"w-full rounded-bl-sm border border-border bg-card text-foreground"),children:c.text},d):null),!s&&e.pending&&e.parts.length===0&&l.jsx("div",{className:"rounded-2xl rounded-bl-sm border border-border bg-card px-3 py-2 text-sm text-muted-foreground",children:"…"}),l.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",children:[l.jsx("span",{children:Yz(e.ts)}),!s&&e.model&&l.jsxs("span",{className:"font-mono",children:["· ",e.model]}),!s&&i&&l.jsxs("span",{children:["· ",e.parts.filter(c=>c.kind==="tool").length," tools"]}),n&&r&&l.jsxs("button",{type:"button",onClick:()=>n(r),className:"inline-flex items-center gap-1 hover:text-foreground",title:"Copiar",children:[l.jsx(wg,{size:10})," copiar"]})]})]}),s&&l.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:l.jsx(vj,{size:14})})]})}function Yz(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function wx({msgs:e,onCopy:n}){const s=v.useRef(null);return v.useEffect(()=>{s.current?.scrollIntoView({behavior:"smooth",block:"end"})},[e]),e.length===0?l.jsx("div",{className:"grid h-full place-items-center p-6",children:l.jsx(lt,{children:C("project.chat.empty")})}):l.jsxs("div",{className:"space-y-4 px-3 py-4",children:[e.map((r,i)=>l.jsx(Gz,{msg:r,onCopy:n},i)),l.jsx("div",{ref:s})]})}function Fz(e){if(!e)return;const n=e.path??e.file??e.filename;return typeof n=="string"?n:void 0}function s2({msgs:e}){const[n,s]=v.useState(!1),{inTok:r,outTok:i,toolCount:c,changed:d,model:f}=v.useMemo(()=>{let m=0,h=0,x=0,y;const w=new Set,S=[];for(const _ of e)if(_.role==="assistant"){_.usage&&(m+=_.usage.input_tokens||0,h+=_.usage.output_tokens||0),_.model&&(y=_.model);for(const j of _.parts)if(j.kind==="tool"&&(x+=1,a2.has(j.tool)&&j.status!=="error")){const E=Fz(j.args);E&&!w.has(E)&&(w.add(E),S.push({path:E,tool:j.tool}))}}return{inTok:m,outTok:h,toolCount:x,changed:S,model:y}},[e]),g=r+i;return g===0&&c===0?null:l.jsxs("div",{className:"shrink-0 border-t border-border bg-card/40 text-[11px]",children:[l.jsxs("button",{type:"button",onClick:()=>d.length>0&&s(m=>!m),className:Ie("flex w-full items-center gap-3 px-4 py-1.5 text-muted-foreground",d.length>0&&"hover:text-foreground"),children:[l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx(wd,{size:12})," ",Fp(g)," tok",l.jsxs("span",{className:"text-muted-foreground/60",children:["(",Fp(r),"↑ / ",Fp(i),"↓)"]})]}),c>0&&l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx(ll,{size:12})," ",c," tools"]}),d.length>0&&l.jsxs("span",{className:"flex items-center gap-1 text-violet-400",children:[l.jsx(Wu,{size:12})," ",d.length," archivos"]}),f&&l.jsx("span",{className:"ml-auto font-mono text-muted-foreground/70",children:f}),d.length>0&&l.jsx(Zr,{className:Ie("size-3 shrink-0 transition-transform",n&&"rotate-180")})]}),n&&d.length>0&&l.jsx("ul",{className:"max-h-40 space-y-0.5 overflow-y-auto border-t border-border/60 px-4 py-2",children:d.map(m=>l.jsxs("li",{className:"flex items-center gap-2 font-mono text-[11px]",children:[l.jsx(Wu,{size:11,className:"shrink-0 text-violet-400"}),l.jsx("span",{className:"truncate",children:m.path}),l.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-muted-foreground/60",children:m.tool==="write_file"?"write":"edit"})]},m.path))})]})}function Fp(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const gi="__super_agent__";function Xz({pid:e}){const n=rt(),[s]=sj(),r=Qe(`/projects/${e}/agents`,()=>Jt.list(e)),[i,c]=v.useState(s.get("agent")||""),[d,f]=v.useState(!1),[g,m]=v.useState(""),{msgs:h,send:x,stop:y,clear:w,streaming:S}=$z(e,I=>n.error(I)),_=r.data||[],j=I=>I===gi,E=v.useMemo(()=>[{value:gi,label:"Roby (super-agent)"},..._.map(I=>({value:I.slug,label:I.slug}))],[_]),k=v.useMemo(()=>_.find(I=>I.slug===i)||_[0],[_,i]),N=j(i)?gi:k?.slug||gi,R=N===gi;v.useEffect(()=>{!i&&k?.slug&&c(k.slug)},[k?.slug,i]);const A=()=>w(),M=async I=>{!R&&!k||await x(I,{model:R?g:void 0,agentSlug:R?void 0:k.slug})},O=async I=>{try{await navigator.clipboard.writeText(I),n.info(C("project.chat.copied"))}catch{}};if(r.isLoading)return l.jsx(Je,{});const U=C(R?"project.chat.roby_subtitle":"project.chat.subtitle");return l.jsxs("div",{className:"flex h-[calc(100vh-11rem)] flex-col overflow-hidden rounded-xl border border-border bg-card/40",children:[l.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("h2",{className:"text-sm font-semibold",children:C(R?"project.chat.roby_title":"project.chat.title")}),l.jsx("p",{className:"truncate text-[11px] text-muted-fg",children:U})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"w-52",children:l.jsx(Ct,{value:N,onChange:I=>{c(I),A()},options:E})}),R?l.jsx(Ue,{tone:"success",children:"super-agent"}):k?.model&&l.jsx(Ue,{tone:"info",children:k.model}),!_.length&&!R&&l.jsxs(he,{variant:"primary",size:"sm",onClick:()=>f(!0),children:[l.jsx(Rn,{size:14})," ",C("project.chat.create_agent")]}),l.jsxs(he,{variant:"ghost",size:"sm",disabled:S||h.length===0,onClick:A,children:[l.jsx(Ms,{size:13})," ",C("project.chat.clear")]})]})]}),l.jsx("div",{className:"flex-1 overflow-y-auto",children:h.length?l.jsx(wx,{msgs:h,onCopy:O}):l.jsx(lt,{children:C("project.chat.empty")})}),l.jsx(s2,{msgs:h}),l.jsx(Lz,{onSend:M,onStop:y,streaming:S,model:R?g:void 0,onModelChange:R?m:void 0}),l.jsx(Kz,{open:d,pid:e,onClose:()=>f(!1),onCreated:()=>{f(!1),r.mutate()}})]})}function Kz({open:e,onClose:n,onCreated:s,pid:r}){const i=rt(),[c,d]=v.useState(""),[f,g]=v.useState("master"),[m,h]=v.useState(""),[x,y]=v.useState(!0),[w,S]=v.useState(!1),_=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(c)){i.error(C("project.agents.slug_invalid"));return}S(!0);try{await Jt.create(r,{slug:c,role:f,model:m||void 0,is_master:x}),i.success(C("project.agents.created",{slug:c})),d(""),g("master"),h(""),y(!0),s()}catch(j){i.error(j.message)}finally{S(!1)}};return l.jsx(ma,{open:e,onClose:n,title:C("project.chat.create_agent_title"),description:C("project.chat.create_agent_desc"),footer:l.jsxs(l.Fragment,{children:[l.jsx(he,{variant:"ghost",onClick:n,disabled:w,children:C("common.cancel")}),l.jsx(he,{variant:"primary",onClick:_,loading:w,children:C("common.create")})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(fe,{label:"slug",children:l.jsx(Ce,{autoFocus:!0,value:c,onChange:j=>d(j.target.value),placeholder:"master"})}),l.jsx(fe,{label:C("project.chat.role_label"),children:l.jsx(Ce,{value:f,onChange:j=>g(j.target.value),placeholder:"master"})}),l.jsx(fe,{label:C("project.chat.model_label"),hint:C("project.chat.model_hint"),children:l.jsx(Ce,{value:m,onChange:j=>h(j.target.value)})}),l.jsx(sn,{checked:x,onChange:y,label:C("project.chat.master_label")})]})})}function Qz({pid:e}){const n=rt(),{project:s}=lw(e),{channels:r,isLoading:i,mutate:c}=ux(),d=String(e),f=s?.name||s?.path?.split("/").pop()||d,g=`proj-${d}`,m=r.find(O=>O.project===d||O.project===f||O.name===g),[h,x]=v.useState(!!m),[y,w]=v.useState(""),[S,_]=v.useState(""),[j,E]=v.useState(""),[k,N]=v.useState(!0),[R,A]=v.useState(!1);if(v.useEffect(()=>{m?(x(!0),w(""),_(m.chat_id||""),E(m.route_to_agent||""),N(m.respond_with_engine??!0)):(x(!1),w(""),_(""),E(""),N(!0))},[m?.name,m?.chat_id,m?.route_to_agent]),i)return l.jsx(Je,{});const M=async()=>{A(!0);try{if(!h){m&&(await kn.channels.remove(m.name),n.success(C("project.telegram.cleared"))),await c();return}const O={name:m?.name||g,project:d,chat_id:S,route_to_agent:j,respond_with_engine:k,...y?{bot_token:y}:{}};m?await kn.channels.patch(m.name,O):await kn.channels.upsert(O),n.success(C("project.telegram.saved")),await c(),w("")}catch(O){n.error(O.message)}finally{A(!1)}};return l.jsx(He,{title:C("project.telegram.title"),description:C("project.telegram.subtitle"),children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(sn,{checked:h,onChange:x,label:C(h?"project.telegram.override_active":"project.telegram.use_default")}),m&&l.jsx(Ue,{tone:"success",children:C("project.telegram.channel_badge",{name:m.name})})]}),h&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(fe,{label:C("project.telegram.bot_token"),hint:m?.bot_token?`${fr(m.bot_token)} — vacío = mantener`:C("project.telegram.bot_hint_none"),children:l.jsx(Ce,{type:"password",value:y,onChange:O=>w(O.target.value),placeholder:m?.bot_token?fr(m.bot_token):""})}),l.jsx(fe,{label:C("project.telegram.chat_id"),children:l.jsx(Ce,{value:S,onChange:O=>_(O.target.value)})}),l.jsx(fe,{label:C("project.telegram.route_agent"),hint:C("project.telegram.route_hint"),children:l.jsx(Ce,{value:j,onChange:O=>E(O.target.value)})})]}),l.jsx(sn,{checked:k,onChange:N,label:C("project.telegram.respond_engine")})]}),l.jsx("div",{className:"pt-2",children:l.jsx(he,{variant:"primary",loading:R,onClick:M,children:C("common.save")})}),!h&&!m&&l.jsx(lt,{children:C("project.telegram.no_override")})]})})}function r2({load:e,save:n,rows:s=10,placeholder:r}){const i=rt(),[c,d]=v.useState(null),[f,g]=v.useState(""),[m,h]=v.useState(!1);if(v.useEffect(()=>{let w=!0;return e().then(S=>{w&&(d(S),g(S))}).catch(()=>{w&&(d(""),g(""))}),()=>{w=!1}},[e]),c===null)return l.jsx(Je,{});const x=f!==c,y=async()=>{h(!0);try{await n(f),d(f),i.success(C("project.memories.saved"))}catch(w){i.error(w.message)}finally{h(!1)}};return l.jsxs("div",{className:"space-y-2",children:[l.jsx(Qt,{rows:s,className:"font-mono text-xs",value:f,onChange:w=>g(w.target.value),placeholder:r}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-[11px] text-muted-fg",children:[f.length," ",C("project.memories.chars")]}),l.jsxs(he,{size:"sm",variant:"primary",loading:m,disabled:!x,onClick:y,children:[l.jsx(hh,{size:12})," ",C("project.memories.save_btn")]})]})]})}function Zz({pid:e,agent:n}){const[s,r]=v.useState(!1),i=n.is_master?ks:vn;return l.jsxs("li",{className:"rounded-xl border border-border bg-muted/30",children:[l.jsxs("button",{type:"button",onClick:()=>r(c=>!c),className:"flex w-full items-center gap-3 px-3 py-2 text-left",children:[s?l.jsx(Zr,{size:14,className:"text-muted-fg"}):l.jsx(dh,{size:14,className:"text-muted-fg"}),l.jsx(i,{size:14,className:n.is_master?"text-violet-400":"text-muted-fg"}),l.jsx("span",{className:"text-sm font-medium",children:n.slug}),n.role&&l.jsxs("span",{className:"text-xs text-muted-fg",children:["· ",n.role]})]}),s&&l.jsx("div",{className:"border-t border-border p-3",children:l.jsx(r2,{rows:8,load:()=>Jt.memory.get(e,n.slug).then(c=>c.body),save:c=>Jt.memory.put(e,n.slug,c).then(()=>{})})})]})}function Jz({pid:e}){const n=Qe(`/projects/${e}/agents`,()=>Jt.list(e));return l.jsxs("div",{className:"space-y-6",children:[l.jsx(He,{title:C("project.memories.project_title"),description:C("project.memories.project_desc"),children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"mt-1 flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-sky-600 to-indigo-600",children:l.jsx(Ju,{className:"size-4 text-white"})}),l.jsx("div",{className:"min-w-0 flex-1",children:l.jsx(r2,{rows:12,load:()=>Qn.memory.get(e).then(s=>s.body),save:s=>Qn.memory.put(e,s).then(()=>{}),placeholder:C("project.memories.project_ph")})})]})}),l.jsxs(He,{title:C("project.memories.agents_title"),description:C("project.memories.agents_desc"),children:[n.isLoading&&l.jsx(Je,{}),!n.isLoading&&(n.data?.length??0)===0&&l.jsx(lt,{children:C("project.memories.no_agents")}),l.jsx("ul",{className:"space-y-2",children:(n.data||[]).map(s=>l.jsx(Zz,{pid:e,agent:s},s.slug))})]})]})}function Wz(e,n){var s,r=1;e==null&&(e=0),n==null&&(n=0);function i(){var c,d=s.length,f,g=0,m=0;for(c=0;c<d;++c)f=s[c],g+=f.x,m+=f.y;for(g=(g/d-e)*r,m=(m/d-n)*r,c=0;c<d;++c)f=s[c],f.x-=g,f.y-=m}return i.initialize=function(c){s=c},i.x=function(c){return arguments.length?(e=+c,i):e},i.y=function(c){return arguments.length?(n=+c,i):n},i.strength=function(c){return arguments.length?(r=+c,i):r},i}function eD(e){const n=+this._x.call(null,e),s=+this._y.call(null,e);return o2(this.cover(n,s),n,s,e)}function o2(e,n,s,r){if(isNaN(n)||isNaN(s))return e;var i,c=e._root,d={data:r},f=e._x0,g=e._y0,m=e._x1,h=e._y1,x,y,w,S,_,j,E,k;if(!c)return e._root=d,e;for(;c.length;)if((_=n>=(x=(f+m)/2))?f=x:m=x,(j=s>=(y=(g+h)/2))?g=y:h=y,i=c,!(c=c[E=j<<1|_]))return i[E]=d,e;if(w=+e._x.call(null,c.data),S=+e._y.call(null,c.data),n===w&&s===S)return d.next=c,i?i[E]=d:e._root=d,e;do i=i?i[E]=new Array(4):e._root=new Array(4),(_=n>=(x=(f+m)/2))?f=x:m=x,(j=s>=(y=(g+h)/2))?g=y:h=y;while((E=j<<1|_)===(k=(S>=y)<<1|w>=x));return i[k]=c,i[E]=d,e}function tD(e){var n,s,r=e.length,i,c,d=new Array(r),f=new Array(r),g=1/0,m=1/0,h=-1/0,x=-1/0;for(s=0;s<r;++s)isNaN(i=+this._x.call(null,n=e[s]))||isNaN(c=+this._y.call(null,n))||(d[s]=i,f[s]=c,i<g&&(g=i),i>h&&(h=i),c<m&&(m=c),c>x&&(x=c));if(g>h||m>x)return this;for(this.cover(g,m).cover(h,x),s=0;s<r;++s)o2(this,d[s],f[s],e[s]);return this}function nD(e,n){if(isNaN(e=+e)||isNaN(n=+n))return this;var s=this._x0,r=this._y0,i=this._x1,c=this._y1;if(isNaN(s))i=(s=Math.floor(e))+1,c=(r=Math.floor(n))+1;else{for(var d=i-s||1,f=this._root,g,m;s>e||e>=i||r>n||n>=c;)switch(m=(n<r)<<1|e<s,g=new Array(4),g[m]=f,f=g,d*=2,m){case 0:i=s+d,c=r+d;break;case 1:s=i-d,c=r+d;break;case 2:i=s+d,r=c-d;break;case 3:s=i-d,r=c-d;break}this._root&&this._root.length&&(this._root=f)}return this._x0=s,this._y0=r,this._x1=i,this._y1=c,this}function aD(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function sD(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 Un(e,n,s,r,i){this.node=e,this.x0=n,this.y0=s,this.x1=r,this.y1=i}function rD(e,n,s){var r,i=this._x0,c=this._y0,d,f,g,m,h=this._x1,x=this._y1,y=[],w=this._root,S,_;for(w&&y.push(new Un(w,i,c,h,x)),s==null?s=1/0:(i=e-s,c=n-s,h=e+s,x=n+s,s*=s);S=y.pop();)if(!(!(w=S.node)||(d=S.x0)>h||(f=S.y0)>x||(g=S.x1)<i||(m=S.y1)<c))if(w.length){var j=(d+g)/2,E=(f+m)/2;y.push(new Un(w[3],j,E,g,m),new Un(w[2],d,E,j,m),new Un(w[1],j,f,g,E),new Un(w[0],d,f,j,E)),(_=(n>=E)<<1|e>=j)&&(S=y[y.length-1],y[y.length-1]=y[y.length-1-_],y[y.length-1-_]=S)}else{var k=e-+this._x.call(null,w.data),N=n-+this._y.call(null,w.data),R=k*k+N*N;if(R<s){var A=Math.sqrt(s=R);i=e-A,c=n-A,h=e+A,x=n+A,r=w.data}}return r}function oD(e){if(isNaN(h=+this._x.call(null,e))||isNaN(x=+this._y.call(null,e)))return this;var n,s=this._root,r,i,c,d=this._x0,f=this._y0,g=this._x1,m=this._y1,h,x,y,w,S,_,j,E;if(!s)return this;if(s.length)for(;;){if((S=h>=(y=(d+g)/2))?d=y:g=y,(_=x>=(w=(f+m)/2))?f=w:m=w,n=s,!(s=s[j=_<<1|S]))return this;if(!s.length)break;(n[j+1&3]||n[j+2&3]||n[j+3&3])&&(r=n,E=j)}for(;s.data!==e;)if(i=s,!(s=s.next))return this;return(c=s.next)&&delete s.next,i?(c?i.next=c:delete i.next,this):n?(c?n[j]=c:delete n[j],(s=n[0]||n[1]||n[2]||n[3])&&s===(n[3]||n[2]||n[1]||n[0])&&!s.length&&(r?r[E]=s:this._root=s),this):(this._root=c,this)}function lD(e){for(var n=0,s=e.length;n<s;++n)this.remove(e[n]);return this}function iD(){return this._root}function cD(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function uD(e){var n=[],s,r=this._root,i,c,d,f,g;for(r&&n.push(new Un(r,this._x0,this._y0,this._x1,this._y1));s=n.pop();)if(!e(r=s.node,c=s.x0,d=s.y0,f=s.x1,g=s.y1)&&r.length){var m=(c+f)/2,h=(d+g)/2;(i=r[3])&&n.push(new Un(i,m,h,f,g)),(i=r[2])&&n.push(new Un(i,c,h,m,g)),(i=r[1])&&n.push(new Un(i,m,d,f,h)),(i=r[0])&&n.push(new Un(i,c,d,m,h))}return this}function dD(e){var n=[],s=[],r;for(this._root&&n.push(new Un(this._root,this._x0,this._y0,this._x1,this._y1));r=n.pop();){var i=r.node;if(i.length){var c,d=r.x0,f=r.y0,g=r.x1,m=r.y1,h=(d+g)/2,x=(f+m)/2;(c=i[0])&&n.push(new Un(c,d,f,h,x)),(c=i[1])&&n.push(new Un(c,h,f,g,x)),(c=i[2])&&n.push(new Un(c,d,x,h,m)),(c=i[3])&&n.push(new Un(c,h,x,g,m))}s.push(r)}for(;r=s.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function fD(e){return e[0]}function mD(e){return arguments.length?(this._x=e,this):this._x}function pD(e){return e[1]}function gD(e){return arguments.length?(this._y=e,this):this._y}function Cx(e,n,s){var r=new Ex(n??fD,s??pD,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function Ex(e,n,s,r,i,c){this._x=e,this._y=n,this._x0=s,this._y0=r,this._x1=i,this._y1=c,this._root=void 0}function Q1(e){for(var n={data:e.data},s=n;e=e.next;)s=s.next={data:e.data};return n}var Hn=Cx.prototype=Ex.prototype;Hn.copy=function(){var e=new Ex(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root,s,r;if(!n)return e;if(!n.length)return e._root=Q1(n),e;for(s=[{source:n,target:e._root=new Array(4)}];n=s.pop();)for(var i=0;i<4;++i)(r=n.source[i])&&(r.length?s.push({source:r,target:n.target[i]=new Array(4)}):n.target[i]=Q1(r));return e};Hn.add=eD;Hn.addAll=tD;Hn.cover=nD;Hn.data=aD;Hn.extent=sD;Hn.find=rD;Hn.remove=oD;Hn.removeAll=lD;Hn.root=iD;Hn.size=cD;Hn.visit=uD;Hn.visitAfter=dD;Hn.x=mD;Hn.y=gD;function Gr(e){return function(){return e}}function cr(e){return(e()-.5)*1e-6}function hD(e){return e.x+e.vx}function xD(e){return e.y+e.vy}function bD(e){var n,s,r,i=1,c=1;typeof e!="function"&&(e=Gr(e==null?1:+e));function d(){for(var m,h=n.length,x,y,w,S,_,j,E=0;E<c;++E)for(x=Cx(n,hD,xD).visitAfter(f),m=0;m<h;++m)y=n[m],_=s[y.index],j=_*_,w=y.x+y.vx,S=y.y+y.vy,x.visit(k);function k(N,R,A,M,O){var U=N.data,I=N.r,B=_+I;if(U){if(U.index>y.index){var L=w-U.x-U.vx,D=S-U.y-U.vy,q=L*L+D*D;q<B*B&&(L===0&&(L=cr(r),q+=L*L),D===0&&(D=cr(r),q+=D*D),q=(B-(q=Math.sqrt(q)))/q*i,y.vx+=(L*=q)*(B=(I*=I)/(j+I)),y.vy+=(D*=q)*B,U.vx-=L*(B=1-B),U.vy-=D*B)}return}return R>w+B||M<w-B||A>S+B||O<S-B}}function f(m){if(m.data)return m.r=s[m.data.index];for(var h=m.r=0;h<4;++h)m[h]&&m[h].r>m.r&&(m.r=m[h].r)}function g(){if(n){var m,h=n.length,x;for(s=new Array(h),m=0;m<h;++m)x=n[m],s[x.index]=+e(x,m,n)}}return d.initialize=function(m,h){n=m,r=h,g()},d.iterations=function(m){return arguments.length?(c=+m,d):c},d.strength=function(m){return arguments.length?(i=+m,d):i},d.radius=function(m){return arguments.length?(e=typeof m=="function"?m:Gr(+m),g(),d):e},d}function vD(e){return e.index}function Z1(e,n){var s=e.get(n);if(!s)throw new Error("node not found: "+n);return s}function yD(e){var n=vD,s=x,r,i=Gr(30),c,d,f,g,m,h=1;e==null&&(e=[]);function x(j){return 1/Math.min(f[j.source.index],f[j.target.index])}function y(j){for(var E=0,k=e.length;E<h;++E)for(var N=0,R,A,M,O,U,I,B;N<k;++N)R=e[N],A=R.source,M=R.target,O=M.x+M.vx-A.x-A.vx||cr(m),U=M.y+M.vy-A.y-A.vy||cr(m),I=Math.sqrt(O*O+U*U),I=(I-c[N])/I*j*r[N],O*=I,U*=I,M.vx-=O*(B=g[N]),M.vy-=U*B,A.vx+=O*(B=1-B),A.vy+=U*B}function w(){if(d){var j,E=d.length,k=e.length,N=new Map(d.map((A,M)=>[n(A,M,d),A])),R;for(j=0,f=new Array(E);j<k;++j)R=e[j],R.index=j,typeof R.source!="object"&&(R.source=Z1(N,R.source)),typeof R.target!="object"&&(R.target=Z1(N,R.target)),f[R.source.index]=(f[R.source.index]||0)+1,f[R.target.index]=(f[R.target.index]||0)+1;for(j=0,g=new Array(k);j<k;++j)R=e[j],g[j]=f[R.source.index]/(f[R.source.index]+f[R.target.index]);r=new Array(k),S(),c=new Array(k),_()}}function S(){if(d)for(var j=0,E=e.length;j<E;++j)r[j]=+s(e[j],j,e)}function _(){if(d)for(var j=0,E=e.length;j<E;++j)c[j]=+i(e[j],j,e)}return y.initialize=function(j,E){d=j,m=E,w()},y.links=function(j){return arguments.length?(e=j,w(),y):e},y.id=function(j){return arguments.length?(n=j,y):n},y.iterations=function(j){return arguments.length?(h=+j,y):h},y.strength=function(j){return arguments.length?(s=typeof j=="function"?j:Gr(+j),S(),y):s},y.distance=function(j){return arguments.length?(i=typeof j=="function"?j:Gr(+j),_(),y):i},y}var _D={value:()=>{}};function l2(){for(var e=0,n=arguments.length,s={},r;e<n;++e){if(!(r=arguments[e]+"")||r in s||/[\s.]/.test(r))throw new Error("illegal type: "+r);s[r]=[]}return new Ku(s)}function Ku(e){this._=e}function jD(e,n){return e.trim().split(/^|\s+/).map(function(s){var r="",i=s.indexOf(".");if(i>=0&&(r=s.slice(i+1),s=s.slice(0,i)),s&&!n.hasOwnProperty(s))throw new Error("unknown type: "+s);return{type:s,name:r}})}Ku.prototype=l2.prototype={constructor:Ku,on:function(e,n){var s=this._,r=jD(e+"",s),i,c=-1,d=r.length;if(arguments.length<2){for(;++c<d;)if((i=(e=r[c]).type)&&(i=SD(s[i],e.name)))return i;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++c<d;)if(i=(e=r[c]).type)s[i]=J1(s[i],e.name,n);else if(n==null)for(i in s)s[i]=J1(s[i],e.name,null);return this},copy:function(){var e={},n=this._;for(var s in n)e[s]=n[s].slice();return new Ku(e)},call:function(e,n){if((i=arguments.length-2)>0)for(var s=new Array(i),r=0,i,c;r<i;++r)s[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(c=this._[e],r=0,i=c.length;r<i;++r)c[r].value.apply(n,s)},apply:function(e,n,s){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,c=r.length;i<c;++i)r[i].value.apply(n,s)}};function SD(e,n){for(var s=0,r=e.length,i;s<r;++s)if((i=e[s]).name===n)return i.value}function J1(e,n,s){for(var r=0,i=e.length;r<i;++r)if(e[r].name===n){e[r]=_D,e=e.slice(0,r).concat(e.slice(r+1));break}return s!=null&&e.push({name:n,value:s}),e}var nl=0,Ci=0,hi=0,i2=1e3,yd,Ei,_d=0,Kr=0,Qd=0,Fi=typeof performance=="object"&&performance.now?performance:Date,c2=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function u2(){return Kr||(c2(wD),Kr=Fi.now()+Qd)}function wD(){Kr=0}function Jg(){this._call=this._time=this._next=null}Jg.prototype=d2.prototype={constructor:Jg,restart:function(e,n,s){if(typeof e!="function")throw new TypeError("callback is not a function");s=(s==null?u2():+s)+(n==null?0:+n),!this._next&&Ei!==this&&(Ei?Ei._next=this:yd=this,Ei=this),this._call=e,this._time=s,Wg()},stop:function(){this._call&&(this._call=null,this._time=1/0,Wg())}};function d2(e,n,s){var r=new Jg;return r.restart(e,n,s),r}function CD(){u2(),++nl;for(var e=yd,n;e;)(n=Kr-e._time)>=0&&e._call.call(void 0,n),e=e._next;--nl}function W1(){Kr=(_d=Fi.now())+Qd,nl=Ci=0;try{CD()}finally{nl=0,kD(),Kr=0}}function ED(){var e=Fi.now(),n=e-_d;n>i2&&(Qd-=n,_d=e)}function kD(){for(var e,n=yd,s,r=1/0;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(s=n._next,n._next=null,n=e?e._next=s:yd=s);Ei=e,Wg(r)}function Wg(e){if(!nl){Ci&&(Ci=clearTimeout(Ci));var n=e-Kr;n>24?(e<1/0&&(Ci=setTimeout(W1,e-Fi.now()-Qd)),hi&&(hi=clearInterval(hi))):(hi||(_d=Fi.now(),hi=setInterval(ED,i2)),nl=1,c2(W1))}}const RD=1664525,ND=1013904223,e_=4294967296;function TD(){let e=1;return()=>(e=(RD*e+ND)%e_)/e_}function AD(e){return e.x}function MD(e){return e.y}var OD=10,zD=Math.PI*(3-Math.sqrt(5));function DD(e){var n,s=1,r=.001,i=1-Math.pow(r,1/300),c=0,d=.6,f=new Map,g=d2(x),m=l2("tick","end"),h=TD();e==null&&(e=[]);function x(){y(),m.call("tick",n),s<r&&(g.stop(),m.call("end",n))}function y(_){var j,E=e.length,k;_===void 0&&(_=1);for(var N=0;N<_;++N)for(s+=(c-s)*i,f.forEach(function(R){R(s)}),j=0;j<E;++j)k=e[j],k.fx==null?k.x+=k.vx*=d:(k.x=k.fx,k.vx=0),k.fy==null?k.y+=k.vy*=d:(k.y=k.fy,k.vy=0);return n}function w(){for(var _=0,j=e.length,E;_<j;++_){if(E=e[_],E.index=_,E.fx!=null&&(E.x=E.fx),E.fy!=null&&(E.y=E.fy),isNaN(E.x)||isNaN(E.y)){var k=OD*Math.sqrt(.5+_),N=_*zD;E.x=k*Math.cos(N),E.y=k*Math.sin(N)}(isNaN(E.vx)||isNaN(E.vy))&&(E.vx=E.vy=0)}}function S(_){return _.initialize&&_.initialize(e,h),_}return w(),n={tick:y,restart:function(){return g.restart(x),n},stop:function(){return g.stop(),n},nodes:function(_){return arguments.length?(e=_,w(),f.forEach(S),n):e},alpha:function(_){return arguments.length?(s=+_,n):s},alphaMin:function(_){return arguments.length?(r=+_,n):r},alphaDecay:function(_){return arguments.length?(i=+_,n):+i},alphaTarget:function(_){return arguments.length?(c=+_,n):c},velocityDecay:function(_){return arguments.length?(d=1-_,n):1-d},randomSource:function(_){return arguments.length?(h=_,f.forEach(S),n):h},force:function(_,j){return arguments.length>1?(j==null?f.delete(_):f.set(_,S(j)),n):f.get(_)},find:function(_,j,E){var k=0,N=e.length,R,A,M,O,U;for(E==null?E=1/0:E*=E,k=0;k<N;++k)O=e[k],R=_-O.x,A=j-O.y,M=R*R+A*A,M<E&&(U=O,E=M);return U},on:function(_,j){return arguments.length>1?(m.on(_,j),n):m.on(_)}}}function LD(){var e,n,s,r,i=Gr(-30),c,d=1,f=1/0,g=.81;function m(w){var S,_=e.length,j=Cx(e,AD,MD).visitAfter(x);for(r=w,S=0;S<_;++S)n=e[S],j.visit(y)}function h(){if(e){var w,S=e.length,_;for(c=new Array(S),w=0;w<S;++w)_=e[w],c[_.index]=+i(_,w,e)}}function x(w){var S=0,_,j,E=0,k,N,R;if(w.length){for(k=N=R=0;R<4;++R)(_=w[R])&&(j=Math.abs(_.value))&&(S+=_.value,E+=j,k+=j*_.x,N+=j*_.y);w.x=k/E,w.y=N/E}else{_=w,_.x=_.data.x,_.y=_.data.y;do S+=c[_.data.index];while(_=_.next)}w.value=S}function y(w,S,_,j){if(!w.value)return!0;var E=w.x-n.x,k=w.y-n.y,N=j-S,R=E*E+k*k;if(N*N/g<R)return R<f&&(E===0&&(E=cr(s),R+=E*E),k===0&&(k=cr(s),R+=k*k),R<d&&(R=Math.sqrt(d*R)),n.vx+=E*w.value*r/R,n.vy+=k*w.value*r/R),!0;if(w.length||R>=f)return;(w.data!==n||w.next)&&(E===0&&(E=cr(s),R+=E*E),k===0&&(k=cr(s),R+=k*k),R<d&&(R=Math.sqrt(d*R)));do w.data!==n&&(N=c[w.data.index]*r/R,n.vx+=E*N,n.vy+=k*N);while(w=w.next)}return m.initialize=function(w,S){e=w,s=S,h()},m.strength=function(w){return arguments.length?(i=typeof w=="function"?w:Gr(+w),h(),m):i},m.distanceMin=function(w){return arguments.length?(d=w*w,m):Math.sqrt(d)},m.distanceMax=function(w){return arguments.length?(f=w*w,m):Math.sqrt(f)},m.theta=function(w){return arguments.length?(g=w*w,m):Math.sqrt(g)},m}const xi={agent:"#a78bfa",memory:"#38bdf8",thread:"#34d399",task:"#fbbf24",routine:"#f472b6",agentlink:"#c084fc"},t_={agent:"agente",memory:"memoria",thread:"thread",task:"task",routine:"rutina",agentlink:"jerarquía"},bi=760,vi=460;function PD({center:e,nodes:n}){const s=v.useRef(null),r=v.useRef(null),i=v.useRef([]),c=v.useRef([]),d=v.useRef(null),[,f]=v.useState(0),[g,m]=v.useState(null);v.useEffect(()=>{const j={id:"__center",label:e,kind:"agent",relation:"self",x:bi/2,y:vi/2,fx:bi/2,fy:vi/2},E=[j,...n.map(R=>({...R}))],k=E.slice(1).map(R=>({source:j,target:R}));i.current=E,c.current=k;const N=DD(E).force("link",yD(k).distance(120).strength(.5)).force("charge",LD().strength(-220)).force("center",Wz(bi/2,vi/2).strength(.05)).force("collide",bD(26)).on("tick",()=>f(R=>R+1));return r.current=N,()=>{N.stop()}},[e,n]);const h=j=>{const E=s.current.getBoundingClientRect();return{x:(j.clientX-E.left)/E.width*bi,y:(j.clientY-E.top)/E.height*vi}},x=j=>E=>{j.id!=="__center"&&(d.current=j,E.target.setPointerCapture?.(E.pointerId),r.current?.alphaTarget(.3).restart())},y=j=>{const E=d.current;if(!E)return;const{x:k,y:N}=h(j);E.fx=k,E.fy=N},w=()=>{const j=d.current;j&&(j.fx=null,j.fy=null),d.current=null,r.current?.alphaTarget(0)},S=i.current,_=c.current;return l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-muted/10",children:l.jsxs("svg",{ref:s,viewBox:`0 0 ${bi} ${vi}`,className:"h-[460px] w-full touch-none select-none",onPointerMove:y,onPointerUp:w,onPointerLeave:w,children:[_.map((j,E)=>l.jsx("line",{x1:j.source.x,y1:j.source.y,x2:j.target.x,y2:j.target.y,stroke:xi[j.target.kind],strokeOpacity:.22,strokeWidth:1.5},E)),S.map(j=>{if(j.id==="__center")return l.jsxs("g",{transform:`translate(${j.x},${j.y})`,children:[l.jsx("circle",{r:22,fill:xi.agent}),l.jsx("text",{textAnchor:"middle",y:4,fontSize:11,fontWeight:700,fill:"#1a1a1a",children:e.length>8?e.slice(0,8):e})]},j.id);const E=g?.id===j.id;return l.jsxs("g",{transform:`translate(${j.x},${j.y})`,className:"cursor-grab active:cursor-grabbing",onPointerDown:x(j),onClick:()=>m(j),children:[l.jsx("circle",{r:E?9:6,fill:xi[j.kind],fillOpacity:E?1:.9,stroke:E?"#fff":"none",strokeWidth:E?2:0}),l.jsx("text",{x:10,y:4,fontSize:10,className:"fill-foreground/80",children:j.label.length>22?`${j.label.slice(0,22)}…`:j.label})]},j.id)})]})}),l.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[11px] text-muted-fg",children:[Object.keys(t_).filter(j=>j!=="agent").map(j=>l.jsxs("span",{className:"inline-flex items-center gap-1",children:[l.jsx("span",{className:"size-2 rounded-full",style:{background:xi[j]}})," ",t_[j]]},j)),l.jsxs("span",{className:"ml-auto",children:[n.length," nodos · arrastrá para reacomodar"]})]}),g&&l.jsxs("div",{className:"rounded-lg border border-border bg-card p-3 text-xs",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"size-2 rounded-full",style:{background:xi[g.kind]}}),l.jsx("span",{className:"font-medium",children:g.label}),l.jsxs("span",{className:"text-muted-fg",children:["· ",g.relation]})]}),g.detail&&l.jsx("p",{className:"mt-1 whitespace-pre-wrap text-muted-fg",children:g.detail})]})]})}function BD(){return[{key:"overview",label:"Explorer",icon:wd},{key:"memories",label:C("project.nav.memories"),icon:Ju},{key:"records",label:C("project.agent_detail.records_title"),icon:oj},{key:"sleep",label:C("project.agent_detail.sleep_title"),icon:Go},{key:"brain",label:C("project.agent_detail.brain_title"),icon:ol},{key:"config",label:C("settings.tabs.advanced"),icon:ed}]}const ID=[{value:"",label:"— sin tipo —"},{value:"orchestrator",label:"Orchestrator",description:"Coordina al equipo y delega."},{value:"specialist",label:"Specialist",description:"Experto en un dominio; ejecuta tareas."},{value:"assistant",label:"Assistant",description:"Ayudante conversacional."},{value:"worker",label:"Worker",description:"Corre tareas autónomas."},{value:"monitor",label:"Monitor",description:"Observa estado y reporta."}],eh=e=>e.split(",").map(n=>n.trim()).filter(Boolean),UD=(e,n)=>e.filter(s=>s.spec?.agent===n||n==="super-agent"&&s.kind==="super_agent");function HD(e){return e.split(`
|
|
533
|
+
`).map(n=>n.replace(/^[-*#>\s]+/,"").trim()).filter(n=>n.length>2&&!n.startsWith("```")).slice(0,12)}function qD({pid:e}){const{slug:n=""}=K_(),s=Ua(),[r,i]=v.useState("overview"),c=BD(),d=Qe(`/projects/${e}/agents/${n}`,()=>Jt.get(e,n)),f=Qe(`/projects/${e}/agents`,()=>Jt.list(e)),g=Qe(`/projects/${e}/routines`,()=>or.list(e)),m=Qe(`/projects/${e}/messages?agent=${n}`,()=>Xg.project(e,{agent:n,limit:200})),h=Qe(`/projects/${e}/agents/${n}/conversations`,()=>nx.list(e,n)),x=Qe(`/projects/${e}/tasks?all`,()=>lr.list(e,"all")),y=d.data,w=UD(g.data||[],n),S=(x.data||[]).filter(E=>E.agent===n),_=(f.data||[]).filter(E=>E.parent===n);if(d.isLoading)return l.jsx(Je,{});if(!y)return l.jsx("div",{className:"text-sm text-muted-fg",children:C("project.agent_detail.not_found")});const j=y.is_master?ks:vn;return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("button",{onClick:()=>s(`/p/${e}/agents`),className:"mt-1 text-muted-fg hover:text-foreground",children:l.jsx(yR,{size:16})}),l.jsx("div",{className:Ie("flex size-11 items-center justify-center rounded-xl bg-gradient-to-br",y.is_master?"from-violet-600 to-indigo-600":"from-slate-600 to-gray-600"),children:l.jsx(j,{className:"size-5 text-white"})}),l.jsxs("div",{children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h1",{className:"text-lg font-semibold",children:y.slug}),y.is_master&&l.jsxs(Ue,{tone:"success",children:[l.jsx(ks,{size:10})," ",C("project.agents.orchestrator")]}),y.role&&l.jsx(Ue,{children:y.role}),y.model&&l.jsx(Ue,{tone:"info",children:y.model}),y.parent&&l.jsxs("button",{onClick:()=>s(`/p/${e}/agents/${y.parent}`),className:"text-[11px] text-violet-400 hover:underline",children:[C("project.agent_detail.reports_to")," ",y.parent]})]}),y.description&&l.jsx("p",{className:"mt-0.5 max-w-2xl text-xs text-muted-fg",children:y.description})]})]}),l.jsxs(he,{size:"sm",variant:"primary",onClick:()=>s(`/p/${e}/chat?agent=${n}`),children:[l.jsx(Za,{size:13})," ",C("project.agent_detail.chat_btn",{slug:y.slug})]})]}),l.jsx("div",{className:"flex flex-wrap gap-1 border-b border-border",children:c.map(({key:E,label:k,icon:N})=>l.jsxs("button",{onClick:()=>i(E),className:Ie("flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm transition-colors -mb-px",r===E?"border-foreground text-foreground":"border-transparent text-muted-fg hover:text-foreground"),children:[l.jsx(N,{size:14})," ",k]},E))}),r==="overview"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[l.jsx(Pu,{label:"Threads",value:h.data?.length??0,icon:ki}),l.jsx(Pu,{label:"Records",value:m.data?.length??0,icon:oj}),l.jsx(Pu,{label:"Tasks",value:S.length,icon:wd}),l.jsx(Pu,{label:"Heartbeats",value:w.length,icon:Go})]}),l.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[l.jsx(He,{title:"Skills & tools",description:"",children:l.jsxs("div",{className:"flex flex-wrap gap-1",children:[y.skills?.map(E=>l.jsxs(Ue,{tone:"info",children:[l.jsx(ol,{size:10})," ",E]},E)),y.tools?.map(E=>l.jsxs(Ue,{children:[l.jsx(ll,{size:10})," ",E]},E)),!y.skills?.length&&!y.tools?.length&&l.jsx("span",{className:"text-xs text-muted-fg",children:"—"})]})}),l.jsx(He,{title:C("project.agent_detail.threads_recent"),description:"",children:l.jsxs("ul",{className:"space-y-1 text-xs",children:[(h.data||[]).slice(0,6).map(E=>l.jsxs("li",{className:"flex items-center justify-between rounded-md bg-muted/30 px-2 py-1",children:[l.jsx("span",{className:"truncate",children:E.title||E.filename}),l.jsxs("span",{className:"shrink-0 text-muted-fg",children:[E.messages??0," ",C("project.agent_detail.msgs_count")]})]},E.id)),!h.data?.length&&l.jsx("li",{className:"text-muted-fg",children:C("project.agent_detail.no_threads")})]})})]}),_.length>0&&l.jsx(He,{title:C("project.agent_detail.subagents"),description:C("project.agent_detail.subagents_desc"),children:l.jsx("div",{className:"flex flex-wrap gap-2",children:_.map(E=>l.jsxs("button",{onClick:()=>s(`/p/${e}/agents/${E.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:[l.jsx(vn,{size:14,className:"text-muted-fg"})," ",E.slug]},E.slug))})})]}),r==="memories"&&l.jsx($D,{pid:e,slug:n,initial:y.memory||"",onSaved:()=>d.mutate()}),r==="records"&&l.jsx(GD,{records:m.data||[],loading:m.isLoading}),r==="sleep"&&l.jsx(YD,{routines:w}),r==="brain"&&l.jsx(XD,{slug:n,memory:y.memory||"",threads:(h.data||[]).map(E=>({id:E.id,label:E.title||E.filename})),tasks:S.map(E=>({id:E.id,label:E.title,detail:E.body||void 0})),routines:w,parent:y.parent||null,children:_.map(E=>E.slug)}),r==="config"&&l.jsx(VD,{pid:e,agent:y,agents:f.data||[],onSaved:()=>{d.mutate(),f.mutate()},onDeleted:()=>{f.mutate(),s(`/p/${e}/agents`)}})]})}function VD({pid:e,agent:n,agents:s,onSaved:r,onDeleted:i}){const c=rt(),[d,f]=v.useState(n.type||""),[g,m]=v.useState(n.area||""),[h,x]=v.useState(n.role||""),[y,w]=v.useState(n.model||""),[S,_]=v.useState(n.parent||""),[j,E]=v.useState(!!n.is_master),[k,N]=v.useState((n.skills||[]).join(", ")),[R,A]=v.useState((n.tools||[]).join(", ")),[M,O]=v.useState(n.description||""),[U,I]=v.useState(n.system||""),[B,L]=v.useState(!1),D=async()=>{L(!0);try{await Jt.update(e,n.slug,{type:d||null,area:g||null,role:h||null,model:y||null,parent:S||null,is_master:j||d==="orchestrator",skills:eh(k),tools:eh(R),description:M||null,system:U}),c.success(C("project.agent_detail.update_success")),r()}catch(F){c.error(F.message)}finally{L(!1)}},q=async()=>{if(confirm(C("project.agent_detail.delete_confirm",{slug:n.slug})))try{await Jt.remove(e,n.slug),c.success(C("project.agent_detail.delete_success")),i()}catch(F){c.error(F.message)}};return l.jsx(He,{title:C("project.agent_detail.config_title"),description:`.apc/agents/${n.slug}.md — definición (frontmatter + system prompt).`,children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(fe,{label:C("project.agent_detail.type_label"),children:l.jsx(Ct,{value:d,onChange:f,options:ID})}),l.jsx(fe,{label:C("project.agent_detail.area_label"),hint:C("project.agent_detail.area_hint"),children:l.jsx(Ce,{value:g,onChange:F=>m(F.target.value),placeholder:C("project.agent_detail.area_ph")})})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(fe,{label:C("project.agent_detail.role_label"),children:l.jsx(Ce,{value:h,onChange:F=>x(F.target.value),placeholder:"Operations Lead"})}),l.jsx(fe,{label:C("project.agent_detail.parent_label"),children:l.jsx(Ct,{value:S,onChange:_,placeholder:C("project.agent_detail.none_parent"),options:[{value:"",label:C("project.agent_detail.none_parent")},...s.filter(F=>F.slug!==n.slug).map(F=>({value:F.slug,label:F.slug}))]})})]}),l.jsx(fe,{label:C("project.agent_detail.model_label"),hint:C("project.agent_detail.model_hint"),children:l.jsx(Ce,{value:y,onChange:F=>w(F.target.value),placeholder:C("project.agent_detail.model_ph")})}),l.jsx(fe,{label:C("project.agent_detail.skills_label"),children:l.jsx(Ce,{value:k,onChange:F=>N(F.target.value),placeholder:"skill-a, skill-b"})}),l.jsx(FD,{value:R,onChange:A}),l.jsx(fe,{label:C("project.agent_detail.bio_label"),children:l.jsx(Qt,{rows:2,value:M,onChange:F=>O(F.target.value)})}),l.jsx(fe,{label:C("project.agent_detail.system_label"),hint:C("project.agent_detail.system_hint"),children:l.jsx(Qt,{rows:10,className:"font-mono text-xs",value:U,onChange:F=>I(F.target.value),placeholder:"You are…"})}),l.jsx(sn,{checked:j,onChange:E,label:C("project.agent_detail.master_label")}),l.jsxs("div",{className:"flex items-center justify-between border-t border-border pt-3",children:[l.jsxs(he,{variant:"destructive",onClick:q,children:[l.jsx(Ms,{size:13})," ",C("project.agent_detail.delete_btn")]}),l.jsxs(he,{variant:"primary",loading:B,onClick:D,children:[l.jsx(hh,{size:13})," ",C("project.agent_detail.save_btn")]})]})]})})}function Pu({label:e,value:n,icon:s}){return l.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[l.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[l.jsx(s,{size:13})," ",e]}),l.jsx("div",{className:"mt-1 text-2xl font-semibold",children:n})]})}function $D({pid:e,slug:n,initial:s,onSaved:r}){const i=rt(),[c,d]=v.useState(s),[f,g]=v.useState(!1);v.useEffect(()=>{d(s)},[s]);const m=c!==s,h=async()=>{g(!0);try{await Jt.memory.put(e,n,c),i.success(C("project.agent_detail.memory_saved")),r()}catch(x){i.error(x.message)}finally{g(!1)}};return l.jsxs(He,{title:C("project.agent_detail.memory_title"),description:`.apc/agents/${n}/memory.md — hechos durables que el agente recuerda.`,children:[l.jsx(Qt,{rows:16,className:"font-mono text-xs",value:c,onChange:x=>d(x.target.value),placeholder:C("project.agent_detail.memory_empty")}),l.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[l.jsxs("span",{className:"text-[11px] text-muted-fg",children:[c.length," ",C("project.memories.chars")]}),l.jsxs(he,{size:"sm",variant:"primary",loading:f,disabled:!m,onClick:h,children:[l.jsx(hh,{size:12})," ",C("project.memories.save_btn")]})]})]})}function GD({records:e,loading:n}){const s=v.useMemo(()=>[...e].sort((r,i)=>(i.ts||"").localeCompare(r.ts||"")),[e]);return l.jsxs(He,{title:C("project.agent_detail.records_title"),description:C("project.agent_detail.records_desc"),children:[n&&l.jsx(Je,{}),!n&&s.length===0&&l.jsx("p",{className:"text-xs text-muted-fg",children:C("project.agent_detail.no_activity")}),l.jsx("ul",{className:"space-y-1 text-sm",children:s.map((r,i)=>l.jsxs("li",{className:"flex items-start gap-2 rounded-md border border-border bg-muted/30 px-3 py-2",children:[l.jsx("span",{className:"mt-0.5 shrink-0",children:r.direction==="in"?l.jsx(lj,{size:13,className:"text-blue-400"}):l.jsx(cj,{size:13,className:"text-emerald-400"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-fg",children:[l.jsx("span",{className:"font-mono",children:new Date(r.ts).toLocaleString()}),l.jsx(Ue,{tone:"info",children:r.channel}),r.type&&l.jsx(Ue,{children:r.type})]}),r.body&&l.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 YD({routines:e}){return e.length===0?l.jsx(He,{title:C("project.agent_detail.sleep_title"),description:C("project.agent_detail.sleep_desc"),children:l.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4 text-sm",children:[l.jsx("div",{className:"font-medium text-amber-400",children:C("project.agent_detail.sleep_deep")}),l.jsx("p",{className:"mt-1 text-xs text-muted-fg",children:C("project.agent_detail.sleep_deep_desc")})]})}):l.jsx(He,{title:C("project.agent_detail.sleep_title"),description:C("project.agent_detail.sleep_desc"),children:l.jsx("div",{className:"space-y-3",children:e.map(n=>{const s=n.enabled,r=n.last_status==="error";return l.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:Ie("size-2 rounded-full",r?"bg-destructive":s?"bg-emerald-400":"bg-muted-fg/40")}),l.jsx("span",{className:"text-sm font-medium",children:n.name}),l.jsx(Ue,{tone:s?"success":"muted",children:s?"running":"paused"}),r&&l.jsx(Ue,{tone:"danger",children:"last: error"})]}),l.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-2 text-xs sm:grid-cols-4",children:[l.jsx(Bu,{label:"Tick",value:n.schedule}),l.jsx(Bu,{label:"Next tick",value:n.next_run_at?new Date(n.next_run_at).toLocaleString():"—"}),l.jsx(Bu,{label:"Last tick",value:n.last_run_at?new Date(n.last_run_at).toLocaleString():"—"}),l.jsx(Bu,{label:"Last run",value:n.last_status||"—"})]}),n.last_error&&l.jsx("p",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1 text-[11px] text-destructive",children:n.last_error})]},n.name)})})})}function Bu({label:e,value:n}){return l.jsxs("div",{className:"rounded-md border border-border bg-card p-2",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-fg",children:e}),l.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px]",children:n})]})}function FD({value:e,onChange:n}){const s=Qe("/tools",()=>e5.list()),r=eh(e),i=s.data||[],c=f=>{const g=new Set(r);g.has(f)?g.delete(f):g.add(f),n([...g].join(", "))},d=r.filter(f=>!i.some(g=>g.name===f));return l.jsxs(fe,{label:"Tools",hint:C("project.agent_detail.tools_hint"),children:[l.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i.map(f=>{const g=r.includes(f.name);return l.jsx("button",{type:"button",title:f.description||f.name,onClick:()=>c(f.name),className:Ie("rounded-md border px-2 py-0.5 font-mono text-[11px] transition-colors",g?"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=>l.jsxs("button",{type:"button",onClick:()=>c(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))]}),l.jsx(Ce,{className:"mt-2",value:e,onChange:f=>n(f.target.value),placeholder:C("project.agent_detail.tools_custom_ph")})]})}function XD({slug:e,memory:n,threads:s,tasks:r,routines:i,parent:c,children:d}){const f=v.useMemo(()=>{const g=[];return HD(n).forEach((m,h)=>g.push({id:`m${h}`,label:m,kind:"memory",relation:"knows",detail:m})),s.slice(0,8).forEach(m=>g.push({id:`th-${m.id}`,label:m.label,kind:"thread",relation:"in_thread"})),r.slice(0,8).forEach(m=>g.push({id:`ts-${m.id}`,label:m.label,kind:"task",relation:"handles_task",detail:m.detail})),i.forEach(m=>g.push({id:`rt-${m.name}`,label:m.name,kind:"routine",relation:"ticks",detail:`schedule: ${m.schedule}`})),c&&g.push({id:`p-${c}`,label:c,kind:"agentlink",relation:"reports_to"}),d.forEach(m=>g.push({id:`c-${m}`,label:m,kind:"agentlink",relation:"orchestrates"})),g},[n,s,r,i,c,d]);return l.jsx(He,{title:C("project.agent_detail.brain_title"),description:C("project.agent_detail.brain_desc"),children:f.length===0?l.jsx("p",{className:"text-xs text-muted-fg",children:C("project.agent_detail.brain_empty")}):l.jsx(PD,{center:e,nodes:f})})}function KD(){const e=Ua(),n=ea(),s=rt(),{pid:r=""}=K_(),{project:i,mutate:c}=lw(r),{collapsed:d,toggle:f}=zw(Cn.sidebarCollapsed+".project"),g=String(r)==="0",m=v.useMemo(()=>g?[{title:C("base.nav_general"),items:[{key:"",label:"Dashboard",icon:GR},{key:"workspaces",label:C("base.workspaces_title"),icon:jR},{key:"models",label:C("settings.tabs.engines"),icon:fh},{key:"agent-defaults",label:C("base.defaults_title"),icon:vn}]},{title:C("base.nav_activity"),items:[{key:"chat",label:C("project.nav.chat"),icon:ki},{key:"sessions",label:C("base.sessions_title"),icon:HR},{key:"tasks",label:C("project.nav.tasks"),icon:Bi},{key:"logs",label:C("project.nav.logs"),icon:Eg}]},{title:C("base.nav_system"),items:[{key:"agents",label:C("project.nav.agents"),icon:vn},{key:"memories",label:C("project.nav.memories"),icon:Ju},{key:"routines",label:C("project.nav.routines"),icon:Go},{key:"mcps",label:C("project.nav.mcps"),icon:Cg},{key:"config",label:C("project.nav.config"),icon:ed}]}]:[{title:C("project.sections.workspace"),items:[{key:"",label:C("project.nav.overview"),icon:mj},{key:"telegram",label:C("project.nav.telegram"),icon:Za},{key:"chat",label:C("project.nav.chat"),icon:ki},{key:"threads",label:C("project.nav.threads"),icon:ki},{key:"agents",label:C("project.nav.agents"),icon:vn},{key:"memories",label:C("project.nav.memories"),icon:Ju}]},{title:C("project.sections.automation"),items:[{key:"routines",label:C("project.nav.routines"),icon:Go},{key:"tasks",label:C("project.nav.tasks"),icon:Bi},{key:"mcps",label:C("project.nav.mcps"),icon:Cg},{key:"logs",label:C("project.nav.logs"),icon:Eg}]},{title:C("project.sections.config"),items:[{key:"config",label:C("project.nav.config"),icon:ed}]}],[g]),h=n.pathname.replace(`/p/${r}`,"").replace(/^\//,"").split("/")[0];if(!i)return l.jsx("div",{className:"p-8 text-muted-fg",children:C("project.not_found",{pid:r})});const x=async()=>{try{await Qn.rebuild(r),s.success(C("project.rebuild_done"))}catch(_){s.error(_.message)}},y=async()=>{const _=i.name||i.path;if(confirm(C("project.unregister_confirm",{label:_})))try{await Qn.remove(r),s.success(C("project.unregistered")),c(),e("/")}catch(j){s.error(j.message)}},w=_=>{const j=_?`/p/${r}/${_}`:`/p/${r}`;e(j)},S=Number(r)!==0?l.jsxs(l.Fragment,{children:[l.jsxs(he,{size:"sm",variant:"secondary",onClick:x,children:[l.jsx(rl,{size:13})," ",C("project.rebuild")]}),l.jsx(he,{size:"sm",variant:"destructive",onClick:y,children:C("admin.unregister")})]}):void 0;return l.jsx(Dw,{sections:m,active:h,onChange:w,collapsed:d,onToggleCollapse:f,actions:S,contentClassName:"w-full space-y-6 p-6 pt-3",testId:`project-tab-${h||"overview"}`,children:l.jsxs(W_,{children:[l.jsx(qt,{index:!0,element:l.jsx(I1,{pid:r})}),l.jsx(qt,{path:"workspaces",element:l.jsx(D4,{})}),l.jsx(qt,{path:"models",element:l.jsx(Zw,{})}),l.jsx(qt,{path:"agent-defaults",element:l.jsx($O,{})}),l.jsx(qt,{path:"sessions",element:l.jsx(XO,{})}),l.jsx(qt,{path:"logs",element:l.jsx(OO,{pid:r})}),l.jsx(qt,{path:"config",element:l.jsx(gz,{pid:r})}),l.jsx(qt,{path:"telegram",element:l.jsx(Qz,{pid:r})}),l.jsx(qt,{path:"agents",element:l.jsx(vz,{pid:r})}),l.jsx(qt,{path:"agents/:slug",element:l.jsx(qD,{pid:r})}),l.jsx(qt,{path:"memories",element:l.jsx(Jz,{pid:r})}),l.jsx(qt,{path:"routines",element:l.jsx(Rz,{pid:r})}),l.jsx(qt,{path:"tasks",element:g?l.jsx(KO,{}):l.jsx(Tz,{pid:r})}),l.jsx(qt,{path:"mcps",element:l.jsx(Az,{pid:r})}),l.jsx(qt,{path:"threads",element:l.jsx(Oz,{pid:r})}),l.jsx(qt,{path:"chat",element:l.jsx(Xz,{pid:r})}),l.jsx(qt,{path:"*",element:l.jsx(I1,{pid:r})})]})})}function f2(){const{data:e,error:n,isLoading:s,mutate:r}=Qe("/identity",()=>E1.get());return{identity:e||{},error:n,isLoading:s,mutate:r,save:async c=>{const d=await E1.patch(c);return await r(d,{revalidate:!1}),d}}}const QD=["es","en","pt","fr","it","de"];function ZD(){const e=rt(),{identity:n,isLoading:s,save:r}=f2(),[i,c]=v.useState({}),[d,f]=v.useState(!1);if(v.useEffect(()=>{c(n)},[n]),s)return l.jsx(Je,{});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(C("settings.identity.saved"))}catch(m){e.error(m.message)}finally{f(!1)}};return l.jsxs(He,{title:C("settings.identity.title"),description:C("settings.identity.subtitle"),children:[n?null:l.jsx(lt,{children:C("common.none_yet")}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(fe,{label:C("settings.identity.owner_name"),children:l.jsx(Ce,{value:i.owner_name||"",onChange:m=>c({...i,owner_name:m.target.value})})}),l.jsx(fe,{label:C("settings.identity.language"),children:l.jsx(Ct,{value:i.language||"es",onChange:m=>c({...i,language:m}),options:QD.map(m=>({value:m,label:m}))})}),l.jsx(fe,{label:C("settings.identity.timezone"),hint:"ej. America/Argentina/Buenos_Aires",children:l.jsx(Ce,{value:i.timezone||"",onChange:m=>c({...i,timezone:m.target.value})})})]}),l.jsx("div",{className:"mt-3",children:l.jsx(fe,{label:C("settings.identity.owner_context"),hint:"Quién sos, en qué trabajás, qué le interesa al agente saber de vos.",children:l.jsx(Qt,{rows:3,value:i.owner_context||"",onChange:m=>c({...i,owner_context:m.target.value})})})}),l.jsx("div",{className:"mt-4",children:l.jsx(he,{variant:"primary",loading:d,onClick:g,children:C("common.save")})})]})}function JD(){const e=rt(),n=Ua(),{superAgent:s,isLoading:r,mutate:i}=Kw(),{patch:c}=vr(),{identity:d,save:f}=f2(),[g,m]=v.useState(!0),[h,x]=v.useState(""),[y,w]=v.useState(""),[S,_]=v.useState("permiso"),[j,E]=v.useState(!1);if(v.useEffect(()=>{s&&(m(!!s.enabled),x(s.system||""),_(s.permission_mode||"permiso"))},[s]),v.useEffect(()=>{w(d.personality||"")},[d.personality]),r||!s)return l.jsx(Je,{});const k=async()=>{E(!0);try{await c({"super_agent.enabled":g,"super_agent.system":h,"super_agent.permission_mode":S},["super_agent.name"]),await f({personality:y}),e.success(C("settings.super_agent.saved")),i()}catch(N){e.error(N.message)}finally{E(!1)}};return l.jsx(He,{title:C("settings.super_agent.title"),description:"Comportamiento del super-agente. El modelo y la cadena de fallback se configuran en el Router de modelos.",children:l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"flex items-center gap-3",children:l.jsx(sn,{checked:g,onChange:m,label:"Super-agente habilitado"})}),l.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 p-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-sm font-medium",children:"Modelo activo (router)"}),l.jsx("div",{className:"truncate font-mono text-xs text-muted-fg",children:s.model||"—"})]}),l.jsxs(he,{size:"sm",variant:"secondary",onClick:()=>n("/p/0/models"),children:[l.jsx(fh,{size:13})," Configurar en Modelos"]})]}),l.jsx(fe,{label:C("settings.super_agent.permission_mode"),children:l.jsx(Ct,{value:S,onChange:_,options:xh.map(N=>({value:N,label:N}))})}),l.jsx(fe,{label:C("settings.super_agent.personality"),children:l.jsx(Qt,{rows:2,value:y,onChange:N=>w(N.target.value)})}),l.jsx(fe,{label:C("settings.super_agent.system"),hint:C("settings.super_agent.system_hint"),children:l.jsx(Qt,{rows:6,className:"font-mono text-xs",value:h,onChange:N=>x(N.target.value),placeholder:"(Vacío = se usa el prompt base de core/agent/prompts/super-agent-base.md)"})}),l.jsx(he,{variant:"primary",loading:j,onClick:k,children:C("common.save")})]})})}const Xp={providers:()=>ge.get("/embeddings/providers"),test:(e={})=>ge.post("/embeddings/test",e),reindex:()=>ge.post("/embeddings/reindex",{})},WD=[{value:"auto",label:"Automático (cadena: Ollama → Gemini → OpenAI → offline)"},{value:"ollama",label:"Ollama — local, sin API key (nomic-embed-text)"},{value:"gemini",label:"Gemini — free tier con key (text-embedding-004)"},{value:"openai",label:"OpenAI — text-embedding-3-small (cloud)"},{value:"tf",label:"Offline (term-frequency, sin modelo — degradado)"}],e6=[{value:"chain",label:"Cadena (fallback automático)"},{value:"single",label:"Único (usa solo el elegido)"}],n_=e=>e.startsWith("***");function t6(){const e=rt(),{config:n,isLoading:s,patch:r}=vr(),{data:i,mutate:c}=Qe("/embeddings/providers",()=>Xp.providers()),[d,f]=v.useState(!1),[g,m]=v.useState(null);if(s)return l.jsx(Je,{});const x=(n.memory||{}).embeddings||{},y=i?.configured_provider||x.provider||"auto",w=i?.mode||x.mode||"chain",S=i?.engines||[],_=async k=>{f(!0);try{await r(k),await c()}catch(N){e.error(`No se pudo guardar: ${N.message}`)}finally{f(!1)}},j=async()=>{f(!0),m(null);try{const k=await Xp.test({});m(`${k.embedder} · dim ${k.dim} · ${k.ms}ms`),e.success(`Embedding OK con ${k.embedder}`)}catch(k){e.error(`Falló el test: ${k.message}`)}finally{f(!1)}},E=async()=>{f(!0);try{const k=await Xp.reindex();e.success(`Reindexado: ${k.indexed} chunks (limpiados ${k.cleared}).`)}catch(k){e.error(`Falló el reindex: ${k.message}`)}finally{f(!1)}};return l.jsxs("div",{className:"space-y-6",children:[l.jsx(He,{title:"Embeddings (RAG)",description:"Modelo que vectoriza el historial de todos los canales para la memoria relevante. Igual que TTS/STT: elegí proveedor y modelo. 'Automático' prueba local primero y cae al offline si no hay nada.",children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(fe,{label:"Proveedor",hint:"Ollama es local y gratis. Gemini/OpenAI usan la API key de su sección en Modelos (o la de acá abajo).",children:l.jsx(Ct,{value:y,onChange:k=>_({"memory.embeddings.provider":k}),options:WD,disabled:d,className:"max-w-xl"})}),l.jsx(fe,{label:"Modo de selección",hint:"Cadena cae al siguiente si uno falla; Único usa exactamente el proveedor elegido.",children:l.jsx(Ct,{value:w,onChange:k=>_({"memory.embeddings.mode":k}),options:e6,disabled:d,className:"max-w-md"})}),l.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:S.map(k=>l.jsxs(Ue,{tone:k.available?"success":"muted",children:[k.id,": ",k.available?"disponible":"no disp."]},k.id))}),l.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[l.jsxs(he,{variant:"secondary",onClick:j,loading:d,children:[l.jsx(ol,{size:14})," Probar embedding"]}),l.jsxs(he,{variant:"secondary",onClick:E,loading:d,children:[l.jsx(dj,{size:14})," Reindexar memoria"]}),g&&l.jsx("span",{className:"text-sm text-muted-foreground",children:g})]})]})}),l.jsxs(He,{title:"Ollama (local)",description:"Sin API key. Corre nomic-embed-text en tu Ollama local o cloud.",children:[l.jsx(fe,{label:"Modelo",children:l.jsx(Ce,{defaultValue:x.ollama?.model||"nomic-embed-text",placeholder:"nomic-embed-text",disabled:d,onBlur:k=>{const N=k.target.value.trim();N&&N!==x.ollama?.model&&_({"memory.embeddings.ollama.model":N})},className:"max-w-md"})}),l.jsx(fe,{label:"Base URL",hint:"Vacío usa engines.ollama.base_url (por defecto http://localhost:11434).",children:l.jsx(Ce,{defaultValue:x.ollama?.base_url||"",placeholder:"http://localhost:11434",disabled:d,onBlur:k=>_({"memory.embeddings.ollama.base_url":k.target.value.trim()}),className:"max-w-md"})})]}),l.jsxs(He,{title:"OpenAI",description:"text-embedding-3-small (1536 dims) u otro modelo compatible.",children:[l.jsx(fe,{label:"Modelo",children:l.jsx(Ce,{defaultValue:x.openai?.model||"text-embedding-3-small",placeholder:"text-embedding-3-small",disabled:d,onBlur:k=>{const N=k.target.value.trim();N&&N!==x.openai?.model&&_({"memory.embeddings.openai.model":N})},className:"max-w-md"})}),l.jsx(fe,{label:"API key",hint:"Vacío reusa engines.openai.api_key. Dejalo en blanco para no tocar la guardada.",children:l.jsx(Ce,{type:"password",defaultValue:x.openai?.api_key||"",placeholder:"sk-…",disabled:d,onBlur:k=>{const N=k.target.value;N&&!n_(N)&&_({"memory.embeddings.openai.api_key":N})},className:"max-w-md"})})]}),l.jsxs(He,{title:"Gemini",description:"text-embedding-004 (768 dims). Free tier con API key de Google.",children:[l.jsx(fe,{label:"Modelo",children:l.jsx(Ce,{defaultValue:x.gemini?.model||"text-embedding-004",placeholder:"text-embedding-004",disabled:d,onBlur:k=>{const N=k.target.value.trim();N&&N!==x.gemini?.model&&_({"memory.embeddings.gemini.model":N})},className:"max-w-md"})}),l.jsx(fe,{label:"API key",hint:"Vacío reusa engines.gemini.api_key.",children:l.jsx(Ce,{type:"password",defaultValue:x.gemini?.api_key||"",placeholder:"AIza…",disabled:d,onBlur:k=>{const N=k.target.value;N&&!n_(N)&&_({"memory.embeddings.gemini.api_key":N})},className:"max-w-md"})})]})]})}function n6(){const e=rt(),{config:n,isLoading:s,patch:r,mutate:i}=vr(),c=n.telegram?.channels||[],d=Math.max(0,c.findIndex(A=>A.name==="default")),f=c[d],[g,m]=v.useState(!0),[h,x]=v.useState(1500),[y,w]=v.useState(!0),[S,_]=v.useState(""),[j,E]=v.useState(""),[k,N]=v.useState(!1);if(v.useEffect(()=>{m(!!n.telegram?.enabled),x(Number(n.telegram?.poll_interval_ms||1500)),w(!!n.telegram?.respond_with_engine),_(""),E(f?.chat_id||"")},[n,f?.chat_id]),s)return l.jsx(Je,{});const R=async()=>{N(!0);try{const A=c.slice(),M={name:"default",chat_id:j,respond_with_engine:y,...S?{bot_token:S}:{}};c.length===0?A.push(M):A[d]={...f,...M},await r({"telegram.enabled":g,"telegram.poll_interval_ms":h,"telegram.respond_with_engine":y,"telegram.channels":A}),e.success(C("settings.telegram_global.saved")),i(),_("")}catch(A){e.error(A.message)}finally{N(!1)}};return l.jsx(He,{title:C("settings.telegram_global.title"),description:C("settings.telegram_global.subtitle"),children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(sn,{checked:g,onChange:m,label:C("settings.telegram_global.enabled")}),l.jsx(sn,{checked:y,onChange:w,label:C("settings.telegram_global.respond_with_engine")})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(fe,{label:C("settings.telegram_global.bot_token"),hint:f?.bot_token?`…${el(f.bot_token)??""} (seteado — escribí para reemplazar)`:"Token del BotFather.",children:l.jsx(Ce,{type:"password",value:S,onChange:A=>_(A.target.value),placeholder:f?.bot_token?`…${el(f.bot_token)??""} (ya seteado)`:""})}),l.jsx(fe,{label:C("settings.telegram_global.chat_id"),children:l.jsx(Ce,{value:j,onChange:A=>E(A.target.value),placeholder:"889721252"})}),l.jsx(fe,{label:C("settings.telegram_global.poll_interval"),children:l.jsx(Ce,{type:"number",value:String(h),onChange:A=>x(Number(A.target.value)||1500)})})]}),l.jsx(he,{variant:"primary",loading:k,onClick:R,children:C("common.save")})]})})}function a6(){const e=rt(),{channels:n,isLoading:s,mutate:r}=ux(),{contacts:i}=dx(),[c,d]=v.useState(null),[f,g]=v.useState(null),m=new Map;for(const x of i)m.set(String(x.user_id),x.name||`@${x.username||x.user_id}`);const h=async x=>{if(confirm(C("telegram_channels.delete_confirm",{name:x})))try{await kn.channels.remove(x),e.success(C("telegram_channels.removed")),r()}catch(y){e.error(y.message)}};return l.jsxs(He,{title:C("telegram_channels.title"),description:C("telegram_channels.desc"),action:l.jsxs(he,{size:"sm",onClick:()=>d({name:""}),children:[l.jsx(Rn,{size:14})," ",C("telegram_channels.new_btn")]}),children:[s&&l.jsx(Je,{}),!s&&n.length===0&&l.jsx(lt,{children:C("telegram_channels.empty")}),l.jsx("ul",{className:"space-y-2 text-sm",children:n.map(x=>{const y=x.owner_user_id!=null?m.get(String(x.owner_user_id))||`user_id ${x.owner_user_id}`:C("telegram_channels.no_owner");return l.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:"font-medium",children:x.name}),l.jsxs("div",{className:"flex items-center gap-2",children:[x.project&&l.jsxs(Ue,{tone:"success",children:["project = ",x.project]}),l.jsxs(he,{size:"sm",variant:"ghost",onClick:()=>g(x),children:[l.jsx(Za,{size:13})," ",C("admin.telegram_send_test")]}),l.jsx(he,{size:"sm",variant:"secondary",onClick:()=>d(x),children:C("common.edit")}),l.jsx(he,{size:"sm",variant:"destructive",onClick:()=>h(x.name),children:C("common.delete")})]})]}),l.jsxs("div",{className:"mt-1 grid grid-cols-2 gap-2 text-xs text-muted-fg",children:[l.jsxs("span",{children:["chat_id: ",x.chat_id||"—"]}),l.jsxs("span",{children:["bot_token: ",x.bot_token?`…${el(x.bot_token)??""}`:"—"]}),l.jsxs("span",{children:["route_to_agent: ",x.route_to_agent||"default APX"]}),l.jsxs("span",{children:["engine: ",x.respond_with_engine?"sí":"no"]}),l.jsxs("span",{className:"col-span-2",children:[C("telegram_channels.owner_label")," ",y]})]})]},x.name)})}),l.jsx(Aw,{channel:c,onClose:()=>d(null),onSaved:()=>{d(null),r()}}),l.jsx(Mw,{channel:f,onClose:()=>g(null)})]})}const a_=new Set(["owner","guest"]);function s6(){const e=rt(),{roles:n,mutate:s,isLoading:r}=dx(),[i,c]=v.useState(""),[d,f]=v.useState(""),[g,m]=v.useState(!1),[h,x]=v.useState(!1),y=async()=>{const _=i.trim();if(!_){e.error(C("telegram_roles.name_required"));return}if(a_.has(_)){e.error(C("telegram_roles.builtin_error",{name:_}));return}x(!0);try{const j=g?"*":d.split(",").map(E=>E.trim()).filter(Boolean);await kn.roles.set(_,j),e.success(C("telegram_roles.saved",{name:_})),c(""),f(""),m(!1),s()}catch(j){e.error(j.message)}finally{x(!1)}},w=async _=>{if(confirm(C("telegram_roles.delete_confirm",{name:_})))try{await kn.roles.remove(_),e.success(C("telegram_roles.removed")),s()}catch(j){e.error(j.message)}},S=Object.entries(n);return l.jsxs(He,{title:C("telegram_roles.title"),description:C("telegram_roles.desc"),children:[r&&l.jsx(Je,{}),S.length===0&&!r&&l.jsx(lt,{children:C("telegram_roles.empty")}),S.length>0&&l.jsx("ul",{className:"space-y-2 text-sm",children:S.map(([_,j])=>{const E=a_.has(_),k=j?.tools==="*"?C("telegram_roles.tools_all"):Array.isArray(j?.tools)&&j.tools.length>0?j.tools.join(", "):C("telegram_roles.tools_none");return l.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("span",{className:"font-medium",children:_}),E&&l.jsx(Ue,{tone:"info",children:C("telegram_roles.builtin")})]}),!E&&l.jsx(he,{size:"sm",variant:"destructive",onClick:()=>w(_),children:C("telegram_roles.delete_btn")})]}),l.jsxs("div",{className:"mt-1 text-xs text-muted-fg",children:["tools: ",k]})]},_)})}),l.jsxs("div",{className:"mt-4 space-y-3 rounded-md border border-dashed border-border p-3",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[l.jsx(Rn,{size:14})," ",C("telegram_roles.new_title")]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(fe,{label:C("telegram_roles.name_label"),children:l.jsx(Ce,{value:i,onChange:_=>c(_.target.value),placeholder:C("telegram_roles.name_ph")})}),l.jsx(fe,{label:C("telegram_roles.tools_label"),hint:C("telegram_roles.tools_hint"),children:l.jsx(Ce,{value:d,onChange:_=>f(_.target.value),disabled:g,placeholder:C("telegram_roles.tools_ph")})})]}),l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsx(sn,{checked:g,onChange:m,label:C("telegram_roles.full_access")}),l.jsx(he,{variant:"primary",loading:h,onClick:y,children:C("telegram_roles.save_btn")})]})]})]})}const m2="apx.settings.telegramTab";function r6(){if(typeof window>"u")return"default";const e=window.localStorage.getItem(m2);return e==="channels"||e==="contacts"||e==="roles"||e==="default"?e:"default"}function o6(){const[e,n]=v.useState("default");v.useEffect(()=>{n(r6())},[]);const s=r=>{const i=r==="channels"||r==="contacts"||r==="roles"||r==="default"?r:"default";n(i);try{window.localStorage.setItem(m2,i)}catch{}};return l.jsxs(Xd,{value:e,onValueChange:s,className:"w-full",children:[l.jsxs(Kd,{children:[l.jsx(Da,{value:"default",children:C("settings.telegram_global.title")}),l.jsx(Da,{value:"channels",children:C("telegram_channels.title")}),l.jsx(Da,{value:"contacts",children:C("telegram_contacts.title")}),l.jsx(Da,{value:"roles",children:C("telegram_roles.title")})]}),l.jsx(La,{value:"default",className:"mt-4",children:l.jsx(n6,{})}),l.jsx(La,{value:"channels",className:"mt-4",children:l.jsx(a6,{})}),l.jsx(La,{value:"contacts",className:"mt-4",children:l.jsx(Ow,{})}),l.jsx(La,{value:"roles",className:"mt-4",children:l.jsx(s6,{})})]})}function l6(){const{data:e,error:n,isLoading:s,mutate:r}=Qe("/pair/list",()=>Jo.list(),{refreshInterval:Ed.pairList});return{clients:e?.clients||[],error:n,isLoading:s,mutate:r}}var Io={},Kp,s_;function i6(){return s_||(s_=1,Kp=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Kp}var Qp={},rr={},r_;function Wr(){if(r_)return rr;r_=1;let e;const n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return rr.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},rr.getSymbolTotalCodewords=function(r){return n[r]},rr.getBCHDigit=function(s){let r=0;for(;s!==0;)r++,s>>>=1;return r},rr.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');e=r},rr.isKanjiModeEnabled=function(){return typeof e<"u"},rr.toSJIS=function(r){return e(r)},rr}var Zp={},o_;function kx(){return o_||(o_=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function n(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.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: "+s)}}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 n(r)}catch{return i}}})(Zp)),Zp}var Jp,l_;function c6(){if(l_)return Jp;l_=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(n){const s=Math.floor(n/8);return(this.buffer[s]>>>7-n%8&1)===1},put:function(n,s){for(let r=0;r<s;r++)this.putBit((n>>>s-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(n){const s=Math.floor(this.length/8);this.buffer.length<=s&&this.buffer.push(0),n&&(this.buffer[s]|=128>>>this.length%8),this.length++}},Jp=e,Jp}var Wp,i_;function u6(){if(i_)return Wp;i_=1;function e(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n)}return e.prototype.set=function(n,s,r,i){const c=n*this.size+s;this.data[c]=r,i&&(this.reservedBit[c]=!0)},e.prototype.get=function(n,s){return this.data[n*this.size+s]},e.prototype.xor=function(n,s,r){this.data[n*this.size+s]^=r},e.prototype.isReserved=function(n,s){return this.reservedBit[n*this.size+s]},Wp=e,Wp}var eg={},c_;function d6(){return c_||(c_=1,(function(e){const n=Wr().getSymbolSize;e.getRowColCoords=function(r){if(r===1)return[];const i=Math.floor(r/7)+2,c=n(r),d=c===145?26:Math.ceil((c-13)/(2*i-2))*2,f=[c-7];for(let g=1;g<i-1;g++)f[g]=f[g-1]-d;return f.push(6),f.reverse()},e.getPositions=function(r){const i=[],c=e.getRowColCoords(r),d=c.length;for(let f=0;f<d;f++)for(let g=0;g<d;g++)f===0&&g===0||f===0&&g===d-1||f===d-1&&g===0||i.push([c[f],c[g]]);return i}})(eg)),eg}var tg={},u_;function f6(){if(u_)return tg;u_=1;const e=Wr().getSymbolSize,n=7;return tg.getPositions=function(r){const i=e(r);return[[0,0],[i-n,0],[0,i-n]]},tg}var ng={},d_;function m6(){return d_||(d_=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const n={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 c=i.size;let d=0,f=0,g=0,m=null,h=null;for(let x=0;x<c;x++){f=g=0,m=h=null;for(let y=0;y<c;y++){let w=i.get(x,y);w===m?f++:(f>=5&&(d+=n.N1+(f-5)),m=w,f=1),w=i.get(y,x),w===h?g++:(g>=5&&(d+=n.N1+(g-5)),h=w,g=1)}f>=5&&(d+=n.N1+(f-5)),g>=5&&(d+=n.N1+(g-5))}return d},e.getPenaltyN2=function(i){const c=i.size;let d=0;for(let f=0;f<c-1;f++)for(let g=0;g<c-1;g++){const m=i.get(f,g)+i.get(f,g+1)+i.get(f+1,g)+i.get(f+1,g+1);(m===4||m===0)&&d++}return d*n.N2},e.getPenaltyN3=function(i){const c=i.size;let d=0,f=0,g=0;for(let m=0;m<c;m++){f=g=0;for(let h=0;h<c;h++)f=f<<1&2047|i.get(m,h),h>=10&&(f===1488||f===93)&&d++,g=g<<1&2047|i.get(h,m),h>=10&&(g===1488||g===93)&&d++}return d*n.N3},e.getPenaltyN4=function(i){let c=0;const d=i.data.length;for(let g=0;g<d;g++)c+=i.data[g];return Math.abs(Math.ceil(c*100/d/5)-10)*n.N4};function s(r,i,c){switch(r){case e.Patterns.PATTERN000:return(i+c)%2===0;case e.Patterns.PATTERN001:return i%2===0;case e.Patterns.PATTERN010:return c%3===0;case e.Patterns.PATTERN011:return(i+c)%3===0;case e.Patterns.PATTERN100:return(Math.floor(i/2)+Math.floor(c/3))%2===0;case e.Patterns.PATTERN101:return i*c%2+i*c%3===0;case e.Patterns.PATTERN110:return(i*c%2+i*c%3)%2===0;case e.Patterns.PATTERN111:return(i*c%3+(i+c)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}e.applyMask=function(i,c){const d=c.size;for(let f=0;f<d;f++)for(let g=0;g<d;g++)c.isReserved(g,f)||c.xor(g,f,s(i,g,f))},e.getBestMask=function(i,c){const d=Object.keys(e.Patterns).length;let f=0,g=1/0;for(let m=0;m<d;m++){c(m),e.applyMask(m,i);const h=e.getPenaltyN1(i)+e.getPenaltyN2(i)+e.getPenaltyN3(i)+e.getPenaltyN4(i);e.applyMask(m,i),h<g&&(g=h,f=m)}return f}})(ng)),ng}var Iu={},f_;function p2(){if(f_)return Iu;f_=1;const e=kx(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],s=[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 Iu.getBlocksCount=function(i,c){switch(c){case e.L:return n[(i-1)*4+0];case e.M:return n[(i-1)*4+1];case e.Q:return n[(i-1)*4+2];case e.H:return n[(i-1)*4+3];default:return}},Iu.getTotalCodewordsCount=function(i,c){switch(c){case e.L:return s[(i-1)*4+0];case e.M:return s[(i-1)*4+1];case e.Q:return s[(i-1)*4+2];case e.H:return s[(i-1)*4+3];default:return}},Iu}var ag={},yi={},m_;function p6(){if(m_)return yi;m_=1;const e=new Uint8Array(512),n=new Uint8Array(256);return(function(){let r=1;for(let i=0;i<255;i++)e[i]=r,n[r]=i,r<<=1,r&256&&(r^=285);for(let i=255;i<512;i++)e[i]=e[i-255]})(),yi.log=function(r){if(r<1)throw new Error("log("+r+")");return n[r]},yi.exp=function(r){return e[r]},yi.mul=function(r,i){return r===0||i===0?0:e[n[r]+n[i]]},yi}var p_;function g6(){return p_||(p_=1,(function(e){const n=p6();e.mul=function(r,i){const c=new Uint8Array(r.length+i.length-1);for(let d=0;d<r.length;d++)for(let f=0;f<i.length;f++)c[d+f]^=n.mul(r[d],i[f]);return c},e.mod=function(r,i){let c=new Uint8Array(r);for(;c.length-i.length>=0;){const d=c[0];for(let g=0;g<i.length;g++)c[g]^=n.mul(i[g],d);let f=0;for(;f<c.length&&c[f]===0;)f++;c=c.slice(f)}return c},e.generateECPolynomial=function(r){let i=new Uint8Array([1]);for(let c=0;c<r;c++)i=e.mul(i,new Uint8Array([1,n.exp(c)]));return i}})(ag)),ag}var sg,g_;function h6(){if(g_)return sg;g_=1;const e=g6();function n(s){this.genPoly=void 0,this.degree=s,this.degree&&this.initialize(this.degree)}return n.prototype.initialize=function(r){this.degree=r,this.genPoly=e.generateECPolynomial(this.degree)},n.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 c=e.mod(i,this.genPoly),d=this.degree-c.length;if(d>0){const f=new Uint8Array(this.degree);return f.set(c,d),f}return c},sg=n,sg}var rg={},og={},lg={},h_;function g2(){return h_||(h_=1,lg.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}),lg}var Ga={},x_;function h2(){if(x_)return Ga;x_=1;const e="[0-9]+",n="[A-Z $%*+\\-./:]+";let s="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";s=s.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+s+`)(?:.|[\r
|
|
534
|
+
]))+`;Ga.KANJI=new RegExp(s,"g"),Ga.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Ga.BYTE=new RegExp(r,"g"),Ga.NUMERIC=new RegExp(e,"g"),Ga.ALPHANUMERIC=new RegExp(n,"g");const i=new RegExp("^"+s+"$"),c=new RegExp("^"+e+"$"),d=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Ga.testKanji=function(g){return i.test(g)},Ga.testNumeric=function(g){return c.test(g)},Ga.testAlphanumeric=function(g){return d.test(g)},Ga}var b_;function eo(){return b_||(b_=1,(function(e){const n=g2(),s=h2();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(c,d){if(!c.ccBits)throw new Error("Invalid mode: "+c);if(!n.isValid(d))throw new Error("Invalid version: "+d);return d>=1&&d<10?c.ccBits[0]:d<27?c.ccBits[1]:c.ccBits[2]},e.getBestModeForData=function(c){return s.testNumeric(c)?e.NUMERIC:s.testAlphanumeric(c)?e.ALPHANUMERIC:s.testKanji(c)?e.KANJI:e.BYTE},e.toString=function(c){if(c&&c.id)return c.id;throw new Error("Invalid mode")},e.isValid=function(c){return c&&c.bit&&c.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(c,d){if(e.isValid(c))return c;try{return r(c)}catch{return d}}})(og)),og}var v_;function x6(){return v_||(v_=1,(function(e){const n=Wr(),s=p2(),r=kx(),i=eo(),c=g2(),d=7973,f=n.getBCHDigit(d);function g(y,w,S){for(let _=1;_<=40;_++)if(w<=e.getCapacity(_,S,y))return _}function m(y,w){return i.getCharCountIndicator(y,w)+4}function h(y,w){let S=0;return y.forEach(function(_){const j=m(_.mode,w);S+=j+_.getBitsLength()}),S}function x(y,w){for(let S=1;S<=40;S++)if(h(y,S)<=e.getCapacity(S,w,i.MIXED))return S}e.from=function(w,S){return c.isValid(w)?parseInt(w,10):S},e.getCapacity=function(w,S,_){if(!c.isValid(w))throw new Error("Invalid QR Code version");typeof _>"u"&&(_=i.BYTE);const j=n.getSymbolTotalCodewords(w),E=s.getTotalCodewordsCount(w,S),k=(j-E)*8;if(_===i.MIXED)return k;const N=k-m(_,w);switch(_){case i.NUMERIC:return Math.floor(N/10*3);case i.ALPHANUMERIC:return Math.floor(N/11*2);case i.KANJI:return Math.floor(N/13);case i.BYTE:default:return Math.floor(N/8)}},e.getBestVersionForData=function(w,S){let _;const j=r.from(S,r.M);if(Array.isArray(w)){if(w.length>1)return x(w,j);if(w.length===0)return 1;_=w[0]}else _=w;return g(_.mode,_.getLength(),j)},e.getEncodedBits=function(w){if(!c.isValid(w)||w<7)throw new Error("Invalid QR Code version");let S=w<<12;for(;n.getBCHDigit(S)-f>=0;)S^=d<<n.getBCHDigit(S)-f;return w<<12|S}})(rg)),rg}var ig={},y_;function b6(){if(y_)return ig;y_=1;const e=Wr(),n=1335,s=21522,r=e.getBCHDigit(n);return ig.getEncodedBits=function(c,d){const f=c.bit<<3|d;let g=f<<10;for(;e.getBCHDigit(g)-r>=0;)g^=n<<e.getBCHDigit(g)-r;return(f<<10|g)^s},ig}var cg={},ug,__;function v6(){if(__)return ug;__=1;const e=eo();function n(s){this.mode=e.NUMERIC,this.data=s.toString()}return n.getBitsLength=function(r){return 10*Math.floor(r/3)+(r%3?r%3*3+1:0)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(r){let i,c,d;for(i=0;i+3<=this.data.length;i+=3)c=this.data.substr(i,3),d=parseInt(c,10),r.put(d,10);const f=this.data.length-i;f>0&&(c=this.data.substr(i),d=parseInt(c,10),r.put(d,f*3+1))},ug=n,ug}var dg,j_;function y6(){if(j_)return dg;j_=1;const e=eo(),n=["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 s(r){this.mode=e.ALPHANUMERIC,this.data=r}return s.getBitsLength=function(i){return 11*Math.floor(i/2)+6*(i%2)},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(i){let c;for(c=0;c+2<=this.data.length;c+=2){let d=n.indexOf(this.data[c])*45;d+=n.indexOf(this.data[c+1]),i.put(d,11)}this.data.length%2&&i.put(n.indexOf(this.data[c]),6)},dg=s,dg}var fg,S_;function _6(){if(S_)return fg;S_=1;const e=eo();function n(s){this.mode=e.BYTE,typeof s=="string"?this.data=new TextEncoder().encode(s):this.data=new Uint8Array(s)}return n.getBitsLength=function(r){return r*8},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(s){for(let r=0,i=this.data.length;r<i;r++)s.put(this.data[r],8)},fg=n,fg}var mg,w_;function j6(){if(w_)return mg;w_=1;const e=eo(),n=Wr();function s(r){this.mode=e.KANJI,this.data=r}return s.getBitsLength=function(i){return i*13},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(r){let i;for(i=0;i<this.data.length;i++){let c=n.toSJIS(this.data[i]);if(c>=33088&&c<=40956)c-=33088;else if(c>=57408&&c<=60351)c-=49472;else throw new Error("Invalid SJIS character: "+this.data[i]+`
|
|
535
|
+
Make sure your charset is UTF-8`);c=(c>>>8&255)*192+(c&255),r.put(c,13)}},mg=s,mg}var pg={exports:{}},C_;function S6(){return C_||(C_=1,(function(e){var n={single_source_shortest_paths:function(s,r,i){var c={},d={};d[r]=0;var f=n.PriorityQueue.make();f.push(r,0);for(var g,m,h,x,y,w,S,_,j;!f.empty();){g=f.pop(),m=g.value,x=g.cost,y=s[m]||{};for(h in y)y.hasOwnProperty(h)&&(w=y[h],S=x+w,_=d[h],j=typeof d[h]>"u",(j||_>S)&&(d[h]=S,f.push(h,S),c[h]=m))}if(typeof i<"u"&&typeof d[i]>"u"){var E=["Could not find a path from ",r," to ",i,"."].join("");throw new Error(E)}return c},extract_shortest_path_from_predecessor_list:function(s,r){for(var i=[],c=r;c;)i.push(c),s[c],c=s[c];return i.reverse(),i},find_path:function(s,r,i){var c=n.single_source_shortest_paths(s,r,i);return n.extract_shortest_path_from_predecessor_list(c,i)},PriorityQueue:{make:function(s){var r=n.PriorityQueue,i={},c;s=s||{};for(c in r)r.hasOwnProperty(c)&&(i[c]=r[c]);return i.queue=[],i.sorter=s.sorter||r.default_sorter,i},default_sorter:function(s,r){return s.cost-r.cost},push:function(s,r){var i={value:s,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=n})(pg)),pg.exports}var E_;function w6(){return E_||(E_=1,(function(e){const n=eo(),s=v6(),r=y6(),i=_6(),c=j6(),d=h2(),f=Wr(),g=S6();function m(E){return unescape(encodeURIComponent(E)).length}function h(E,k,N){const R=[];let A;for(;(A=E.exec(N))!==null;)R.push({data:A[0],index:A.index,mode:k,length:A[0].length});return R}function x(E){const k=h(d.NUMERIC,n.NUMERIC,E),N=h(d.ALPHANUMERIC,n.ALPHANUMERIC,E);let R,A;return f.isKanjiModeEnabled()?(R=h(d.BYTE,n.BYTE,E),A=h(d.KANJI,n.KANJI,E)):(R=h(d.BYTE_KANJI,n.BYTE,E),A=[]),k.concat(N,R,A).sort(function(O,U){return O.index-U.index}).map(function(O){return{data:O.data,mode:O.mode,length:O.length}})}function y(E,k){switch(k){case n.NUMERIC:return s.getBitsLength(E);case n.ALPHANUMERIC:return r.getBitsLength(E);case n.KANJI:return c.getBitsLength(E);case n.BYTE:return i.getBitsLength(E)}}function w(E){return E.reduce(function(k,N){const R=k.length-1>=0?k[k.length-1]:null;return R&&R.mode===N.mode?(k[k.length-1].data+=N.data,k):(k.push(N),k)},[])}function S(E){const k=[];for(let N=0;N<E.length;N++){const R=E[N];switch(R.mode){case n.NUMERIC:k.push([R,{data:R.data,mode:n.ALPHANUMERIC,length:R.length},{data:R.data,mode:n.BYTE,length:R.length}]);break;case n.ALPHANUMERIC:k.push([R,{data:R.data,mode:n.BYTE,length:R.length}]);break;case n.KANJI:k.push([R,{data:R.data,mode:n.BYTE,length:m(R.data)}]);break;case n.BYTE:k.push([{data:R.data,mode:n.BYTE,length:m(R.data)}])}}return k}function _(E,k){const N={},R={start:{}};let A=["start"];for(let M=0;M<E.length;M++){const O=E[M],U=[];for(let I=0;I<O.length;I++){const B=O[I],L=""+M+I;U.push(L),N[L]={node:B,lastCount:0},R[L]={};for(let D=0;D<A.length;D++){const q=A[D];N[q]&&N[q].node.mode===B.mode?(R[q][L]=y(N[q].lastCount+B.length,B.mode)-y(N[q].lastCount,B.mode),N[q].lastCount+=B.length):(N[q]&&(N[q].lastCount=B.length),R[q][L]=y(B.length,B.mode)+4+n.getCharCountIndicator(B.mode,k))}}A=U}for(let M=0;M<A.length;M++)R[A[M]].end=0;return{map:R,table:N}}function j(E,k){let N;const R=n.getBestModeForData(E);if(N=n.from(k,R),N!==n.BYTE&&N.bit<R.bit)throw new Error('"'+E+'" cannot be encoded with mode '+n.toString(N)+`.
|
|
536
|
+
Suggested mode is: `+n.toString(R));switch(N===n.KANJI&&!f.isKanjiModeEnabled()&&(N=n.BYTE),N){case n.NUMERIC:return new s(E);case n.ALPHANUMERIC:return new r(E);case n.KANJI:return new c(E);case n.BYTE:return new i(E)}}e.fromArray=function(k){return k.reduce(function(N,R){return typeof R=="string"?N.push(j(R,null)):R.data&&N.push(j(R.data,R.mode)),N},[])},e.fromString=function(k,N){const R=x(k,f.isKanjiModeEnabled()),A=S(R),M=_(A,N),O=g.find_path(M.map,"start","end"),U=[];for(let I=1;I<O.length-1;I++)U.push(M.table[O[I]].node);return e.fromArray(w(U))},e.rawSplit=function(k){return e.fromArray(x(k,f.isKanjiModeEnabled()))}})(cg)),cg}var k_;function C6(){if(k_)return Qp;k_=1;const e=Wr(),n=kx(),s=c6(),r=u6(),i=d6(),c=f6(),d=m6(),f=p2(),g=h6(),m=x6(),h=b6(),x=eo(),y=w6();function w(M,O){const U=M.size,I=c.getPositions(O);for(let B=0;B<I.length;B++){const L=I[B][0],D=I[B][1];for(let q=-1;q<=7;q++)if(!(L+q<=-1||U<=L+q))for(let F=-1;F<=7;F++)D+F<=-1||U<=D+F||(q>=0&&q<=6&&(F===0||F===6)||F>=0&&F<=6&&(q===0||q===6)||q>=2&&q<=4&&F>=2&&F<=4?M.set(L+q,D+F,!0,!0):M.set(L+q,D+F,!1,!0))}}function S(M){const O=M.size;for(let U=8;U<O-8;U++){const I=U%2===0;M.set(U,6,I,!0),M.set(6,U,I,!0)}}function _(M,O){const U=i.getPositions(O);for(let I=0;I<U.length;I++){const B=U[I][0],L=U[I][1];for(let D=-2;D<=2;D++)for(let q=-2;q<=2;q++)D===-2||D===2||q===-2||q===2||D===0&&q===0?M.set(B+D,L+q,!0,!0):M.set(B+D,L+q,!1,!0)}}function j(M,O){const U=M.size,I=m.getEncodedBits(O);let B,L,D;for(let q=0;q<18;q++)B=Math.floor(q/3),L=q%3+U-8-3,D=(I>>q&1)===1,M.set(B,L,D,!0),M.set(L,B,D,!0)}function E(M,O,U){const I=M.size,B=h.getEncodedBits(O,U);let L,D;for(L=0;L<15;L++)D=(B>>L&1)===1,L<6?M.set(L,8,D,!0):L<8?M.set(L+1,8,D,!0):M.set(I-15+L,8,D,!0),L<8?M.set(8,I-L-1,D,!0):L<9?M.set(8,15-L-1+1,D,!0):M.set(8,15-L-1,D,!0);M.set(I-8,8,1,!0)}function k(M,O){const U=M.size;let I=-1,B=U-1,L=7,D=0;for(let q=U-1;q>0;q-=2)for(q===6&&q--;;){for(let F=0;F<2;F++)if(!M.isReserved(B,q-F)){let Z=!1;D<O.length&&(Z=(O[D]>>>L&1)===1),M.set(B,q-F,Z),L--,L===-1&&(D++,L=7)}if(B+=I,B<0||U<=B){B-=I,I=-I;break}}}function N(M,O,U){const I=new s;U.forEach(function(F){I.put(F.mode.bit,4),I.put(F.getLength(),x.getCharCountIndicator(F.mode,M)),F.write(I)});const B=e.getSymbolTotalCodewords(M),L=f.getTotalCodewordsCount(M,O),D=(B-L)*8;for(I.getLengthInBits()+4<=D&&I.put(0,4);I.getLengthInBits()%8!==0;)I.putBit(0);const q=(D-I.getLengthInBits())/8;for(let F=0;F<q;F++)I.put(F%2?17:236,8);return R(I,M,O)}function R(M,O,U){const I=e.getSymbolTotalCodewords(O),B=f.getTotalCodewordsCount(O,U),L=I-B,D=f.getBlocksCount(O,U),q=I%D,F=D-q,Z=Math.floor(I/D),H=Math.floor(L/D),G=H+1,Q=Z-H,V=new g(Q);let Y=0;const P=new Array(D),K=new Array(D);let $=0;const W=new Uint8Array(M.buffer);for(let te=0;te<D;te++){const Ne=te<F?H:G;P[te]=W.slice(Y,Y+Ne),K[te]=V.encode(P[te]),Y+=Ne,$=Math.max($,Ne)}const ce=new Uint8Array(I);let ie=0,oe,ue;for(oe=0;oe<$;oe++)for(ue=0;ue<D;ue++)oe<P[ue].length&&(ce[ie++]=P[ue][oe]);for(oe=0;oe<Q;oe++)for(ue=0;ue<D;ue++)ce[ie++]=K[ue][oe];return ce}function A(M,O,U,I){let B;if(Array.isArray(M))B=y.fromArray(M);else if(typeof M=="string"){let Z=O;if(!Z){const H=y.rawSplit(M);Z=m.getBestVersionForData(H,U)}B=y.fromString(M,Z||40)}else throw new Error("Invalid data");const L=m.getBestVersionForData(B,U);if(!L)throw new Error("The amount of data is too big to be stored in a QR Code");if(!O)O=L;else if(O<L)throw new Error(`
|
|
537
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
538
|
+
Minimum version required to store current data is: `+L+`.
|
|
539
|
+
`);const D=N(O,U,B),q=e.getSymbolSize(O),F=new r(q);return w(F,O),S(F),_(F,O),E(F,U,0),O>=7&&j(F,O),k(F,D),isNaN(I)&&(I=d.getBestMask(F,E.bind(null,F,U))),d.applyMask(I,F),E(F,U,I),{modules:F,version:O,errorCorrectionLevel:U,maskPattern:I,segments:B}}return Qp.create=function(O,U){if(typeof O>"u"||O==="")throw new Error("No input text");let I=n.M,B,L;return typeof U<"u"&&(I=n.from(U.errorCorrectionLevel,n.M),B=m.from(U.version),L=d.from(U.maskPattern),U.toSJISFunc&&e.setToSJISFunction(U.toSJISFunc)),A(O,B,I,L)},Qp}var gg={},hg={},R_;function x2(){return R_||(R_=1,(function(e){function n(s){if(typeof s=="number"&&(s=s.toString()),typeof s!="string")throw new Error("Color should be defined as hex string");let r=s.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+s);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(c){return[c,c]}))),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,c=r.width&&r.width>=21?r.width:void 0,d=r.scale||4;return{width:c,scale:c?4:d,margin:i,color:{dark:n(r.color.dark||"#000000ff"),light:n(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 c=e.getScale(r,i);return Math.floor((r+i.margin*2)*c)},e.qrToImageData=function(r,i,c){const d=i.modules.size,f=i.modules.data,g=e.getScale(d,c),m=Math.floor((d+c.margin*2)*g),h=c.margin*g,x=[c.color.light,c.color.dark];for(let y=0;y<m;y++)for(let w=0;w<m;w++){let S=(y*m+w)*4,_=c.color.light;if(y>=h&&w>=h&&y<m-h&&w<m-h){const j=Math.floor((y-h)/g),E=Math.floor((w-h)/g);_=x[f[j*d+E]?1:0]}r[S++]=_.r,r[S++]=_.g,r[S++]=_.b,r[S]=_.a}}})(hg)),hg}var N_;function E6(){return N_||(N_=1,(function(e){const n=x2();function s(i,c,d){i.clearRect(0,0,c.width,c.height),c.style||(c.style={}),c.height=d,c.width=d,c.style.height=d+"px",c.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(c,d,f){let g=f,m=d;typeof g>"u"&&(!d||!d.getContext)&&(g=d,d=void 0),d||(m=r()),g=n.getOptions(g);const h=n.getImageWidth(c.modules.size,g),x=m.getContext("2d"),y=x.createImageData(h,h);return n.qrToImageData(y.data,c,g),s(x,m,h),x.putImageData(y,0,0),m},e.renderToDataURL=function(c,d,f){let g=f;typeof g>"u"&&(!d||!d.getContext)&&(g=d,d=void 0),g||(g={});const m=e.render(c,d,g),h=g.type||"image/png",x=g.rendererOpts||{};return m.toDataURL(h,x.quality)}})(gg)),gg}var xg={},T_;function k6(){if(T_)return xg;T_=1;const e=x2();function n(i,c){const d=i.a/255,f=c+'="'+i.hex+'"';return d<1?f+" "+c+'-opacity="'+d.toFixed(2).slice(1)+'"':f}function s(i,c,d){let f=i+c;return typeof d<"u"&&(f+=" "+d),f}function r(i,c,d){let f="",g=0,m=!1,h=0;for(let x=0;x<i.length;x++){const y=Math.floor(x%c),w=Math.floor(x/c);!y&&!m&&(m=!0),i[x]?(h++,x>0&&y>0&&i[x-1]||(f+=m?s("M",y+d,.5+w+d):s("m",g,0),g=0,m=!1),y+1<c&&i[x+1]||(f+=s("h",h),h=0)):g++}return f}return xg.render=function(c,d,f){const g=e.getOptions(d),m=c.modules.size,h=c.modules.data,x=m+g.margin*2,y=g.color.light.a?"<path "+n(g.color.light,"fill")+' d="M0 0h'+x+"v"+x+'H0z"/>':"",w="<path "+n(g.color.dark,"stroke")+' d="'+r(h,m,g.margin)+'"/>',S='viewBox="0 0 '+x+" "+x+'"',j='<svg xmlns="http://www.w3.org/2000/svg" '+(g.width?'width="'+g.width+'" height="'+g.width+'" ':"")+S+' shape-rendering="crispEdges">'+y+w+`</svg>
|
|
540
|
+
`;return typeof f=="function"&&f(null,j),j},xg}var A_;function R6(){if(A_)return Io;A_=1;const e=i6(),n=C6(),s=E6(),r=k6();function i(c,d,f,g,m){const h=[].slice.call(arguments,1),x=h.length,y=typeof h[x-1]=="function";if(!y&&!e())throw new Error("Callback required as last argument");if(y){if(x<2)throw new Error("Too few arguments provided");x===2?(m=f,f=d,d=g=void 0):x===3&&(d.getContext&&typeof m>"u"?(m=g,g=void 0):(m=g,g=f,f=d,d=void 0))}else{if(x<1)throw new Error("Too few arguments provided");return x===1?(f=d,d=g=void 0):x===2&&!d.getContext&&(g=f,f=d,d=void 0),new Promise(function(w,S){try{const _=n.create(f,g);w(c(_,d,g))}catch(_){S(_)}})}try{const w=n.create(f,g);m(null,c(w,d,g))}catch(w){m(w)}}return Io.create=n.create,Io.toCanvas=i.bind(null,s.render),Io.toDataURL=i.bind(null,s.renderToDataURL),Io.toString=i.bind(null,function(c,d,f){return r.render(c,f)}),Io}var N6=R6();const T6=th(N6);function A6({value:e,size:n=200}){const[s,r]=v.useState(null);return v.useEffect(()=>{let i=!0;return T6.toDataURL(e,{margin:2,width:n*2,errorCorrectionLevel:"M"}).then(c=>{i&&r(c)}).catch(()=>{i&&r(null)}),()=>{i=!1}},[e,n]),l.jsx("div",{className:"grid place-items-center rounded-lg bg-white p-3",style:{width:n+24,height:n+24},children:s?l.jsx("img",{src:s,width:n,height:n,alt:"QR"}):l.jsx("div",{className:"size-full animate-pulse rounded bg-muted"})})}function M6(e){return e.find(n=>!n.includes("127.0.0.1")&&!n.includes("localhost"))||e[0]||window.location.origin}function O6({open:e,onClose:n,onPaired:s}){const r=rt(),[i,c]=v.useState(null),[d,f]=v.useState(null),[g,m]=v.useState(0),[h,x]=v.useState(!1),y=v.useRef(null),w=v.useCallback(async()=>{c(null),f(null),x(!1);try{const k=await Jo.init();c(k),m(Math.round((k.ttl_ms||9e4)/1e3))}catch(k){k instanceof ac&&k.status===403?f(C("settings.devices_pair_localhost_only")):f(k.message)}},[]);v.useEffect(()=>{e?w():(c(null),f(null),x(!1))},[e,w]),v.useEffect(()=>{if(!i||h||g<=0)return;const k=window.setTimeout(()=>m(N=>N-1),1e3);return()=>window.clearTimeout(k)},[i,g,h]),v.useEffect(()=>{if(!e||!i||h)return;let k=!0;const N=async()=>{try{const R=await Jo.status(i.pairing_id);if(!k)return;if(R.status==="confirmed"){x(!0),r.success(C("settings.devices_pair_done")),s(),window.setTimeout(()=>{k&&n()},900);return}if(R.status==="expired"||R.status==="unknown"){m(0);return}}catch{}y.current=window.setTimeout(N,1500)};return y.current=window.setTimeout(N,1500),()=>{k=!1,y.current&&window.clearTimeout(y.current)}},[e,i,h,n,s,r]);const S=!!i&&!h&&g<=0,_=i?M6(i.lan_urls):"",j=i?`${_}/#pair=${i.pairing_id}`:"",E=async(k,N)=>{try{await navigator.clipboard.writeText(k),r.success(N)}catch{r.error(k)}};return l.jsxs(ma,{open:e,onClose:n,title:C("settings.devices_pair_title"),description:C("settings.devices_pair_desc"),footer:l.jsx(he,{variant:"secondary",onClick:n,children:C("common.close")}),children:[d&&l.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:d}),!d&&!i&&l.jsxs("div",{className:"flex items-center gap-2 py-8 text-sm text-muted-fg",children:[l.jsx(Yi,{})," ",C("common.loading")]}),!d&&i&&l.jsxs("div",{className:"flex flex-col items-center gap-4",children:[l.jsx("div",{className:S?"opacity-40":"",children:l.jsx(A6,{value:j,size:196})}),h?l.jsx("p",{className:"text-sm font-medium text-emerald-500",children:C("settings.devices_pair_done")}):S?l.jsxs("div",{className:"flex flex-col items-center gap-2",children:[l.jsx("p",{className:"text-sm text-muted-fg",children:C("settings.devices_pair_expired")}),l.jsx(he,{variant:"primary",onClick:()=>void w(),children:C("settings.devices_pair_regen")})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-center text-xs text-muted-fg",children:C("settings.devices_pair_scan")}),l.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[l.jsx(Yi,{size:12}),l.jsx("span",{children:C("settings.devices_pair_waiting")}),l.jsxs("span",{className:"tabular-nums",children:["· ",C("settings.devices_pair_expires",{s:g})]})]}),l.jsxs("div",{className:"w-full space-y-3 border-t border-border pt-3",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-xs text-muted-fg",children:C("settings.devices_pair_link")}),l.jsxs("div",{className:"flex items-stretch gap-2",children:[l.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-xs",children:j}),l.jsx(he,{size:"sm",variant:"secondary",onClick:()=>E(j,C("settings.devices_pair_copied")),title:C("settings.devices_pair_copy"),children:l.jsx(wg,{size:14})})]})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-xs text-muted-fg",children:C("settings.devices_pair_code")}),l.jsxs("div",{className:"flex items-stretch gap-2",children:[l.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}),l.jsx(he,{size:"sm",variant:"secondary",onClick:()=>E(i.pairing_id,C("settings.devices_pair_copied_code")),title:C("settings.devices_pair_copy"),children:l.jsx(wg,{size:14})})]})]})]})]})]})]})}function z6(){const e=rt(),{clients:n,isLoading:s,mutate:r}=l6(),[i,c]=v.useState(!1),d=async f=>{if(confirm(C("settings.devices_revoke_confirm",{id:f})))try{await Jo.revoke(f),e.success("Cliente revocado."),r()}catch(g){e.error(g.message)}};return l.jsxs(He,{title:C("settings.devices"),description:C("settings.devices_sub"),action:l.jsxs(he,{size:"sm",variant:"primary",onClick:()=>c(!0),children:[l.jsx(nN,{size:14})," ",C("settings.devices_pair_btn")]}),children:[s&&l.jsx(Je,{}),!s&&n.length===0&&l.jsx(lt,{children:C("settings.devices_empty")}),n.length>0&&l.jsx("ul",{className:"space-y-2 text-sm",children:n.map(f=>l.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[l.jsx("span",{className:"font-medium",children:f.label||f.id}),l.jsx(Ue,{tone:f.kind==="web"?"info":f.kind==="deck"?"success":"muted",children:f.kind}),l.jsxs("span",{className:"font-mono text-xs text-muted-fg",children:["…",f.token_suffix]}),l.jsxs("span",{className:"ml-auto text-xs text-muted-fg",children:["visto: ",f.last_seen?new Date(f.last_seen).toLocaleString():"nunca"]}),l.jsx(he,{size:"sm",variant:"destructive",onClick:()=>d(f.id),children:"Revocar"})]},f.id))}),l.jsx(O6,{open:i,onClose:()=>c(!1),onPaired:()=>r()})]})}const D6=[{key:"daemon",label:"Daemon",description:"~/.apx/config.json. Config general APX.",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:"Idioma",placeholder:"es"},{path:"user.locale",label:"Locale",placeholder:"es-AR"},{path:"user.timezone",label:"Timezone",placeholder:"America/Argentina/Salta"}]},{key:"super-agent",label:"Super-agente",fields:[{path:"super_agent.enabled",label:"Super-agente habilitado",kind:"boolean"},{path:"super_agent.model",label:"Modelo",placeholder:"gemini:gemini-2.5-flash"},{path:"super_agent.permission_mode",label:"Permission mode",kind:"select",options:xh.map(e=>({value:e,label:e}))},{path:"super_agent.system",label:"Prompt extra",kind:"textarea"}]},{key:"telegram",label:"Telegram",fields:[{path:"telegram.enabled",label:"Polling habilitado",kind:"boolean"},{path:"telegram.poll_interval_ms",label:"Poll interval ms",kind:"number",placeholder:"1500"},{path:"telegram.respond_with_engine",label:"Responder con 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 L6(){const{config:e,isLoading:n,patch:s,mutate:r}=vr();if(n)return l.jsx(Je,{});const i=async c=>{const d={};for(const[f,g]of Object.entries(vx(c)))za(g)||(d[f]=g);await s(d),r()};return l.jsx(He,{title:"Config APX",description:"Config general en ~/.apx/config.json. Editable por tabs; JSON queda separado.",children:l.jsx(Zg,{sections:D6,source:e,jsonTitle:"~/.apx/config.json",jsonDescription:"Secretos redacted no se sobrescriben.",onSaveFields:async(c,d)=>{await s(c,d),r()},onSaveJson:i})})}function P6(){const e=rt(),{health:n,isUp:s}=Tw(),r=async()=>{try{await Zo.reload(),e.success("Config recargada.")}catch(i){e.error(i.message)}};return l.jsxs("div",{className:"space-y-6",children:[l.jsx(He,{title:C("daemon.version"),action:l.jsx(he,{size:"sm",onClick:r,children:C("common.reload")}),children:l.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[l.jsx(bg,{label:C("daemon.version"),value:n?.version||"—"}),l.jsx(bg,{label:C("daemon.uptime"),value:n?`${n.uptime_s}s`:"—"}),l.jsx(bg,{label:C("daemon.status"),value:C(s?"daemon.running":"daemon.down"),ok:s})]})}),l.jsx(L6,{})]})}function bg({label:e,value:n,ok:s}){return l.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[l.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),l.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[s!==void 0&&l.jsx(Vd,{ok:s}),l.jsx("span",{children:n})]})]})}function B6(){const e=rt(),{theme:n,set:s}=bh(),[r,i]=v.useState(""),[c,d]=v.useState(m5()),f=()=>{const m=r.trim();if(m){Ur(m);try{localStorage.setItem(Cn.token,m)}catch{}i(""),e.success(C("settings.token_saved"))}},g=m=>{d5(m),d(m),window.location.reload()};return l.jsxs("div",{className:"space-y-6",children:[l.jsx(He,{title:C("settings.appearance"),children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(he,{variant:n==="light"?"primary":"secondary",onClick:()=>s("light"),children:C("settings.light_mode")}),l.jsx(he,{variant:n==="dark"?"primary":"secondary",onClick:()=>s("dark"),children:C("settings.dark_mode")})]})}),l.jsx(He,{title:C("settings.language"),children:l.jsx("div",{className:"flex items-center gap-2",children:f5.map(m=>l.jsx(he,{variant:c===m.value?"primary":"secondary",onClick:()=>g(m.value),children:m.label},m.value))})}),l.jsxs(He,{title:C("settings.token"),description:C("settings.token_sub"),children:[l.jsx(fe,{label:"Bearer",children:l.jsx(Ce,{type:"password",placeholder:tx()?C("settings.token_active"):C("settings.token_paste"),value:r,onChange:m=>i(m.target.value),className:"font-mono",onKeyDown:m=>{m.key==="Enter"&&f()}})}),l.jsx("div",{className:"mt-2",children:l.jsx(he,{variant:"primary",onClick:f,children:C("common.save")})})]})]})}const I6=[{title:C("settings.account_section"),items:[{key:"identity",label:C("settings.tabs.identity"),icon:vj},{key:"appearance",label:C("settings.appearance"),icon:WR}]},{title:C("settings.agents_section"),items:[{key:"super_agent",label:C("settings.tabs.super_agent"),icon:vn},{key:"engines",label:C("settings.tabs.engines"),icon:fh},{key:"memory",label:"Memoria (RAG)",icon:dj}]},{title:C("settings.channels_section"),items:[{key:"telegram",label:C("settings.tabs.telegram"),icon:Za},{key:"devices",label:C("settings.tabs.devices"),icon:sN}]},{title:C("settings.advanced_section"),items:[{key:"advanced",label:C("settings.tabs.advanced"),icon:Eg}]}],U6=new Set(["engines","telegram"]),H6={identity:()=>l.jsx(ZD,{}),super_agent:()=>l.jsx(JD,{}),engines:()=>l.jsx(Zw,{}),memory:()=>l.jsx(t6,{}),telegram:()=>l.jsx(o6,{}),devices:()=>l.jsx(z6,{}),appearance:()=>l.jsx(B6,{}),advanced:()=>l.jsx(P6,{})};function q6(){const e=Ua(),n=ea(),s=V6(n.pathname),r=H6[s],{collapsed:i,toggle:c}=zw(Cn.sidebarCollapsed+".settings");return l.jsx(Dw,{sections:I6,active:s,onChange:d=>e(d==="identity"?"/settings":`/settings/${$6(d)}`),collapsed:i,onToggleCollapse:c,contentClassName:`mx-auto w-full ${U6.has(s)?"max-w-6xl":"max-w-3xl"} space-y-6 p-6 pt-3`,testId:`settings-tab-${s}`,children:l.jsx(r,{})})}function V6(e){switch(e.split("/").filter(Boolean)[1]||"identity"){case"super-agent":return"super_agent";case"engines":return"engines";case"memory":return"memory";case"telegram":return"telegram";case"devices":return"devices";case"appearance":return"appearance";case"config":case"advanced":return"advanced";default:return"identity"}}function $6(e){return e==="super_agent"?"super-agent":e==="advanced"?"config":e}function G6({engines:e,order:n,mode:s,configuredProvider:r,onSetMode:i,onSetDefault:c,onToggleEnabled:d,onReorder:f,onConfigure:g,busy:m}){const h=new Map(e.map(S=>[S.id,S])),x=[...n.filter(S=>h.has(S)),...e.map(S=>S.id).filter(S=>!n.includes(S))],y=s==="chain",w=(S,_)=>{const j=x.indexOf(S),E=j+_;if(j<0||E<0||E>=x.length)return;const k=[...x];[k[j],k[E]]=[k[E],k[j]],f(k)};return l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"rounded-lg border border-border p-3",children:l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-sm font-medium",children:"Modo de selección"}),l.jsx("div",{className:"text-xs text-muted-fg",children:y?"Cadena con fallback: usa el primer motor disponible según el orden de abajo.":"Solo el motor por defecto: usa siempre el elegido; los demás quedan configurados para otras cosas."})]}),l.jsxs("div",{className:"flex shrink-0 overflow-hidden rounded-md border border-border",role:"group",children:[l.jsx("button",{type:"button",onClick:()=>i("chain"),disabled:m,"data-testid":"voice-mode-chain",className:Ie("px-3 py-1.5 text-xs font-medium transition-colors",y?"bg-emerald-500/15 text-emerald-300":"text-muted-fg hover:text-fg"),children:"Cadena (router)"}),l.jsx("button",{type:"button",onClick:()=>i("single"),disabled:m,"data-testid":"voice-mode-single",className:Ie("border-l border-border px-3 py-1.5 text-xs font-medium transition-colors",y?"text-muted-fg hover:text-fg":"bg-emerald-500/15 text-emerald-300"),children:"Solo el motor por defecto"})]})]})}),l.jsx("div",{className:"space-y-2",children:x.map((S,_)=>{const j=h.get(S),E=gd[S]||{name:S,note:""},k=!y&&r===S,N=S==="mock";return l.jsxs("div",{"data-testid":`voice-provider-${S}`,className:Ie("flex items-center gap-3 rounded-lg border px-3 py-2.5",k?"border-emerald-500/50 bg-emerald-500/10":"border-border",y&&!N&&!j.enabled&&"opacity-60"),children:[y&&l.jsxs("div",{className:"flex flex-col",children:[l.jsx("button",{type:"button",onClick:()=>w(S,-1),disabled:m||_===0,"aria-label":"Subir","data-testid":`voice-provider-${S}-up`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:l.jsx(uj,{className:"size-3.5"})}),l.jsx("button",{type:"button",onClick:()=>w(S,1),disabled:m||_===x.length-1,"aria-label":"Bajar","data-testid":`voice-provider-${S}-down`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:l.jsx(Zr,{className:"size-3.5"})})]}),l.jsx(Vd,{ok:j.available?!0:j.configured?!1:null}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm font-medium",children:E.name}),E.local&&l.jsx(Ue,{tone:"info",children:"local"}),j.available?l.jsx(Ue,{tone:"success",children:"disponible"}):j.configured?l.jsx(Ue,{tone:"warning",children:"configurado, no disponible"}):l.jsx(Ue,{tone:"muted",children:"sin configurar"}),k&&l.jsx(Ue,{tone:"success",children:"por defecto"})]}),l.jsx("div",{className:"truncate text-xs text-muted-fg",children:E.note})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[y?l.jsx(sn,{checked:N?!0:j.enabled,onChange:R=>d(S,R),disabled:m||N}):!k&&l.jsxs(he,{size:"sm",variant:"ghost",onClick:()=>c(S),disabled:m,"data-testid":`voice-provider-${S}-default`,children:[l.jsx(CR,{className:"size-3.5"})," Usar por defecto"]}),k&&l.jsx(wR,{className:"size-4 text-emerald-400"}),l.jsxs(he,{size:"sm",variant:"secondary",onClick:()=>g(S),"data-testid":`voice-provider-${S}-config`,children:[l.jsx(aN,{className:"size-3.5"})," Configurar"]})]})]},S)})})]})}function Ca(e){return typeof e=="string"?e:e==null?"":String(e)}function Y6({open:e,providerId:n,config:s,onClose:r,onSave:i}){const[c,d]=v.useState(!1),[f,g]=v.useState(null),[m,h]=v.useState(""),[x,y]=v.useState({});if(v.useEffect(()=>{if(!e||!n)return;g(null),h("");const R=s||{};if(n==="piper"){const A=R;y({bin:Ca(A.bin),model:Ca(A.model),speaker:Ca(A.speaker)})}else if(n==="elevenlabs"){const A=R;y({model:Ca(A.model),voice_id:Ca(A.voice_id),output_format:Ca(A.output_format)})}else if(n==="openai"){const A=R;y({model:Ca(A.model)||"tts-1",voice:Ca(A.voice)||"alloy",format:Ca(A.format)||"mp3"})}else if(n==="gemini"){const A=R;y({model:Ca(A.model),voice:Ca(A.voice)||"Kore",style:Ca(A.style)})}else y({})},[e,n,s]),!n)return null;const w=gd[n],S=`voice.tts.${n}`,_=R=>y(A=>({...A,...R})),j=n!=="piper"&&n!=="mock",E=j&&za(s?.api_key),k=E?`…${el(s?.api_key)??""} (ya seteada)`:"API key",N=async()=>{d(!0),g(null);try{const R={},A=[],M=(O,U)=>{U.trim()?R[`${S}.${O}`]=U.trim():A.push(`${S}.${O}`)};n==="piper"?(M("bin",x.bin),M("model",x.model),x.speaker.trim()?R[`${S}.speaker`]=x.speaker.trim():A.push(`${S}.speaker`)):n==="elevenlabs"?(M("model",x.model),M("voice_id",x.voice_id),M("output_format",x.output_format)):n==="openai"?(M("model",x.model),M("voice",x.voice),M("format",x.format)):n==="gemini"&&(M("model",x.model),M("voice",x.voice),M("style",x.style)),j&&m.trim()&&(R[`${S}.api_key`]=m.trim()),await i({set:R,unset:A}),r()}catch(R){g(R.message||"Error al guardar.")}finally{d(!1)}};return l.jsx(ma,{open:e,onClose:r,title:`Configurar ${w?.name||n}`,description:w?.note,size:"md",footer:l.jsxs(l.Fragment,{children:[l.jsx(he,{variant:"ghost",onClick:r,disabled:c,children:"Cancelar"}),l.jsx(he,{variant:"primary",onClick:N,loading:c,"data-testid":"voice-provider-save",children:"Guardar"})]}),children:l.jsxs("div",{className:"space-y-3",children:[n==="piper"&&l.jsxs(l.Fragment,{children:[l.jsx(fe,{label:"Binario (bin)",hint:"Ruta o nombre del CLI piper (PATH).",children:l.jsx(Ce,{value:x.bin,onChange:R=>_({bin:R.target.value}),placeholder:"piper"})}),l.jsx(fe,{label:"Modelo (.onnx)",hint:"Ruta absoluta al modelo de voz piper.",children:l.jsx(Ce,{value:x.model,onChange:R=>_({model:R.target.value}),placeholder:"/abs/path/voz.onnx"})}),l.jsx(fe,{label:"Speaker (opcional)",hint:"Id de hablante para modelos multi-voz.",children:l.jsx(Ce,{value:x.speaker,onChange:R=>_({speaker:R.target.value}),placeholder:"0"})})]}),n==="elevenlabs"&&l.jsxs(l.Fragment,{children:[l.jsx(fe,{label:"API key",hint:E?"Dejá en blanco para mantener la actual.":"Se guarda como secreto. Env: ELEVENLABS_API_KEY",children:l.jsx(Ce,{type:"password",autoComplete:"new-password",value:m,onChange:R=>h(R.target.value),placeholder:k})}),l.jsx(fe,{label:"Modelo",children:l.jsx(Ct,{value:x.model||"",onChange:R=>_({model:R}),options:s5.map(R=>({value:R,label:R})),placeholder:"eleven_multilingual_v2"})}),l.jsx(fe,{label:"Voice ID",hint:"Id de la voz de ElevenLabs (vacío = default).",children:l.jsx(Ce,{value:x.voice_id,onChange:R=>_({voice_id:R.target.value}),placeholder:"EXAVITQu4vr4xnSDxMaL"})}),l.jsx(fe,{label:"Formato de salida",children:l.jsx(Ce,{value:x.output_format,onChange:R=>_({output_format:R.target.value}),placeholder:"mp3_44100_128"})})]}),n==="openai"&&l.jsxs(l.Fragment,{children:[l.jsx(fe,{label:"API key",hint:E?"Dejá en blanco para mantener la actual.":"Se reusa engines.openai.api_key si la dejás en blanco. Env: OPENAI_API_KEY",children:l.jsx(Ce,{type:"password",autoComplete:"new-password",value:m,onChange:R=>h(R.target.value),placeholder:k})}),l.jsx(fe,{label:"Modelo",children:l.jsx(Ct,{value:x.model||"tts-1",onChange:R=>_({model:R}),options:r5.map(R=>({value:R,label:R}))})}),l.jsx(fe,{label:"Voz",children:l.jsx(Ct,{value:x.voice||"alloy",onChange:R=>_({voice:R}),options:n5.map(R=>({value:R,label:R}))})}),l.jsx(fe,{label:"Formato",children:l.jsx(Ct,{value:x.format||"mp3",onChange:R=>_({format:R}),options:["mp3","opus","aac","flac","wav"].map(R=>({value:R,label:R}))})})]}),n==="gemini"&&l.jsxs(l.Fragment,{children:[l.jsx(fe,{label:"API key",hint:E?"Dejá en blanco para mantener la actual.":"Se reusa engines.gemini.api_key si la dejás en blanco. Env: GEMINI_API_KEY",children:l.jsx(Ce,{type:"password",autoComplete:"new-password",value:m,onChange:R=>h(R.target.value),placeholder:k})}),l.jsx(fe,{label:"Modelo",hint:"TTS de Gemini sigue en preview.",children:l.jsx(Ce,{value:x.model,onChange:R=>_({model:R.target.value}),placeholder:"gemini-2.5-flash-preview-tts"})}),l.jsx(fe,{label:"Voz",children:l.jsx(Ct,{value:x.voice||"Kore",onChange:R=>_({voice:R}),options:a5.map(R=>({value:R,label:R}))})}),l.jsx(fe,{label:"Estilo (cómo querés que hable)",hint:"Instrucción en lenguaje natural. Vacío = sin estilo. Ej: 'hablá en tono alegre y pausado'.",children:l.jsx(Qt,{rows:2,value:x.style||"",onChange:R=>_({style:R.target.value}),placeholder:"hablá en tono alegre y enérgico"})})]}),n==="mock"&&l.jsxs("p",{className:"text-sm text-muted-fg",children:["El motor ",l.jsx("strong",{children:"mock"})," genera un WAV silencioso de prueba. No tiene parámetros: sirve como fallback garantizado cuando no hay otro motor configurado."]}),f&&l.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:f})]})})}function F6(){const e=v.useRef(null),n=v.useRef(null),[s,r]=v.useState(!1),[i,c]=v.useState(!1),d=v.useCallback(()=>{n.current&&(URL.revokeObjectURL(n.current),n.current=null)},[]);v.useEffect(()=>()=>{e.current&&(e.current.pause(),e.current=null),d()},[d]);const f=v.useCallback(async m=>{c(!0);try{d();const h=await l5(m);n.current=h,e.current||(e.current=new Audio);const x=e.current;x.src=h,x.onended=()=>r(!1),x.onerror=()=>r(!1),await x.play(),r(!0)}finally{c(!1)}},[d]),g=v.useCallback(()=>{e.current&&(e.current.pause(),e.current.currentTime=0),r(!1)},[]);return{play:f,stop:g,playing:s,loading:i}}function X6({engines:e,defaultProvider:n,mode:s}){const r=rt(),{play:i,stop:c,playing:d,loading:f}=F6(),[g,m]=v.useState("Hola, soy APX. Esto es una prueba de voz."),[h,x]=v.useState(""),[y,w]=v.useState(""),[S,_]=v.useState(!1),[j,E]=v.useState(null),N=[{value:"",label:s==="single"&&n&&n!=="auto"?`Por defecto (${gd[n]?.name||n})`:"Por defecto (cadena)"},...e.map(A=>({value:A.id,label:`${gd[A.id]?.name||A.id}${A.available?"":" · no disponible"}`}))],R=async()=>{const A=g.trim();if(!A){r.error("Escribí algo para decir.");return}_(!0);try{const M=await ow.say({text:A,provider:h||void 0,style:y.trim()||void 0});E(M),await i(M.audio_path)}catch(M){r.error(M.message||"No se pudo sintetizar.")}finally{_(!1)}};return l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[l.jsx(fe,{label:"Motor",hint:"Override del por defecto para probar.",children:l.jsx(Ct,{value:h,onChange:x,options:N})}),l.jsx(fe,{label:"Estilo (solo Gemini)",hint:"Cómo querés que hable. Vacío = sin estilo.",children:l.jsx(Ce,{value:y,onChange:A=>w(A.target.value),placeholder:"hablá en tono alegre y enérgico","data-testid":"voice-test-style"})})]}),l.jsx(fe,{label:"Texto a decir",children:l.jsx(Qt,{rows:2,value:g,onChange:A=>m(A.target.value),placeholder:"Escribí lo que querés que diga…","data-testid":"voice-test-input"})}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(he,{variant:"primary",onClick:R,loading:S,disabled:f,"data-testid":"voice-test-say",children:[l.jsx(lN,{className:"size-4"})," Decir esto"]}),d?l.jsxs(he,{variant:"secondary",onClick:c,"data-testid":"voice-test-stop",children:[l.jsx(xj,{className:"size-4"})," Parar"]}):j?l.jsxs(he,{variant:"secondary",onClick:()=>i(j.audio_path),loading:f,"data-testid":"voice-test-replay",children:[l.jsx(pj,{className:"size-4"})," Repetir"]}):null,j&&l.jsxs("span",{className:"text-xs text-muted-fg",children:["Motor: ",l.jsx("strong",{children:j.provider}),j.duration_s?` · ${j.duration_s.toFixed(1)}s`:""]})]})]})}const K6=[{value:"auto",label:"Automático (local, luego OpenAI)"},{value:"local",label:"Local — faster-whisper (offline)"},{value:"openai",label:"OpenAI — Whisper-1 (cloud)"}],Q6=[{value:"auto",label:"Auto-detectar"},{value:"es",label:"Español"},{value:"en",label:"Inglés"},{value:"pt",label:"Portugués"},{value:"fr",label:"Francés"},{value:"it",label:"Italiano"},{value:"de",label:"Alemán"}];function Z6({config:e,onPatch:n,busy:s}){const r=e.provider||"auto",i=e.local||{},c=i.model||"small",d=i.language||"auto",f=r!=="openai";return l.jsxs("div",{className:"space-y-3",children:[l.jsx(fe,{label:"Motor de transcripción",hint:"Local usa faster-whisper (requiere python3 + faster-whisper). OpenAI usa la key de engines.openai.",children:l.jsx(Ct,{value:r,onChange:g=>n({"transcription.provider":g}),options:K6,disabled:s,className:"max-w-md"})}),f&&l.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[l.jsx(fe,{label:"Modelo local (whisper)",hint:"Más grande = más preciso y más lento.",children:l.jsx(Ct,{value:c,onChange:g=>n({"transcription.local.model":g}),options:o5.map(g=>({value:g,label:g})),disabled:s})}),l.jsx(fe,{label:"Idioma",hint:'Para español, fijá "Español" mejora la precisión.',children:l.jsx(Ct,{value:d,onChange:g=>n({"transcription.local.language":g}),options:Q6,disabled:s})})]})]})}function J6(){const e=rt(),{config:n,isLoading:s,patch:r,mutate:i}=vr(),{data:c,isLoading:d,error:f,mutate:g}=Qe("/tts/providers",()=>ow.providers()),[m,h]=v.useState(null),[x,y]=v.useState(!1),w=n,S=w.voice?.tts||{},_=w.transcription||{},j=c?.configured_provider||S.provider||"auto",E=c?.mode||S.mode||"chain",k=c?.engines||[],N=c?.order||[],R=v.useMemo(()=>m?S[m]||{}:{},[m,S]),A=async L=>{y(!0);try{await r({"voice.tts.provider":L,"voice.tts.mode":"single"}),await g(),e.success(`Motor por defecto: ${L}.`)}catch(D){e.error(D.message)}finally{y(!1)}},M=async L=>{y(!0);try{const D={"voice.tts.mode":L};if(L==="single"&&(j==="auto"||!j)){const q=k.find(F=>F.available)?.id||N[0]||"mock";D["voice.tts.provider"]=q}await r(D),await g(),e.success(L==="chain"?"Modo: cadena con fallback.":"Modo: solo el motor por defecto.")}catch(D){e.error(D.message)}finally{y(!1)}},O=async(L,D)=>{y(!0);try{await r({[`voice.tts.${L}.enabled`]:D}),await g()}catch(q){e.error(q.message)}finally{y(!1)}},U=async L=>{y(!0);try{await r({"voice.tts.order":L}),await g()}catch(D){e.error(D.message)}finally{y(!1)}},I=async({set:L,unset:D})=>{await r(L,D.length?D:void 0),await g(),await i(),e.success("Configuración de voz guardada.")},B=async(L,D)=>{try{await r(L,D),e.success("Transcripción actualizada.")}catch(q){e.error(q.message)}};return l.jsxs("div",{className:"mx-auto max-w-4xl space-y-6 p-6","data-testid":"screen-voice",children:[l.jsxs("header",{children:[l.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Voces"}),l.jsx("p",{className:"text-sm text-muted-fg",children:"Configurá el texto a voz (TTS) y la transcripción (STT), elegí el motor por defecto y probá la voz."})]}),l.jsx(He,{title:"Proveedores de voz (TTS)",description:"Motores de síntesis. El estado lo reporta el daemon en vivo. Elegí cuál usar por defecto.",children:d||s?l.jsx(Je,{}):f?l.jsxs(lt,{children:["No se pudieron cargar los proveedores: ",f.message]}):l.jsx(G6,{engines:k,order:N,mode:E,configuredProvider:j,onSetMode:M,onSetDefault:A,onToggleEnabled:O,onReorder:U,onConfigure:L=>h(L),busy:x})}),l.jsx(He,{title:"Probar voz",description:"Elegí con qué motor sintetizar y, si aplica, cómo querés que hable.",children:l.jsx(X6,{engines:k,defaultProvider:j,mode:E})}),l.jsx(He,{title:"Transcripción (STT)",description:"Motor de voz a texto que usan el deck, Telegram y la CLI al escuchar.",children:s?l.jsx(Je,{}):l.jsx(Z6,{config:_,onPatch:B})}),l.jsx(Y6,{open:!!m,providerId:m,config:R,onClose:()=>h(null),onSave:I})]})}const vg={status:()=>ge.get("/desktop/status"),autostartGet:()=>ge.get("/desktop/autostart"),autostartSet:e=>ge.post("/desktop/autostart",{enable:e})};function W6(e=30){return ge.get(`/messages/global?channel=desktop&limit=${e}`)}const M_="CommandOrControl+G",eL=[{value:"left",label:"Izquierda"},{value:"center",label:"Centro"},{value:"right",label:"Derecha"}],tL=[{value:"light",label:"Claro"},{value:"dark",label:"Oscuro"}];function nL(){const e=rt(),{config:n,isLoading:s,patch:r}=vr(),i=n,c=i.desktop?.shortcut||i.overlay?.shortcut||M_,d=i.desktop?.enabled!==!1,f=i.desktop?.theme||"light",g=i.desktop?.position||"right",{data:m,isLoading:h,mutate:x}=Qe("/desktop/status",()=>vg.status(),{refreshInterval:5e3}),y=!!m?.running,{data:w,mutate:S}=Qe("/desktop/autostart",()=>vg.autostartGet()),{data:_,isLoading:j,mutate:E}=Qe("/messages/global?channel=desktop",()=>W6(40),{refreshInterval:8e3}),[k,N]=v.useState(c),[R,A]=v.useState(!1),[M,O]=v.useState(!1);v.useEffect(()=>N(c),[c]);const U=async()=>{const L=k.trim();if(!(!L||L===c)){A(!0);try{await r({"desktop.shortcut":L}),e.success("Atajo guardado. Reiniciá la ventana (apx desktop stop && start) para aplicarlo.")}catch(D){e.error(D.message)}finally{A(!1)}}},I=async(L,D,q)=>{A(!0);try{await r({[L]:D}),e.success(q)}catch(F){e.error(F.message)}finally{A(!1)}},B=async L=>{O(!0);try{await vg.autostartSet(L),await S(),e.success(L?"Autostart activado para el próximo login.":"Autostart desactivado.")}catch(D){e.error(D.message)}finally{O(!1)}};return l.jsxs("div",{className:"mx-auto max-w-6xl space-y-6 p-6","data-testid":"screen-desktop",children:[l.jsxs("header",{children:[l.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Escritorio"}),l.jsx("p",{className:"text-sm text-muted-fg",children:"Ventana flotante de voz (Electron): atajo global, escucha por micrófono y muestra el chat."})]}),l.jsxs("div",{className:"grid gap-6 lg:grid-cols-[1fr_1fr]",children:[l.jsxs("div",{className:"space-y-6",children:[l.jsxs(He,{title:"Estado",description:"La ventana se lanza desde la terminal o por autostart.",children:[h?l.jsx(Je,{}):l.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[l.jsx(Vd,{ok:y}),l.jsx("span",{className:"font-medium",children:y?"En ejecución":"Detenida"}),l.jsx("button",{type:"button",onClick:()=>x(),className:"ml-2 text-xs text-muted-fg underline-offset-2 hover:underline",children:"refrescar"})]}),l.jsxs("p",{className:"mt-3 text-xs text-muted-fg",children:["Desde terminal: ",l.jsx(R1,{children:"apx desktop start"})," · ",l.jsx(R1,{children:"apx desktop --debug"})]})]}),l.jsx(He,{title:"Arranque automático",description:"Lanza la ventana al iniciar sesión del usuario. Equivalente a `apx desktop install` (no requiere sudo).",children:w?l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsx(sn,{checked:w.enabled,onChange:B,disabled:M,label:w.enabled?"Activado":"Desactivado"}),l.jsxs("span",{className:"text-xs text-muted-fg",children:["platform: ",w.platform]})]}):l.jsx(Je,{})}),l.jsx(He,{title:"Atajo de teclado",description:"Botón de acceso rápido global que muestra/oculta la ventana y arranca a escuchar.",children:s?l.jsx(Je,{}):l.jsxs("div",{className:"flex items-end gap-3",children:[l.jsx("div",{className:"flex-1",children:l.jsx(fe,{label:"Acelerador",hint:'Formato Electron, p. ej. "CommandOrControl+G" o "CommandOrControl+Shift+Space". Reiniciá la ventana para aplicar.',children:l.jsx(Ce,{value:k,onChange:L=>N(L.target.value),onKeyDown:L=>{L.key==="Enter"&&U()},placeholder:M_,className:"max-w-md font-mono",disabled:R})})}),l.jsx(he,{variant:"primary",onClick:U,loading:R,disabled:!k.trim()||k.trim()===c,children:"Guardar"})]})}),l.jsx(He,{title:"Apariencia",description:"Tema y posición de la ventana en la pantalla.",children:s?l.jsx(Je,{}):l.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[l.jsx(fe,{label:"Tema",hint:"Reiniciá la ventana para aplicar.",children:l.jsx(Ct,{value:f,onChange:L=>I("desktop.theme",L,`Tema: ${L}.`),options:tL,disabled:R})}),l.jsx(fe,{label:"Posición",hint:'"izquierda" / "centro" / "derecha" del borde superior.',children:l.jsx(Ct,{value:g,onChange:L=>I("desktop.position",L,`Posición: ${L}.`),options:eL,disabled:R})})]})}),l.jsx(He,{title:"Activación + transcripción",description:"El plugin del daemon procesa los mensajes. STT se configura en Voces.",children:s?l.jsx(Je,{}):l.jsxs("div",{className:"space-y-3",children:[l.jsx(sn,{checked:d,onChange:L=>I("desktop.enabled",L,L?"Desktop activado.":"Desktop desactivado."),disabled:R,label:d?"Plugin activado (responde mensajes)":"Plugin desactivado"}),l.jsxs("p",{className:"text-xs text-muted-fg",children:["Motor de voz a texto: ",l.jsx(uh,{to:"/m/voice",className:"font-medium text-fg underline underline-offset-2",children:"Voces"})," ","(whisper local, idioma, modelo)."]})]})})]}),l.jsx("div",{children:l.jsx(He,{title:"Última conversación",description:"Lo último charlado con el agente desde la ventana flotante.",action:l.jsx("button",{type:"button",onClick:()=>E(),className:"text-xs text-muted-fg underline-offset-2 hover:underline",children:"refrescar"}),children:l.jsx(aL,{messages:_||[],loading:j})})})]})]})}function aL({messages:e,loading:n}){const s=v.useMemo(()=>rL(e),[e]);return n?l.jsx(Je,{}):e.length?l.jsx("div",{className:"space-y-3 max-h-[560px] overflow-y-auto pr-1",children:s.slice().reverse().map((r,i)=>l.jsx("div",{className:"rounded-lg border border-border bg-card/40 p-3",children:r.map((c,d)=>l.jsx(sL,{m:c},d))},i))}):l.jsx(lt,{children:"Sin mensajes todavía. Mandale algo a la ventana de escritorio para que aparezca aquí."})}function sL({m:e}){const n=e.direction==="in",s=oL(e.ts);return l.jsxs("div",{className:"py-1",children:[l.jsxs("div",{className:"flex items-baseline gap-2 text-[11px] text-muted-fg",children:[l.jsx("span",{className:"font-semibold",children:n?"Vos":"Roby"}),l.jsx("span",{children:s})]}),l.jsx("div",{className:"mt-0.5 text-sm leading-snug whitespace-pre-wrap "+(n?"text-muted-fg":"text-fg"),children:(e.body||"").trim()||l.jsx("span",{className:"italic opacity-50",children:"(vacío)"})})]})}function rL(e){const n=[];for(const s of e)s.direction==="in"||!n.length?n.push([s]):n[n.length-1].push(s);return n}function oL(e){try{const n=new Date(e);return n.toDateString()===new Date().toDateString()?n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):n.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return""}}function lL(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 iL({manifest:e}){const n=e.daemon,s=e.safety;return l.jsxs("div",{"data-testid":"deck-daemon-card",className:"rounded-xl border border-border bg-muted/10 px-4 py-3 text-xs",children:[l.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[l.jsxs("span",{className:"font-semibold text-foreground",children:[n.name," ",l.jsxs("span",{className:"font-normal text-muted-fg",children:["v",n.version]})]}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"size-2 rounded-full bg-emerald-500"}),l.jsxs("span",{className:"text-muted-fg",children:["activo · ",lL(n.uptime_s)]})]})]}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsxs("span",{className:"text-muted-fg",children:[n.host,":",n.port]}),l.jsx("span",{className:"text-muted-fg",children:"·"}),l.jsxs("span",{className:"text-muted-fg",children:["iniciado"," ",new Date(n.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),l.jsxs("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[s.direct_shell===!1&&l.jsx(Ue,{tone:"success",children:"sin shell directo"}),s.arbitrary_commands===!1&&l.jsx(Ue,{tone:"success",children:"comandos arbitrarios bloqueados"}),s.dangerous_actions_require_confirmation&&l.jsx(Ue,{tone:"info",children:"acciones peligrosas requieren confirmación"})]})]})}function cL(e){return e==="available"?"success":e==="configured"?"info":"muted"}function uL(e){return e==="available"?"activo":e==="configured"?"configurado":e==="disabled"?"deshabilitado":"sin configurar"}function dL(e){return e==="voice"?"warning":e==="plugin"?"info":"muted"}function fL({widget:e,onToggle:n}){const s=e.source==="external",[r,i]=v.useState(!1),c=e.user_enabled===!0,d=async f=>{if(!(!n||r)){i(!0);try{await n(f)}finally{i(!1)}}};return l.jsxs("li",{"data-testid":`deck-widget-${e.id}`,className:Ie("flex items-center gap-3 rounded-lg border px-3 py-2.5 text-sm transition-colors",s?"border-border bg-muted/20 hover:border-muted-fg/30":"border-border/50 bg-muted/10"),children:[l.jsx("span",{title:e.source==="apx"?"Widget nativo APX":"Widget externo",className:Ie("size-2 shrink-0 rounded-full",e.source==="apx"?"bg-emerald-500":"bg-sky-400")}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"font-medium",children:e.title}),l.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:e.desktop})]}),l.jsx(Ue,{tone:dL(e.kind),children:e.kind}),l.jsx(Ue,{tone:cL(e.status),children:uL(e.status)}),s?l.jsx("span",{"data-testid":`deck-widget-toggle-${e.id}`,children:l.jsx(sn,{checked:c,onChange:d,disabled:r||!n})}):l.jsx("span",{className:"w-9 shrink-0","aria-hidden":!0})]})}function mL({desktop:e,widgets:n,onToggle:s}){return n.length===0?null:l.jsxs("div",{"data-testid":`deck-desktop-${e.id}`,className:"space-y-1.5",children:[l.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-fg",children:e.title}),l.jsx("ul",{className:"space-y-1.5",children:n.map(r=>l.jsx(fL,{widget:r,onToggle:r.source==="external"?i=>s(r.id,i):void 0},r.id))})]})}function pL(){const e=rt(),{data:n,error:s,isLoading:r,mutate:i}=Qe("/deck/manifest",()=>k1.manifest(),{refreshInterval:3e4}),c=async(x,y)=>{try{await k1.setWidget(x,{enabled:y}),await i(w=>w&&{...w,deck:{...w.deck,widgets:w.deck.widgets.map(S=>S.id===x?{...S,user_enabled:y,status:y?S.daemon_status?"available":"configured":"disabled"}:S)}},{revalidate:!1}),e.success(y?`Widget ${x} habilitado.`:`Widget ${x} deshabilitado.`),setTimeout(()=>i(),800)}catch(w){const S=w instanceof Error?w.message:"Error al guardar";e.error(S)}},d=n?.deck.desktops??[],f=n?.deck.widgets??[],g=d.map(x=>({desktop:x,widgets:f.filter(y=>y.desktop===x.id)})),h=f.filter(x=>x.source==="external").filter(x=>x.user_enabled===!0).length;return l.jsxs("div",{className:"mx-auto max-w-4xl space-y-6 p-6","data-testid":"screen-deck",children:[l.jsxs("header",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Deck"}),l.jsx("p",{className:"text-sm text-muted-fg",children:"App companion · widgets y escritorios."})]}),l.jsx(he,{size:"sm",variant:"ghost",onClick:()=>i(),disabled:r,title:"Recargar manifest",children:l.jsx(rl,{size:14,className:r?"animate-spin":""})})]}),n&&l.jsx(iL,{manifest:n}),l.jsxs(He,{title:"Widgets",description:r?"Cargando manifest…":s?"Error al cargar el manifest.":`${f.length} widgets · ${h} externos habilitados`,children:[r&&l.jsx(Je,{label:"Cargando manifest del Deck…"}),!r&&s&&l.jsxs(lt,{children:["No se pudo cargar el manifest del Deck."," ",l.jsx("button",{type:"button",className:"ml-1 underline",onClick:()=>i(),children:"Reintentar"})]}),!r&&!s&&f.length===0&&l.jsx(lt,{children:"No hay widgets en el manifest."}),!r&&!s&&f.length>0&&l.jsx("div",{className:"space-y-5","data-testid":"deck-desktop-list",children:g.filter(x=>x.widgets.length>0).map(x=>l.jsx(mL,{desktop:x.desktop,widgets:x.widgets,onToggle:c},x.desktop.id))})]}),n?.apx&&l.jsx(He,{title:"Contexto APX",description:"Información que el Deck ve del daemon.",children:l.jsxs("div",{className:"space-y-2 text-sm","data-testid":"deck-apx-context",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-muted-fg",children:"Proyecto activo:"}),l.jsx("span",{className:"font-medium",children:n.apx.active_project?n.apx.active_project.name:"ninguno"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-muted-fg",children:"Proyectos registrados:"}),l.jsx("span",{className:"font-medium",children:n.apx.projects.length})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-muted-fg",children:"Plugins activos:"}),l.jsx("span",{className:"font-medium",children:Object.keys(n.apx.plugins).join(", ")||"—"})]})]})})]})}function gL({projects:e,value:n,onChange:s,disabled:r}){const i=e.map(c=>{const d=c.path?.split("/").filter(Boolean).pop()||`proyecto ${c.id}`;return{value:String(c.id),label:c.name||d,icon:DR,description:c.path}});return l.jsx("div",{className:"w-60","data-testid":"code-project-select",children:l.jsx(Ct,{value:n,onChange:s,options:i,placeholder:"Elegí un proyecto…",disabled:r})})}function hL({sessions:e,activeId:n,busy:s,onSelect:r,onCreate:i,onRename:c,onDelete:d}){return l.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-session-list",children:[l.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[l.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:C("code_module.sessions")}),l.jsxs("button",{type:"button",onClick:i,disabled:s,title:C("code_module.new_session"),"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:[l.jsx(Rn,{className:"size-3"})," ",C("code_module.new_session")]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 pb-2",children:e.length===0?l.jsx("div",{className:"p-2",children:l.jsx(lt,{children:C("code_module.no_sessions")})}):l.jsx("ul",{className:"space-y-0.5",children:e.map(f=>l.jsxs("li",{className:"group/item relative",children:[l.jsxs("button",{type:"button",onClick:()=>r(f.id),className:Ie("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left text-xs transition-colors",f.id===n?"bg-accent text-accent-fg":"text-foreground/80 hover:bg-accent/50"),children:[l.jsx(KR,{className:"mt-0.5 size-3.5 shrink-0 opacity-60"}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block truncate font-medium",children:f.title}),l.jsxs("span",{className:"block truncate text-[10px] text-muted-foreground",children:[f.mode," · ",f.messageCount," msg",f.model?` · ${f.model}`:""]})]})]}),l.jsxs("div",{className:"absolute right-1 top-1 hidden items-center gap-0.5 group-hover/item:flex",children:[l.jsx("button",{type:"button",onClick:()=>c(f.id,f.title),title:C("code_module.rename"),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-foreground",children:l.jsx(gh,{className:"size-3"})}),l.jsx("button",{type:"button",onClick:()=>d(f.id),title:C("code_module.delete"),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-rose-500",children:l.jsx(Ms,{className:"size-3"})})]})]},f.id))})})]})}function xL({mode:e,onChange:n,disabled:s}){const r=(i,c,d,f)=>l.jsxs("button",{type:"button",disabled:s,title:d,"data-testid":`code-mode-${i}`,"aria-pressed":e===i,onClick:()=>n(i),className:Ie("flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium transition-colors disabled:opacity-50",e===i?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[l.jsx(f,{className:"size-3"})," ",c]});return l.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border border-border bg-muted/60 p-0.5",children:[r("build",C("code_module.mode_build"),C("code_module.mode_build_hint"),UR),r("plan",C("code_module.mode_plan"),C("code_module.mode_plan_hint"),ER)]})}function bL({value:e,onValueChange:n,onSubmit:s,onStop:r,busy:i,disabled:c,mode:d,onModeChange:f,model:g,onModelChange:m}){return l.jsx(yx,{value:e,onValueChange:n,onSubmit:s,onStop:r,busy:i,disabled:c,placeholder:C("code_module.placeholder"),maxRows:12,footer:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(xL,{mode:d,onChange:f,disabled:i}),l.jsx(_x,{value:g,onChange:m,disabled:i})]})})}function yg(e,n){let s=0;for(const r of e.parts||[])r.kind==="text"&&n.text&&(s+=r.text.length),r.kind==="tool"&&n.tool&&(r.args&&(s+=JSON.stringify(r.args).length),r.result!==void 0&&(s+=JSON.stringify(r.result).length));return Math.ceil(s/4)}function vL(e){let n=null,s=0,r=0;for(const d of e)d.role==="user"?s++:r++,d.role==="assistant"&&d.usage&&(n={input:d.usage.input_tokens,output:d.usage.output_tokens,model:d.model});const i=n?.input??0,c=n?.output??0;return{model:n?.model??null,input:i,output:c,total:i+c,hasUsage:!!n,messages:e.length,userMsgs:s,assistantMsgs:r}}function yL(e){let n=0,s=0,r=0;for(const d of e)d.role==="user"?n+=yg(d,{text:!0}):s+=yg(d,{text:!0}),r+=yg(d,{tool:!0});const i=n+s+r||1,c=(d,f)=>({key:d,tokens:f,percent:Math.round(f/i*100)});return[c("user",n),c("assistant",s),c("tool",r)].filter(d=>d.tokens>0)}const O_={user:"bg-emerald-500",assistant:"bg-sky-500",tool:"bg-amber-500"};function Uu({label:e,value:n}){return l.jsxs("div",{className:"rounded-md border border-border bg-background/50 px-2.5 py-2",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:e}),l.jsx("div",{className:"mt-0.5 truncate font-mono text-sm",children:n})]})}function _L({turns:e}){const n=v.useMemo(()=>vL(e),[e]),s=v.useMemo(()=>yL(e),[e]);return e.length===0?l.jsx("div",{className:"p-3",children:l.jsx(lt,{children:C("code_module.ctx_none")})}):l.jsxs("div",{className:"space-y-3 p-3","data-testid":"code-context-tab",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsx(Uu,{label:C("code_module.ctx_model"),value:n.model||"auto"}),l.jsx(Uu,{label:C("code_module.ctx_messages"),value:`${n.userMsgs}/${n.assistantMsgs}`}),l.jsx(Uu,{label:C("code_module.ctx_input"),value:n.input.toLocaleString()}),l.jsx(Uu,{label:C("code_module.ctx_output"),value:n.output.toLocaleString()})]}),l.jsxs("div",{children:[l.jsx("div",{className:"mb-1 text-[11px] font-semibold text-muted-foreground",children:C("code_module.ctx_breakdown")}),s.length>0?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"flex h-2.5 w-full overflow-hidden rounded-full bg-muted",children:s.map(r=>l.jsx("div",{className:O_[r.key],style:{width:`${r.percent}%`},title:`${r.key}: ${r.tokens} (${r.percent}%)`},r.key))}),l.jsx("ul",{className:"mt-2 space-y-1",children:s.map(r=>l.jsxs("li",{className:"flex items-center gap-2 text-[11px]",children:[l.jsx("span",{className:`size-2 rounded-full ${O_[r.key]}`}),l.jsx("span",{className:"flex-1 text-foreground/80",children:C(`code_module.seg_${r.key}`)}),l.jsxs("span",{className:"font-mono text-muted-foreground",children:[r.tokens," · ",r.percent,"%"]})]},r.key))})]}):l.jsx("p",{className:"text-[11px] text-muted-foreground",children:C("code_module.ctx_none")})]})]})}function jL(e){const n=[];for(const s of(e||"").split(`
|
|
541
|
+
`))s.startsWith("diff --git")||s.startsWith("index ")||s.startsWith("--- ")||s.startsWith("+++ ")||s.startsWith("new file")||s.startsWith("deleted file")||s.startsWith("similarity index")||s.startsWith("rename ")||(s.startsWith("@@")?n.push({kind:"hunk",text:s}):s.startsWith("+")?n.push({kind:"add",text:s.slice(1)}):s.startsWith("-")?n.push({kind:"del",text:s.slice(1)}):n.push({kind:"ctx",text:s.replace(/^ /,"")}));for(;n.length&&n[n.length-1].kind==="ctx"&&n[n.length-1].text==="";)n.pop();return n}function SL({patch:e}){const n=v.useMemo(()=>jL(e),[e]);return n.length?l.jsx("pre",{className:"overflow-x-auto rounded-md border border-border bg-background/60 font-mono text-[11px] leading-relaxed",children:l.jsx("code",{className:"block",children:n.map((s,r)=>l.jsxs("div",{className:Ie("px-2 whitespace-pre",s.kind==="add"&&"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",s.kind==="del"&&"bg-rose-500/10 text-rose-600 dark:text-rose-400",s.kind==="hunk"&&"bg-muted/60 text-muted-foreground",s.kind==="ctx"&&"text-foreground/70"),children:[l.jsx("span",{className:"select-none opacity-50",children:s.kind==="add"?"+":s.kind==="del"?"-":" "}),s.text]},r))})}):null}const wL={added:TR,modified:Wu,deleted:OR},CL={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 EL({file:e}){const[n,s]=v.useState(!1),r=wL[e.status];return l.jsxs("li",{className:"rounded-md border border-border",children:[l.jsxs("button",{type:"button",onClick:()=>s(i=>!i),className:"flex w-full items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-accent/40",children:[l.jsx(dh,{className:Ie("size-3 shrink-0 transition-transform",n&&"rotate-90")}),l.jsx(r,{className:Ie("size-3.5 shrink-0",CL[e.status])}),l.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:e.path}),l.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[e.additions!=null&&l.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400",children:["+",e.additions]}),e.deletions!=null&&l.jsxs("span",{className:"ml-1 text-rose-600 dark:text-rose-400",children:["-",e.deletions]})]})]}),n&&l.jsx("div",{className:"border-t border-border p-1.5",children:l.jsx(SL,{patch:e.patch})})]})}function kL({changes:e,loading:n,onRefresh:s}){const r=e?.files||[];return l.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-changes-tab",children:[l.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[l.jsx("span",{className:"text-[11px] text-muted-foreground",children:r.length>0?C("code_module.changes_files",{n:r.length}):""}),l.jsx("button",{type:"button",onClick:s,title:"↻",className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:n?l.jsx(Yi,{size:12}):l.jsx(rl,{className:"size-3"})})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:e&&!e.git?l.jsx(lt,{children:C("code_module.changes_no_git")}):r.length===0?l.jsx(lt,{children:C("code_module.changes_none")}):l.jsx("ul",{className:"space-y-1.5",children:r.map(i=>l.jsx(EL,{file:i},i.path))})})]})}function RL({turns:e,changes:n,changesLoading:s,onRefreshChanges:r}){const i=n?.files.length||0;return l.jsxs(Xd,{defaultValue:"context",className:"flex h-full flex-col gap-0","data-testid":"code-side-panel",children:[l.jsx("div",{className:"shrink-0 border-b border-border px-3 py-2",children:l.jsxs(Kd,{variant:"line",className:"w-full",children:[l.jsxs(Da,{value:"context",className:"flex-1",children:[l.jsx(wd,{className:"size-3.5"})," ",C("code_module.tab_context")]}),l.jsxs(Da,{value:"changes",className:"flex-1",children:[l.jsx(IR,{className:"size-3.5"})," ",C("code_module.tab_changes"),i>0&&l.jsx("span",{className:"ml-1 rounded-full bg-muted px-1.5 text-[10px] text-muted-foreground",children:i})]})]})}),l.jsx(La,{value:"context",className:"min-h-0 flex-1 overflow-y-auto",children:l.jsx(_L,{turns:e})}),l.jsx(La,{value:"changes",className:"min-h-0 flex-1 overflow-hidden",children:l.jsx(kL,{changes:n,loading:s,onRefresh:r})})]})}function NL(){const e=rt(),n=Qe("/projects",()=>Qn.list()),s=v.useMemo(()=>n.data||[],[n.data]),[r,i]=v.useState(""),[c,d]=v.useState(null),[f,g]=v.useState([]),[m,h]=v.useState(""),[x,y]=v.useState(!1),w=v.useRef(null);v.useEffect(()=>{!r&&s.length&&i(String(s[0].id))},[r,s]);const S=Qe(r?["code-sessions",r]:null,()=>sr.sessions.list(r)),_=Qe(r&&c?["code-session",r,c]:null,()=>sr.sessions.get(r,c)),j=Qe(r&&c?["code-changes",r,c]:null,()=>sr.changes(r,c));v.useEffect(()=>{const H=S.data||[];!c&&H.length&&d(H[0].id),c&&H.length&&!H.some(G=>G.id===c)&&d(H[0]?.id??null)},[S.data,c]),v.useEffect(()=>{x||(_.data?g(_.data.messages||[]):c||g([]))},[_.data,c,x]),v.useEffect(()=>()=>w.current?.abort(),[]);const E=_.data,k=E?.mode==="plan"?"plan":"build",N=E?.model||"",R=H=>{H===r||x||(i(H),d(null),g([]))},A=H=>{x||H===c||(d(H),g([]))},M=async()=>{if(!(!r||x))try{const H=await sr.sessions.create(r,{title:C("code_module.untitled")});await S.mutate(),d(H.id),g([])}catch(H){e.error(H.message)}},O=async(H,G)=>{const Q=window.prompt(C("code_module.rename"),G);if(!(!Q||Q===G))try{await sr.sessions.update(r,H,{title:Q}),await S.mutate(),H===c&&await _.mutate()}catch(V){e.error(V.message)}},U=async H=>{if(!x&&window.confirm(C("code_module.delete_confirm")))try{await sr.sessions.remove(r,H),H===c&&(d(null),g([])),await S.mutate()}catch(G){e.error(G.message)}},I=v.useCallback(async H=>{if(c)try{await sr.sessions.update(r,c,H),await Promise.all([_.mutate(),S.mutate()])}catch(G){e.error(G.message)}},[r,c,_,S,e]),B=()=>{w.current?.abort(),y(!1)},L=H=>g(G=>{const Q=[...G],V=Q[Q.length-1];return V&&V.role==="assistant"&&(Q[Q.length-1]=H(V)),Q}),D=async()=>{const H=m.trim();if(!H||x||!r||!c)return;const G=new Date().toISOString();g(Y=>[...Y,{role:"user",parts:[{kind:"text",text:H}],ts:G},{role:"assistant",parts:[],ts:G,pending:!0}]),h(""),y(!0);const Q=new AbortController;w.current=Q;const V=Y=>{if(Y.type==="error"){e.error(Y.error||"error");return}L(P=>Sx(P,Y))};try{await sr.stream(r,c,{prompt:H},V,Q.signal),L(Y=>({...Y,pending:!1}))}catch(Y){Q.signal.aborted?L(P=>({...P,pending:!1,parts:[...P.parts,{kind:"text",text:C("code_module.stopped")}]})):(e.error(Y.message),g(P=>P.filter((K,$)=>$!==P.length-1)))}finally{w.current===Q&&(w.current=null),y(!1),_.mutate(),S.mutate(),j.mutate()}},q=async H=>{try{await navigator.clipboard.writeText(H),e.info("Copiado.")}catch{}},F=!n.isLoading&&s.length>0,Z=v.useMemo(()=>f,[f]);return l.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden p-4","data-testid":"screen-code",children:[l.jsxs("header",{className:"mb-3 flex items-center justify-between gap-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold tracking-tight",children:[l.jsx(RR,{size:22})," ",C("code_module.title")]}),l.jsx("p",{className:"text-sm text-muted-fg",children:C("code_module.desc")})]}),l.jsx(Ue,{tone:"success",children:C("code_module.badge")})]}),n.isLoading?l.jsx(Je,{}):F?l.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden rounded-xl border border-border bg-card/40",children:[l.jsxs("aside",{className:"flex w-60 shrink-0 flex-col border-r border-border",children:[l.jsx("div",{className:"shrink-0 border-b border-border p-2",children:l.jsx(gL,{projects:s,value:r,onChange:R,disabled:x})}),l.jsx(hL,{sessions:S.data||[],activeId:c,busy:x,onSelect:A,onCreate:M,onRename:O,onDelete:U})]}),l.jsxs("main",{className:"flex min-w-0 flex-1 flex-col",children:[l.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"code-transcript",children:c?f.length?l.jsx(wx,{msgs:f,onCopy:q}):l.jsx("div",{className:"grid h-full place-items-center p-6",children:l.jsx(lt,{children:C("code_module.empty_chat")})}):l.jsx("div",{className:"grid h-full place-items-center p-6",children:l.jsx(lt,{children:C("code_module.pick_project")})})}),l.jsx("div",{className:"border-t border-border bg-card/60 p-3","data-testid":"code-input",children:l.jsx(bL,{value:m,onValueChange:h,onSubmit:()=>void D(),onStop:B,busy:x,disabled:!c,mode:k,onModeChange:H=>void I({mode:H}),model:N,onModelChange:H=>void I({model:H||null})})})]}),l.jsx("aside",{className:"hidden w-80 shrink-0 flex-col border-l border-border lg:flex",children:l.jsx(RL,{turns:Z,changes:j.data,changesLoading:j.isLoading,onRefreshChanges:()=>void j.mutate()})})]}):l.jsx(lt,{children:C("code_module.no_projects")})]})}function TL({open:e,onClose:n}){const{mutate:s}=aw(),r=rt(),[i,c]=v.useState(""),[d,f]=v.useState(""),[g,m]=v.useState([]),[h,x]=v.useState(null),[y,w]=v.useState(""),[S,_]=v.useState(!1),[j,E]=v.useState(!1),k=async(R,A=!1)=>{_(!0),w("");try{const M=await t5.dirs(R||"~");f(M.path),c(M.path),x(M.parent),m(M.entries)}catch(M){const O=M.message;w(O),A||r.error(O)}finally{_(!1)}};v.useEffect(()=>{e&&!d&&k(i||"~",!0)},[e]);const N=async()=>{const R=i.trim();if(!R){r.error(C("add_project.path_required"));return}E(!0);try{const A=await Qn.register(R);r.success(C("add_project.registered",{id:A.id})),await s("/projects"),c(""),n()}catch(A){r.error(A.message)}finally{E(!1)}};return l.jsx(ma,{open:e,onClose:n,title:C("add_project.title"),description:C("add_project.subtitle"),footer:l.jsxs(l.Fragment,{children:[l.jsx(he,{variant:"ghost",onClick:n,disabled:j,children:C("common.cancel")}),l.jsx(he,{variant:"primary",onClick:N,loading:j,children:C("add_project.register")})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(fe,{label:C("add_project.path_label"),hint:C("add_project.path_hint"),children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Ce,{autoFocus:!0,placeholder:C("add_project.path_placeholder"),value:i,onChange:R=>c(R.target.value),onKeyDown:R=>{R.key==="Enter"&&N()}}),l.jsxs(he,{onClick:()=>k(i||"~"),disabled:S,children:[l.jsx(Vu,{size:14})," ",C("add_project.search_btn")]})]})}),l.jsxs("div",{className:"rounded-md border border-border bg-muted/20",children:[l.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[l.jsx("span",{className:"truncate font-mono text-xs text-muted-fg",children:d||i||"~"}),l.jsxs("div",{className:"flex gap-1",children:[l.jsx(he,{size:"sm",variant:"ghost",onClick:()=>k("~"),disabled:S,children:l.jsx(qR,{size:13})}),l.jsx(he,{size:"sm",variant:"ghost",onClick:()=>h&&k(h),disabled:!h||S,children:".."})]})]}),l.jsxs("div",{className:"max-h-64 overflow-y-auto p-2",children:[S&&l.jsx(Je,{}),!S&&y&&l.jsx(lt,{children:C("add_project.browser_unavailable")}),!S&&!y&&g.length===0&&l.jsx(lt,{children:C("add_project.no_folders")}),!S&&!y&&g.map(R=>l.jsxs("button",{type:"button",onClick:()=>k(R),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-accent",children:[l.jsx(LR,{size:14,className:"text-muted-fg"}),l.jsx("span",{className:"truncate",children:R.split("/").pop()}),l.jsx("span",{className:"ml-auto truncate font-mono text-[10px] text-muted-fg",children:R})]},R))]})]})]})})}function AL({onPaired:e}){const[n,s]=v.useState(""),[r,i]=v.useState(ML()),[c,d]=v.useState(!1),[f,g]=v.useState(null);async function m(){const h=n.trim();if(!h){g(C("pairing.err_required"));return}d(!0),g(null);try{const x=await Jo.confirm({pairing_id:h,label:r.trim()||void 0});Ur(x.token);try{localStorage.setItem(Cn.token,x.token)}catch{}e()}catch(x){g(OL(x)),d(!1)}}return l.jsx("div",{className:"flex min-h-[100dvh] w-full items-center justify-center overflow-y-auto bg-background p-4 text-foreground",children:l.jsxs("div",{className:"my-auto w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-sm",children:[l.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[l.jsx("div",{className:"grid size-10 place-items-center rounded-lg bg-primary/10 text-primary",children:l.jsx($R,{size:20})}),l.jsxs("div",{children:[l.jsx("h1",{className:"text-base font-semibold",children:C("pairing.title")}),l.jsx("p",{className:"text-xs text-muted-fg",children:C("pairing.subtitle")})]})]}),l.jsxs("ol",{className:"mb-5 space-y-1.5 rounded-lg bg-muted/50 p-3 text-xs text-muted-fg",children:[l.jsx("li",{className:"font-medium text-foreground",children:C("pairing.steps_title")}),l.jsxs("li",{children:["1. ",C("pairing.step_1")]}),l.jsxs("li",{children:["2. ",C("pairing.step_2")]}),l.jsxs("li",{children:["3. ",C("pairing.step_3")]})]}),l.jsxs("form",{className:"space-y-3",onSubmit:h=>{h.preventDefault(),m()},children:[l.jsx(fe,{label:C("pairing.code_label"),children:l.jsx(Ce,{value:n,onChange:h=>s(h.target.value),placeholder:C("pairing.code_ph"),spellCheck:!1,autoComplete:"off"})}),l.jsx(fe,{label:C("pairing.label_label"),hint:C("pairing.revoke_hint"),children:l.jsx(Ce,{value:r,onChange:h=>i(h.target.value),placeholder:C("pairing.label_ph")})}),f&&l.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:f}),l.jsx(he,{type:"submit",variant:"primary",size:"md",loading:c,className:"w-full justify-center",children:C(c?"pairing.linking":"pairing.submit")})]})]})})}function ML(){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 OL(e){if(e instanceof ac){if(e.status===410)return C("pairing.err_expired");if(e.status===404||e.status===409)return C("pairing.err_unknown")}return C("pairing.err_generic")}function zL({...e}){return l.jsx(kw,{"data-slot":"sheet",...e})}function DL({...e}){return l.jsx(Cw,{"data-slot":"sheet-portal",...e})}function LL({className:e,...n}){return l.jsx(hw,{"data-slot":"sheet-overlay",className:Pt("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),...n})}function PL({className:e,children:n,side:s="right",showCloseButton:r=!0,...i}){return l.jsxs(DL,{children:[l.jsx(LL,{}),l.jsxs(Sw,{"data-slot":"sheet-content","data-side":s,className:Pt("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:[n,r&&l.jsxs(xw,{"data-slot":"sheet-close",render:l.jsx(Wo,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[l.jsx(Cd,{}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function BL({className:e,...n}){return l.jsx("div",{"data-slot":"sheet-header",className:Pt("flex flex-col gap-0.5 p-4",e),...n})}function IL({className:e,...n}){return l.jsx(Rw,{"data-slot":"sheet-title",className:Pt("font-heading text-base font-medium text-foreground",e),...n})}function UL({className:e,...n}){return l.jsx(bw,{"data-slot":"sheet-description",className:Pt("text-sm text-muted-foreground",e),...n})}function HL(){try{const e=localStorage.getItem(Cn.robyChat);if(!e)return[];const n=JSON.parse(e);return Array.isArray(n)?n.filter(s=>s&&Array.isArray(s.parts)&&!s.pending):[]}catch{return[]}}function qL({open:e,onOpenChange:n}){const s=rt(),[r,i]=v.useState(HL),[c,d]=v.useState(""),[f,g]=v.useState(!1),[m,h]=v.useState(""),x=v.useRef(null);v.useEffect(()=>{const E=r.filter(k=>!k.pending);try{E.length?localStorage.setItem(Cn.robyChat,JSON.stringify(E)):localStorage.removeItem(Cn.robyChat)}catch{}},[r]);const y=()=>{if(!f){i([]),d("");try{localStorage.removeItem(Cn.robyChat)}catch{}}};v.useEffect(()=>()=>x.current?.abort(),[]);const w=()=>{x.current?.abort(),g(!1)},S=E=>i(k=>{const N=[...k],R=N[N.length-1];return R?.role==="assistant"&&(N[N.length-1]=E(R)),N}),_=async()=>{const E=c.trim();if(!E||f)return;const k=new Date().toISOString(),N=r.filter(O=>!O.pending).map(O=>({role:O.role,content:jx(O)}));i(O=>[...O,{role:"user",parts:[{kind:"text",text:E}],ts:k},{role:"assistant",parts:[],ts:k,pending:!0}]),d(""),g(!0);const R=new AbortController;x.current=R;let A=!1;const M=O=>{if(O?.type==="error"){A=!0,s.error(O.error||"error"),i(U=>{const I=[...U],B=I[I.length-1];return B?.role==="assistant"&&B.pending&&I.pop(),I});return}S(U=>Sx(U,O))};try{await rw.stream(0,{prompt:E,previousMessages:N,model:m||void 0,channel:"web_sidebar"},M,R.signal),S(O=>({...O,pending:!1}))}catch(O){R.signal.aborted?S(U=>({...U,pending:!1,parts:[...U.parts,{kind:"text",text:C("project.chat.stopped_marker")}]})):A||(s.error(O.message),i(U=>{const I=[...U],B=I[I.length-1];return B?.role==="assistant"&&B.pending&&I.pop(),I}))}finally{x.current===R&&(x.current=null),g(!1)}},j=async E=>{try{await navigator.clipboard.writeText(E),s.info(C("project.chat.copied"))}catch{}};return l.jsx(zL,{open:e,onOpenChange:n,children:l.jsxs(PL,{side:"right",className:"flex w-full flex-col gap-0 p-0 sm:max-w-xl data-[side=right]:sm:max-w-xl",children:[l.jsxs(BL,{className:"pr-12",children:[l.jsxs(IL,{className:"flex items-center gap-2",children:[l.jsx(vn,{size:18})," ",C("roby.title"),l.jsx("span",{className:"text-xs font-normal text-muted-fg",children:C("roby.badge")})]}),l.jsx(UL,{children:C("roby.desc")})]}),l.jsx("div",{className:"flex-1 overflow-y-auto",children:r.length===0?l.jsx("p",{className:"mt-6 text-center text-sm text-muted-fg",children:C("roby.empty")}):l.jsx(wx,{msgs:r,onCopy:j})}),l.jsx(s2,{msgs:r}),l.jsxs("div",{className:"border-t border-border p-3",children:[l.jsx(yx,{value:c,onValueChange:d,onSubmit:()=>void _(),onStop:w,busy:f,placeholder:C("roby.placeholder"),footer:l.jsx(_x,{value:m,onChange:h,disabled:f})}),l.jsx("div",{className:"mt-1.5 flex justify-end",children:l.jsxs(Wo,{size:"xs",variant:"ghost",onClick:y,disabled:f||r.length===0,children:[l.jsx(Rn,{className:"size-3"})," ",C("roby.new_chat")]})})]})]})})}function VL(){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 $L(){const[e,n]=v.useState({status:"loading"}),[s,r]=v.useState(0),i=v.useCallback(()=>{n({status:"loading"}),r(c=>c+1)},[]);return v.useEffect(()=>{let c=!1;return(async()=>{try{const h=await fetch("/health");if(!h.ok)throw new Error(`HTTP ${h.status}`)}catch(h){c||n({status:"error",reason:String(h)});return}const d=window.location.hash.replace(/^#/,""),f=new URLSearchParams(d),g=f.get("pair");if(g){history.replaceState(null,"",window.location.pathname+window.location.search);try{const h=await Jo.confirm({pairing_id:g,label:VL(),kind:"web"});Ur(h.token);try{localStorage.setItem(Cn.token,h.token)}catch{}c||n({status:"ok"});return}catch{}}const m=f.get("token");if(m){Ur(m);try{localStorage.setItem(Cn.token,m)}catch{}history.replaceState(null,"",window.location.pathname+window.location.search)}else try{const h=localStorage.getItem(Cn.token);h&&Ur(h)}catch{}try{const h=await fetch("/admin/web-token");if(h.ok){const x=await h.json();if(x?.token){Ur(x.token);try{localStorage.setItem(Cn.token,x.token)}catch{}}}}catch{}if(!tx()){c||n({status:"unpaired"});return}try{await ge.get("/projects"),c||n({status:"ok"})}catch(h){if(h instanceof ac&&(h.status===401||h.status===403)){Ur(null);try{localStorage.removeItem(Cn.token)}catch{}c||n({status:"unpaired"})}else c||n({status:"error",reason:String(h)})}})(),()=>{c=!0}},[s]),{...e,reload:i}}function GL(){const e=$L();return e.status==="loading"?l.jsx(z_,{text:C("daemon.connecting")}):e.status==="error"?l.jsx(z_,{text:C("daemon.unreachable"),sub:`${C("daemon.unreachable_hint")}
|
|
542
|
+
|
|
543
|
+
${e.reason}`}):e.status==="unpaired"?l.jsx(AL,{onPaired:e.reload}):l.jsx(R4,{children:l.jsx(g3,{delay:300,children:l.jsx(YL,{})})})}function YL(){const e=Ua(),n=ea(),[s,r]=sj(),{theme:i,toggle:c}=bh(),d=s.get("action")==="add-project",[f,g]=v.useState(!1),m=()=>{const h=new URLSearchParams(s);h.delete("action"),r(h,{replace:!0})};return l.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground","data-testid":"app-shell",children:[l.jsx(b5,{onSelect:h=>e(h),onOpenRoby:()=>g(!0)}),l.jsxs("main",{className:"m-2 ml-0 flex min-w-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card shadow-sm",children:[l.jsx(FL,{onToggleTheme:c,isDark:i==="dark",pathname:n.pathname}),l.jsx("div",{className:"flex-1 overflow-y-auto",children:l.jsxs(W_,{children:[l.jsx(qt,{path:"/",element:l.jsx(M4,{})}),l.jsx(qt,{path:"/settings/*",element:l.jsx(q6,{})}),l.jsx(qt,{path:"/m/voice/*",element:l.jsx(J6,{})}),l.jsx(qt,{path:"/m/desktop/*",element:l.jsx(nL,{})}),l.jsx(qt,{path:"/m/deck/*",element:l.jsx(pL,{})}),l.jsx(qt,{path:"/m/code/*",element:l.jsx(NL,{})}),l.jsx(qt,{path:"/p/:pid/*",element:l.jsx(KD,{})}),l.jsx(qt,{path:"*",element:l.jsx(QL,{})})]})})]}),l.jsx(TL,{open:d,onClose:m}),l.jsx(qL,{open:f,onOpenChange:g})]})}function FL({onToggleTheme:e,isDark:n,pathname:s}){const{projects:r}=sc(),i=s.split("/").filter(Boolean),c=i[0]==="p"?r.find(x=>String(x.id)===i[1]):void 0,d=i[0]==="settings"?XL(i[1]):i[0]==="p"?KL(i[2]):"",f=i[0]==="p"&&i[1]==="0",g=c?.name||c?.path?.split("/").pop()||C("nav.project"),m=s==="/"?C("topbar.breadcrumb_root"):i[0]==="settings"?[C("topbar.breadcrumb_root"),C("nav.settings"),d].filter(Boolean).join(" › "):i[0]==="p"?f?[C("topbar.breadcrumb_root"),C("topbar.breadcrumb_base"),d].filter(Boolean).join(" › "):[C("topbar.breadcrumb_root"),C("topbar.breadcrumb_projects"),g,d].filter(Boolean).join(" › "):C("topbar.breadcrumb_root"),h=s==="/"?"":i[0]==="settings"?C("settings.subtitle"):i[0]==="p"?f?C("base.subtitle"):c?`${iw(c.kind)} · ${c.path}`:"":"";return l.jsxs("header",{className:"flex h-11 shrink-0 items-center justify-between gap-4 px-4",children:[l.jsxs("span",{className:"min-w-0 truncate text-xs tracking-wide text-muted-fg",children:[m,h&&l.jsxs("span",{className:"text-muted-fg/60",children:[" · ",h]})]}),l.jsx("button",{type:"button",onClick:e,title:C(n?"topbar.light":"topbar.dark"),className:"rounded-md p-1.5 text-muted-fg hover:bg-accent hover:text-accent-fg",children:n?l.jsx(rN,{size:16}):l.jsx(JR,{size:16})})]})}function XL(e){switch(e){case"super-agent":return C("settings.tabs.super_agent");case"engines":return C("settings.tabs.engines");case"telegram":return C("settings.tabs.telegram");case"devices":return C("settings.tabs.devices");case"appearance":return C("settings.appearance");case"config":case"advanced":return C("settings.tabs.advanced");case"identity":default:return e||""}}function KL(e){switch(e){case"chat":return C("project.nav.chat");case"threads":return C("project.nav.threads");case"telegram":return C("project.nav.telegram");case"agents":return C("project.nav.agents");case"routines":return C("project.nav.routines");case"tasks":return C("project.nav.tasks");case"mcps":return C("project.nav.mcps");case"config":return C("project.nav.config");case"workspaces":return C("base.workspaces_title");case"models":return C("settings.tabs.engines");case"agent-defaults":return C("base.defaults_title");case"sessions":return C("base.sessions_title");case"logs":return C("project.nav.logs");case"memories":return C("project.nav.memories");default:return""}}function z_({text:e,sub:n}){return l.jsx("div",{className:"grid h-screen w-screen place-items-center bg-background text-foreground",children:l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"font-mono text-xs text-muted-fg whitespace-pre leading-none mb-4",children:` ▄███████▄
|
|
544
|
+
█ ██ ██ █
|
|
545
|
+
█ ◔ ◔ █
|
|
546
|
+
█ ╰~╯ █
|
|
547
|
+
▀███████▀`}),l.jsx("div",{className:"text-foreground",children:e}),n&&l.jsx("pre",{className:"mt-2 max-w-xl whitespace-pre-wrap text-sm text-muted-fg",children:n})]})})}function QL(){return l.jsxs("div",{className:"p-8",children:[l.jsx("h1",{className:"text-2xl",children:C("not_found.title")}),l.jsx("p",{className:"text-muted-fg",children:C("not_found.message")})]})}UE.createRoot(document.getElementById("root")).render(l.jsx(Ki.StrictMode,{children:l.jsx(iR,{children:l.jsx(uN,{children:l.jsx(GL,{})})})}));
|
|
548
|
+
//# sourceMappingURL=index-CfWyjPBa.js.map
|