diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index fb514291..989888b2 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,11 +1,12 @@ name: Docker Build and Push on: + schedule: + - cron: '0 0 * * *' push: branches: - main - classical - - dev tags: - "v*.*.*" - "v*" @@ -24,6 +25,7 @@ jobs: - name: Check out git repository uses: actions/checkout@v4 with: + ref: ${{ github.event_name == 'schedule' && 'dev' || github.ref }} fetch-depth: 0 # Clone required dependencies @@ -77,6 +79,7 @@ jobs: - name: Check out git repository uses: actions/checkout@v4 with: + ref: ${{ github.event_name == 'schedule' && 'dev' || github.ref }} fetch-depth: 0 # Clone required dependencies diff --git a/.gitignore b/.gitignore index 328a86aa..9db98c1d 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,6 @@ run_maibot_core.bat run_voice.bat run_napcat_adapter.bat run_ad.bat -s4u.s4u llm_tool_benchmark_results.json MaiBot-Napcat-Adapter-main MaiBot-Napcat-Adapter @@ -27,6 +26,7 @@ run.bat log_debug/ run_amds.bat run_none.bat +docs-mai/ run.py message_queue_content.txt message_queue_content.bat @@ -51,6 +51,7 @@ template/compare/model_config_template.toml src/plugins/utils/statistic.py CLAUDE.md MaiBot-Dashboard/ +cloudflare-workers/ # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/Dockerfile b/Dockerfile index b0f3775f..b6a9cd1b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,6 +25,8 @@ WORKDIR /MaiMBot # 复制依赖列表 COPY requirements.txt . +RUN apt-get update && apt-get install -y git + # 从编译阶段复制 LPMM 编译结果 COPY --from=lpmm-builder /usr/local/lib/python3.13/site-packages/ /usr/local/lib/python3.13/site-packages/ diff --git a/README.md b/README.md index a37896f8..de5b2e28 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,12 @@ **🍔MaiCore 是一个基于大语言模型的可交互智能体** -- 💭 **智能对话系统**:基于 LLM 的自然语言交互,聊天时机控制。 -- 🤔 **实时思维系统**:模拟人类思考过程。 -- 🧠 **表达学习功能**:学习群友的说话风格和表达方式 -- 💝 **情感表达系统**:情绪系统和表情包系统。 -- 🔌 **强大插件系统**:提供API和事件系统,可编写强大插件。 +- 💭 **拟人构建的prompt**:使用自然语言风格构建回复器的prompt,实现近似人类言语习惯的回复。 +- 💭 **行为规划**:在合适的时间说话,使用合适的动作 +- 🧠 **表达学习**:学习群友的说话风格和表达方式,学会真实人类的说话风格 +- 🤔 **黑话学习**:自主的学习没有见过的词语,尝试理解并认知含义 +- 🔌 **插件系统**:提供API和事件系统,可编写丰富插件。 +- 💝 **情感表达**:情绪系统和表情包系统。
@@ -44,7 +45,9 @@ ## 🔥 更新和安装 -**最新版本: v0.11.3** ([更新日志](changelogs/changelog.md)) + +**最新版本: v0.11.5** ([更新日志](changelogs/changelog.md)) + 可前往 [Release](https://github.com/MaiM-with-u/MaiBot/releases/) 页面下载最新版本 可前往 [启动器发布页面](https://github.com/MaiM-with-u/mailauncher/releases/)下载最新启动器 @@ -60,15 +63,10 @@ > [!WARNING] > - 项目处于活跃开发阶段,功能和 API 可能随时调整。 -> - 有问题可以提交 Issue 或者 Discussion。 +> - 有问题可以提交 Issue 。 > - QQ 机器人存在被限制风险,请自行了解,谨慎使用。 > - 由于程序处于开发中,可能消耗较多 token。 -## 麦麦MC项目MaiCraft(早期开发) -[让麦麦玩MC](https://github.com/MaiM-with-u/Maicraft) - -交流群:1058573197 - ## 💬 讨论 **技术交流群:** @@ -80,7 +78,7 @@ **聊天吹水群:** - [麦麦之闲聊群](https://qm.qq.com/q/JxvHZnxyec) -**插件开发测试版群:** +**插件开发/测试版讨论群:** - [插件开发群](https://qm.qq.com/q/1036092828) ## 📚 文档 @@ -89,7 +87,22 @@ - [📚 核心 Wiki 文档](https://docs.mai-mai.org) - 项目最全面的文档中心,你可以了解麦麦有关的一切。 -### 设计理念(原始时代的火花) + +## 📚 衍生项目 + +### MaiCraft(早期开发) +[MaiCraft](https://github.com/MaiM-with-u/Maicraft) +> 让麦麦具有玩MC能力的项目 +> 交流群:1058573197 + +### MoFox_Bot +[MoFox - 仓库地址](https://github.com/MoFox-Studio/MoFox-Core) +> MoFox_Bot 是一个基于 MaiCore 0.10.0 snapshot.5 的增强型 fork 项目 +> 我们保留了原项目几乎所有核心功能,并在此基础上进行了深度优化与功能扩展,致力于打造一个更稳定、更智能、更具趣味性的 AI 智能体。 + + + +## 设计理念(原始时代的火花) > **千石可乐说:** > - 这个项目最初只是为了给牛牛 bot 添加一点额外的功能,但是功能越写越多,最后决定重写。其目的是为了创造一个活跃在 QQ 群聊的"生命体"。目的并不是为了写一个功能齐全的机器人,而是一个尽可能让人感知到真实的类人存在。 @@ -101,7 +114,7 @@ ## 🙋 贡献和致谢 你可以阅读[开发文档](https://docs.mai-mai.org/develop/)来更好的了解麦麦! MaiCore 是一个开源项目,我们非常欢迎你的参与。你的贡献,无论是提交 bug 报告、功能需求还是代码 pr,都对项目非常宝贵。我们非常感谢你的支持!🎉 -但无序的讨论会降低沟通效率,进而影响问题的解决速度,因此在提交任何贡献前,请务必先阅读本项目的[贡献指南](docs/CONTRIBUTE.md)。(待补完) +但无序的讨论会降低沟通效率,进而影响问题的解决速度,因此在提交任何贡献前,请务必先阅读本项目的[贡献指南](docs-src/CONTRIBUTE.md)。(待补完) ### 贡献者 diff --git a/bot.py b/bot.py index 38894b29..68c6e110 100644 --- a/bot.py +++ b/bot.py @@ -1,7 +1,6 @@ import asyncio import hashlib import os -import sys import time import platform import traceback @@ -30,7 +29,7 @@ else: raise # 最早期初始化日志系统,确保所有后续模块都使用正确的日志格式 -from src.common.logger import initialize_logging, get_logger, shutdown_logging #noqa +from src.common.logger import initialize_logging, get_logger, shutdown_logging # noqa initialize_logging() @@ -76,6 +75,15 @@ async def graceful_shutdown(): # sourcery skip: use-named-expression try: logger.info("正在优雅关闭麦麦...") + # 关闭 WebUI 服务器 + try: + from src.webui.webui_server import get_webui_server + webui_server = get_webui_server() + if webui_server and webui_server._server: + await webui_server.shutdown() + except Exception as e: + logger.warning(f"关闭 WebUI 服务器时出错: {e}") + from src.plugin_system.core.events_manager import events_manager from src.plugin_system.base.component_types import EventType @@ -212,9 +220,10 @@ if __name__ == "__main__": # 创建事件循环 loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) - + # 初始化 WebSocket 日志推送 from src.common.logger import initialize_ws_handler + initialize_ws_handler(loop) try: @@ -251,7 +260,7 @@ if __name__ == "__main__": print(f"关闭日志系统时出错: {e}") print("[主程序] 准备退出...") - + # 使用 os._exit() 强制退出,避免被阻塞 # 由于已经在 graceful_shutdown() 中完成了所有清理工作,这是安全的 os._exit(exit_code) diff --git a/changelogs/changelog.md b/changelogs/changelog.md index a0e64dd8..0a4f34b9 100644 --- a/changelogs/changelog.md +++ b/changelogs/changelog.md @@ -1,6 +1,88 @@ # Changelog +## [0.11.5] - 2025-11-21 +### 🌟 重大更新 +- WebUI 现支持手动重启麦麦,曲线救国版“热重载” +- 新增麦麦 QQ 适配器可视化编辑 UI(独立进程,需手动上传/下载并覆盖适配器文件) +- 麦麦主程序配置支持可视化模式与源代码模式双模式编辑,后端执行 TOML 校验 +- 优化 planner 与 replyer 协同机制,调试日志更细 -## [0.11.3] - 2025-11-17 +### 新增 +- 表情包管理、人物信息管理、表达方式管理界面手机端适配 +- 配置页“重启麦麦”提示 +- 详细的debug prompt显示配置 +- 麦麦界面操作主题色按钮 +- 前端集成 CodeMirror(Python/JSON/TOML 语法高亮)并对 JSON 配置提供自动纠错提示 + +### 修复 +- 表情包缩略图过小 +- 添加模型后无法立即显示 +- 插件市场分类错误 +- 浅色模式下日志查看器背景异常 +- 表情包详情窗口无法关闭 +- 情绪标签无法正常读取(issues/1373) +- 模型任务配置界面模型温度不可更改(issues/1369) +- 模型任务配置界面部分输入框无法删除默认值 +- 插件商店默认勾选“仅显示兼容插件” +- 插件商店标签页数量显示错误 +- 日志查看器日志换行异常 +- 主题色未正确应用 +- 侧边栏滚动条问题 +- 移除前端 TOML 解析库导致的兼容问题 + +### 优化 +- 首页加载用户体验 +- 首页加载速度(9s → <1s) +- 整个界面的初屏加载速度 + +### 更新 +- 适配器配置支持上传模式与指定路径模式;指定路径模式可免去反复上传/下载配置文件 +- 适配器配置界面标签页响应式优化,小屏仅显示简短标签 +- 麦麦资源管理所有界面的批量删除能力 +- 资源管理所有界面的分页、每页数量选择与页跳转 +- 插件市场新增点赞、点踩、评分与下载量统计(基于 Cloudflare,保证国内可访问) +- 麦麦表情包查看界面的描述部分支持 Markdown 渲染 + +## [0.11.4] - 2025-11-19 +### 🌟 主要更新内容 +- **首个官方 Web 管理界面上线**:在此版本之前,MaiBot 没有 WebUI,所有配置需手动编辑 TOML 文件 +- **认证系统**:Token 安全登录(支持系统生成 64 位随机令牌 / 自定义 Token),首次配置向导 +- **配置管理(可视化编辑,无需手动改 TOML)**: + - 麦麦主程序配置:基础设置、人格、表情、黑话、情绪等 + - 模型提供商配置:OpenAI、Anthropic、DeepSeek、Qwen、Ollama 等 + - 模型配置:对话/视觉/嵌入模型分配 +- **资源管理**: + - 表情包管理:查看、搜索、注册、封禁 + - 表达方式管理:查看麦麦的表达记录 + - 人物信息管理:查看联系人列表 +- **插件系统**: + - 插件市场浏览 + - 一键安装/卸载/更新 + - 版本兼容性检查 + - 实时安装进度推送 +- **日志查看器**: + - WebSocket 实时日志流 + - 日志级别过滤(DEBUG/INFO/WARNING/ERROR/CRITICAL) + - 搜索功能 +- **主题定制**: + - 浅色/深色/跟随系统 + - 12 种主题色(6 单色 + 6 渐变色) + - 自定义颜色选择器 +- **全局搜索**:Cmd/Ctrl + K 快捷键,快速跳转任意页面 + +### 细节 +- **技术栈**: + - 前端: React 19 + TypeScript + Vite + TanStack Router + shadcn/ui + - 后端: FastAPI + Uvicorn + WebSocket + - 特点: SPA 单页应用,前后端同端口,静态文件托管 +- **使用方式**:参照 template.env 文件更新 .env 文件,添加两个字段: + - `WEBUI_ENABLED=true` + - `WEBUI_MODE=production` +- **WebUI 开源协议**:GPLv3 +- **WebUI 地址**:https://github.com/Mai-with-u/MaiBot-Dashboard + +告别手动编辑配置文件,享受现代化图形界面! + +## [0.11.3] - 2025-11-18 ### 功能更改和修复 - 优化记忆提取策略 - 优化黑话提取 diff --git a/docker-compose.yml b/docker-compose.yml index 3bcf0e54..29887250 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,7 +29,8 @@ services: - TZ=Asia/Shanghai # - EULA_AGREE=99f08e0cab0190de853cb6af7d64d4de # 同意EULA # - PRIVACY_AGREE=9943b855e72199d0f5016ea39052f1b6 # 同意EULA -# ports: + ports: + - "18001:8001" # webui端口 # - "8000:8000" volumes: - ./docker-config/mmc/.env:/MaiMBot/.env # 持久化env配置文件 diff --git a/docs/Bing.md b/docs-src/Bing.md similarity index 100% rename from docs/Bing.md rename to docs-src/Bing.md diff --git a/docs/CONTRIBUTE.md b/docs-src/CONTRIBUTE.md similarity index 100% rename from docs/CONTRIBUTE.md rename to docs-src/CONTRIBUTE.md diff --git a/docs/plugins/action-components.md b/docs-src/plugins/action-components.md similarity index 100% rename from docs/plugins/action-components.md rename to docs-src/plugins/action-components.md diff --git a/docs/plugins/api/chat-api.md b/docs-src/plugins/api/chat-api.md similarity index 100% rename from docs/plugins/api/chat-api.md rename to docs-src/plugins/api/chat-api.md diff --git a/docs/plugins/api/component-manage-api.md b/docs-src/plugins/api/component-manage-api.md similarity index 100% rename from docs/plugins/api/component-manage-api.md rename to docs-src/plugins/api/component-manage-api.md diff --git a/docs/plugins/api/config-api.md b/docs-src/plugins/api/config-api.md similarity index 100% rename from docs/plugins/api/config-api.md rename to docs-src/plugins/api/config-api.md diff --git a/docs/plugins/api/database-api.md b/docs-src/plugins/api/database-api.md similarity index 100% rename from docs/plugins/api/database-api.md rename to docs-src/plugins/api/database-api.md diff --git a/docs/plugins/api/emoji-api.md b/docs-src/plugins/api/emoji-api.md similarity index 100% rename from docs/plugins/api/emoji-api.md rename to docs-src/plugins/api/emoji-api.md diff --git a/docs/plugins/api/generator-api.md b/docs-src/plugins/api/generator-api.md similarity index 100% rename from docs/plugins/api/generator-api.md rename to docs-src/plugins/api/generator-api.md diff --git a/docs/plugins/api/llm-api.md b/docs-src/plugins/api/llm-api.md similarity index 100% rename from docs/plugins/api/llm-api.md rename to docs-src/plugins/api/llm-api.md diff --git a/docs/plugins/api/logging-api.md b/docs-src/plugins/api/logging-api.md similarity index 100% rename from docs/plugins/api/logging-api.md rename to docs-src/plugins/api/logging-api.md diff --git a/docs/plugins/api/message-api.md b/docs-src/plugins/api/message-api.md similarity index 100% rename from docs/plugins/api/message-api.md rename to docs-src/plugins/api/message-api.md diff --git a/docs/plugins/api/person-api.md b/docs-src/plugins/api/person-api.md similarity index 100% rename from docs/plugins/api/person-api.md rename to docs-src/plugins/api/person-api.md diff --git a/docs/plugins/api/plugin-manage-api.md b/docs-src/plugins/api/plugin-manage-api.md similarity index 100% rename from docs/plugins/api/plugin-manage-api.md rename to docs-src/plugins/api/plugin-manage-api.md diff --git a/docs/plugins/api/send-api.md b/docs-src/plugins/api/send-api.md similarity index 100% rename from docs/plugins/api/send-api.md rename to docs-src/plugins/api/send-api.md diff --git a/docs/plugins/api/tool-api.md b/docs-src/plugins/api/tool-api.md similarity index 100% rename from docs/plugins/api/tool-api.md rename to docs-src/plugins/api/tool-api.md diff --git a/docs/plugins/command-components.md b/docs-src/plugins/command-components.md similarity index 100% rename from docs/plugins/command-components.md rename to docs-src/plugins/command-components.md diff --git a/docs/plugins/configuration-guide.md b/docs-src/plugins/configuration-guide.md similarity index 100% rename from docs/plugins/configuration-guide.md rename to docs-src/plugins/configuration-guide.md diff --git a/docs/plugins/dependency-management.md b/docs-src/plugins/dependency-management.md similarity index 100% rename from docs/plugins/dependency-management.md rename to docs-src/plugins/dependency-management.md diff --git a/docs/plugins/image/quick-start/1750326700269.png b/docs-src/plugins/image/quick-start/1750326700269.png similarity index 100% rename from docs/plugins/image/quick-start/1750326700269.png rename to docs-src/plugins/image/quick-start/1750326700269.png diff --git a/docs/plugins/image/quick-start/1750332508760.png b/docs-src/plugins/image/quick-start/1750332508760.png similarity index 100% rename from docs/plugins/image/quick-start/1750332508760.png rename to docs-src/plugins/image/quick-start/1750332508760.png diff --git a/docs/plugins/index.md b/docs-src/plugins/index.md similarity index 100% rename from docs/plugins/index.md rename to docs-src/plugins/index.md diff --git a/docs/plugins/manifest-guide.md b/docs-src/plugins/manifest-guide.md similarity index 100% rename from docs/plugins/manifest-guide.md rename to docs-src/plugins/manifest-guide.md diff --git a/docs/plugins/quick-start.md b/docs-src/plugins/quick-start.md similarity index 100% rename from docs/plugins/quick-start.md rename to docs-src/plugins/quick-start.md diff --git a/docs/plugins/tool-components.md b/docs-src/plugins/tool-components.md similarity index 100% rename from docs/plugins/tool-components.md rename to docs-src/plugins/tool-components.md diff --git a/docs/image-1.png b/docs/image-1.png deleted file mode 100644 index c7a0adc8..00000000 Binary files a/docs/image-1.png and /dev/null differ diff --git a/docs/image.png b/docs/image.png deleted file mode 100644 index 63416251..00000000 Binary files a/docs/image.png and /dev/null differ diff --git a/docs/model_configuration_guide.md b/docs/model_configuration_guide.md deleted file mode 100644 index f2da8be1..00000000 --- a/docs/model_configuration_guide.md +++ /dev/null @@ -1,336 +0,0 @@ -# 模型配置指南 - -本文档将指导您如何配置 `model_config.toml` 文件,该文件用于配置 MaiBot 的各种AI模型和API服务提供商。 - -## 配置文件结构 - -配置文件主要包含以下几个部分: -- 版本信息 -- API服务提供商配置 -- 模型配置 -- 模型任务配置 - -## 1. 版本信息 - -```toml -[inner] -version = "1.1.1" -``` - -用于标识配置文件的版本,遵循语义化版本规则。 - -## 2. API服务提供商配置 - -### 2.1 基本配置 - -使用 `[[api_providers]]` 数组配置多个API服务提供商: - -```toml -[[api_providers]] -name = "DeepSeek" # 服务商名称(自定义) -base_url = "https://api.deepseek.com/v1" # API服务的基础URL -api_key = "your-api-key-here" # API密钥 -client_type = "openai" # 客户端类型 -max_retry = 2 # 最大重试次数 -timeout = 30 # 超时时间(秒) -retry_interval = 10 # 重试间隔(秒) -``` - -### 2.2 配置参数说明 - -| 参数 | 必填 | 说明 | 默认值 | -|------|------|------|--------| -| `name` | ✅ | 服务商名称,需要在模型配置中引用 | - | -| `base_url` | ✅ | API服务的基础URL | - | -| `api_key` | ✅ | API密钥,请替换为实际密钥 | - | -| `client_type` | ❌ | 客户端类型:`openai`(OpenAI格式)或 `gemini`(Gemini格式) | `openai` | -| `max_retry` | ❌ | API调用失败时的最大重试次数 | 2 | -| `timeout` | ❌ | API请求超时时间(秒) | 30 | -| `retry_interval` | ❌ | 重试间隔时间(秒) | 10 | - -**请注意,对于`client_type`为`gemini`的模型,`retry`字段由`gemini`自己决定。** -### 2.3 支持的服务商示例 - -#### DeepSeek -```toml -[[api_providers]] -name = "DeepSeek" -base_url = "https://api.deepseek.com/v1" -api_key = "your-deepseek-api-key" -client_type = "openai" -``` - -#### SiliconFlow -```toml -[[api_providers]] -name = "SiliconFlow" -base_url = "https://api.siliconflow.cn/v1" -api_key = "your-siliconflow-api-key" -client_type = "openai" -``` - -#### Google Gemini -```toml -[[api_providers]] -name = "Google" -base_url = "https://generativelanguage.googleapis.com/v1beta" -api_key = "your-google-api-key" -client_type = "gemini" # 注意:Gemini需要使用特殊客户端 -``` - -## 3. 模型配置 - -### 3.1 基本模型配置 - -使用 `[[models]]` 数组配置多个模型: - -```toml -[[models]] -model_identifier = "deepseek-chat" # 模型在API服务商中的标识符 -name = "deepseek-v3" # 自定义模型名称 -api_provider = "DeepSeek" # 引用的API服务商名称 -price_in = 2.0 # 输入价格(元/M token) -price_out = 8.0 # 输出价格(元/M token) -``` - -### 3.2 高级模型配置 - -#### 强制流式输出 -对于不支持非流式输出的模型: -```toml -[[models]] -model_identifier = "some-model" -name = "custom-name" -api_provider = "Provider" -force_stream_mode = true # 启用强制流式输出 -``` - -#### 额外参数配置`extra_params` -```toml -[[models]] -model_identifier = "Qwen/Qwen3-8B" -name = "qwen3-8b" -api_provider = "SiliconFlow" -[models.extra_params] -enable_thinking = false # 禁用思考 -``` -这里的 `extra_params` 可以包含任何API服务商支持的额外参数配置,**配置时应参考相应的API文档**。 - -比如上面就是参考SiliconFlow的文档配置配置的`Qwen3`禁用思考参数。 - -![SiliconFlow文档截图](image-1.png) - -以豆包文档为另一个例子 - -![豆包文档截图](image.png) - -得到豆包`"doubao-seed-1-6-250615"`的禁用思考配置方法为 -```toml -[[models]] -# 你的模型 -[models.extra_params] -thinking = {type = "disabled"} # 禁用思考 -``` - -而对于`gemini`需要单独进行配置 -```toml -[[models]] -model_identifier = "gemini-2.5-flash" -name = "gemini-2.5-flash" -api_provider = "Google" -[models.extra_params] -thinking_budget = 0 # 禁用思考 -# thinking_budget = -1 由模型自己决定 -``` - -请注意,`extra_params` 的配置应该构成一个合法的TOML字典结构,具体内容取决于API服务商的要求。 - -### 3.3 配置参数说明 - -| 参数 | 必填 | 说明 | -|------|------|------| -| `model_identifier` | ✅ | API服务商提供的模型标识符 | -| `name` | ✅ | 自定义模型名称,用于在任务配置中引用 | -| `api_provider` | ✅ | 对应的API服务商名称 | -| `price_in` | ❌ | 输入价格(元/M token),用于成本统计 | -| `price_out` | ❌ | 输出价格(元/M token),用于成本统计 | -| `force_stream_mode` | ❌ | 是否强制使用流式输出 | -| `extra_params` | ❌ | 额外的模型参数配置 | - -## 4. 模型任务配置 - -### utils - 工具模型 -用于表情包模块、取名模块、关系模块等核心功能: -```toml -[model_task_config.utils] -model_list = ["siliconflow-deepseek-v3"] -temperature = 0.2 -max_tokens = 800 -``` - -### utils_small - 小型工具模型 -用于高频率调用的场景,建议使用速度快的小模型: -```toml -[model_task_config.utils_small] -model_list = ["qwen3-8b"] -temperature = 0.7 -max_tokens = 800 -``` - -### replyer - 主要回复模型 -首要回复模型,也用于表达器和表达方式学习: -```toml -[model_task_config.replyer] -model_list = ["siliconflow-deepseek-v3"] -temperature = 0.2 -max_tokens = 800 -``` - -### planner - 决策模型 -负责决定MaiBot该做什么: -```toml -[model_task_config.planner] -model_list = ["siliconflow-deepseek-v3"] -temperature = 0.3 -max_tokens = 800 -``` - -### emotion - 情绪模型 -负责MaiBot的情绪变化: -```toml -[model_task_config.emotion] -model_list = ["siliconflow-deepseek-v3"] -temperature = 0.3 -max_tokens = 800 -``` - -### memory - 记忆模型 -```toml -[model_task_config.memory] -model_list = ["qwen3-30b"] -temperature = 0.7 -max_tokens = 800 -``` - -### vlm - 视觉语言模型 -用于图像识别: -```toml -[model_task_config.vlm] -model_list = ["qwen2.5-vl-72b"] -max_tokens = 800 -``` - -### voice - 语音识别模型 -```toml -[model_task_config.voice] -model_list = ["sensevoice-small"] -``` - -### embedding - 嵌入模型 -```toml -[model_task_config.embedding] -model_list = ["bge-m3"] -``` - -### tool_use - 工具调用模型 -需要使用支持工具调用的模型: -```toml -[model_task_config.tool_use] -model_list = ["qwen3-14b"] -temperature = 0.7 -max_tokens = 800 -``` - -### lpmm_entity_extract - 实体提取模型 -```toml -[model_task_config.lpmm_entity_extract] -model_list = ["siliconflow-deepseek-v3"] -temperature = 0.2 -max_tokens = 800 -``` - -### lpmm_rdf_build - RDF构建模型 -```toml -[model_task_config.lpmm_rdf_build] -model_list = ["siliconflow-deepseek-v3"] -temperature = 0.2 -max_tokens = 800 -``` - -### lpmm_qa - 问答模型 -```toml -[model_task_config.lpmm_qa] -model_list = ["deepseek-r1-distill-qwen-32b"] -temperature = 0.7 -max_tokens = 800 -``` - -## 5. 配置建议 - -### 5.1 Temperature 参数选择 - -| 任务类型 | 推荐温度 | 说明 | -|----------|----------|------| -| 精确任务(工具调用、实体提取) | 0.1-0.3 | 需要准确性和一致性 | -| 创意任务(对话、记忆) | 0.5-0.8 | 需要多样性和创造性 | -| 平衡任务(决策、情绪) | 0.3-0.5 | 平衡准确性和灵活性 | - -### 5.2 模型选择建议 - -| 任务类型 | 推荐模型类型 | 示例 | -|----------|--------------|------| -| 高精度任务 | 大模型 | DeepSeek-V3, GPT-4 | -| 高频率任务 | 小模型 | Qwen3-8B | -| 多模态任务 | 专用模型 | Qwen2.5-VL, SenseVoice | -| 工具调用 | 支持Function Call的模型 | Qwen3-14B | - -### 5.3 成本优化 - -1. **分层使用**:核心功能使用高质量模型,辅助功能使用经济模型 -2. **合理配置max_tokens**:根据实际需求设置,避免浪费 -3. **选择免费模型**:对于测试环境,优先使用price为0的模型 - -## 6. 配置验证 - -### 6.1 必要检查项 - -1. ✅ API密钥是否正确配置 -2. ✅ 模型标识符是否与API服务商提供的一致 -3. ✅ 任务配置中引用的模型名称是否在models中定义 -4. ✅ 多模态任务是否配置了对应的专用模型 - -### 6.2 测试配置 - -建议在正式使用前: -1. 使用少量测试数据验证配置 -2. 检查API调用是否正常 -3. 确认成本统计功能正常工作 - -## 7. 故障排除 - -### 7.1 常见问题 - -**问题1**: API调用失败 -- 检查API密钥是否正确 -- 确认base_url是否可访问 -- 检查模型标识符是否正确 - -**问题2**: 模型未找到 -- 确认模型名称在任务配置和模型定义中一致 -- 检查api_provider名称是否匹配 - -**问题3**: 响应异常 -- 检查温度参数是否合理(0-1之间) -- 确认max_tokens设置是否合适 -- 验证模型是否支持所需功能 - -### 7.2 日志查看 - -查看 `logs/` 目录下的日志文件,寻找相关错误信息。 - -## 8. 更新和维护 - -1. **定期更新**: 关注API服务商的模型更新,及时调整配置 -2. **性能监控**: 监控模型调用的成本和性能 -3. **备份配置**: 在修改前备份当前配置文件 - diff --git a/scripts/build_io_pairs.py b/scripts/build_io_pairs.py index f934566a..944d7671 100644 --- a/scripts/build_io_pairs.py +++ b/scripts/build_io_pairs.py @@ -16,8 +16,6 @@ if PROJECT_ROOT not in sys.path: sys.path.insert(0, PROJECT_ROOT) - - SECONDS_5_MINUTES = 5 * 60 diff --git a/scripts/expression_scatter_analysis.py b/scripts/expression_scatter_analysis.py index b022c94e..3cb22f71 100644 --- a/scripts/expression_scatter_analysis.py +++ b/scripts/expression_scatter_analysis.py @@ -12,7 +12,6 @@ project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, project_root) - # 设置中文字体 plt.rcParams["font.sans-serif"] = ["SimHei", "Microsoft YaHei", "DejaVu Sans"] plt.rcParams["axes.unicode_minus"] = False diff --git a/scripts/mmipkg_tool.py b/scripts/mmipkg_tool.py index 6f14ae5b..3b5369ac 100644 --- a/scripts/mmipkg_tool.py +++ b/scripts/mmipkg_tool.py @@ -57,8 +57,8 @@ from src.common.database.database import db from src.common.database.database_model import Emoji # 常量定义 -MAGIC = b'MMIP' -FOOTER_MAGIC = b'MMFF' +MAGIC = b"MMIP" +FOOTER_MAGIC = b"MMFF" VERSION = 1 FOOTER_VERSION = 1 @@ -67,7 +67,7 @@ MAX_MANIFEST_SIZE = 200 * 1024 * 1024 # 200 MB MAX_PAYLOAD_SIZE = 10 * 1024 * 1024 * 1024 # 10 GB # 支持的图片格式 -SUPPORTED_FORMATS = {'.jpg', '.jpeg', '.png', '.gif', '.webp', '.avif', '.bmp'} +SUPPORTED_FORMATS = {".jpg", ".jpeg", ".png", ".gif", ".webp", ".avif", ".bmp"} # 创建控制台对象 console = Console() @@ -75,6 +75,7 @@ console = Console() class MMIPKGError(Exception): """MMIPKG 相关错误""" + pass @@ -97,56 +98,56 @@ def get_image_info(file_path: str) -> Tuple[int, int, str]: try: with Image.open(file_path) as img: width, height = img.size - format_lower = img.format.lower() if img.format else 'unknown' + format_lower = img.format.lower() if img.format else "unknown" mime_map = { - 'jpeg': 'image/jpeg', - 'jpg': 'image/jpeg', - 'png': 'image/png', - 'gif': 'image/gif', - 'webp': 'image/webp', - 'avif': 'image/avif', - 'bmp': 'image/bmp' + "jpeg": "image/jpeg", + "jpg": "image/jpeg", + "png": "image/png", + "gif": "image/gif", + "webp": "image/webp", + "avif": "image/avif", + "bmp": "image/bmp", } - mime_type = mime_map.get(format_lower, f'image/{format_lower}') + mime_type = mime_map.get(format_lower, f"image/{format_lower}") return width, height, mime_type except Exception as e: print(f"警告: 无法读取图片信息 {file_path}: {e}") - return 0, 0, 'image/unknown' + return 0, 0, "image/unknown" -def reencode_image(file_path: str, output_format: str = 'webp', quality: int = 80) -> bytes: +def reencode_image(file_path: str, output_format: str = "webp", quality: int = 80) -> bytes: """重新编码图片""" try: with Image.open(file_path) as img: # 转换为 RGB(如果需要) - if img.mode in ('RGBA', 'LA', 'P'): - if output_format.lower() == 'jpeg': + if img.mode in ("RGBA", "LA", "P"): + if output_format.lower() == "jpeg": # JPEG 不支持透明度,转为白色背景 - background = Image.new('RGB', img.size, (255, 255, 255)) - if img.mode == 'P': - img = img.convert('RGBA') - background.paste(img, mask=img.split()[-1] if img.mode == 'RGBA' else None) + background = Image.new("RGB", img.size, (255, 255, 255)) + if img.mode == "P": + img = img.convert("RGBA") + background.paste(img, mask=img.split()[-1] if img.mode == "RGBA" else None) img = background - elif output_format.lower() == 'webp': + elif output_format.lower() == "webp": # WebP 支持透明度 - if img.mode == 'P': - img = img.convert('RGBA') - elif img.mode not in ('RGB', 'RGBA'): - img = img.convert('RGB') - + if img.mode == "P": + img = img.convert("RGBA") + elif img.mode not in ("RGB", "RGBA"): + img = img.convert("RGB") + # 编码图片 output = io.BytesIO() - save_kwargs = {'format': output_format.upper()} - - if output_format.lower() in {'jpeg', 'jpg'}: - save_kwargs['quality'] = quality - save_kwargs['optimize'] = True - elif output_format.lower() == 'webp': - save_kwargs['quality'] = quality - save_kwargs['method'] = 6 # 更好的压缩 - elif output_format.lower() == 'png': - save_kwargs['optimize'] = True - + save_kwargs = {"format": output_format.upper()} + + if output_format.lower() in {"jpeg", "jpg"}: + save_kwargs["quality"] = quality + save_kwargs["optimize"] = True + elif output_format.lower() == "webp": + save_kwargs["quality"] = quality + save_kwargs["method"] = 6 # 更好的压缩 + elif output_format.lower() == "png": + save_kwargs["optimize"] = True + img.save(output, **save_kwargs) return output.getvalue() except Exception as e: @@ -155,25 +156,28 @@ def reencode_image(file_path: str, output_format: str = 'webp', quality: int = 8 class MMIPKGPacker: """MMIPKG 打包器""" - - def __init__(self, - use_compression: bool = True, - zstd_level: int = 3, - reencode: Optional[str] = None, - reencode_quality: int = 80): + + def __init__( + self, + use_compression: bool = True, + zstd_level: int = 3, + reencode: Optional[str] = None, + reencode_quality: int = 80, + ): self.use_compression = use_compression and zstd is not None self.zstd_level = zstd_level self.reencode = reencode self.reencode_quality = reencode_quality - + if use_compression and zstd is None: print("警告: zstandard 未安装,将不使用压缩") self.use_compression = False - - def pack_from_db(self, output_path: str, pack_name: Optional[str] = None, - custom_manifest: Optional[Dict] = None) -> bool: + + def pack_from_db( + self, output_path: str, pack_name: Optional[str] = None, custom_manifest: Optional[Dict] = None + ) -> bool: """从数据库导出已注册的表情包 - + Args: output_path: 输出文件路径 pack_name: 包名称 @@ -183,21 +187,21 @@ class MMIPKGPacker: # 连接数据库 if db.is_closed(): db.connect() - + # 查询所有已注册的表情包 emojis = Emoji.select().where(Emoji.is_registered) emoji_count = emojis.count() - + if emoji_count == 0: print("错误: 数据库中没有已注册的表情包") return False - + print(f"找到 {emoji_count} 个已注册的表情包") - + # 准备 items items = [] image_data_list = [] - + # 使用进度条处理表情包 with Progress( SpinnerColumn(), @@ -205,37 +209,39 @@ class MMIPKGPacker: BarColumn(), TextColumn("[progress.percentage]{task.percentage:>3.0f}%"), TimeElapsedColumn(), - console=console + console=console, ) as progress: task = progress.add_task("[cyan]扫描表情包...", total=emoji_count) - + for idx, emoji in enumerate(emojis, 1): - progress.update(task, description=f"[cyan]处理 {idx}/{emoji_count}: {os.path.basename(emoji.full_path)}") - + progress.update( + task, description=f"[cyan]处理 {idx}/{emoji_count}: {os.path.basename(emoji.full_path)}" + ) + # 检查文件是否存在 if not os.path.exists(emoji.full_path): console.print(" [yellow]警告: 文件不存在,跳过[/yellow]") progress.advance(task) continue - + # 读取或重新编码图片 if self.reencode: try: img_bytes = reencode_image(emoji.full_path, self.reencode, self.reencode_quality) except Exception as e: console.print(f" [yellow]警告: 重新编码失败,使用原始文件: {e}[/yellow]") - with open(emoji.full_path, 'rb') as f: + with open(emoji.full_path, "rb") as f: img_bytes = f.read() else: - with open(emoji.full_path, 'rb') as f: + with open(emoji.full_path, "rb") as f: img_bytes = f.read() - + # 计算 SHA256 img_sha = calculate_sha256(img_bytes) - + # 获取图片信息 width, height, mime_type = get_image_info(emoji.full_path) - + # 构建 item(使用短字段名) filename = os.path.basename(emoji.full_path) item = { @@ -259,95 +265,97 @@ class MMIPKGPacker: "emoji_hash": emoji.emoji_hash or "", "is_registered": True, "is_banned": emoji.is_banned or False, - } + }, } - + items.append(item) image_data_list.append(img_bytes) progress.advance(task) - + if not items: print("错误: 没有有效的表情包可以打包") return False - + print(f"找到 {len(items)} 个表情包可以打包...") - + # 准备打包 pack_id = str(uuid.uuid4()) if pack_name is None: pack_name = f"MaiBot_Emojis_{datetime.now().strftime('%Y%m%d_%H%M%S')}" - + manifest = { "p": pack_id, # pack_id "n": pack_name, # pack_name "t": datetime.now().isoformat(), # created_at - "a": items # items array + "a": items, # items array } - + # 添加自定义字段 if custom_manifest: for key, value in custom_manifest.items(): if key not in manifest: # 不覆盖核心字段 manifest[key] = value - + # 序列化 manifest manifest_bytes = msgpack.packb(manifest, use_bin_type=True) manifest_len = len(manifest_bytes) - + # 计算 payload 大小 payload_size = 4 + manifest_len # manifest_len + manifest_bytes for img_bytes in image_data_list: payload_size += 4 + len(img_bytes) # img_len + img_bytes - + print(f"Manifest 大小: {manifest_len / 1024:.2f} KB") print(f"Payload 未压缩大小: {payload_size / 1024 / 1024:.2f} MB") - + # 写入文件 return self._write_package(output_path, manifest_bytes, image_data_list, payload_size) - + except Exception as e: print(f"打包失败: {e}") import traceback + traceback.print_exc() return False finally: if not db.is_closed(): db.close() - - def _write_package(self, output_path: str, manifest_bytes: bytes, - image_data_list: List[bytes], payload_size: int) -> bool: + + def _write_package( + self, output_path: str, manifest_bytes: bytes, image_data_list: List[bytes], payload_size: int + ) -> bool: """写入打包文件""" try: - with open(output_path, 'wb') as f: + with open(output_path, "wb") as f: # 写入 Header (32 bytes) flags = 0x01 if self.use_compression else 0x00 header = MAGIC # 4 bytes - header += struct.pack('B', VERSION) # 1 byte - header += struct.pack('B', flags) # 1 byte - header += b'\x00\x00' # 2 bytes reserved - header += struct.pack('>Q', payload_size) # 8 bytes - header += struct.pack('>Q', len(manifest_bytes)) # 8 bytes - header += b'\x00' * 8 # 8 bytes reserved - + header += struct.pack("B", VERSION) # 1 byte + header += struct.pack("B", flags) # 1 byte + header += b"\x00\x00" # 2 bytes reserved + header += struct.pack(">Q", payload_size) # 8 bytes + header += struct.pack(">Q", len(manifest_bytes)) # 8 bytes + header += b"\x00" * 8 # 8 bytes reserved + assert len(header) == 32, f"Header size mismatch: {len(header)}" f.write(header) - + # 准备 payload 并计算 SHA256 payload_sha = hashlib.sha256() - + # 写入 payload(可能压缩) if self.use_compression: console.print(f"[cyan]使用 Zstd 压缩 (level={self.zstd_level})...[/cyan]") compressor = zstd.ZstdCompressor(level=self.zstd_level) - + with compressor.stream_writer(f, closefd=False) as writer: # 写入 manifest - manifest_len_bytes = struct.pack('>I', len(manifest_bytes)) + manifest_len_bytes = struct.pack(">I", len(manifest_bytes)) writer.write(manifest_len_bytes) writer.write(manifest_bytes) payload_sha.update(manifest_len_bytes) payload_sha.update(manifest_bytes) - + # 使用进度条写入所有图片 with Progress( SpinnerColumn(), @@ -355,13 +363,13 @@ class MMIPKGPacker: BarColumn(), TextColumn("[progress.percentage]{task.percentage:>3.0f}%"), TimeRemainingColumn(), - console=console + console=console, ) as progress: task = progress.add_task("[green]压缩写入图片...", total=len(image_data_list)) - + for idx, img_bytes in enumerate(image_data_list, 1): progress.update(task, description=f"[green]压缩写入 {idx}/{len(image_data_list)}") - img_len_bytes = struct.pack('>I', len(img_bytes)) + img_len_bytes = struct.pack(">I", len(img_bytes)) writer.write(img_len_bytes) writer.write(img_bytes) payload_sha.update(img_len_bytes) @@ -370,12 +378,12 @@ class MMIPKGPacker: else: # 不压缩,直接写入 # 写入 manifest - manifest_len_bytes = struct.pack('>I', len(manifest_bytes)) + manifest_len_bytes = struct.pack(">I", len(manifest_bytes)) f.write(manifest_len_bytes) f.write(manifest_bytes) payload_sha.update(manifest_len_bytes) payload_sha.update(manifest_bytes) - + # 使用进度条写入所有图片 with Progress( SpinnerColumn(), @@ -383,29 +391,29 @@ class MMIPKGPacker: BarColumn(), TextColumn("[progress.percentage]{task.percentage:>3.0f}%"), TimeRemainingColumn(), - console=console + console=console, ) as progress: task = progress.add_task("[green]写入图片...", total=len(image_data_list)) - + for idx, img_bytes in enumerate(image_data_list, 1): progress.update(task, description=f"[green]写入 {idx}/{len(image_data_list)}") - img_len_bytes = struct.pack('>I', len(img_bytes)) + img_len_bytes = struct.pack(">I", len(img_bytes)) f.write(img_len_bytes) f.write(img_bytes) payload_sha.update(img_len_bytes) payload_sha.update(img_bytes) progress.advance(task) - + # 写入 Footer (40 bytes) file_sha256 = payload_sha.digest() footer = FOOTER_MAGIC # 4 bytes footer += file_sha256 # 32 bytes - footer += struct.pack('B', FOOTER_VERSION) # 1 byte - footer += b'\x00' * 3 # 3 bytes reserved - + footer += struct.pack("B", FOOTER_VERSION) # 1 byte + footer += b"\x00" * 3 # 3 bytes reserved + assert len(footer) == 40, f"Footer size mismatch: {len(footer)}" f.write(footer) - + file_size = f.tell() print("\n打包完成!") print(f"输出文件: {output_path}") @@ -413,100 +421,100 @@ class MMIPKGPacker: if self.use_compression: ratio = (1 - file_size / (payload_size + 32 + 40)) * 100 print(f"压缩率: {ratio:.1f}%") - + return True - + except Exception as e: print(f"写入文件失败: {e}") import traceback + traceback.print_exc() return False class MMIPKGUnpacker: """MMIPKG 解包器""" - + def __init__(self, verify_sha: bool = True): self.verify_sha = verify_sha - - def import_to_db(self, package_path: str, - output_dir: Optional[str] = None, - replace_existing: bool = False, - batch_size: int = 500) -> bool: + + def import_to_db( + self, package_path: str, output_dir: Optional[str] = None, replace_existing: bool = False, batch_size: int = 500 + ) -> bool: """导入到数据库""" try: if not os.path.exists(package_path): print(f"错误: 文件不存在: {package_path}") return False - + # 连接数据库 if db.is_closed(): db.connect() - + # 如果未指定输出目录,使用默认的已注册表情包目录 if output_dir is None: output_dir = os.path.join(PROJECT_ROOT, "data", "emoji_registed") - + os.makedirs(output_dir, exist_ok=True) - + print(f"正在读取包: {package_path}") - - with open(package_path, 'rb') as f: + + with open(package_path, "rb") as f: # 读取 Header header = f.read(32) if len(header) != 32: raise MMIPKGError("Header 大小不正确") - + magic = header[:4] if magic != MAGIC: raise MMIPKGError(f"无效的 MAGIC: {magic}") - - version = struct.unpack('B', header[4:5])[0] + + version = struct.unpack("B", header[4:5])[0] if version != VERSION: print(f"警告: 包版本 {version} 与当前版本 {VERSION} 不匹配") - - flags = struct.unpack('B', header[5:6])[0] + + flags = struct.unpack("B", header[5:6])[0] is_compressed = bool(flags & 0x01) - - payload_uncompressed_len = struct.unpack('>Q', header[8:16])[0] - manifest_uncompressed_len = struct.unpack('>Q', header[16:24])[0] - + + payload_uncompressed_len = struct.unpack(">Q", header[8:16])[0] + manifest_uncompressed_len = struct.unpack(">Q", header[16:24])[0] + # 安全检查 if manifest_uncompressed_len > MAX_MANIFEST_SIZE: raise MMIPKGError(f"Manifest 过大: {manifest_uncompressed_len} bytes") if payload_uncompressed_len > MAX_PAYLOAD_SIZE: raise MMIPKGError(f"Payload 过大: {payload_uncompressed_len} bytes") - + print(f"压缩: {'是' if is_compressed else '否'}") print(f"Payload 大小: {payload_uncompressed_len / 1024 / 1024:.2f} MB") - + # 读取 payload payload_start = f.tell() - + # 找到 footer 位置 f.seek(-40, 2) # 从文件末尾向前 40 bytes footer = f.read(40) - + if footer[:4] != FOOTER_MAGIC: raise MMIPKGError("无效的 Footer MAGIC") - + expected_sha = footer[4:36] - + # 回到 payload 开始 f.seek(payload_start) - + # 读取整个 payload(用于计算 SHA) footer_start = os.path.getsize(package_path) - 40 payload_data_size = footer_start - payload_start - + # 解压或直接读取 if is_compressed: if zstd is None: raise MMIPKGError("需要 zstandard 库来解压此包") - + print("解压 payload...") compressed_data = f.read(payload_data_size) - + # 使用流式解压,不需要预知解压后大小 decompressor = zstd.ZstdDecompressor() try: @@ -519,60 +527,63 @@ class MMIPKGUnpacker: # 方法2:如果流式失败,尝试直接解压(兼容旧格式) print(f" 流式解压失败,尝试直接解压: {e}") try: - payload_data = decompressor.decompress(compressed_data, max_output_size=payload_uncompressed_len) + payload_data = decompressor.decompress( + compressed_data, max_output_size=payload_uncompressed_len + ) except Exception as e2: raise MMIPKGError(f"解压失败: {e2}") from e2 else: payload_data = f.read(payload_data_size) - + # 验证 SHA256 actual_sha = calculate_sha256(payload_data) if self.verify_sha and actual_sha != expected_sha: raise MMIPKGError("SHA256 校验失败!") if self.verify_sha: print("✓ SHA256 校验通过") - + # 解析 payload payload_stream = io.BytesIO(payload_data) - + # 读取 manifest manifest_len_bytes = payload_stream.read(4) - manifest_len = struct.unpack('>I', manifest_len_bytes)[0] + manifest_len = struct.unpack(">I", manifest_len_bytes)[0] manifest_bytes = payload_stream.read(manifest_len) manifest = msgpack.unpackb(manifest_bytes, raw=False) - + pack_id = manifest.get("p", "unknown") pack_name = manifest.get("n", "unknown") created_at = manifest.get("t", "unknown") items = manifest.get("a", []) - + print("\n包信息:") print(f" ID: {pack_id}") print(f" 名称: {pack_name}") print(f" 创建时间: {created_at}") print(f" 表情包数量: {len(items)}") - + # 导入表情包 - return self._import_items(payload_stream, items, output_dir, - replace_existing, batch_size) - + return self._import_items(payload_stream, items, output_dir, replace_existing, batch_size) + except Exception as e: print(f"导入失败: {e}") import traceback + traceback.print_exc() return False finally: if not db.is_closed(): db.close() - - def _import_items(self, payload_stream: BinaryIO, items: List[Dict], - output_dir: str, replace_existing: bool, batch_size: int) -> bool: + + def _import_items( + self, payload_stream: BinaryIO, items: List[Dict], output_dir: str, replace_existing: bool, batch_size: int + ) -> bool: """导入 items 到数据库""" try: imported_count = 0 skipped_count = 0 error_count = 0 - + # 开始事务,使用进度条 with db.atomic(): with Progress( @@ -581,14 +592,14 @@ class MMIPKGUnpacker: BarColumn(), TextColumn("[progress.percentage]{task.percentage:>3.0f}%"), TimeRemainingColumn(), - console=console + console=console, ) as progress: task = progress.add_task("[cyan]导入表情包...", total=len(items)) - + for idx, item in enumerate(items, 1): try: progress.update(task, description=f"[cyan]导入 {idx}/{len(items)}") - + # 读取图片数据 img_len_bytes = payload_stream.read(4) if len(img_len_bytes) != 4: @@ -596,16 +607,16 @@ class MMIPKGUnpacker: error_count += 1 progress.advance(task) continue - - img_len = struct.unpack('>I', img_len_bytes)[0] + + img_len = struct.unpack(">I", img_len_bytes)[0] img_bytes = payload_stream.read(img_len) - + if len(img_bytes) != img_len: console.print(f"[red]错误: 图片数据不完整 (item {idx})[/red]") error_count += 1 progress.advance(task) continue - + # 验证图片 SHA if self.verify_sha and (expected_sha := item.get("h")): actual_sha = calculate_sha256(img_bytes) @@ -614,24 +625,24 @@ class MMIPKGUnpacker: error_count += 1 progress.advance(task) continue - + # 获取元数据 opt = item.get("opt", {}) # 使用 or 提供回退值,如果 emoji_hash 为空则使用后续计算的值 emoji_hash = opt.get("emoji_hash") or calculate_sha256(img_bytes).hex() - + # 检查是否已存在 existing = Emoji.get_or_none(Emoji.emoji_hash == emoji_hash) - + if existing and not replace_existing: skipped_count += 1 progress.advance(task) continue - + # 保存图片文件 filename = item.get("fn", f"{emoji_hash[:8]}.{opt.get('format', 'png')}") file_path = os.path.join(output_dir, filename) - + # 如果文件已存在且不替换,生成新文件名 if os.path.exists(file_path) and not replace_existing: base, ext = os.path.splitext(filename) @@ -640,14 +651,14 @@ class MMIPKGUnpacker: filename = f"{base}_{counter}{ext}" file_path = os.path.join(output_dir, filename) counter += 1 - - with open(file_path, 'wb') as img_file: + + with open(file_path, "wb") as img_file: img_file.write(img_bytes) - + # 准备数据库记录 current_time = time.time() emotion_str = opt.get("emotion", "") - + if existing and replace_existing: # 更新现有记录 - 恢复完整的数据库信息 existing.full_path = file_path @@ -678,28 +689,29 @@ class MMIPKGUnpacker: is_registered=opt.get("is_registered", True), is_banned=opt.get("is_banned", False), ) - + imported_count += 1 progress.advance(task) - + except Exception as e: console.print(f"[red]处理 item {idx} 时出错: {e}[/red]") error_count += 1 progress.advance(task) continue - + # 输出统计 - + console.print(f"\n[green]✓ 成功导入 {imported_count} 个表情包[/green]") console.print(f" [yellow]跳过 {skipped_count} 个[/yellow]") if error_count > 0: console.print(f" [red]错误 {error_count} 个[/red]") - + return error_count == 0 - + except Exception as e: console.print(f"[red]导入 items 失败: {e}[/red]") import traceback + traceback.print_exc() return False @@ -719,26 +731,27 @@ def print_menu(): console.print(" [2] [bold]导入表情包[/bold] (从 .mmipkg 文件导入到数据库)") console.print(" [0] [bold]退出[/bold]") console.print() -def get_input(prompt: str, default: Optional[str] = None, - choices: Optional[List[str]] = None) -> str: + + +def get_input(prompt: str, default: Optional[str] = None, choices: Optional[List[str]] = None) -> str: """获取用户输入""" if default: prompt = f"{prompt} (默认: {default})" - + while True: try: value = input(f"{prompt}: ").strip() - + if not value: if default: return default console.print(" [yellow]⚠ 输入不能为空,请重新输入[/yellow]") continue - + if choices and value not in choices: console.print(f" [yellow]⚠ 无效的选择,请选择: {', '.join(choices)}[/yellow]") continue - + return value except KeyboardInterrupt: console.print("\n[yellow]操作已取消[/yellow]") @@ -756,13 +769,13 @@ def get_yes_no(prompt: str, default: bool = False) -> bool: while True: try: value = input(f"{prompt} ({default_str}): ").strip().lower() - + if not value: return default - - if value in ('y', 'yes', '是'): + + if value in ("y", "yes", "是"): return True - elif value in ('n', 'no', '否'): + elif value in ("n", "no", "否"): return False else: console.print(" [yellow]⚠ 请输入 y/yes/是 或 n/no/否[/yellow]") @@ -778,10 +791,10 @@ def get_int(prompt: str, default: int, min_val: int = 1, max_val: int = 100) -> while True: try: value = input(f"{prompt} (默认: {default}, 范围: {min_val}-{max_val}): ").strip() - + if not value: return default - + try: num = int(value) if min_val <= num <= max_val: @@ -818,15 +831,15 @@ def interactive_export(): console.print("\n[cyan]" + "-" * 70 + "[/cyan]") console.print("[bold]导出表情包到 .mmipkg 文件[/bold]") console.print("[cyan]" + "-" * 70 + "[/cyan]") - + # 检查数据库 try: if db.is_closed(): db.connect() - + emoji_count = Emoji.select().where(Emoji.is_registered).count() console.print(f"\n[green]✓ 找到 {emoji_count} 个已注册的表情包[/green]") - + if emoji_count == 0: console.print("[red]✗ 数据库中没有已注册的表情包,无法导出[/red]") return False @@ -836,27 +849,25 @@ def interactive_export(): finally: if not db.is_closed(): db.close() - + # 获取输出文件路径 console.print("\n[yellow]1. 输出文件设置[/yellow]") default_filename = f"maibot_emojis_{datetime.now().strftime('%Y%m%d_%H%M%S')}.mmipkg" output_path = get_input(" 输出文件路径", default_filename) - + # 确保有 .mmipkg 扩展名 - if not output_path.endswith('.mmipkg'): - output_path += '.mmipkg' - + if not output_path.endswith(".mmipkg"): + output_path += ".mmipkg" + # 获取包名称 default_pack_name = f"MaiBot表情包_{datetime.now().strftime('%Y%m%d')}" pack_name = get_input(" 包名称", default_pack_name) - + # 自定义 manifest console.print("\n[yellow]2. 包信息设置(可选)[/yellow]") if get_yes_no(" 是否添加包的作者和介绍信息", False): - custom_manifest = { - "author": author - } if (author := input(" 作者名称(可选): ").strip()) else {} - + custom_manifest = {"author": author} if (author := input(" 作者名称(可选): ").strip()) else {} + # 介绍信息 console.print(" 包介绍(限制 100 字以内):") if description := input(" > ").strip(): @@ -864,23 +875,23 @@ def interactive_export(): console.print(f" [yellow]⚠ 介绍过长({len(description)} 字),已截断至 100 字[/yellow]") description = description[:100] custom_manifest["description"] = description - + if not custom_manifest: custom_manifest = None else: console.print(" [green]✓ 已添加包信息[/green]") else: custom_manifest = None - + # 压缩设置 console.print("\n[yellow]3. 压缩设置[/yellow]") use_compression = get_yes_no(" 使用 Zstd 压缩", True) - + zstd_level = 3 if use_compression: print_compression_level_info() zstd_level = get_int(" 选择压缩级别", 3, 1, 22) - + # 重新编码设置 console.print("\n[yellow]4. 图片编码设置[/yellow]") if get_yes_no(" 是否重新编码图片(可显著减小文件大小)", False): @@ -888,13 +899,13 @@ def interactive_export(): console.print(" webp: 推荐,体积小且支持透明度") console.print(" jpeg: 最小体积,但不支持透明度") console.print(" png: 无损,文件较大") - reencode = get_input(" 选择格式", "webp", ['webp', 'jpeg', 'png']) - - quality = get_int(" 编码质量", 80, 1, 100) if reencode in ('webp', 'jpeg') else 80 + reencode = get_input(" 选择格式", "webp", ["webp", "jpeg", "png"]) + + quality = get_int(" 编码质量", 80, 1, 100) if reencode in ("webp", "jpeg") else 80 else: reencode = None quality = 80 - + # 确认导出 console.print("\n[cyan]" + "-" * 70 + "[/cyan]") console.print("[bold]导出配置:[/bold]") @@ -912,27 +923,24 @@ def interactive_export(): console.print(f" 编码质量: {quality}") console.print(f" 表情包数量: {emoji_count}") console.print("[cyan]" + "-" * 70 + "[/cyan]") - + if not get_yes_no("\n确认导出", True): console.print("[red]✗ 已取消导出[/red]") return False - + # 开始导出 console.print("\n[cyan]开始导出...[/cyan]") packer = MMIPKGPacker( - use_compression=use_compression, - zstd_level=zstd_level, - reencode=reencode, - reencode_quality=quality + use_compression=use_compression, zstd_level=zstd_level, reencode=reencode, reencode_quality=quality ) - + success = packer.pack_from_db(output_path, pack_name, custom_manifest) - + if success: console.print(f"\n[green]✓ 导出成功: {output_path}[/green]") else: console.print("\n[red]✗ 导出失败[/red]") - + return success @@ -941,37 +949,37 @@ def interactive_import(): console.print("\n[cyan]" + "-" * 70 + "[/cyan]") console.print("[bold]从 .mmipkg 文件导入表情包[/bold]") console.print("[cyan]" + "-" * 70 + "[/cyan]") - + # 选择导入模式 print_import_mode_selection() - import_mode = get_input("请选择", "1", ['1', '2']) - + import_mode = get_input("请选择", "1", ["1", "2"]) + input_files = [] - - if import_mode == '1': + + if import_mode == "1": # 自动扫描模式 import_dir = os.path.join(PROJECT_ROOT, "data", "import_emoji") os.makedirs(import_dir, exist_ok=True) - + console.print(f"\n[cyan]扫描目录: {import_dir}[/cyan]") - + # 查找所有 .mmipkg 文件 for file in os.listdir(import_dir): - if file.endswith('.mmipkg'): + if file.endswith(".mmipkg"): file_path = os.path.join(import_dir, file) if os.path.isfile(file_path): input_files.append(file_path) - + if not input_files: console.print("[red]✗ 目录中没有找到 .mmipkg 文件[/red]") console.print(f" 请将表情包文件放入: {import_dir}") return False - + console.print(f"\n[green]找到 {len(input_files)} 个文件:[/green]") for i, file_path in enumerate(input_files, 1): file_size = os.path.getsize(file_path) / 1024 / 1024 console.print(f" [{i}] {os.path.basename(file_path)} ({file_size:.2f} MB)") - + if not get_yes_no(f"\n确认导入这 {len(input_files)} 个文件", True): console.print("[red]✗ 已取消导入[/red]") return False @@ -979,23 +987,23 @@ def interactive_import(): # 手动输入模式 console.print("\n[yellow]1. 输入文件设置[/yellow]") input_path = get_input(" 输入文件路径 (.mmipkg)") - + if not os.path.exists(input_path): console.print(f"[red]✗ 文件不存在: {input_path}[/red]") return False - + input_files.append(input_path) - + # 获取输出目录 console.print("\n[yellow]2. 输出目录设置[/yellow]") default_output_dir = os.path.join(PROJECT_ROOT, "data", "emoji_registed") output_dir = get_input(" 输出目录", default_output_dir) - + # 导入选项 console.print("\n[yellow]3. 导入选项[/yellow]") replace_existing = get_yes_no(" 替换已存在的表情包", False) verify_sha = get_yes_no(" 验证 SHA256 完整性(推荐)", True) - + # 批量大小 console.print("\n[yellow]4. 性能设置[/yellow]") console.print(" [cyan]批量大小说明:[/cyan]") @@ -1003,7 +1011,7 @@ def interactive_import(): console.print(" 500-1000: 快速导入大量表情包") console.print(" 1000+: 极速模式,但内存占用更高") batch_size = get_int(" 批量提交大小", 500, 100, 5000) - + # 确认导入 console.print("\n[cyan]" + "-" * 70 + "[/cyan]") console.print("[bold]导入配置:[/bold]") @@ -1014,17 +1022,17 @@ def interactive_import(): console.print(f" SHA256 验证: {'是' if verify_sha else '否'}") console.print(f" 批量大小: {batch_size}") console.print("[cyan]" + "-" * 70 + "[/cyan]") - + if not get_yes_no("\n确认导入", True): console.print("[red]✗ 已取消导入[/red]") return False - + # 开始导入 unpacker = MMIPKGUnpacker(verify_sha=verify_sha) - + total_success = 0 total_failed = 0 - + # 使用进度条处理多个文件 with Progress( SpinnerColumn(), @@ -1032,31 +1040,28 @@ def interactive_import(): BarColumn(), TextColumn("[progress.percentage]{task.percentage:>3.0f}%"), TimeElapsedColumn(), - console=console + console=console, ) as progress: task = progress.add_task("[cyan]导入文件...", total=len(input_files)) - + for i, input_path in enumerate(input_files, 1): progress.update(task, description=f"[cyan]导入 [{i}/{len(input_files)}]: {os.path.basename(input_path)}") - + console.print(f"\n[bold]{'=' * 70}[/bold]") console.print(f"[bold]导入文件 [{i}/{len(input_files)}]: {os.path.basename(input_path)}[/bold]") console.print(f"[bold]{'=' * 70}[/bold]") - + success = unpacker.import_to_db( - input_path, - output_dir=output_dir, - replace_existing=replace_existing, - batch_size=batch_size + input_path, output_dir=output_dir, replace_existing=replace_existing, batch_size=batch_size ) - + if success: total_success += 1 else: total_failed += 1 - + progress.advance(task) - + # 总结 console.print(f"\n[bold]{'=' * 70}[/bold]") console.print("[bold]导入总结:[/bold]") @@ -1064,28 +1069,28 @@ def interactive_import(): if total_failed > 0: console.print(f" [red]失败: {total_failed} 个文件[/red]") console.print(f"[bold]{'=' * 70}[/bold]") - + return total_failed == 0 def main(): """主函数 - 交互式界面""" print_header() - + try: while True: print_menu() try: - choice = get_input("请选择", "1", ['0', '1', '2']) + choice = get_input("请选择", "1", ["0", "1", "2"]) except KeyboardInterrupt: console.print("\n[green]再见![/green]") return 0 - - if choice == '0': + + if choice == "0": console.print("\n[green]再见![/green]") return 0 - - elif choice == '1': + + elif choice == "1": try: interactive_export() except KeyboardInterrupt: @@ -1093,14 +1098,15 @@ def main(): except Exception as e: console.print(f"\n[red]✗ 发生错误: {e}[/red]") import traceback + traceback.print_exc() - + try: input("\n按 Enter 键继续...") except (KeyboardInterrupt, EOFError): pass - - elif choice == '2': + + elif choice == "2": try: interactive_import() except KeyboardInterrupt: @@ -1108,8 +1114,9 @@ def main(): except Exception as e: console.print(f"\n[red]✗ 发生错误: {e}[/red]") import traceback + traceback.print_exc() - + try: input("\n按 Enter 键继续...") except (KeyboardInterrupt, EOFError): @@ -1117,9 +1124,9 @@ def main(): except KeyboardInterrupt: console.print("\n[green]再见![/green]") return 0 - + return 0 -if __name__ == '__main__': +if __name__ == "__main__": sys.exit(main()) diff --git a/src/chat/heart_flow/heartFC_chat.py b/src/chat/heart_flow/heartFC_chat.py index 707c44bd..bb37e29e 100644 --- a/src/chat/heart_flow/heartFC_chat.py +++ b/src/chat/heart_flow/heartFC_chat.py @@ -230,7 +230,7 @@ class HeartFChatting: if (message.is_mentioned or message.is_at) and global_config.chat.mentioned_bot_reply: mentioned_message = message - logger.info(f"{self.log_prefix} 当前talk_value: {global_config.chat.get_talk_value(self.stream_id)}") + # logger.info(f"{self.log_prefix} 当前talk_value: {global_config.chat.get_talk_value(self.stream_id)}") # *控制频率用 if mentioned_message: @@ -333,7 +333,6 @@ class HeartFChatting: # 重置连续 no_reply 计数 self.consecutive_no_reply_count = 0 reason = "" - await database_api.store_action_info( chat_stream=self.chat_stream, @@ -411,7 +410,7 @@ class HeartFChatting: # asyncio.create_task(self.chat_history_summarizer.process()) cycle_timers, thinking_id = self.start_cycle() - logger.info(f"{self.log_prefix} 开始第{self._cycle_counter}次思考") + logger.info(f"{self.log_prefix} 开始第{self._cycle_counter}次思考(频率: {global_config.chat.get_talk_value(self.stream_id)})") # 第一步:动作检查 available_actions: Dict[str, ActionInfo] = {} diff --git a/src/chat/knowledge/__init__.py b/src/chat/knowledge/__init__.py index b9c96708..a570277c 100644 --- a/src/chat/knowledge/__init__.py +++ b/src/chat/knowledge/__init__.py @@ -30,9 +30,11 @@ DATA_PATH = os.path.join(ROOT_PATH, "data") qa_manager = None inspire_manager = None + def get_qa_manager(): return qa_manager + def lpmm_start_up(): # sourcery skip: extract-duplicate-method # 检查LPMM知识库是否启用 if global_config.lpmm_knowledge.enable: diff --git a/src/chat/knowledge/qa_manager.py b/src/chat/knowledge/qa_manager.py index 66a6e4d1..1a087a7f 100644 --- a/src/chat/knowledge/qa_manager.py +++ b/src/chat/knowledge/qa_manager.py @@ -92,9 +92,10 @@ class QAManager: # 过滤阈值 result = dyn_select_top_k(result, 0.5, 1.0) - for res in result: - raw_paragraph = self.embed_manager.paragraphs_embedding_store.store[res[0]].str - logger.info(f"找到相关文段,相关系数:{res[1]:.8f}\n{raw_paragraph}\n\n") + if global_config.debug.show_lpmm_paragraph: + for res in result: + raw_paragraph = self.embed_manager.paragraphs_embedding_store.store[res[0]].str + logger.info(f"找到相关文段,相关系数:{res[1]:.8f}\n{raw_paragraph}\n\n") return result, ppr_node_weights @@ -128,11 +129,10 @@ class QAManager: selected_knowledge = knowledge[:limit] formatted_knowledge = [ - f"第{i + 1}条知识:{k[0]}\n 该条知识对于问题的相关性:{k[1]}" - for i, k in enumerate(selected_knowledge) + f"第{i + 1}条知识:{k[0]}\n 该条知识对于问题的相关性:{k[1]}" for i, k in enumerate(selected_knowledge) ] # if max_score is not None: - # formatted_knowledge.insert(0, f"最高相关系数:{max_score}") + # formatted_knowledge.insert(0, f"最高相关系数:{max_score}") found_knowledge = "\n".join(formatted_knowledge) if len(found_knowledge) > MAX_KNOWLEDGE_LENGTH: diff --git a/src/chat/planner_actions/planner.py b/src/chat/planner_actions/planner.py index 7af3291a..5771feed 100644 --- a/src/chat/planner_actions/planner.py +++ b/src/chat/planner_actions/planner.py @@ -7,7 +7,6 @@ from typing import Dict, Optional, Tuple, List, TYPE_CHECKING, Union from rich.traceback import install from datetime import datetime from json_repair import repair_json - from src.llm_models.utils_model import LLMRequest from src.config.config import global_config, model_config from src.common.logger import get_logger @@ -164,6 +163,45 @@ class ActionPlanner: return item[1] return None + def _replace_message_ids_with_text( + self, text: Optional[str], message_id_list: List[Tuple[str, "DatabaseMessages"]] + ) -> Optional[str]: + """将文本中的 m+数字 消息ID替换为原消息内容,并添加双引号""" + if not text: + return text + + id_to_message = {msg_id: msg for msg_id, msg in message_id_list} + + # 匹配m后带2-4位数字,前后不是字母数字下划线 + pattern = r"(? str: + msg_id = match.group(0) + message = id_to_message.get(msg_id) + if not message: + logger.warning(f"{self.log_prefix}planner理由引用 {msg_id} 未找到对应消息,保持原样") + return msg_id + + msg_text = (message.processed_plain_text or message.display_message or "").strip() + if not msg_text: + logger.warning(f"{self.log_prefix}planner理由引用 {msg_id} 的消息内容为空,保持原样") + return msg_id + + preview = msg_text if len(msg_text) <= 100 else f"{msg_text[:97]}..." + logger.info(f"{self.log_prefix}planner理由引用 {msg_id} -> 消息({preview})") + return f"消息({msg_text})" + + return re.sub(pattern, _replace, text) + def _parse_single_action( self, action_json: dict, @@ -176,7 +214,10 @@ class ActionPlanner: try: action = action_json.get("action", "no_reply") - reasoning = action_json.get("reason", "未提供原因") + original_reasoning = action_json.get("reason", "未提供原因") + reasoning = self._replace_message_ids_with_text(original_reasoning, message_id_list) + if reasoning is None: + reasoning = original_reasoning action_data = {key: value for key, value in action_json.items() if key not in ["action", "reason"]} # 非no_reply动作需要target_message_id target_message = None @@ -573,9 +614,6 @@ class ActionPlanner: # 调用LLM llm_content, (reasoning_content, _, _) = await self.planner_llm.generate_response_async(prompt=prompt) - # logger.info(f"{self.log_prefix}规划器原始提示词: {prompt}") - # logger.info(f"{self.log_prefix}规划器原始响应: {llm_content}") - if global_config.debug.show_planner_prompt: logger.info(f"{self.log_prefix}规划器原始提示词: {prompt}") logger.info(f"{self.log_prefix}规划器原始响应: {llm_content}") @@ -604,6 +642,7 @@ class ActionPlanner: if llm_content: try: json_objects, extracted_reasoning = self._extract_json_from_markdown(llm_content) + extracted_reasoning = self._replace_message_ids_with_text(extracted_reasoning, message_id_list) or "" if json_objects: logger.debug(f"{self.log_prefix}从响应中提取到{len(json_objects)}个JSON对象") filtered_actions_list = list(filtered_actions.items()) diff --git a/src/chat/replyer/group_generator.py b/src/chat/replyer/group_generator.py index 3019ca0d..cc948db1 100644 --- a/src/chat/replyer/group_generator.py +++ b/src/chat/replyer/group_generator.py @@ -226,7 +226,9 @@ class DefaultReplyer: traceback.print_exc() return False, llm_response - async def build_expression_habits(self, chat_history: str, target: str, reply_reason: str = "") -> Tuple[str, List[int]]: + async def build_expression_habits( + self, chat_history: str, target: str, reply_reason: str = "" + ) -> Tuple[str, List[int]]: # sourcery skip: for-append-to-extend """构建表达习惯块 @@ -1094,10 +1096,10 @@ class DefaultReplyer: if not global_config.lpmm_knowledge.enable: logger.debug("LPMM知识库未启用,跳过获取知识库内容") return "" - + if global_config.lpmm_knowledge.lpmm_mode == "agent": return "" - + time_now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) bot_name = global_config.bot.nickname @@ -1115,10 +1117,10 @@ class DefaultReplyer: model_config=model_config.model_task_config.tool_use, tool_options=[SearchKnowledgeFromLPMMTool.get_tool_definition()], ) - + # logger.info(f"工具调用提示词: {prompt}") # logger.info(f"工具调用: {tool_calls}") - + if tool_calls: result = await self.tool_executor.execute_tool_call(tool_calls[0], SearchKnowledgeFromLPMMTool()) end_time = time.time() diff --git a/src/chat/replyer/private_generator.py b/src/chat/replyer/private_generator.py index 76eedf8c..74b04f6e 100644 --- a/src/chat/replyer/private_generator.py +++ b/src/chat/replyer/private_generator.py @@ -241,7 +241,9 @@ class PrivateReplyer: return f"{sender_relation}" - async def build_expression_habits(self, chat_history: str, target: str, reply_reason: str = "") -> Tuple[str, List[int]]: + async def build_expression_habits( + self, chat_history: str, target: str, reply_reason: str = "" + ) -> Tuple[str, List[int]]: # sourcery skip: for-append-to-extend """构建表达习惯块 @@ -1032,10 +1034,10 @@ class PrivateReplyer: if not global_config.lpmm_knowledge.enable: logger.debug("LPMM知识库未启用,跳过获取知识库内容") return "" - + if global_config.lpmm_knowledge.lpmm_mode == "agent": return "" - + time_now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) bot_name = global_config.bot.nickname diff --git a/src/chat/utils/chat_history_summarizer.py b/src/chat/utils/chat_history_summarizer.py index 36bb5ff0..7fa55834 100644 --- a/src/chat/utils/chat_history_summarizer.py +++ b/src/chat/utils/chat_history_summarizer.py @@ -106,8 +106,8 @@ class ChatHistorySummarizer: await self._check_and_package(current_time) self.last_check_time = current_time return - - logger.info( + + logger.debug( f"{self.log_prefix} 开始处理聊天概括,时间窗口: {self.last_check_time:.2f} -> {current_time:.2f}" ) @@ -119,7 +119,7 @@ class ChatHistorySummarizer: before_count = len(self.current_batch.messages) self.current_batch.messages.extend(new_messages) self.current_batch.end_time = current_time - logger.info(f"{self.log_prefix} 批次更新: {before_count} -> {len(self.current_batch.messages)} 条消息") + logger.info(f"{self.log_prefix} 更新聊天话题: {before_count} -> {len(self.current_batch.messages)} 条消息") else: # 创建新批次 self.current_batch = MessageBatch( @@ -127,7 +127,7 @@ class ChatHistorySummarizer: start_time=new_messages[0].time if new_messages else current_time, end_time=current_time, ) - logger.info(f"{self.log_prefix} 新建批次: {len(new_messages)} 条消息") + logger.info(f"{self.log_prefix} 新建聊天话题: {len(new_messages)} 条消息") # 检查是否需要打包 await self._check_and_package(current_time) diff --git a/src/common/logger.py b/src/common/logger.py index 9e7e08d4..4cf40398 100644 --- a/src/common/logger.py +++ b/src/common/logger.py @@ -72,16 +72,16 @@ def get_ws_handler(): def initialize_ws_handler(loop): """初始化 WebSocket handler 的事件循环 - + Args: loop: asyncio 事件循环 """ handler = get_ws_handler() handler.set_loop(loop) - + # 为 WebSocket handler 设置 JSON 格式化器(与文件格式相同) handler.setFormatter(file_formatter) - + # 添加到根日志记录器 root_logger = logging.getLogger() if handler not in root_logger.handlers: @@ -177,43 +177,44 @@ class TimestampedFileHandler(logging.Handler): class WebSocketLogHandler(logging.Handler): """WebSocket 日志处理器 - 将日志实时推送到前端""" - + _log_counter = 0 # 类级别计数器,确保 ID 唯一性 - + def __init__(self, loop=None): super().__init__() self.loop = loop self._initialized = False - + def set_loop(self, loop): """设置事件循环""" self.loop = loop self._initialized = True - + def emit(self, record): """发送日志到 WebSocket 客户端""" if not self._initialized or self.loop is None: return - + try: # 获取格式化后的消息 # 对于 structlog,formatted message 包含完整的日志信息 formatted_msg = self.format(record) if self.formatter else record.getMessage() - + # 如果是 JSON 格式(文件格式化器),解析它 message = formatted_msg try: import json + log_dict = json.loads(formatted_msg) - message = log_dict.get('event', formatted_msg) + message = log_dict.get("event", formatted_msg) except (json.JSONDecodeError, ValueError): # 不是 JSON,直接使用消息 message = formatted_msg - + # 生成唯一 ID: 时间戳毫秒 + 自增计数器 WebSocketLogHandler._log_counter += 1 log_id = f"{int(record.created * 1000)}_{WebSocketLogHandler._log_counter}" - + # 格式化日志数据 log_data = { "id": log_id, @@ -222,20 +223,17 @@ class WebSocketLogHandler(logging.Handler): "module": record.name, "message": message, } - + # 异步广播日志(不阻塞日志记录) try: import asyncio from src.webui.logs_ws import broadcast_log - - asyncio.run_coroutine_threadsafe( - broadcast_log(log_data), - self.loop - ) + + asyncio.run_coroutine_threadsafe(broadcast_log(log_data), self.loop) except Exception: # WebSocket 推送失败不影响日志记录 pass - + except Exception: # 不要让 WebSocket 错误影响日志系统 self.handleError(record) @@ -255,7 +253,7 @@ def close_handlers(): if _console_handler: _console_handler.close() _console_handler = None - + if _ws_handler: _ws_handler.close() _ws_handler = None diff --git a/src/common/server.py b/src/common/server.py index ebdc9fa2..88608677 100644 --- a/src/common/server.py +++ b/src/common/server.py @@ -1,5 +1,4 @@ from fastapi import FastAPI, APIRouter -from fastapi.middleware.cors import CORSMiddleware # 新增导入 from typing import Optional from uvicorn import Config, Server as UvicornServer import asyncio @@ -17,21 +16,6 @@ class Server: self._server: Optional[UvicornServer] = None self.set_address(host, port) - # 配置 CORS - origins = [ - "http://localhost:7999", # 允许的前端源 - "http://127.0.0.1:7999", - # 在生产环境中,您应该添加实际的前端域名 - ] - - self.app.add_middleware( - CORSMiddleware, - allow_origins=origins, - allow_credentials=True, # 是否支持 cookie - allow_methods=["*"], # 允许所有 HTTP 方法 - allow_headers=["*"], # 允许所有 HTTP 请求头 - ) - def register_router(self, router: APIRouter, prefix: str = ""): """注册路由 diff --git a/src/config/config.py b/src/config/config.py index 29619e45..01b9f6ca 100644 --- a/src/config/config.py +++ b/src/config/config.py @@ -56,7 +56,7 @@ TEMPLATE_DIR = os.path.join(PROJECT_ROOT, "template") # 考虑到,实际上配置文件中的mai_version是不会自动更新的,所以采用硬编码 # 对该字段的更新,请严格参照语义化版本规范:https://semver.org/lang/zh-CN/ -MMC_VERSION = "0.11.3" +MMC_VERSION = "0.11.5" def get_key_comment(toml_table, key): diff --git a/src/config/official_configs.py b/src/config/official_configs.py index 795b38cb..fc084ecb 100644 --- a/src/config/official_configs.py +++ b/src/config/official_configs.py @@ -581,9 +581,15 @@ class DebugConfig(ConfigBase): show_jargon_prompt: bool = False """是否显示jargon相关提示词""" + show_memory_prompt: bool = False + """是否显示记忆检索相关prompt""" + show_planner_prompt: bool = False """是否显示planner相关提示词""" + show_lpmm_paragraph: bool = False + """是否显示lpmm找到的相关文段日志""" + @dataclass class ExperimentalConfig(ConfigBase): @@ -647,7 +653,7 @@ class LPMMKnowledgeConfig(ConfigBase): enable: bool = True """是否启用LPMM知识库""" - + lpmm_mode: Literal["classic", "agent"] = "classic" """LPMM知识库模式,可选:classic经典模式,agent 模式,结合最新的记忆一同使用""" @@ -690,4 +696,4 @@ class JargonConfig(ConfigBase): """Jargon配置类""" all_global: bool = False - """是否将所有新增的jargon项目默认为全局(is_global=True),chat_id记录第一次存储时的id""" \ No newline at end of file + """是否将所有新增的jargon项目默认为全局(is_global=True),chat_id记录第一次存储时的id""" diff --git a/src/express/expression_learner.py b/src/express/expression_learner.py index 3bc14142..57c03e77 100644 --- a/src/express/expression_learner.py +++ b/src/express/expression_learner.py @@ -467,11 +467,7 @@ class ExpressionLearner: up_content: str, current_time: float, ) -> None: - expr_obj = ( - Expression.select() - .where((Expression.chat_id == self.chat_id) & (Expression.style == style)) - .first() - ) + expr_obj = Expression.select().where((Expression.chat_id == self.chat_id) & (Expression.style == style)).first() if expr_obj: await self._update_existing_expression( diff --git a/src/express/expression_selector.py b/src/express/expression_selector.py index 66c49def..b4e25f36 100644 --- a/src/express/expression_selector.py +++ b/src/express/expression_selector.py @@ -42,8 +42,6 @@ def init_prompt(): Prompt(expression_evaluation_prompt, "expression_evaluation_prompt") - - class ExpressionSelector: def __init__(self): self.llm_model = LLMRequest( @@ -238,9 +236,9 @@ class ExpressionSelector: else: target_message_str = "" target_message_extra_block = "" - + chat_context = f"以下是正在进行的聊天内容:{chat_info}" - + # 构建reply_reason块 if reply_reason: reply_reason_block = f"你的回复理由是:{reply_reason}" @@ -262,9 +260,8 @@ class ExpressionSelector: # 4. 调用LLM content, (reasoning_content, model_name, _) = await self.llm_model.generate_response_async(prompt=prompt) - # print(prompt) - + if not content: logger.warning("LLM返回空结果") return [], [] diff --git a/src/jargon/jargon_miner.py b/src/jargon/jargon_miner.py index 59d79df5..4319ad3d 100644 --- a/src/jargon/jargon_miner.py +++ b/src/jargon/jargon_miner.py @@ -36,10 +36,7 @@ def _contains_bot_self_name(content: str) -> bool: target = content.strip().lower() nickname = str(getattr(bot_config, "nickname", "") or "").strip().lower() - alias_names = [ - str(alias or "").strip().lower() - for alias in getattr(bot_config, "alias_names", []) or [] - ] + alias_names = [str(alias or "").strip().lower() for alias in getattr(bot_config, "alias_names", []) or []] candidates = [name for name in [nickname, *alias_names] if name] @@ -149,7 +146,7 @@ async def _enrich_raw_content_if_needed( ) -> List[str]: """ 检查raw_content是否只包含黑话本身,如果是,则获取该消息的前三条消息作为原始内容 - + Args: content: 黑话内容 raw_content_list: 原始raw_content列表 @@ -157,22 +154,22 @@ async def _enrich_raw_content_if_needed( messages: 当前时间窗口内的消息列表 extraction_start_time: 提取开始时间 extraction_end_time: 提取结束时间 - + Returns: 处理后的raw_content列表 """ enriched_list = [] - + for raw_content in raw_content_list: # 检查raw_content是否只包含黑话本身(去除空白字符后比较) raw_content_clean = raw_content.strip() content_clean = content.strip() - + # 如果raw_content只包含黑话本身(可能有一些标点或空白),则尝试获取上下文 # 去除所有空白字符后比较,确保只包含黑话本身 raw_content_normalized = raw_content_clean.replace(" ", "").replace("\n", "").replace("\t", "") content_normalized = content_clean.replace(" ", "").replace("\n", "").replace("\t", "") - + if raw_content_normalized == content_normalized: # 在消息列表中查找只包含该黑话的消息(去除空白后比较) target_message = None @@ -183,22 +180,20 @@ async def _enrich_raw_content_if_needed( if msg_content_normalized == content_normalized: target_message = msg break - + if target_message and target_message.time: # 获取该消息的前三条消息 try: previous_messages = get_raw_msg_before_timestamp_with_chat( - chat_id=chat_id, - timestamp=target_message.time, - limit=3 + chat_id=chat_id, timestamp=target_message.time, limit=3 ) - + if previous_messages: # 将前三条消息和当前消息一起格式化 context_messages = previous_messages + [target_message] # 按时间排序 context_messages.sort(key=lambda x: x.time or 0) - + # 格式化为可读消息 formatted_context, _ = await build_readable_messages_with_list( context_messages, @@ -206,7 +201,7 @@ async def _enrich_raw_content_if_needed( timestamp_mode="relative", truncate=False, ) - + if formatted_context.strip(): enriched_list.append(formatted_context.strip()) logger.warning(f"为黑话 {content} 补充了上下文消息") @@ -226,7 +221,7 @@ async def _enrich_raw_content_if_needed( else: # raw_content包含更多内容,直接使用 enriched_list.append(raw_content) - + return enriched_list @@ -240,31 +235,31 @@ def _should_infer_meaning(jargon_obj: Jargon) -> bool: # 如果已完成所有推断,不再推断 if jargon_obj.is_complete: return False - + count = jargon_obj.count or 0 last_inference = jargon_obj.last_inference_count or 0 - + # 阈值列表:3,6, 10, 20, 40, 60, 100 - thresholds = [3,6, 10, 20, 40, 60, 100] - + thresholds = [3, 6, 10, 20, 40, 60, 100] + if count < thresholds[0]: return False - + # 如果count没有超过上次判定值,不需要判定 if count <= last_inference: return False - + # 找到第一个大于last_inference的阈值 next_threshold = None for threshold in thresholds: if threshold > last_inference: next_threshold = threshold break - + # 如果没有找到下一个阈值,说明已经超过100,不应该再推断 if next_threshold is None: return False - + # 检查count是否达到或超过这个阈值 return count >= next_threshold @@ -275,13 +270,13 @@ class JargonMiner: self.last_learning_time: float = time.time() # 频率控制,可按需调整 self.min_messages_for_learning: int = 10 - self.min_learning_interval: float = 20 + self.min_learning_interval: float = 20 self.llm = LLMRequest( model_set=model_config.model_task_config.utils, request_type="jargon.extract", ) - + # 初始化stream_name作为类属性,避免重复提取 chat_manager = get_chat_manager() stream_name = chat_manager.get_stream_name(self.chat_id) @@ -306,17 +301,19 @@ class JargonMiner: try: content = jargon_obj.content raw_content_str = jargon_obj.raw_content or "" - + # 解析raw_content列表 raw_content_list = [] if raw_content_str: try: - raw_content_list = json.loads(raw_content_str) if isinstance(raw_content_str, str) else raw_content_str + raw_content_list = ( + json.loads(raw_content_str) if isinstance(raw_content_str, str) else raw_content_str + ) if not isinstance(raw_content_list, list): raw_content_list = [raw_content_list] if raw_content_list else [] except (json.JSONDecodeError, TypeError): raw_content_list = [raw_content_str] if raw_content_str else [] - + if not raw_content_list: logger.warning(f"jargon {content} 没有raw_content,跳过推断") return @@ -328,12 +325,12 @@ class JargonMiner: content=content, raw_content_list=raw_content_text, ) - + response1, _ = await self.llm.generate_response_async(prompt1, temperature=0.3) if not response1: logger.warning(f"jargon {content} 推断1失败:无响应") return - + # 解析推断1结果 inference1 = None try: @@ -349,7 +346,7 @@ class JargonMiner: except Exception as e: logger.error(f"jargon {content} 推断1解析失败: {e}") return - + # 检查推断1是否表示信息不足无法推断 no_info = inference1.get("no_info", False) meaning1 = inference1.get("meaning", "").strip() @@ -360,18 +357,17 @@ class JargonMiner: jargon_obj.save() return - # 步骤2: 仅基于content推断 prompt2 = await global_prompt_manager.format_prompt( "jargon_inference_content_only_prompt", content=content, ) - + response2, _ = await self.llm.generate_response_async(prompt2, temperature=0.3) if not response2: logger.warning(f"jargon {content} 推断2失败:无响应") return - + # 解析推断2结果 inference2 = None try: @@ -387,13 +383,12 @@ class JargonMiner: except Exception as e: logger.error(f"jargon {content} 推断2解析失败: {e}") return - - logger.info(f"jargon {content} 推断2提示词: {prompt2}") - logger.info(f"jargon {content} 推断2结果: {response2}") - logger.info(f"jargon {content} 推断1提示词: {prompt1}") - logger.info(f"jargon {content} 推断1结果: {response1}") - + # logger.info(f"jargon {content} 推断2提示词: {prompt2}") + # logger.info(f"jargon {content} 推断2结果: {response2}") + # logger.info(f"jargon {content} 推断1提示词: {prompt1}") + # logger.info(f"jargon {content} 推断1结果: {response1}") + if global_config.debug.show_jargon_prompt: logger.info(f"jargon {content} 推断2提示词: {prompt2}") logger.info(f"jargon {content} 推断2结果: {response2}") @@ -404,22 +399,22 @@ class JargonMiner: logger.debug(f"jargon {content} 推断2结果: {response2}") logger.debug(f"jargon {content} 推断1提示词: {prompt1}") logger.debug(f"jargon {content} 推断1结果: {response1}") - + # 步骤3: 比较两个推断结果 prompt3 = await global_prompt_manager.format_prompt( "jargon_compare_inference_prompt", inference1=json.dumps(inference1, ensure_ascii=False), inference2=json.dumps(inference2, ensure_ascii=False), ) - + if global_config.debug.show_jargon_prompt: logger.info(f"jargon {content} 比较提示词: {prompt3}") - + response3, _ = await self.llm.generate_response_async(prompt3, temperature=0.3) if not response3: logger.warning(f"jargon {content} 比较失败:无响应") return - + # 解析比较结果 comparison = None try: @@ -439,7 +434,7 @@ class JargonMiner: # 判断是否为黑话 is_similar = comparison.get("is_similar", False) is_jargon = not is_similar # 如果相似,说明不是黑话;如果有差异,说明是黑话 - + # 更新数据库记录 jargon_obj.is_jargon = is_jargon if is_jargon: @@ -448,17 +443,19 @@ class JargonMiner: else: # 不是黑话,也记录含义(使用推断2的结果,因为含义明确) jargon_obj.meaning = inference2.get("meaning", "") - + # 更新最后一次判定的count值,避免重启后重复判定 jargon_obj.last_inference_count = jargon_obj.count or 0 - + # 如果count>=100,标记为完成,不再进行推断 if (jargon_obj.count or 0) >= 100: jargon_obj.is_complete = True - + jargon_obj.save() - logger.debug(f"jargon {content} 推断完成: is_jargon={is_jargon}, meaning={jargon_obj.meaning}, last_inference_count={jargon_obj.last_inference_count}, is_complete={jargon_obj.is_complete}") - + logger.debug( + f"jargon {content} 推断完成: is_jargon={is_jargon}, meaning={jargon_obj.meaning}, last_inference_count={jargon_obj.last_inference_count}, is_complete={jargon_obj.is_complete}" + ) + # 固定输出推断结果,格式化为可读形式 if is_jargon: # 是黑话,输出格式:[聊天名]xxx的含义是 xxxxxxxxxxx @@ -471,10 +468,11 @@ class JargonMiner: else: # 不是黑话,输出格式:[聊天名]xxx 不是黑话 logger.info(f"[{self.stream_name}]{content} 不是黑话") - + except Exception as e: logger.error(f"jargon推断失败: {e}") import traceback + traceback.print_exc() def should_trigger(self) -> bool: @@ -502,7 +500,7 @@ class JargonMiner: # 记录本次提取的时间窗口,避免重复提取 extraction_start_time = self.last_learning_time extraction_end_time = time.time() - + # 拉取学习窗口内的消息 messages = get_raw_msg_by_timestamp_with_chat_inclusive( chat_id=self.chat_id, @@ -525,7 +523,7 @@ class JargonMiner: response, _ = await self.llm.generate_response_async(prompt, temperature=0.2) if not response: return - + if global_config.debug.show_jargon_prompt: logger.info(f"jargon提取提示词: {prompt}") logger.info(f"jargon提取结果: {response}") @@ -555,7 +553,7 @@ class JargonMiner: continue content = str(item.get("content", "")).strip() raw_content_value = item.get("raw_content", "") - + # 处理raw_content:可能是字符串或列表 raw_content_list = [] if isinstance(raw_content_value, list): @@ -566,15 +564,12 @@ class JargonMiner: raw_content_str = raw_content_value.strip() if raw_content_str: raw_content_list = [raw_content_str] - + if content and raw_content_list: if _contains_bot_self_name(content): logger.debug(f"解析阶段跳过包含机器人昵称/别名的词条: {content}") continue - entries.append({ - "content": content, - "raw_content": raw_content_list - }) + entries.append({"content": content, "raw_content": raw_content_list}) except Exception as e: logger.error(f"解析jargon JSON失败: {e}; 原始: {response}") return @@ -591,13 +586,13 @@ class JargonMiner: if content_key not in seen: seen.add(content_key) uniq_entries.append(entry) - + saved = 0 updated = 0 for entry in uniq_entries: content = entry["content"] raw_content_list = entry["raw_content"] # 已经是列表 - + # 检查并补充raw_content:如果只包含黑话本身,则获取前三条消息作为上下文 raw_content_list = await _enrich_raw_content_if_needed( content=content, @@ -607,60 +602,53 @@ class JargonMiner: extraction_start_time=extraction_start_time, extraction_end_time=extraction_end_time, ) - + try: # 根据all_global配置决定查询逻辑 if global_config.jargon.all_global: # 开启all_global:无视chat_id,查询所有content匹配的记录(所有记录都是全局的) - query = ( - Jargon.select() - .where(Jargon.content == content) - ) + query = Jargon.select().where(Jargon.content == content) else: # 关闭all_global:只查询chat_id匹配的记录(不考虑is_global) - query = ( - Jargon.select() - .where( - (Jargon.chat_id == self.chat_id) & - (Jargon.content == content) - ) - ) - + query = Jargon.select().where((Jargon.chat_id == self.chat_id) & (Jargon.content == content)) + if query.exists(): obj = query.get() try: obj.count = (obj.count or 0) + 1 except Exception: obj.count = 1 - + # 合并raw_content列表:读取现有列表,追加新值,去重 existing_raw_content = [] if obj.raw_content: try: - existing_raw_content = json.loads(obj.raw_content) if isinstance(obj.raw_content, str) else obj.raw_content + existing_raw_content = ( + json.loads(obj.raw_content) if isinstance(obj.raw_content, str) else obj.raw_content + ) if not isinstance(existing_raw_content, list): existing_raw_content = [existing_raw_content] if existing_raw_content else [] except (json.JSONDecodeError, TypeError): existing_raw_content = [obj.raw_content] if obj.raw_content else [] - + # 合并并去重 merged_list = list(dict.fromkeys(existing_raw_content + raw_content_list)) obj.raw_content = json.dumps(merged_list, ensure_ascii=False) - + # 开启all_global时,确保记录标记为is_global=True if global_config.jargon.all_global: obj.is_global = True # 关闭all_global时,保持原有is_global不变(不修改) - + obj.save() - + # 检查是否需要推断(达到阈值且超过上次判定值) if _should_infer_meaning(obj): # 异步触发推断,不阻塞主流程 # 重新加载对象以确保数据最新 jargon_id = obj.id asyncio.create_task(self._infer_meaning_by_id(jargon_id)) - + updated += 1 else: # 没找到匹配记录,创建新记录 @@ -670,13 +658,13 @@ class JargonMiner: else: # 关闭all_global:新记录is_global=False is_global_new = False - + Jargon.create( content=content, raw_content=json.dumps(raw_content_list, ensure_ascii=False), chat_id=self.chat_id, is_global=is_global_new, - count=1 + count=1, ) saved += 1 except Exception as e: @@ -688,13 +676,13 @@ class JargonMiner: # 收集所有提取的jargon内容 jargon_list = [entry["content"] for entry in uniq_entries] jargon_str = ",".join(jargon_list) - + # 输出格式化的结果(使用logger.info会自动应用jargon模块的颜色) logger.info(f"[{self.stream_name}]疑似黑话: {jargon_str}") - + # 更新为本次提取的结束时间,确保不会重复提取相同的消息窗口 self.last_learning_time = extraction_end_time - + if saved or updated: logger.info(f"jargon写入: 新增 {saved} 条,更新 {updated} 条,chat_id={self.chat_id}") except Exception as e: @@ -720,15 +708,11 @@ async def extract_and_store_jargon(chat_id: str) -> None: def search_jargon( - keyword: str, - chat_id: Optional[str] = None, - limit: int = 10, - case_sensitive: bool = False, - fuzzy: bool = True + keyword: str, chat_id: Optional[str] = None, limit: int = 10, case_sensitive: bool = False, fuzzy: bool = True ) -> List[Dict[str, str]]: """ 搜索jargon,支持大小写不敏感和模糊搜索 - + Args: keyword: 搜索关键词 chat_id: 可选的聊天ID @@ -737,21 +721,18 @@ def search_jargon( limit: 返回结果数量限制,默认10 case_sensitive: 是否大小写敏感,默认False(不敏感) fuzzy: 是否模糊搜索,默认True(使用LIKE匹配) - + Returns: List[Dict[str, str]]: 包含content, meaning的字典列表 """ if not keyword or not keyword.strip(): return [] - + keyword = keyword.strip() - + # 构建查询 - query = Jargon.select( - Jargon.content, - Jargon.meaning - ) - + query = Jargon.select(Jargon.content, Jargon.meaning) + # 构建搜索条件 if case_sensitive: # 大小写敏感 @@ -760,7 +741,7 @@ def search_jargon( search_condition = Jargon.content.contains(keyword) else: # 精确匹配 - search_condition = (Jargon.content == keyword) + search_condition = Jargon.content == keyword else: # 大小写不敏感 if fuzzy: @@ -768,10 +749,10 @@ def search_jargon( search_condition = fn.LOWER(Jargon.content).contains(keyword.lower()) else: # 精确匹配(使用LOWER函数) - search_condition = (fn.LOWER(Jargon.content) == keyword.lower()) - + search_condition = fn.LOWER(Jargon.content) == keyword.lower() + query = query.where(search_condition) - + # 根据all_global配置决定查询逻辑 if global_config.jargon.all_global: # 开启all_global:所有记录都是全局的,查询所有is_global=True的记录(无视chat_id) @@ -779,35 +760,28 @@ def search_jargon( else: # 关闭all_global:如果提供了chat_id,优先搜索该聊天或global的jargon if chat_id: - query = query.where( - (Jargon.chat_id == chat_id) | Jargon.is_global - ) - + query = query.where((Jargon.chat_id == chat_id) | Jargon.is_global) + # 只返回有meaning的记录 - query = query.where( - (Jargon.meaning.is_null(False)) & (Jargon.meaning != "") - ) - + query = query.where((Jargon.meaning.is_null(False)) & (Jargon.meaning != "")) + # 按count降序排序,优先返回出现频率高的 query = query.order_by(Jargon.count.desc()) - + # 限制结果数量 query = query.limit(limit) - + # 执行查询并返回结果 results = [] for jargon in query: - results.append({ - "content": jargon.content or "", - "meaning": jargon.meaning or "" - }) - + results.append({"content": jargon.content or "", "meaning": jargon.meaning or ""}) + return results async def store_jargon_from_answer(jargon_keyword: str, answer: str, chat_id: str) -> None: """将黑话存入jargon系统 - + Args: jargon_keyword: 黑话关键词 answer: 答案内容(将概括为raw_content) @@ -820,53 +794,52 @@ async def store_jargon_from_answer(jargon_keyword: str, answer: str, chat_id: st 答案:{answer} 只输出概括后的内容,不要输出其他内容:""" - + success, summary, _, _ = await llm_api.generate_with_model( summary_prompt, model_config=model_config.model_task_config.utils_small, request_type="memory.summarize_jargon", ) - + logger.info(f"概括答案提示: {summary_prompt}") logger.info(f"概括答案: {summary}") - + if not success: logger.warning(f"概括答案失败,使用原始答案: {summary}") summary = answer[:100] # 截取前100字符作为备用 - + raw_content = summary.strip()[:200] # 限制长度 - + # 检查是否已存在 if global_config.jargon.all_global: query = Jargon.select().where(Jargon.content == jargon_keyword) else: - query = Jargon.select().where( - (Jargon.chat_id == chat_id) & - (Jargon.content == jargon_keyword) - ) - + query = Jargon.select().where((Jargon.chat_id == chat_id) & (Jargon.content == jargon_keyword)) + if query.exists(): # 更新现有记录 obj = query.get() obj.count = (obj.count or 0) + 1 - + # 合并raw_content列表 existing_raw_content = [] if obj.raw_content: try: - existing_raw_content = json.loads(obj.raw_content) if isinstance(obj.raw_content, str) else obj.raw_content + existing_raw_content = ( + json.loads(obj.raw_content) if isinstance(obj.raw_content, str) else obj.raw_content + ) if not isinstance(existing_raw_content, list): existing_raw_content = [existing_raw_content] if existing_raw_content else [] except (json.JSONDecodeError, TypeError): existing_raw_content = [obj.raw_content] if obj.raw_content else [] - + # 合并并去重 merged_list = list(dict.fromkeys(existing_raw_content + [raw_content])) obj.raw_content = json.dumps(merged_list, ensure_ascii=False) - + if global_config.jargon.all_global: obj.is_global = True - + obj.save() logger.info(f"更新jargon记录: {jargon_keyword}") else: @@ -877,11 +850,9 @@ async def store_jargon_from_answer(jargon_keyword: str, answer: str, chat_id: st raw_content=json.dumps([raw_content], ensure_ascii=False), chat_id=chat_id, is_global=is_global_new, - count=1 + count=1, ) logger.info(f"创建新jargon记录: {jargon_keyword}") - + except Exception as e: logger.error(f"存储jargon失败: {e}") - - diff --git a/src/llm_models/model_client/gemini_client.py b/src/llm_models/model_client/gemini_client.py index 444c5671..b3fafca0 100644 --- a/src/llm_models/model_client/gemini_client.py +++ b/src/llm_models/model_client/gemini_client.py @@ -147,7 +147,7 @@ def _convert_tool_options(tool_options: list[ToolOption]) -> list[FunctionDeclar param_type_value = tool_option_param.param_type.value if param_type_value == "bool": param_type_value = "boolean" - + return_dict: dict[str, Any] = { "type": param_type_value, "description": tool_option_param.description, diff --git a/src/llm_models/model_client/openai_client.py b/src/llm_models/model_client/openai_client.py index 01e12588..f573d33e 100644 --- a/src/llm_models/model_client/openai_client.py +++ b/src/llm_models/model_client/openai_client.py @@ -122,7 +122,7 @@ def _convert_tool_options(tool_options: list[ToolOption]) -> list[dict[str, Any] param_type_value = tool_option_param.param_type.value if param_type_value == "bool": param_type_value = "boolean" - + return_dict: dict[str, Any] = { "type": param_type_value, "description": tool_option_param.description, diff --git a/src/llm_models/payload_content/message.py b/src/llm_models/payload_content/message.py index ddcdf57f..960de08b 100644 --- a/src/llm_models/payload_content/message.py +++ b/src/llm_models/payload_content/message.py @@ -116,9 +116,7 @@ class MessageBuilder: 构建消息对象 :return: Message对象 """ - if len(self.__content) == 0 and not ( - self.__role == RoleType.Assistant and self.__tool_calls - ): + if len(self.__content) == 0 and not (self.__role == RoleType.Assistant and self.__tool_calls): raise ValueError("内容不能为空") if self.__role == RoleType.Tool and self.__tool_call_id is None: raise ValueError("Tool角色的工具调用ID不能为空") diff --git a/src/llm_models/utils_model.py b/src/llm_models/utils_model.py index 28f63c11..1ed74e03 100644 --- a/src/llm_models/utils_model.py +++ b/src/llm_models/utils_model.py @@ -166,7 +166,7 @@ class LLMRequest: time_cost=time.time() - start_time, ) return content or "", (reasoning_content, model_info.name, tool_calls) - + async def generate_response_with_message_async( self, message_factory: Callable[[BaseClient], List[Message]], diff --git a/src/main.py b/src/main.py index a75d4d26..09ead248 100644 --- a/src/main.py +++ b/src/main.py @@ -36,37 +36,39 @@ class MainSystem: # 使用消息API替代直接的FastAPI实例 self.app: MessageServer = get_global_api() self.server: Server = get_global_server() - - # 注册 WebUI API 路由 - self._register_webui_routes() - - # 设置 WebUI(开发/生产模式) - self._setup_webui() + self.webui_server = None # 独立的 WebUI 服务器 - def _register_webui_routes(self): - """注册 WebUI API 路由""" - try: - from src.webui.routes import router as webui_router - self.server.register_router(webui_router) - logger.info("WebUI API 路由已注册") - except Exception as e: - logger.warning(f"注册 WebUI API 路由失败: {e}") + # 设置独立的 WebUI 服务器 + self._setup_webui_server() - def _setup_webui(self): - """设置 WebUI(根据环境变量决定模式)""" + def _setup_webui_server(self): + """设置独立的 WebUI 服务器""" import os + webui_enabled = os.getenv("WEBUI_ENABLED", "false").lower() == "true" if not webui_enabled: logger.info("WebUI 已禁用") return - + webui_mode = os.getenv("WEBUI_MODE", "production").lower() - + try: - from src.webui.manager import setup_webui - setup_webui(mode=webui_mode) + from src.webui.webui_server import get_webui_server + + self.webui_server = get_webui_server() + + if webui_mode == "development": + logger.info("📝 WebUI 开发模式已启用") + logger.info("🌐 后端 API 将运行在 http://0.0.0.0:8001") + logger.info("💡 请手动启动前端开发服务器: cd MaiBot-Dashboard && bun dev") + logger.info("💡 前端将运行在 http://localhost:7999") + else: + logger.info("✅ WebUI 生产模式已启用") + logger.info(f"🌐 WebUI 将运行在 http://0.0.0.0:8001") + logger.info("💡 请确保已构建前端: cd MaiBot-Dashboard && bun run build") + except Exception as e: - logger.error(f"设置 WebUI 失败: {e}") + logger.error(f"❌ 初始化 WebUI 服务器失败: {e}") async def initialize(self): """初始化系统组件""" @@ -161,6 +163,10 @@ class MainSystem: self.server.run(), ] + # 如果 WebUI 服务器已初始化,添加到任务列表 + if self.webui_server: + tasks.append(self.webui_server.start()) + await asyncio.gather(*tasks) # async def forget_memory_task(self): diff --git a/src/memory_system/memory_retrieval.py b/src/memory_system/memory_retrieval.py index e1562b6e..7d129bbc 100644 --- a/src/memory_system/memory_retrieval.py +++ b/src/memory_system/memory_retrieval.py @@ -16,27 +16,24 @@ from src.llm_models.payload_content.message import MessageBuilder, RoleType, Mes logger = get_logger("memory_retrieval") -THINKING_BACK_NOT_FOUND_RETENTION_SECONDS = 3600 # 未找到答案记录保留时长 -THINKING_BACK_CLEANUP_INTERVAL_SECONDS = 300 # 清理频率 +THINKING_BACK_NOT_FOUND_RETENTION_SECONDS = 36000 # 未找到答案记录保留时长 +THINKING_BACK_CLEANUP_INTERVAL_SECONDS = 3000 # 清理频率 _last_not_found_cleanup_ts: float = 0.0 def _cleanup_stale_not_found_thinking_back() -> None: """定期清理过期的未找到答案记录""" global _last_not_found_cleanup_ts - + now = time.time() if now - _last_not_found_cleanup_ts < THINKING_BACK_CLEANUP_INTERVAL_SECONDS: return - + threshold_time = now - THINKING_BACK_NOT_FOUND_RETENTION_SECONDS try: deleted_rows = ( ThinkingBack.delete() - .where( - (ThinkingBack.found_answer == 0) & - (ThinkingBack.update_time < threshold_time) - ) + .where((ThinkingBack.found_answer == 0) & (ThinkingBack.update_time < threshold_time)) .execute() ) if deleted_rows: @@ -45,11 +42,12 @@ def _cleanup_stale_not_found_thinking_back() -> None: except Exception as e: logger.error(f"清理未找到答案的thinking_back记录失败: {e}") + def init_memory_retrieval_prompt(): """初始化记忆检索相关的 prompt 模板和工具""" # 首先注册所有工具 init_all_tools() - + # 第一步:问题生成prompt Prompt( """ @@ -102,7 +100,7 @@ def init_memory_retrieval_prompt(): """, name="memory_retrieval_question_prompt", ) - + # 第二步:ReAct Agent prompt(使用function calling,要求先思考再行动) Prompt( """你的名字是{bot_name}。现在是{time_now}。 @@ -140,7 +138,7 @@ def init_memory_retrieval_prompt(): """, name="memory_retrieval_react_prompt_head", ) - + # 额外,如果最后一轮迭代:ReAct Agent prompt(使用function calling,要求先思考再行动) Prompt( """你的名字是{bot_name}。现在是{time_now}。 @@ -170,10 +168,10 @@ def init_memory_retrieval_prompt(): def _parse_react_response(response: str) -> Optional[Dict[str, Any]]: """解析ReAct Agent的响应 - + Args: response: LLM返回的响应 - + Returns: Dict[str, Any]: 解析后的动作信息,如果解析失败返回None 格式: {"thought": str, "actions": List[Dict[str, Any]]} @@ -183,90 +181,75 @@ def _parse_react_response(response: str) -> Optional[Dict[str, Any]]: # 尝试提取JSON(可能包含在```json代码块中) json_pattern = r"```json\s*(.*?)\s*```" matches = re.findall(json_pattern, response, re.DOTALL) - + if matches: json_str = matches[0] else: # 尝试直接解析整个响应 json_str = response.strip() - + # 修复可能的JSON错误 repaired_json = repair_json(json_str) - + # 解析JSON action_info = json.loads(repaired_json) - + if not isinstance(action_info, dict): logger.warning(f"解析的JSON不是对象格式: {action_info}") return None - + # 确保actions字段存在且为列表 if "actions" not in action_info: logger.warning(f"响应中缺少actions字段: {action_info}") return None - + if not isinstance(action_info["actions"], list): logger.warning(f"actions字段不是数组格式: {action_info['actions']}") return None - + # 确保actions不为空 if len(action_info["actions"]) == 0: logger.warning("actions数组为空") return None - + return action_info - + except Exception as e: logger.error(f"解析ReAct响应失败: {e}, 响应内容: {response[:200]}...") return None -async def _retrieve_concepts_with_jargon( - concepts: List[str], - chat_id: str -) -> str: +async def _retrieve_concepts_with_jargon(concepts: List[str], chat_id: str) -> str: """对概念列表进行jargon检索 - + Args: concepts: 概念列表 chat_id: 聊天ID - + Returns: str: 检索结果字符串 """ if not concepts: return "" - + from src.jargon.jargon_miner import search_jargon - + results = [] for concept in concepts: concept = concept.strip() if not concept: continue - + # 先尝试精确匹配 - jargon_results = search_jargon( - keyword=concept, - chat_id=chat_id, - limit=10, - case_sensitive=False, - fuzzy=False - ) - + jargon_results = search_jargon(keyword=concept, chat_id=chat_id, limit=10, case_sensitive=False, fuzzy=False) + is_fuzzy_match = False - + # 如果精确匹配未找到,尝试模糊搜索 if not jargon_results: - jargon_results = search_jargon( - keyword=concept, - chat_id=chat_id, - limit=10, - case_sensitive=False, - fuzzy=True - ) + jargon_results = search_jargon(keyword=concept, chat_id=chat_id, limit=10, case_sensitive=False, fuzzy=True) is_fuzzy_match = True - + if jargon_results: # 找到结果 if is_fuzzy_match: @@ -291,28 +274,24 @@ async def _retrieve_concepts_with_jargon( else: # 未找到,不返回占位信息,只记录日志 logger.info(f"在jargon库中未找到匹配: {concept}") - + if results: return "【概念检索结果】\n" + "\n".join(results) + "\n" return "" async def _react_agent_solve_question( - question: str, - chat_id: str, - max_iterations: int = 5, - timeout: float = 30.0, - initial_info: str = "" + question: str, chat_id: str, max_iterations: int = 5, timeout: float = 30.0, initial_info: str = "" ) -> Tuple[bool, str, List[Dict[str, Any]], bool]: """使用ReAct架构的Agent来解决问题 - + Args: question: 要回答的问题 chat_id: 聊天ID max_iterations: 最大迭代次数 timeout: 超时时间(秒) initial_info: 初始信息(如概念检索结果),将作为collected_info的初始值 - + Returns: Tuple[bool, str, List[Dict[str, Any]], bool]: (是否找到答案, 答案内容, 思考步骤列表, 是否超时) """ @@ -321,34 +300,35 @@ async def _react_agent_solve_question( thinking_steps = [] is_timeout = False conversation_messages: List[Message] = [] - + for iteration in range(max_iterations): # 检查超时 if time.time() - start_time > timeout: logger.warning(f"ReAct Agent超时,已迭代{iteration}次") is_timeout = True break - + # 获取工具注册器 tool_registry = get_tool_registry() - + # 获取bot_name bot_name = global_config.bot.nickname - + # 获取当前时间 time_now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) - + # 计算剩余迭代次数 current_iteration = iteration + 1 remaining_iterations = max_iterations - current_iteration is_final_iteration = current_iteration >= max_iterations - - + if is_final_iteration: # 最后一次迭代,使用最终prompt tool_definitions = [] - logger.info(f"ReAct Agent 第 {iteration + 1} 次迭代,问题: {question}|可用工具数量: 0(最后一次迭代,不提供工具调用)") - + logger.info( + f"ReAct Agent 第 {iteration + 1} 次迭代,问题: {question}|可用工具数量: 0(最后一次迭代,不提供工具调用)" + ) + prompt = await global_prompt_manager.format_prompt( "memory_retrieval_react_final_prompt", bot_name=bot_name, @@ -359,8 +339,9 @@ async def _react_agent_solve_question( remaining_iterations=remaining_iterations, max_iterations=max_iterations, ) - - logger.info(f"ReAct Agent 第 {iteration + 1} 次Prompt: {prompt}") + + if global_config.debug.show_memory_prompt: + logger.info(f"ReAct Agent 第 {iteration + 1} 次Prompt: {prompt}") success, response, reasoning_content, model_name, tool_calls = await llm_api.generate_with_model_with_tools( prompt, model_config=model_config.model_task_config.tool_use, @@ -370,7 +351,9 @@ async def _react_agent_solve_question( else: # 非最终迭代,使用head_prompt tool_definitions = tool_registry.get_tool_definitions() - logger.info(f"ReAct Agent 第 {iteration + 1} 次迭代,问题: {question}|可用工具数量: {len(tool_definitions)}") + logger.info( + f"ReAct Agent 第 {iteration + 1} 次迭代,问题: {question}|可用工具数量: {len(tool_definitions)}" + ) head_prompt = await global_prompt_manager.format_prompt( "memory_retrieval_react_prompt_head", @@ -397,55 +380,64 @@ async def _react_agent_solve_question( messages.append(system_builder.build()) messages.extend(_conversation_messages) - - # 优化日志展示 - 合并所有消息到一条日志 - log_lines = [] - for idx, msg in enumerate(messages, 1): - role_name = msg.role.value if hasattr(msg.role, 'value') else str(msg.role) - - # 处理内容 - 显示完整内容,不截断 - if isinstance(msg.content, str): - full_content = msg.content - content_type = "文本" - elif isinstance(msg.content, list): - text_parts = [item for item in msg.content if isinstance(item, str)] - image_count = len([item for item in msg.content if isinstance(item, tuple)]) - full_content = "".join(text_parts) if text_parts else "" - content_type = f"混合({len(text_parts)}段文本, {image_count}张图片)" - else: - full_content = str(msg.content) - content_type = "未知" - - # 构建单条消息的日志信息 - msg_info = f"\n[消息 {idx}] 角色: {role_name} 内容类型: {content_type}\n========================================" - - if full_content: - msg_info += f"\n{full_content}" - - if msg.tool_calls: - msg_info += f"\n 工具调用: {len(msg.tool_calls)}个" - for tool_call in msg.tool_calls: - msg_info += f"\n - {tool_call}" - - if msg.tool_call_id: - msg_info += f"\n 工具调用ID: {msg.tool_call_id}" - - log_lines.append(msg_info) - - # 合并所有消息为一条日志输出 - logger.info(f"消息列表 (共{len(messages)}条):{''.join(log_lines)}") + + if global_config.debug.show_memory_prompt: + # 优化日志展示 - 合并所有消息到一条日志 + log_lines = [] + for idx, msg in enumerate(messages, 1): + role_name = msg.role.value if hasattr(msg.role, "value") else str(msg.role) + + # 处理内容 - 显示完整内容,不截断 + if isinstance(msg.content, str): + full_content = msg.content + content_type = "文本" + elif isinstance(msg.content, list): + text_parts = [item for item in msg.content if isinstance(item, str)] + image_count = len([item for item in msg.content if isinstance(item, tuple)]) + full_content = "".join(text_parts) if text_parts else "" + content_type = f"混合({len(text_parts)}段文本, {image_count}张图片)" + else: + full_content = str(msg.content) + content_type = "未知" + + # 构建单条消息的日志信息 + msg_info = f"\n[消息 {idx}] 角色: {role_name} 内容类型: {content_type}\n========================================" + + if full_content: + msg_info += f"\n{full_content}" + + if msg.tool_calls: + msg_info += f"\n 工具调用: {len(msg.tool_calls)}个" + for tool_call in msg.tool_calls: + msg_info += f"\n - {tool_call}" + + if msg.tool_call_id: + msg_info += f"\n 工具调用ID: {msg.tool_call_id}" + + log_lines.append(msg_info) + + # 合并所有消息为一条日志输出 + logger.info(f"消息列表 (共{len(messages)}条):{''.join(log_lines)}") return messages - success, response, reasoning_content, model_name, tool_calls = await llm_api.generate_with_model_with_tools_by_message_factory( + ( + success, + response, + reasoning_content, + model_name, + tool_calls, + ) = await llm_api.generate_with_model_with_tools_by_message_factory( message_factory, model_config=model_config.model_task_config.tool_use, tool_options=tool_definitions, request_type="memory.react", ) - - logger.info(f"ReAct Agent 第 {iteration + 1} 次迭代 模型: {model_name} ,调用工具数量: {len(tool_calls) if tool_calls else 0} ,调用工具响应: {response}") - + + logger.info( + f"ReAct Agent 第 {iteration + 1} 次迭代 模型: {model_name} ,调用工具数量: {len(tool_calls) if tool_calls else 0} ,调用工具响应: {response}" + ) + if not success: logger.error(f"ReAct Agent LLM调用失败: {response}") break @@ -463,105 +455,108 @@ async def _react_agent_solve_question( assistant_builder.set_role(RoleType.Assistant) assistant_builder.add_text_content(response) assistant_message = assistant_builder.build() - + # 记录思考步骤 - step = { - "iteration": iteration + 1, - "thought": response, - "actions": [], - "observations": [] - } - + step = {"iteration": iteration + 1, "thought": response, "actions": [], "observations": []} + # 优先从思考内容中提取found_answer或not_enough_info def extract_quoted_content(text, func_name, param_name): """从文本中提取函数调用中参数的值,支持单引号和双引号 - + Args: text: 要搜索的文本 func_name: 函数名,如 'found_answer' param_name: 参数名,如 'answer' - + Returns: 提取的参数值,如果未找到则返回None """ if not text: return None - + # 查找函数调用位置(不区分大小写) func_pattern = func_name.lower() text_lower = text.lower() func_pos = text_lower.find(func_pattern) if func_pos == -1: return None - + # 查找参数名和等号 - param_pattern = f'{param_name}=' + param_pattern = f"{param_name}=" param_pos = text_lower.find(param_pattern, func_pos) if param_pos == -1: return None - + # 跳过参数名、等号和空白 start_pos = param_pos + len(param_pattern) - while start_pos < len(text) and text[start_pos] in ' \t\n': + while start_pos < len(text) and text[start_pos] in " \t\n": start_pos += 1 - + if start_pos >= len(text): return None - + # 确定引号类型 quote_char = text[start_pos] if quote_char not in ['"', "'"]: return None - + # 查找匹配的结束引号(考虑转义) end_pos = start_pos + 1 while end_pos < len(text): if text[end_pos] == quote_char: # 检查是否是转义的引号 - if end_pos > start_pos + 1 and text[end_pos - 1] == '\\': + if end_pos > start_pos + 1 and text[end_pos - 1] == "\\": end_pos += 1 continue # 找到匹配的引号 - content = text[start_pos + 1:end_pos] + content = text[start_pos + 1 : end_pos] # 处理转义字符 - content = content.replace('\\"', '"').replace("\\'", "'").replace('\\\\', '\\') + content = content.replace('\\"', '"').replace("\\'", "'").replace("\\\\", "\\") return content end_pos += 1 - + return None - + # 从LLM的直接输出内容中提取found_answer或not_enough_info found_answer_content = None not_enough_info_reason = None - + # 只检查response(LLM的直接输出内容),不检查reasoning_content if response: - found_answer_content = extract_quoted_content(response, 'found_answer', 'answer') + found_answer_content = extract_quoted_content(response, "found_answer", "answer") if not found_answer_content: - not_enough_info_reason = extract_quoted_content(response, 'not_enough_info', 'reason') - + not_enough_info_reason = extract_quoted_content(response, "not_enough_info", "reason") + # 如果从输出内容中找到了答案,直接返回 if found_answer_content: step["actions"].append({"action_type": "found_answer", "action_params": {"answer": found_answer_content}}) step["observations"] = ["从LLM输出内容中检测到found_answer"] thinking_steps.append(step) - logger.info(f"ReAct Agent 第 {iteration + 1} 次迭代 从LLM输出内容中检测到found_answer: {found_answer_content[:100]}...") + logger.info( + f"ReAct Agent 第 {iteration + 1} 次迭代 从LLM输出内容中检测到found_answer: {found_answer_content[:100]}..." + ) return True, found_answer_content, thinking_steps, False - + if not_enough_info_reason: - step["actions"].append({"action_type": "not_enough_info", "action_params": {"reason": not_enough_info_reason}}) + step["actions"].append( + {"action_type": "not_enough_info", "action_params": {"reason": not_enough_info_reason}} + ) step["observations"] = ["从LLM输出内容中检测到not_enough_info"] thinking_steps.append(step) - logger.info(f"ReAct Agent 第 {iteration + 1} 次迭代 从LLM输出内容中检测到not_enough_info: {not_enough_info_reason[:100]}...") + logger.info( + f"ReAct Agent 第 {iteration + 1} 次迭代 从LLM输出内容中检测到not_enough_info: {not_enough_info_reason[:100]}..." + ) return False, not_enough_info_reason, thinking_steps, False - + if is_final_iteration: - step["actions"].append({"action_type": "not_enough_info", "action_params": {"reason": "已到达最后一次迭代,无法找到答案"}}) + step["actions"].append( + {"action_type": "not_enough_info", "action_params": {"reason": "已到达最后一次迭代,无法找到答案"}} + ) step["observations"] = ["已到达最后一次迭代,无法找到答案"] thinking_steps.append(step) logger.info(f"ReAct Agent 第 {iteration + 1} 次迭代 已到达最后一次迭代,无法找到答案") return False, "已到达最后一次迭代,无法找到答案", thinking_steps, False - + if assistant_message: conversation_messages.append(assistant_message) @@ -570,7 +565,7 @@ async def _react_agent_solve_question( thought_summary = reasoning_content or (response[:200] if response else "") if thought_summary: collected_info += f"\n[思考] {thought_summary}\n" - + # 处理工具调用 if not tool_calls: # 没有工具调用,说明LLM在思考中已经给出了答案(已在前面检查),或者需要继续查询 @@ -588,28 +583,31 @@ async def _react_agent_solve_question( step["observations"] = ["无响应且无工具调用"] thinking_steps.append(step) break - + # 处理工具调用 tool_tasks = [] - + for i, tool_call in enumerate(tool_calls): tool_name = tool_call.func_name tool_args = tool_call.args or {} - - logger.info(f"ReAct Agent 第 {iteration + 1} 次迭代 工具调用 {i+1}/{len(tool_calls)}: {tool_name}({tool_args})") - + + logger.info( + f"ReAct Agent 第 {iteration + 1} 次迭代 工具调用 {i + 1}/{len(tool_calls)}: {tool_name}({tool_args})" + ) + # 普通工具调用 tool = tool_registry.get_tool(tool_name) if tool: # 准备工具参数(需要添加chat_id如果工具需要) tool_params = tool_args.copy() - + # 如果工具函数签名需要chat_id,添加它 import inspect + sig = inspect.signature(tool.execute_func) if "chat_id" in sig.parameters: tool_params["chat_id"] = chat_id - + # 创建异步任务 async def execute_single_tool(tool_instance, params, tool_name_str, iter_num): try: @@ -620,23 +618,23 @@ async def _react_agent_solve_question( error_msg = f"工具执行失败: {str(e)}" logger.error(f"ReAct Agent 第 {iter_num + 1} 次迭代 工具 {tool_name_str} {error_msg}") return f"查询{tool_name_str}失败: {error_msg}" - + tool_tasks.append(execute_single_tool(tool, tool_params, tool_name, iteration)) step["actions"].append({"action_type": tool_name, "action_params": tool_args}) else: error_msg = f"未知的工具类型: {tool_name}" - logger.warning(f"ReAct Agent 第 {iteration + 1} 次迭代 工具 {i+1}/{len(tool_calls)} {error_msg}") + logger.warning(f"ReAct Agent 第 {iteration + 1} 次迭代 工具 {i + 1}/{len(tool_calls)} {error_msg}") tool_tasks.append(asyncio.create_task(asyncio.sleep(0, result=f"查询{tool_name}失败: {error_msg}"))) - + # 并行执行所有工具 if tool_tasks: observations = await asyncio.gather(*tool_tasks, return_exceptions=True) - + # 处理执行结果 for i, (tool_call_item, observation) in enumerate(zip(tool_calls, observations, strict=False)): if isinstance(observation, Exception): observation = f"工具执行异常: {str(observation)}" - logger.error(f"ReAct Agent 第 {iteration + 1} 次迭代 工具 {i+1} 执行异常: {observation}") + logger.error(f"ReAct Agent 第 {iteration + 1} 次迭代 工具 {i + 1} 执行异常: {observation}") observation_text = observation if isinstance(observation, str) else str(observation) step["observations"].append(observation_text) @@ -648,14 +646,16 @@ async def _react_agent_solve_question( tool_builder.add_tool_call(tool_call_item.call_id) conversation_messages.append(tool_builder.build()) # logger.info(f"ReAct Agent 第 {iteration + 1} 次迭代 工具 {i+1} 执行结果: {observation_text}") - + thinking_steps.append(step) - + # 达到最大迭代次数或超时,但Agent没有明确返回found_answer # 迭代超时应该直接视为not_enough_info,而不是使用已有信息 # 只有Agent明确返回found_answer时,才认为找到了答案 if collected_info: - logger.warning(f"ReAct Agent达到最大迭代次数或超时,但未明确返回found_answer。已收集信息: {collected_info[:100]}...") + logger.warning( + f"ReAct Agent达到最大迭代次数或超时,但未明确返回found_answer。已收集信息: {collected_info[:100]}..." + ) if is_timeout: logger.warning("ReAct Agent超时,直接视为not_enough_info") else: @@ -665,35 +665,32 @@ async def _react_agent_solve_question( def _get_recent_query_history(chat_id: str, time_window_seconds: float = 300.0) -> str: """获取最近一段时间内的查询历史 - + Args: chat_id: 聊天ID time_window_seconds: 时间窗口(秒),默认10分钟 - + Returns: str: 格式化的查询历史字符串 """ try: current_time = time.time() start_time = current_time - time_window_seconds - + # 查询最近时间窗口内的记录,按更新时间倒序 records = ( ThinkingBack.select() - .where( - (ThinkingBack.chat_id == chat_id) & - (ThinkingBack.update_time >= start_time) - ) + .where((ThinkingBack.chat_id == chat_id) & (ThinkingBack.update_time >= start_time)) .order_by(ThinkingBack.update_time.desc()) .limit(5) # 最多返回5条最近的记录 ) - + if not records.exists(): return "" - + history_lines = [] history_lines.append("最近已查询的问题和结果:") - + for record in records: status = "✓ 已找到答案" if record.found_answer else "✗ 未找到答案" answer_preview = "" @@ -703,15 +700,15 @@ def _get_recent_query_history(chat_id: str, time_window_seconds: float = 300.0) answer_preview = record.answer[:100] if len(record.answer) > 100: answer_preview += "..." - + history_lines.append(f"- 问题:{record.question}") history_lines.append(f" 状态:{status}") if answer_preview: history_lines.append(f" 答案:{answer_preview}") history_lines.append("") # 空行分隔 - + return "\n".join(history_lines) - + except Exception as e: logger.error(f"获取查询历史失败: {e}") return "" @@ -719,40 +716,40 @@ def _get_recent_query_history(chat_id: str, time_window_seconds: float = 300.0) def _get_cached_memories(chat_id: str, time_window_seconds: float = 300.0) -> List[str]: """获取最近一段时间内缓存的记忆(只返回找到答案的记录) - + Args: chat_id: 聊天ID time_window_seconds: 时间窗口(秒),默认300秒(5分钟) - + Returns: List[str]: 格式化的记忆列表,每个元素格式为 "问题:xxx\n答案:xxx" """ try: current_time = time.time() start_time = current_time - time_window_seconds - + # 查询最近时间窗口内找到答案的记录,按更新时间倒序 records = ( ThinkingBack.select() .where( - (ThinkingBack.chat_id == chat_id) & - (ThinkingBack.update_time >= start_time) & - (ThinkingBack.found_answer == 1) + (ThinkingBack.chat_id == chat_id) + & (ThinkingBack.update_time >= start_time) + & (ThinkingBack.found_answer == 1) ) .order_by(ThinkingBack.update_time.desc()) .limit(5) # 最多返回5条最近的记录 ) - + if not records.exists(): return [] - + cached_memories = [] for record in records: if record.answer: cached_memories.append(f"问题:{record.question}\n答案:{record.answer}") - + return cached_memories - + except Exception as e: logger.error(f"获取缓存记忆失败: {e}") return [] @@ -760,11 +757,11 @@ def _get_cached_memories(chat_id: str, time_window_seconds: float = 300.0) -> Li def _query_thinking_back(chat_id: str, question: str) -> Optional[Tuple[bool, str]]: """从thinking_back数据库中查询是否有现成的答案 - + Args: chat_id: 聊天ID question: 问题 - + Returns: Optional[Tuple[bool, str]]: 如果找到记录,返回(found_answer, answer),否则返回None found_answer: 是否找到答案(True表示found_answer=1,False表示found_answer=0) @@ -775,23 +772,20 @@ def _query_thinking_back(chat_id: str, question: str) -> Optional[Tuple[bool, st # 按更新时间倒序,获取最新的记录 records = ( ThinkingBack.select() - .where( - (ThinkingBack.chat_id == chat_id) & - (ThinkingBack.question == question) - ) + .where((ThinkingBack.chat_id == chat_id) & (ThinkingBack.question == question)) .order_by(ThinkingBack.update_time.desc()) .limit(1) ) - + if records.exists(): record = records.get() found_answer = bool(record.found_answer) answer = record.answer or "" logger.info(f"在thinking_back中找到记录,问题: {question[:50]}...,found_answer: {found_answer}") return found_answer, answer - + return None - + except Exception as e: logger.error(f"查询thinking_back失败: {e}") return None @@ -799,7 +793,7 @@ def _query_thinking_back(chat_id: str, question: str) -> Optional[Tuple[bool, st async def _analyze_question_answer(question: str, answer: str, chat_id: str) -> None: """异步分析问题和答案的类别,并存储到相应系统 - + Args: question: 问题 answer: 答案 @@ -826,41 +820,42 @@ async def _analyze_question_answer(question: str, answer: str, chat_id: str) -> }} 只输出JSON,不要输出其他内容:""" - + success, response, _, _ = await llm_api.generate_with_model( analysis_prompt, model_config=model_config.model_task_config.utils, request_type="memory.analyze_qa", ) - + if not success: logger.error(f"分析问题和答案失败: {response}") return - + # 解析JSON响应 try: json_pattern = r"```json\s*(.*?)\s*```" matches = re.findall(json_pattern, response, re.DOTALL) - + if matches: json_str = matches[0] else: json_str = response.strip() - + repaired_json = repair_json(json_str) analysis_result = json.loads(repaired_json) - + category = analysis_result.get("category", "").strip() - + if category == "黑话": # 处理黑话 jargon_keyword = analysis_result.get("jargon_keyword", "").strip() if jargon_keyword: from src.jargon.jargon_miner import store_jargon_from_answer + await store_jargon_from_answer(jargon_keyword, answer, chat_id) else: logger.warning(f"分析为黑话但未提取到关键词,问题: {question[:50]}...") - + elif category == "人物信息": # 处理人物信息 # person_name = analysis_result.get("person_name", "").strip() @@ -871,28 +866,22 @@ async def _analyze_question_answer(question: str, answer: str, chat_id: str) -> # else: # logger.warning(f"分析为人物信息但未提取到人物名称或记忆内容,问题: {question[:50]}...") pass # 功能暂时禁用 - + else: logger.info(f"问题和答案类别为'其他',不进行存储,问题: {question[:50]}...") - + except Exception as e: logger.error(f"解析分析结果失败: {e}, 响应: {response[:200]}...") - + except Exception as e: logger.error(f"分析问题和答案时发生异常: {e}") - def _store_thinking_back( - chat_id: str, - question: str, - context: str, - found_answer: bool, - answer: str, - thinking_steps: List[Dict[str, Any]] + chat_id: str, question: str, context: str, found_answer: bool, answer: str, thinking_steps: List[Dict[str, Any]] ) -> None: """存储或更新思考过程到数据库(如果已存在则更新,否则创建) - + Args: chat_id: 聊天ID question: 问题 @@ -903,18 +892,15 @@ def _store_thinking_back( """ try: now = time.time() - + # 先查询是否已存在相同chat_id和问题的记录 existing = ( ThinkingBack.select() - .where( - (ThinkingBack.chat_id == chat_id) & - (ThinkingBack.question == question) - ) + .where((ThinkingBack.chat_id == chat_id) & (ThinkingBack.question == question)) .order_by(ThinkingBack.update_time.desc()) .limit(1) ) - + if existing.exists(): # 更新现有记录 record = existing.get() @@ -935,27 +921,22 @@ def _store_thinking_back( answer=answer, thinking_steps=json.dumps(thinking_steps, ensure_ascii=False), create_time=now, - update_time=now + update_time=now, ) logger.info(f"已创建思考过程到数据库,问题: {question[:50]}...") except Exception as e: logger.error(f"存储思考过程失败: {e}") -async def _process_single_question( - question: str, - chat_id: str, - context: str, - initial_info: str = "" -) -> Optional[str]: +async def _process_single_question(question: str, chat_id: str, context: str, initial_info: str = "") -> Optional[str]: """处理单个问题的查询(包含缓存检查逻辑) - + Args: question: 要查询的问题 chat_id: 聊天ID context: 上下文信息 initial_info: 初始信息(如概念检索结果),将传递给ReAct Agent - + Returns: Optional[str]: 如果找到答案,返回格式化的结果字符串,否则返回None """ @@ -978,20 +959,20 @@ async def _process_single_question( logger.info(f"LPMM预查询未命中或未找到信息,问题: {question[:50]}...") except Exception as e: logger.error(f"LPMM预查询失败,问题: {question[:50]}... 错误: {e}") - + # 先检查thinking_back数据库中是否有现成答案 cached_result = _query_thinking_back(chat_id, question) should_requery = False - + if cached_result: cached_found_answer, cached_answer = cached_result - + if cached_found_answer: # found_answer == 1 (True) # found_answer == 1:20%概率重新查询 if random.random() < 0.5: should_requery = True logger.info(f"found_answer=1,触发20%概率重新查询,问题: {question[:50]}...") - + if not should_requery and cached_answer: logger.info(f"从thinking_back缓存中获取答案,问题: {question[:50]}...") return f"问题:{question}\n答案:{cached_answer}" @@ -1002,22 +983,22 @@ async def _process_single_question( # found_answer == 0:不使用缓存,直接重新查询 should_requery = True logger.info(f"thinking_back存在但未找到答案,忽略缓存重新查询,问题: {question[:50]}...") - + # 如果没有缓存答案或需要重新查询,使用ReAct Agent查询 if not cached_result or should_requery: if should_requery: logger.info(f"概率触发重新查询,使用ReAct Agent查询,问题: {question[:50]}...") else: logger.info(f"未找到缓存答案,使用ReAct Agent查询,问题: {question[:50]}...") - + found_answer, answer, thinking_steps, is_timeout = await _react_agent_solve_question( question=question, chat_id=chat_id, max_iterations=global_config.memory.max_agent_iterations, timeout=120.0, - initial_info=question_initial_info + initial_info=question_initial_info, ) - + # 存储到数据库(超时时不存储) if not is_timeout: _store_thinking_back( @@ -1026,16 +1007,16 @@ async def _process_single_question( context=context, found_answer=found_answer, answer=answer, - thinking_steps=thinking_steps + thinking_steps=thinking_steps, ) else: logger.info(f"ReAct Agent超时,不存储到数据库,问题: {question[:50]}...") - + if found_answer and answer: # 创建异步任务分析问题和答案 asyncio.create_task(_analyze_question_answer(question, answer, chat_id)) return f"问题:{question}\n答案:{answer}" - + return None @@ -1048,30 +1029,30 @@ async def build_memory_retrieval_prompt( ) -> str: """构建记忆检索提示 使用两段式查询:第一步生成问题,第二步使用ReAct Agent查询答案 - + Args: message: 聊天历史记录 sender: 发送者名称 target: 目标消息内容 chat_stream: 聊天流对象 tool_executor: 工具执行器(保留参数以兼容接口) - + Returns: str: 记忆检索结果字符串 """ start_time = time.time() - + logger.info(f"检测是否需要回忆,元消息:{message[:30]}...,消息长度: {len(message)}") try: time_now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) bot_name = global_config.bot.nickname chat_id = chat_stream.stream_id - + # 获取最近查询历史(最近1小时内的查询) recent_query_history = _get_recent_query_history(chat_id, time_window_seconds=300.0) if not recent_query_history: recent_query_history = "最近没有查询记录。" - + # 第一步:生成问题 question_prompt = await global_prompt_manager.format_prompt( "memory_retrieval_question_prompt", @@ -1082,25 +1063,26 @@ async def build_memory_retrieval_prompt( sender=sender, target_message=target, ) - + success, response, reasoning_content, model_name = await llm_api.generate_with_model( question_prompt, model_config=model_config.model_task_config.tool_use, request_type="memory.question", ) - - logger.info(f"记忆检索问题生成提示词: {question_prompt}") + + if global_config.debug.show_memory_prompt: + logger.info(f"记忆检索问题生成提示词: {question_prompt}") logger.info(f"记忆检索问题生成响应: {response}") - + if not success: logger.error(f"LLM生成问题失败: {response}") return "" - + # 解析概念列表和问题列表 concepts, questions = _parse_questions_json(response) logger.info(f"解析到 {len(concepts)} 个概念: {concepts}") logger.info(f"解析到 {len(questions)} 个问题: {questions}") - + # 对概念进行jargon检索,作为初始信息 initial_info = "" if concepts: @@ -1111,11 +1093,10 @@ async def build_memory_retrieval_prompt( logger.info(f"概念检索完成,结果: {concept_info[:200]}...") else: logger.info("概念检索未找到任何结果") - - + # 获取缓存的记忆(与question时使用相同的时间窗口和数量限制) cached_memories = _get_cached_memories(chat_id, time_window_seconds=300.0) - + if not questions: logger.debug("模型认为不需要检索记忆或解析失败") # 即使没有当次查询,也返回缓存的记忆和概念检索结果 @@ -1124,7 +1105,7 @@ async def build_memory_retrieval_prompt( all_results.append(initial_info.strip()) if cached_memories: all_results.extend(cached_memories) - + if all_results: retrieved_memory = "\n\n".join(all_results) end_time = time.time() @@ -1132,27 +1113,22 @@ async def build_memory_retrieval_prompt( return f"你回忆起了以下信息:\n{retrieved_memory}\n如果与回复内容相关,可以参考这些回忆的信息。\n" else: return "" - + logger.info(f"解析到 {len(questions)} 个问题: {questions}") - + # 第二步:并行处理所有问题(使用配置的最大迭代次数/120秒超时) max_iterations = global_config.memory.max_agent_iterations logger.info(f"问题数量: {len(questions)},设置最大迭代次数: {max_iterations},超时时间: 120秒") - + # 并行处理所有问题,将概念检索结果作为初始信息传递 question_tasks = [ - _process_single_question( - question=question, - chat_id=chat_id, - context=message, - initial_info=initial_info - ) + _process_single_question(question=question, chat_id=chat_id, context=message, initial_info=initial_info) for question in questions ] - + # 并行执行所有查询任务 results = await asyncio.gather(*question_tasks, return_exceptions=True) - + # 收集所有有效结果 all_results = [] current_questions = set() # 用于去重,避免缓存和当次查询重复 @@ -1165,7 +1141,7 @@ async def build_memory_retrieval_prompt( if result.startswith("问题:"): question = result.split("\n")[0].replace("问题:", "").strip() current_questions.add(question) - + # 将缓存的记忆添加到结果中(排除当次查询已包含的问题,避免重复) for cached_memory in cached_memories: if cached_memory.startswith("问题:"): @@ -1174,17 +1150,19 @@ async def build_memory_retrieval_prompt( if question not in current_questions: all_results.append(cached_memory) logger.debug(f"添加缓存记忆: {question[:50]}...") - + end_time = time.time() - + if all_results: retrieved_memory = "\n\n".join(all_results) - logger.info(f"记忆检索成功,耗时: {(end_time - start_time):.3f}秒,包含 {len(all_results)} 条记忆(含缓存)") + logger.info( + f"记忆检索成功,耗时: {(end_time - start_time):.3f}秒,包含 {len(all_results)} 条记忆(含缓存)" + ) return f"你回忆起了以下信息:\n{retrieved_memory}\n如果与回复内容相关,可以参考这些回忆的信息。\n" else: logger.debug("所有问题均未找到答案,且无缓存记忆") return "" - + except Exception as e: logger.error(f"记忆检索时发生异常: {str(e)}") return "" @@ -1192,10 +1170,10 @@ async def build_memory_retrieval_prompt( def _parse_questions_json(response: str) -> Tuple[List[str], List[str]]: """解析问题JSON,返回概念列表和问题列表 - + Args: response: LLM返回的响应 - + Returns: Tuple[List[str], List[str]]: (概念列表, 问题列表) """ @@ -1203,39 +1181,39 @@ def _parse_questions_json(response: str) -> Tuple[List[str], List[str]]: # 尝试提取JSON(可能包含在```json代码块中) json_pattern = r"```json\s*(.*?)\s*```" matches = re.findall(json_pattern, response, re.DOTALL) - + if matches: json_str = matches[0] else: # 尝试直接解析整个响应 json_str = response.strip() - + # 修复可能的JSON错误 repaired_json = repair_json(json_str) - + # 解析JSON parsed = json.loads(repaired_json) - + # 只支持新格式:包含concepts和questions的对象 if not isinstance(parsed, dict): logger.warning(f"解析的JSON不是对象格式: {parsed}") return [], [] - + concepts_raw = parsed.get("concepts", []) questions_raw = parsed.get("questions", []) - + # 确保是列表 if not isinstance(concepts_raw, list): concepts_raw = [] if not isinstance(questions_raw, list): questions_raw = [] - + # 确保所有元素都是字符串 concepts = [c for c in concepts_raw if isinstance(c, str) and c.strip()] questions = [q for q in questions_raw if isinstance(q, str) and q.strip()] - + return concepts, questions - + except Exception as e: logger.error(f"解析问题JSON失败: {e}, 响应内容: {response[:200]}...") return [], [] diff --git a/src/memory_system/memory_utils.py b/src/memory_system/memory_utils.py index af16456b..bff39f95 100644 --- a/src/memory_system/memory_utils.py +++ b/src/memory_system/memory_utils.py @@ -3,6 +3,7 @@ 记忆系统工具函数 包含模糊查找、相似度计算等工具函数 """ + import json import re from datetime import datetime @@ -14,6 +15,7 @@ from src.common.logger import get_logger logger = get_logger("memory_utils") + def parse_md_json(json_text: str) -> list[str]: """从Markdown格式的内容中提取JSON对象和推理内容""" json_objects = [] @@ -52,14 +54,15 @@ def parse_md_json(json_text: str) -> list[str]: return json_objects, reasoning_content + def calculate_similarity(text1: str, text2: str) -> float: """ 计算两个文本的相似度 - + Args: text1: 第一个文本 text2: 第二个文本 - + Returns: float: 相似度分数 (0-1) """ @@ -67,16 +70,16 @@ def calculate_similarity(text1: str, text2: str) -> float: # 预处理文本 text1 = preprocess_text(text1) text2 = preprocess_text(text2) - + # 使用SequenceMatcher计算相似度 similarity = SequenceMatcher(None, text1, text2).ratio() - + # 如果其中一个文本包含另一个,提高相似度 if text1 in text2 or text2 in text1: similarity = max(similarity, 0.8) - + return similarity - + except Exception as e: logger.error(f"计算相似度时出错: {e}") return 0.0 @@ -85,31 +88,30 @@ def calculate_similarity(text1: str, text2: str) -> float: def preprocess_text(text: str) -> str: """ 预处理文本,提高匹配准确性 - + Args: text: 原始文本 - + Returns: str: 预处理后的文本 """ try: # 转换为小写 text = text.lower() - + # 移除标点符号和特殊字符 - text = re.sub(r'[^\w\s]', '', text) - + text = re.sub(r"[^\w\s]", "", text) + # 移除多余空格 - text = re.sub(r'\s+', ' ', text).strip() - + text = re.sub(r"\s+", " ", text).strip() + return text - + except Exception as e: logger.error(f"预处理文本时出错: {e}") return text - def parse_datetime_to_timestamp(value: str) -> float: """ 接受多种常见格式并转换为时间戳(秒) @@ -143,25 +145,24 @@ def parse_datetime_to_timestamp(value: str) -> float: def parse_time_range(time_range: str) -> Tuple[float, float]: """ 解析时间范围字符串,返回开始和结束时间戳 - + Args: time_range: 时间范围字符串,格式:"YYYY-MM-DD HH:MM:SS - YYYY-MM-DD HH:MM:SS" - + Returns: Tuple[float, float]: (开始时间戳, 结束时间戳) """ if " - " not in time_range: raise ValueError(f"时间范围格式错误,应为 '开始时间 - 结束时间': {time_range}") - + parts = time_range.split(" - ", 1) if len(parts) != 2: raise ValueError(f"时间范围格式错误: {time_range}") - + start_str = parts[0].strip() end_str = parts[1].strip() - + start_timestamp = parse_datetime_to_timestamp(start_str) end_timestamp = parse_datetime_to_timestamp(end_str) - - return start_timestamp, end_timestamp + return start_timestamp, end_timestamp diff --git a/src/memory_system/retrieval_tools/__init__.py b/src/memory_system/retrieval_tools/__init__.py index e02875be..4b5c40c0 100644 --- a/src/memory_system/retrieval_tools/__init__.py +++ b/src/memory_system/retrieval_tools/__init__.py @@ -17,6 +17,7 @@ from .query_lpmm_knowledge import register_tool as register_lpmm_knowledge from .query_person_info import register_tool as register_query_person_info from src.config.config import global_config + def init_all_tools(): """初始化并注册所有记忆检索工具""" register_query_jargon() diff --git a/src/memory_system/retrieval_tools/query_chat_history.py b/src/memory_system/retrieval_tools/query_chat_history.py index 900426ee..407bba05 100644 --- a/src/memory_system/retrieval_tools/query_chat_history.py +++ b/src/memory_system/retrieval_tools/query_chat_history.py @@ -15,13 +15,10 @@ logger = get_logger("memory_retrieval_tools") async def query_chat_history( - chat_id: str, - keyword: Optional[str] = None, - time_range: Optional[str] = None, - fuzzy: bool = True + chat_id: str, keyword: Optional[str] = None, time_range: Optional[str] = None, fuzzy: bool = True ) -> str: """根据时间或关键词在chat_history表中查询聊天记录概述 - + Args: chat_id: 聊天ID keyword: 关键词(可选,支持多个关键词,可用空格、逗号等分隔) @@ -31,7 +28,7 @@ async def query_chat_history( fuzzy: 是否使用模糊匹配模式(默认True) - True: 模糊匹配,只要包含任意一个关键词即匹配(OR关系) - False: 全匹配,必须包含所有关键词才匹配(AND关系) - + Returns: str: 查询结果 """ @@ -39,10 +36,10 @@ async def query_chat_history( # 检查参数 if not keyword and not time_range: return "未指定查询参数(需要提供keyword或time_range之一)" - + # 构建查询条件 query = ChatHistory.select().where(ChatHistory.chat_id == chat_id) - + # 时间过滤条件 if time_range: # 判断是时间点还是时间范围 @@ -50,79 +47,79 @@ async def query_chat_history( # 时间范围:查询与时间范围有交集的记录 start_timestamp, end_timestamp = parse_time_range(time_range) # 交集条件:start_time < end_timestamp AND end_time > start_timestamp - time_filter = ( - (ChatHistory.start_time < end_timestamp) & - (ChatHistory.end_time > start_timestamp) - ) + time_filter = (ChatHistory.start_time < end_timestamp) & (ChatHistory.end_time > start_timestamp) else: # 时间点:查询包含该时间点的记录(start_time <= time_point <= end_time) target_timestamp = parse_datetime_to_timestamp(time_range) - time_filter = ( - (ChatHistory.start_time <= target_timestamp) & - (ChatHistory.end_time >= target_timestamp) - ) + time_filter = (ChatHistory.start_time <= target_timestamp) & (ChatHistory.end_time >= target_timestamp) query = query.where(time_filter) - + # 执行查询 records = list(query.order_by(ChatHistory.start_time.desc()).limit(50)) - + # 如果有关键词,进一步过滤 if keyword: # 解析多个关键词(支持空格、逗号等分隔符) keywords_list = parse_keywords_string(keyword) if not keywords_list: keywords_list = [keyword.strip()] if keyword.strip() else [] - + # 转换为小写以便匹配 keywords_lower = [kw.lower() for kw in keywords_list if kw.strip()] - + if not keywords_lower: return "关键词为空" - + filtered_records = [] - + for record in records: # 在theme、keywords、summary、original_text中搜索 theme = (record.theme or "").lower() summary = (record.summary or "").lower() original_text = (record.original_text or "").lower() - + # 解析record中的keywords JSON record_keywords_list = [] if record.keywords: try: - keywords_data = json.loads(record.keywords) if isinstance(record.keywords, str) else record.keywords + keywords_data = ( + json.loads(record.keywords) if isinstance(record.keywords, str) else record.keywords + ) if isinstance(keywords_data, list): record_keywords_list = [str(k).lower() for k in keywords_data] except (json.JSONDecodeError, TypeError, ValueError): pass - + # 根据匹配模式检查关键词 matched = False if fuzzy: # 模糊匹配:只要包含任意一个关键词即匹配(OR关系) for kw in keywords_lower: - if (kw in theme or - kw in summary or - kw in original_text or - any(kw in k for k in record_keywords_list)): + if ( + kw in theme + or kw in summary + or kw in original_text + or any(kw in k for k in record_keywords_list) + ): matched = True break else: # 全匹配:必须包含所有关键词才匹配(AND关系) matched = True for kw in keywords_lower: - kw_matched = (kw in theme or - kw in summary or - kw in original_text or - any(kw in k for k in record_keywords_list)) + kw_matched = ( + kw in theme + or kw in summary + or kw in original_text + or any(kw in k for k in record_keywords_list) + ) if not kw_matched: matched = False break - + if matched: filtered_records.append(record) - + if not filtered_records: keywords_str = "、".join(keywords_list) match_mode = "包含任意一个关键词" if fuzzy else "包含所有关键词" @@ -130,9 +127,9 @@ async def query_chat_history( return f"未找到{match_mode}'{keywords_str}'且在指定时间范围内的聊天记录概述" else: return f"未找到{match_mode}'{keywords_str}'的聊天记录概述" - + records = filtered_records - + # 如果没有记录(可能是时间范围查询但没有匹配的记录) if not records: if time_range: @@ -148,22 +145,23 @@ async def query_chat_history( record.count = (record.count or 0) + 1 except Exception as update_error: logger.error(f"更新聊天记录概述计数失败: {update_error}") - + # 构建结果文本 results = [] for record in records_to_use: # 最多返回3条记录 result_parts = [] - + # 添加主题 if record.theme: result_parts.append(f"主题:{record.theme}") - + # 添加时间范围 from datetime import datetime + start_str = datetime.fromtimestamp(record.start_time).strftime("%Y-%m-%d %H:%M:%S") end_str = datetime.fromtimestamp(record.end_time).strftime("%Y-%m-%d %H:%M:%S") result_parts.append(f"时间:{start_str} - {end_str}") - + # 添加概括(优先使用summary,如果没有则使用original_text的前200字符) if record.summary: result_parts.append(f"概括:{record.summary}") @@ -172,18 +170,18 @@ async def query_chat_history( if len(record.original_text) > 200: text_preview += "..." result_parts.append(f"内容:{text_preview}") - + results.append("\n".join(result_parts)) - + if not results: return "未找到相关聊天记录概述" - + response_text = "\n\n---\n\n".join(results) if len(records) > len(records_to_use): omitted_count = len(records) - len(records_to_use) response_text += f"\n\n(还有{omitted_count}条历史记录已省略)" return response_text - + except Exception as e: logger.error(f"查询聊天历史概述失败: {e}") return f"查询失败: {str(e)}" @@ -199,20 +197,20 @@ def register_tool(): "name": "keyword", "type": "string", "description": "关键词(可选,支持多个关键词,可用空格、逗号、斜杠等分隔,如:'麦麦 百度网盘' 或 '麦麦,百度网盘'。用于在主题、关键词、概括、原文中搜索)", - "required": False + "required": False, }, { "name": "time_range", "type": "string", "description": "时间范围或时间点(可选)。格式:'YYYY-MM-DD HH:MM:SS - YYYY-MM-DD HH:MM:SS'(时间范围,查询与时间范围有交集的记录)或 'YYYY-MM-DD HH:MM:SS'(时间点,查询包含该时间点的记录)", - "required": False + "required": False, }, { "name": "fuzzy", "type": "boolean", "description": "是否使用模糊匹配模式(默认True)。True表示模糊匹配(只要包含任意一个关键词即匹配,OR关系),False表示全匹配(必须包含所有关键词才匹配,AND关系)", - "required": False - } + "required": False, + }, ], - execute_func=query_chat_history + execute_func=query_chat_history, ) diff --git a/src/memory_system/retrieval_tools/query_lpmm_knowledge.py b/src/memory_system/retrieval_tools/query_lpmm_knowledge.py index 20664eea..c1f39270 100644 --- a/src/memory_system/retrieval_tools/query_lpmm_knowledge.py +++ b/src/memory_system/retrieval_tools/query_lpmm_knowledge.py @@ -73,5 +73,3 @@ def register_tool(): ], execute_func=query_lpmm_knowledge, ) - - diff --git a/src/memory_system/retrieval_tools/query_person_info.py b/src/memory_system/retrieval_tools/query_person_info.py index 878daf4d..bc192722 100644 --- a/src/memory_system/retrieval_tools/query_person_info.py +++ b/src/memory_system/retrieval_tools/query_person_info.py @@ -14,23 +14,25 @@ logger = get_logger("memory_retrieval_tools") def _format_group_nick_names(group_nick_name_field) -> str: """格式化群昵称信息 - + Args: group_nick_name_field: 群昵称字段(可能是字符串JSON或None) - + Returns: str: 格式化后的群昵称信息字符串 """ if not group_nick_name_field: return "" - + try: # 解析JSON格式的群昵称列表 - group_nick_names_data = json.loads(group_nick_name_field) if isinstance(group_nick_name_field, str) else group_nick_name_field - + group_nick_names_data = ( + json.loads(group_nick_name_field) if isinstance(group_nick_name_field, str) else group_nick_name_field + ) + if not isinstance(group_nick_names_data, list) or not group_nick_names_data: return "" - + # 格式化群昵称列表 group_nick_list = [] for item in group_nick_names_data: @@ -41,7 +43,7 @@ def _format_group_nick_names(group_nick_name_field) -> str: elif isinstance(item, str): # 兼容旧格式(如果存在) group_nick_list.append(f" - {item}") - + if group_nick_list: return "群昵称:\n" + "\n".join(group_nick_list) return "" @@ -58,10 +60,10 @@ def _format_group_nick_names(group_nick_name_field) -> str: async def query_person_info(person_name: str) -> str: """根据person_name查询用户信息,使用模糊查询 - + Args: person_name: 用户名称(person_name字段) - + Returns: str: 查询结果,包含用户的所有信息 """ @@ -69,37 +71,35 @@ async def query_person_info(person_name: str) -> str: person_name = str(person_name).strip() if not person_name: return "用户名称为空" - + # 构建查询条件(使用模糊查询) - query = PersonInfo.select().where( - PersonInfo.person_name.contains(person_name) - ) - + query = PersonInfo.select().where(PersonInfo.person_name.contains(person_name)) + # 执行查询 records = list(query.limit(20)) # 最多返回20条记录 - + if not records: return f"未找到模糊匹配'{person_name}'的用户信息" - + # 区分精确匹配和模糊匹配的结果 exact_matches = [] fuzzy_matches = [] - + for record in records: # 检查是否是精确匹配 if record.person_name and record.person_name.strip() == person_name: exact_matches.append(record) else: fuzzy_matches.append(record) - + # 构建结果文本 results = [] - + # 先处理精确匹配的结果 for record in exact_matches: result_parts = [] result_parts.append("【精确匹配】") # 标注为精确匹配 - + # 基本信息 if record.person_name: result_parts.append(f"用户名称:{record.person_name}") @@ -111,19 +111,19 @@ async def query_person_info(person_name: str) -> str: result_parts.append(f"平台:{record.platform}") if record.user_id: result_parts.append(f"平台用户ID:{record.user_id}") - + # 群昵称信息 group_nick_name_str = _format_group_nick_names(getattr(record, "group_nick_name", None)) if group_nick_name_str: result_parts.append(group_nick_name_str) - + # 名称设定原因 if record.name_reason: result_parts.append(f"名称设定原因:{record.name_reason}") - + # 认识状态 result_parts.append(f"是否已认识:{'是' if record.is_known else '否'}") - + # 时间信息 if record.know_since: know_since_str = datetime.fromtimestamp(record.know_since).strftime("%Y-%m-%d %H:%M:%S") @@ -133,11 +133,15 @@ async def query_person_info(person_name: str) -> str: result_parts.append(f"最后认识时间:{last_know_str}") if record.know_times: result_parts.append(f"认识次数:{int(record.know_times)}") - + # 记忆点(memory_points) if record.memory_points: try: - memory_points_data = json.loads(record.memory_points) if isinstance(record.memory_points, str) else record.memory_points + memory_points_data = ( + json.loads(record.memory_points) + if isinstance(record.memory_points, str) + else record.memory_points + ) if isinstance(memory_points_data, list) and memory_points_data: # 解析记忆点格式:category:content:weight memory_list = [] @@ -151,7 +155,7 @@ async def query_person_info(person_name: str) -> str: memory_list.append(f" - [{category}] {content} (权重: {weight})") else: memory_list.append(f" - {memory_point}") - + if memory_list: result_parts.append("记忆点:\n" + "\n".join(memory_list)) except (json.JSONDecodeError, TypeError, ValueError) as e: @@ -161,14 +165,14 @@ async def query_person_info(person_name: str) -> str: if len(str(record.memory_points)) > 200: memory_preview += "..." result_parts.append(f"记忆点(原始数据):{memory_preview}") - + results.append("\n".join(result_parts)) - + # 再处理模糊匹配的结果 for record in fuzzy_matches: result_parts = [] result_parts.append("【模糊匹配】") # 标注为模糊匹配 - + # 基本信息 if record.person_name: result_parts.append(f"用户名称:{record.person_name}") @@ -180,19 +184,19 @@ async def query_person_info(person_name: str) -> str: result_parts.append(f"平台:{record.platform}") if record.user_id: result_parts.append(f"平台用户ID:{record.user_id}") - + # 群昵称信息 group_nick_name_str = _format_group_nick_names(getattr(record, "group_nick_name", None)) if group_nick_name_str: result_parts.append(group_nick_name_str) - + # 名称设定原因 if record.name_reason: result_parts.append(f"名称设定原因:{record.name_reason}") - + # 认识状态 result_parts.append(f"是否已认识:{'是' if record.is_known else '否'}") - + # 时间信息 if record.know_since: know_since_str = datetime.fromtimestamp(record.know_since).strftime("%Y-%m-%d %H:%M:%S") @@ -202,11 +206,15 @@ async def query_person_info(person_name: str) -> str: result_parts.append(f"最后认识时间:{last_know_str}") if record.know_times: result_parts.append(f"认识次数:{int(record.know_times)}") - + # 记忆点(memory_points) if record.memory_points: try: - memory_points_data = json.loads(record.memory_points) if isinstance(record.memory_points, str) else record.memory_points + memory_points_data = ( + json.loads(record.memory_points) + if isinstance(record.memory_points, str) + else record.memory_points + ) if isinstance(memory_points_data, list) and memory_points_data: # 解析记忆点格式:category:content:weight memory_list = [] @@ -220,7 +228,7 @@ async def query_person_info(person_name: str) -> str: memory_list.append(f" - [{category}] {content} (权重: {weight})") else: memory_list.append(f" - {memory_point}") - + if memory_list: result_parts.append("记忆点:\n" + "\n".join(memory_list)) except (json.JSONDecodeError, TypeError, ValueError) as e: @@ -230,20 +238,20 @@ async def query_person_info(person_name: str) -> str: if len(str(record.memory_points)) > 200: memory_preview += "..." result_parts.append(f"记忆点(原始数据):{memory_preview}") - + results.append("\n".join(result_parts)) - + # 组合所有结果 if not results: return f"未找到匹配'{person_name}'的用户信息" - + response_text = "\n\n---\n\n".join(results) - + # 添加统计信息 total_count = len(records) exact_count = len(exact_matches) fuzzy_count = len(fuzzy_matches) - + # 显示精确匹配和模糊匹配的统计 if exact_count > 0 or fuzzy_count > 0: stats_parts = [] @@ -257,13 +265,13 @@ async def query_person_info(person_name: str) -> str: response_text = f"找到 {total_count} 条匹配的用户信息:\n\n{response_text}" else: response_text = f"找到用户信息:\n\n{response_text}" - + # 如果结果数量达到限制,添加提示 if total_count >= 20: response_text += "\n\n(已显示前20条结果,可能还有更多匹配记录)" - + return response_text - + except Exception as e: logger.error(f"查询用户信息失败: {e}") return f"查询失败: {str(e)}" @@ -275,13 +283,7 @@ def register_tool(): name="query_person_info", description="根据查询某个用户的所有信息。名称、昵称、平台、用户ID、qq号、群昵称等", parameters=[ - { - "name": "person_name", - "type": "string", - "description": "用户名称,用于查询用户信息", - "required": True - } + {"name": "person_name", "type": "string", "description": "用户名称,用于查询用户信息", "required": True} ], - execute_func=query_person_info + execute_func=query_person_info, ) - diff --git a/src/memory_system/retrieval_tools/tool_registry.py b/src/memory_system/retrieval_tools/tool_registry.py index 143666ab..1e1fa62b 100644 --- a/src/memory_system/retrieval_tools/tool_registry.py +++ b/src/memory_system/retrieval_tools/tool_registry.py @@ -47,10 +47,10 @@ class MemoryRetrievalTool: async def execute(self, **kwargs) -> str: """执行工具""" return await self.execute_func(**kwargs) - + def get_tool_definition(self) -> Dict[str, Any]: """获取工具定义,用于LLM function calling - + Returns: Dict[str, Any]: 工具定义字典,格式与BaseTool一致 格式: {"name": str, "description": str, "parameters": List[Tuple]} @@ -58,14 +58,14 @@ class MemoryRetrievalTool: # 转换参数格式为元组列表,格式与BaseTool一致 # 格式: [("param_name", ToolParamType, "description", required, enum_values)] param_tuples = [] - + for param in self.parameters: param_name = param.get("name", "") param_type_str = param.get("type", "string").lower() param_desc = param.get("description", "") is_required = param.get("required", False) enum_values = param.get("enum", None) - + # 转换类型字符串到ToolParamType type_mapping = { "string": ToolParamType.STRING, @@ -76,18 +76,14 @@ class MemoryRetrievalTool: "bool": ToolParamType.BOOLEAN, } param_type = type_mapping.get(param_type_str, ToolParamType.STRING) - + # 构建参数元组 param_tuple = (param_name, param_type, param_desc, is_required, enum_values) param_tuples.append(param_tuple) - + # 构建工具定义,格式与BaseTool.get_tool_definition()一致 - tool_def = { - "name": self.name, - "description": self.description, - "parameters": param_tuples - } - + tool_def = {"name": self.name, "description": self.description, "parameters": param_tuples} + return tool_def @@ -126,10 +122,10 @@ class MemoryRetrievalToolRegistry: action_types.append("final_answer") action_types.append("no_answer") return " 或 ".join([f'"{at}"' for at in action_types]) - + def get_tool_definitions(self) -> List[Dict[str, Any]]: """获取所有工具的定义列表,用于LLM function calling - + Returns: List[Dict[str, Any]]: 工具定义列表,每个元素是一个工具定义字典 """ diff --git a/src/person_info/person_info.py b/src/person_info/person_info.py index bbc3fb99..f5cfdcd0 100644 --- a/src/person_info/person_info.py +++ b/src/person_info/person_info.py @@ -162,7 +162,12 @@ def levenshtein_distance(s1: str, s2: str) -> int: class Person: @classmethod def register_person( - cls, platform: str, user_id: str, nickname: str, group_id: Optional[str] = None, group_nick_name: Optional[str] = None + cls, + platform: str, + user_id: str, + nickname: str, + group_id: Optional[str] = None, + group_nick_name: Optional[str] = None, ): """ 注册新用户的类方法 @@ -727,7 +732,7 @@ person_info_manager = PersonInfoManager() async def store_person_memory_from_answer(person_name: str, memory_content: str, chat_id: str) -> None: """将人物信息存入person_info的memory_points - + Args: person_name: 人物名称 memory_content: 记忆内容 @@ -739,13 +744,13 @@ async def store_person_memory_from_answer(person_name: str, memory_content: str, if not chat_stream: logger.warning(f"无法获取chat_stream for chat_id: {chat_id}") return - + platform = chat_stream.platform - + # 尝试从person_name查找person_id # 首先尝试通过person_name查找 person_id = get_person_id_by_person_name(person_name) - + if not person_id: # 如果通过person_name找不到,尝试从chat_stream获取user_info if chat_stream.user_info: @@ -754,25 +759,25 @@ async def store_person_memory_from_answer(person_name: str, memory_content: str, else: logger.warning(f"无法确定person_id for person_name: {person_name}, chat_id: {chat_id}") return - + # 创建或获取Person对象 person = Person(person_id=person_id) - + if not person.is_known: logger.warning(f"用户 {person_name} (person_id: {person_id}) 尚未认识,无法存储记忆") return - + # 确定记忆分类(可以根据memory_content判断,这里使用通用分类) category = "其他" # 默认分类,可以根据需要调整 - + # 记忆点格式:category:content:weight weight = "1.0" # 默认权重 memory_point = f"{category}:{memory_content}:{weight}" - + # 添加到memory_points if not person.memory_points: person.memory_points = [] - + # 检查是否已存在相似的记忆点(避免重复) is_duplicate = False for existing_point in person.memory_points: @@ -781,16 +786,20 @@ async def store_person_memory_from_answer(person_name: str, memory_content: str, if len(parts) >= 2: existing_content = parts[1].strip() # 简单相似度检查(如果内容相同或非常相似,则跳过) - if existing_content == memory_content or memory_content in existing_content or existing_content in memory_content: + if ( + existing_content == memory_content + or memory_content in existing_content + or existing_content in memory_content + ): is_duplicate = True break - + if not is_duplicate: person.memory_points.append(memory_point) person.sync_to_database() logger.info(f"成功添加记忆点到 {person_name} (person_id: {person_id}): {memory_point}") else: logger.debug(f"记忆点已存在,跳过: {memory_point}") - + except Exception as e: logger.error(f"存储人物记忆失败: {e}") diff --git a/src/plugin_system/core/tool_use.py b/src/plugin_system/core/tool_use.py index 12c11795..915ed7aa 100644 --- a/src/plugin_system/core/tool_use.py +++ b/src/plugin_system/core/tool_use.py @@ -124,7 +124,6 @@ class ToolExecutor: response, (reasoning_content, model_name, tool_calls) = await self.llm_model.generate_response_async( prompt=prompt, tools=tools, raise_when_empty=False ) - # 执行工具调用 tool_results, used_tools = await self.execute_tool_calls(tool_calls) diff --git a/src/plugins/built_in/emoji_plugin/emoji.py b/src/plugins/built_in/emoji_plugin/emoji.py index 7078a817..3783886a 100644 --- a/src/plugins/built_in/emoji_plugin/emoji.py +++ b/src/plugins/built_in/emoji_plugin/emoji.py @@ -102,13 +102,13 @@ class EmojiAction(BaseAction): # 5. 调用LLM models = llm_api.get_available_models() - chat_model_config = models.get("replyer") # 使用字典访问方式 + chat_model_config = models.get("utils") # 使用字典访问方式 if not chat_model_config: - logger.error(f"{self.log_prefix} 未找到'replyer'模型配置,无法调用LLM") - return False, "未找到'replyer'模型配置" + logger.error(f"{self.log_prefix} 未找到'utils'模型配置,无法调用LLM") + return False, "未找到'utils'模型配置" success, chosen_emotion, _, _ = await llm_api.generate_with_model( - prompt, model_config=chat_model_config, request_type="emoji" + prompt, model_config=chat_model_config, request_type="emoji.select" ) if not success: diff --git a/src/webui/config_routes.py b/src/webui/config_routes.py index 03a4643f..84c660ae 100644 --- a/src/webui/config_routes.py +++ b/src/webui/config_routes.py @@ -51,7 +51,7 @@ def _update_dict_preserve_comments(target: Any, source: Any) -> None: """ 递归合并字典,保留 target 中的注释和格式 将 source 的值更新到 target 中(仅更新已存在的键) - + Args: target: 目标字典(tomlkit 对象,包含注释) source: 源字典(普通 dict 或 list) @@ -59,7 +59,7 @@ def _update_dict_preserve_comments(target: Any, source: Any) -> None: # 如果 source 是列表,直接替换(数组表没有注释保留的意义) if isinstance(source, list): return # 调用者需要直接赋值 - + # 如果都是字典,递归合并 if isinstance(source, dict) and isinstance(target, dict): for key, value in source.items(): @@ -319,6 +319,58 @@ async def update_bot_config_section(section_name: str, section_data: Any = Body( raise HTTPException(status_code=500, detail=f"更新配置节失败: {str(e)}") +# ===== 原始 TOML 文件操作接口 ===== + + +@router.get("/bot/raw") +async def get_bot_config_raw(): + """获取麦麦主程序配置的原始 TOML 内容""" + try: + config_path = os.path.join(CONFIG_DIR, "bot_config.toml") + if not os.path.exists(config_path): + raise HTTPException(status_code=404, detail="配置文件不存在") + + with open(config_path, "r", encoding="utf-8") as f: + raw_content = f.read() + + return {"success": True, "content": raw_content} + except HTTPException: + raise + except Exception as e: + logger.error(f"读取配置文件失败: {e}") + raise HTTPException(status_code=500, detail=f"读取配置文件失败: {str(e)}") + + +@router.post("/bot/raw") +async def update_bot_config_raw(raw_content: str = Body(..., embed=True)): + """更新麦麦主程序配置(直接保存原始 TOML 内容,会先验证格式)""" + try: + # 验证 TOML 格式 + try: + config_data = tomlkit.loads(raw_content) + except Exception as e: + raise HTTPException(status_code=400, detail=f"TOML 格式错误: {str(e)}") + + # 验证配置数据结构 + try: + Config.from_dict(config_data) + except Exception as e: + raise HTTPException(status_code=400, detail=f"配置数据验证失败: {str(e)}") + + # 保存配置文件 + config_path = os.path.join(CONFIG_DIR, "bot_config.toml") + with open(config_path, "w", encoding="utf-8") as f: + f.write(raw_content) + + logger.info("麦麦主程序配置已更新(原始模式)") + return {"success": True, "message": "配置已保存"} + except HTTPException: + raise + except Exception as e: + logger.error(f"保存配置文件失败: {e}") + raise HTTPException(status_code=500, detail=f"保存配置文件失败: {str(e)}") + + @router.post("/model/section/{section_name}") async def update_model_config_section(section_name: str, section_data: Any = Body(...)): """更新模型配置的指定节(保留注释和格式)""" @@ -364,3 +416,144 @@ async def update_model_config_section(section_name: str, section_data: Any = Bod except Exception as e: logger.error(f"更新配置节失败: {e}") raise HTTPException(status_code=500, detail=f"更新配置节失败: {str(e)}") + + +# ===== 适配器配置管理接口 ===== + + +@router.get("/adapter-config/path") +async def get_adapter_config_path(): + """获取保存的适配器配置文件路径""" + try: + # 从 data/webui.json 读取路径偏好 + webui_data_path = os.path.join("data", "webui.json") + if not os.path.exists(webui_data_path): + return {"success": True, "path": None} + + import json + with open(webui_data_path, "r", encoding="utf-8") as f: + webui_data = json.load(f) + + adapter_config_path = webui_data.get("adapter_config_path") + if not adapter_config_path: + return {"success": True, "path": None} + + # 检查文件是否存在并返回最后修改时间 + if os.path.exists(adapter_config_path): + import datetime + mtime = os.path.getmtime(adapter_config_path) + last_modified = datetime.datetime.fromtimestamp(mtime).isoformat() + return {"success": True, "path": adapter_config_path, "lastModified": last_modified} + else: + return {"success": True, "path": adapter_config_path, "lastModified": None} + + except Exception as e: + logger.error(f"获取适配器配置路径失败: {e}") + raise HTTPException(status_code=500, detail=f"获取配置路径失败: {str(e)}") + + +@router.post("/adapter-config/path") +async def save_adapter_config_path(data: dict[str, str] = Body(...)): + """保存适配器配置文件路径偏好""" + try: + path = data.get("path") + if not path: + raise HTTPException(status_code=400, detail="路径不能为空") + + # 保存到 data/webui.json + webui_data_path = os.path.join("data", "webui.json") + import json + + # 读取现有数据 + if os.path.exists(webui_data_path): + with open(webui_data_path, "r", encoding="utf-8") as f: + webui_data = json.load(f) + else: + webui_data = {} + + # 更新路径 + webui_data["adapter_config_path"] = path + + # 保存 + os.makedirs("data", exist_ok=True) + with open(webui_data_path, "w", encoding="utf-8") as f: + json.dump(webui_data, f, ensure_ascii=False, indent=2) + + logger.info(f"适配器配置路径已保存: {path}") + return {"success": True, "message": "路径已保存"} + + except HTTPException: + raise + except Exception as e: + logger.error(f"保存适配器配置路径失败: {e}") + raise HTTPException(status_code=500, detail=f"保存路径失败: {str(e)}") + + +@router.get("/adapter-config") +async def get_adapter_config(path: str): + """从指定路径读取适配器配置文件""" + try: + if not path: + raise HTTPException(status_code=400, detail="路径参数不能为空") + + # 检查文件是否存在 + if not os.path.exists(path): + raise HTTPException(status_code=404, detail=f"配置文件不存在: {path}") + + # 检查文件扩展名 + if not path.endswith(".toml"): + raise HTTPException(status_code=400, detail="只支持 .toml 格式的配置文件") + + # 读取文件内容 + with open(path, "r", encoding="utf-8") as f: + content = f.read() + + logger.info(f"已读取适配器配置: {path}") + return {"success": True, "content": content} + + except HTTPException: + raise + except Exception as e: + logger.error(f"读取适配器配置失败: {e}") + raise HTTPException(status_code=500, detail=f"读取配置失败: {str(e)}") + + +@router.post("/adapter-config") +async def save_adapter_config(data: dict[str, str] = Body(...)): + """保存适配器配置到指定路径""" + try: + path = data.get("path") + content = data.get("content") + + if not path: + raise HTTPException(status_code=400, detail="路径不能为空") + if content is None: + raise HTTPException(status_code=400, detail="配置内容不能为空") + + # 检查文件扩展名 + if not path.endswith(".toml"): + raise HTTPException(status_code=400, detail="只支持 .toml 格式的配置文件") + + # 验证 TOML 格式 + try: + import toml + toml.loads(content) + except Exception as e: + raise HTTPException(status_code=400, detail=f"TOML 格式错误: {str(e)}") + + # 确保目录存在 + os.makedirs(os.path.dirname(path) if os.path.dirname(path) else ".", exist_ok=True) + + # 保存文件 + with open(path, "w", encoding="utf-8") as f: + f.write(content) + + logger.info(f"适配器配置已保存: {path}") + return {"success": True, "message": "配置已保存"} + + except HTTPException: + raise + except Exception as e: + logger.error(f"保存适配器配置失败: {e}") + raise HTTPException(status_code=500, detail=f"保存配置失败: {str(e)}") + diff --git a/src/webui/emoji_routes.py b/src/webui/emoji_routes.py index 526bc3a9..471eb6d7 100644 --- a/src/webui/emoji_routes.py +++ b/src/webui/emoji_routes.py @@ -1,5 +1,7 @@ """表情包管理 API 路由""" + from fastapi import APIRouter, HTTPException, Header, Query +from fastapi.responses import FileResponse from pydantic import BaseModel from typing import Optional, List from src.common.logger import get_logger @@ -7,6 +9,7 @@ from src.common.database.database_model import Emoji from .token_manager import get_token_manager import json import time +import os logger = get_logger("webui.emoji") @@ -16,6 +19,7 @@ router = APIRouter(prefix="/emoji", tags=["Emoji"]) class EmojiResponse(BaseModel): """表情包响应""" + id: int full_path: str format: str @@ -24,7 +28,7 @@ class EmojiResponse(BaseModel): query_count: int is_registered: bool is_banned: bool - emotion: Optional[List[str]] # 解析后的 JSON + emotion: Optional[str] # 直接返回字符串 record_time: float register_time: Optional[float] usage_count: int @@ -33,6 +37,7 @@ class EmojiResponse(BaseModel): class EmojiListResponse(BaseModel): """表情包列表响应""" + success: bool total: int page: int @@ -42,20 +47,23 @@ class EmojiListResponse(BaseModel): class EmojiDetailResponse(BaseModel): """表情包详情响应""" + success: bool data: EmojiResponse class EmojiUpdateRequest(BaseModel): """表情包更新请求""" + description: Optional[str] = None is_registered: Optional[bool] = None is_banned: Optional[bool] = None - emotion: Optional[List[str]] = None + emotion: Optional[str] = None class EmojiUpdateResponse(BaseModel): """表情包更新响应""" + success: bool message: str data: Optional[EmojiResponse] = None @@ -63,34 +71,41 @@ class EmojiUpdateResponse(BaseModel): class EmojiDeleteResponse(BaseModel): """表情包删除响应""" + success: bool message: str +class BatchDeleteRequest(BaseModel): + """批量删除请求""" + + emoji_ids: List[int] + + +class BatchDeleteResponse(BaseModel): + """批量删除响应""" + + success: bool + message: str + deleted_count: int + failed_count: int + failed_ids: List[int] = [] + + def verify_auth_token(authorization: Optional[str]) -> bool: """验证认证 Token""" if not authorization or not authorization.startswith("Bearer "): raise HTTPException(status_code=401, detail="未提供有效的认证信息") - + token = authorization.replace("Bearer ", "") token_manager = get_token_manager() - + if not token_manager.verify_token(token): raise HTTPException(status_code=401, detail="Token 无效或已过期") - + return True -def parse_emotion(emotion_str: Optional[str]) -> Optional[List[str]]: - """解析情感标签 JSON 字符串""" - if not emotion_str: - return None - try: - return json.loads(emotion_str) - except (json.JSONDecodeError, TypeError): - return None - - def emoji_to_response(emoji: Emoji) -> EmojiResponse: """将 Emoji 模型转换为响应对象""" return EmojiResponse( @@ -102,7 +117,7 @@ def emoji_to_response(emoji: Emoji) -> EmojiResponse: query_count=emoji.query_count, is_registered=emoji.is_registered, is_banned=emoji.is_banned, - emotion=parse_emotion(emoji.emotion), + emotion=str(emoji.emotion) if emoji.emotion is not None else None, record_time=emoji.record_time, register_time=emoji.register_time, usage_count=emoji.usage_count, @@ -118,11 +133,11 @@ async def get_emoji_list( is_registered: Optional[bool] = Query(None, description="是否已注册筛选"), is_banned: Optional[bool] = Query(None, description="是否被禁用筛选"), format: Optional[str] = Query(None, description="格式筛选"), - authorization: Optional[str] = Header(None) + authorization: Optional[str] = Header(None), ): """ 获取表情包列表 - + Args: page: 页码 (从 1 开始) page_size: 每页数量 (1-100) @@ -131,61 +146,51 @@ async def get_emoji_list( is_banned: 是否被禁用筛选 format: 格式筛选 authorization: Authorization header - + Returns: 表情包列表 """ try: verify_auth_token(authorization) - + # 构建查询 query = Emoji.select() - + # 搜索过滤 if search: - query = query.where( - (Emoji.description.contains(search)) | - (Emoji.emoji_hash.contains(search)) - ) - + query = query.where((Emoji.description.contains(search)) | (Emoji.emoji_hash.contains(search))) + # 注册状态过滤 if is_registered is not None: query = query.where(Emoji.is_registered == is_registered) - + # 禁用状态过滤 if is_banned is not None: query = query.where(Emoji.is_banned == is_banned) - + # 格式过滤 if format: query = query.where(Emoji.format == format) - + # 排序:使用次数倒序,然后按记录时间倒序 from peewee import Case + query = query.order_by( - Emoji.usage_count.desc(), - Case(None, [(Emoji.record_time.is_null(), 1)], 0), - Emoji.record_time.desc() + Emoji.usage_count.desc(), Case(None, [(Emoji.record_time.is_null(), 1)], 0), Emoji.record_time.desc() ) - + # 获取总数 total = query.count() - + # 分页 offset = (page - 1) * page_size emojis = query.offset(offset).limit(page_size) - + # 转换为响应对象 data = [emoji_to_response(emoji) for emoji in emojis] - - return EmojiListResponse( - success=True, - total=total, - page=page, - page_size=page_size, - data=data - ) - + + return EmojiListResponse(success=True, total=total, page=page, page_size=page_size, data=data) + except HTTPException: raise except Exception as e: @@ -194,33 +199,27 @@ async def get_emoji_list( @router.get("/{emoji_id}", response_model=EmojiDetailResponse) -async def get_emoji_detail( - emoji_id: int, - authorization: Optional[str] = Header(None) -): +async def get_emoji_detail(emoji_id: int, authorization: Optional[str] = Header(None)): """ 获取表情包详细信息 - + Args: emoji_id: 表情包ID authorization: Authorization header - + Returns: 表情包详细信息 """ try: verify_auth_token(authorization) - + emoji = Emoji.get_or_none(Emoji.id == emoji_id) - + if not emoji: raise HTTPException(status_code=404, detail=f"未找到 ID 为 {emoji_id} 的表情包") - - return EmojiDetailResponse( - success=True, - data=emoji_to_response(emoji) - ) - + + return EmojiDetailResponse(success=True, data=emoji_to_response(emoji)) + except HTTPException: raise except Exception as e: @@ -229,61 +228,50 @@ async def get_emoji_detail( @router.patch("/{emoji_id}", response_model=EmojiUpdateResponse) -async def update_emoji( - emoji_id: int, - request: EmojiUpdateRequest, - authorization: Optional[str] = Header(None) -): +async def update_emoji(emoji_id: int, request: EmojiUpdateRequest, authorization: Optional[str] = Header(None)): """ 增量更新表情包(只更新提供的字段) - + Args: emoji_id: 表情包ID request: 更新请求(只包含需要更新的字段) authorization: Authorization header - + Returns: 更新结果 """ try: verify_auth_token(authorization) - + emoji = Emoji.get_or_none(Emoji.id == emoji_id) - + if not emoji: raise HTTPException(status_code=404, detail=f"未找到 ID 为 {emoji_id} 的表情包") - + # 只更新提供的字段 update_data = request.model_dump(exclude_unset=True) - + if not update_data: raise HTTPException(status_code=400, detail="未提供任何需要更新的字段") - - # 处理情感标签(转换为 JSON) - if 'emotion' in update_data: - if update_data['emotion'] is None: - update_data['emotion'] = None - else: - update_data['emotion'] = json.dumps(update_data['emotion'], ensure_ascii=False) - + + # emotion 字段直接使用字符串,无需转换 + # 如果注册状态从 False 变为 True,记录注册时间 - if 'is_registered' in update_data and update_data['is_registered'] and not emoji.is_registered: - update_data['register_time'] = time.time() - + if "is_registered" in update_data and update_data["is_registered"] and not emoji.is_registered: + update_data["register_time"] = time.time() + # 执行更新 for field, value in update_data.items(): setattr(emoji, field, value) - + emoji.save() - + logger.info(f"表情包已更新: ID={emoji_id}, 字段: {list(update_data.keys())}") - + return EmojiUpdateResponse( - success=True, - message=f"成功更新 {len(update_data)} 个字段", - data=emoji_to_response(emoji) + success=True, message=f"成功更新 {len(update_data)} 个字段", data=emoji_to_response(emoji) ) - + except HTTPException: raise except Exception as e: @@ -292,41 +280,35 @@ async def update_emoji( @router.delete("/{emoji_id}", response_model=EmojiDeleteResponse) -async def delete_emoji( - emoji_id: int, - authorization: Optional[str] = Header(None) -): +async def delete_emoji(emoji_id: int, authorization: Optional[str] = Header(None)): """ 删除表情包 - + Args: emoji_id: 表情包ID authorization: Authorization header - + Returns: 删除结果 """ try: verify_auth_token(authorization) - + emoji = Emoji.get_or_none(Emoji.id == emoji_id) - + if not emoji: raise HTTPException(status_code=404, detail=f"未找到 ID 为 {emoji_id} 的表情包") - + # 记录删除信息 emoji_hash = emoji.emoji_hash - + # 执行删除 emoji.delete_instance() - + logger.info(f"表情包已删除: ID={emoji_id}, hash={emoji_hash}") - - return EmojiDeleteResponse( - success=True, - message=f"成功删除表情包: {emoji_hash}" - ) - + + return EmojiDeleteResponse(success=True, message=f"成功删除表情包: {emoji_hash}") + except HTTPException: raise except Exception as e: @@ -335,31 +317,29 @@ async def delete_emoji( @router.get("/stats/summary") -async def get_emoji_stats( - authorization: Optional[str] = Header(None) -): +async def get_emoji_stats(authorization: Optional[str] = Header(None)): """ 获取表情包统计数据 - + Args: authorization: Authorization header - + Returns: 统计数据 """ try: verify_auth_token(authorization) - + total = Emoji.select().count() registered = Emoji.select().where(Emoji.is_registered).count() banned = Emoji.select().where(Emoji.is_banned).count() - + # 按格式统计 formats = {} for emoji in Emoji.select(Emoji.format): fmt = emoji.format formats[fmt] = formats.get(fmt, 0) + 1 - + # 获取最常用的表情包(前10) top_used = Emoji.select().order_by(Emoji.usage_count.desc()).limit(10) top_used_list = [ @@ -367,11 +347,11 @@ async def get_emoji_stats( "id": emoji.id, "emoji_hash": emoji.emoji_hash, "description": emoji.description, - "usage_count": emoji.usage_count + "usage_count": emoji.usage_count, } for emoji in top_used ] - + return { "success": True, "data": { @@ -380,10 +360,10 @@ async def get_emoji_stats( "banned": banned, "unregistered": total - registered, "formats": formats, - "top_used": top_used_list - } + "top_used": top_used_list, + }, } - + except HTTPException: raise except Exception as e: @@ -392,47 +372,40 @@ async def get_emoji_stats( @router.post("/{emoji_id}/register", response_model=EmojiUpdateResponse) -async def register_emoji( - emoji_id: int, - authorization: Optional[str] = Header(None) -): +async def register_emoji(emoji_id: int, authorization: Optional[str] = Header(None)): """ 注册表情包(快捷操作) - + Args: emoji_id: 表情包ID authorization: Authorization header - + Returns: 更新结果 """ try: verify_auth_token(authorization) - + emoji = Emoji.get_or_none(Emoji.id == emoji_id) - + if not emoji: raise HTTPException(status_code=404, detail=f"未找到 ID 为 {emoji_id} 的表情包") - + if emoji.is_registered: raise HTTPException(status_code=400, detail="该表情包已经注册") - + if emoji.is_banned: raise HTTPException(status_code=400, detail="该表情包已被禁用,无法注册") - + # 注册表情包 emoji.is_registered = True emoji.register_time = time.time() emoji.save() - + logger.info(f"表情包已注册: ID={emoji_id}") - - return EmojiUpdateResponse( - success=True, - message="表情包注册成功", - data=emoji_to_response(emoji) - ) - + + return EmojiUpdateResponse(success=True, message="表情包注册成功", data=emoji_to_response(emoji)) + except HTTPException: raise except Exception as e: @@ -441,43 +414,149 @@ async def register_emoji( @router.post("/{emoji_id}/ban", response_model=EmojiUpdateResponse) -async def ban_emoji( - emoji_id: int, - authorization: Optional[str] = Header(None) -): +async def ban_emoji(emoji_id: int, authorization: Optional[str] = Header(None)): """ 禁用表情包(快捷操作) - + Args: emoji_id: 表情包ID authorization: Authorization header - + Returns: 更新结果 """ try: verify_auth_token(authorization) - + emoji = Emoji.get_or_none(Emoji.id == emoji_id) - + if not emoji: raise HTTPException(status_code=404, detail=f"未找到 ID 为 {emoji_id} 的表情包") - + # 禁用表情包(同时取消注册) emoji.is_banned = True emoji.is_registered = False emoji.save() - + logger.info(f"表情包已禁用: ID={emoji_id}") - - return EmojiUpdateResponse( - success=True, - message="表情包禁用成功", - data=emoji_to_response(emoji) - ) - + + return EmojiUpdateResponse(success=True, message="表情包禁用成功", data=emoji_to_response(emoji)) + except HTTPException: raise except Exception as e: logger.exception(f"禁用表情包失败: {e}") raise HTTPException(status_code=500, detail=f"禁用表情包失败: {str(e)}") from e + + +@router.get("/{emoji_id}/thumbnail") +async def get_emoji_thumbnail( + emoji_id: int, + token: Optional[str] = Query(None, description="访问令牌"), + authorization: Optional[str] = Header(None), +): + """ + 获取表情包缩略图 + + Args: + emoji_id: 表情包ID + token: 访问令牌(通过 query parameter) + authorization: Authorization header + + Returns: + 表情包图片文件 + """ + try: + # 优先使用 query parameter 中的 token(用于 img 标签) + if token: + token_manager = get_token_manager() + if not token_manager.verify_token(token): + raise HTTPException(status_code=401, detail="Token 无效或已过期") + else: + # 如果没有 query token,则验证 Authorization header + verify_auth_token(authorization) + + emoji = Emoji.get_or_none(Emoji.id == emoji_id) + + if not emoji: + raise HTTPException(status_code=404, detail=f"未找到 ID 为 {emoji_id} 的表情包") + + # 检查文件是否存在 + if not os.path.exists(emoji.full_path): + raise HTTPException(status_code=404, detail="表情包文件不存在") + + # 根据格式设置 MIME 类型 + mime_types = { + "png": "image/png", + "jpg": "image/jpeg", + "jpeg": "image/jpeg", + "gif": "image/gif", + "webp": "image/webp", + "bmp": "image/bmp", + } + + media_type = mime_types.get(emoji.format.lower(), "application/octet-stream") + + return FileResponse(path=emoji.full_path, media_type=media_type, filename=f"{emoji.emoji_hash}.{emoji.format}") + + except HTTPException: + raise + except Exception as e: + logger.exception(f"获取表情包缩略图失败: {e}") + raise HTTPException(status_code=500, detail=f"获取表情包缩略图失败: {str(e)}") from e + + +@router.post("/batch/delete", response_model=BatchDeleteResponse) +async def batch_delete_emojis(request: BatchDeleteRequest, authorization: Optional[str] = Header(None)): + """ + 批量删除表情包 + + Args: + request: 包含emoji_ids列表的请求 + authorization: Authorization header + + Returns: + 批量删除结果 + """ + try: + verify_auth_token(authorization) + + if not request.emoji_ids: + raise HTTPException(status_code=400, detail="未提供要删除的表情包ID") + + deleted_count = 0 + failed_count = 0 + failed_ids = [] + + for emoji_id in request.emoji_ids: + try: + emoji = Emoji.get_or_none(Emoji.id == emoji_id) + if emoji: + emoji.delete_instance() + deleted_count += 1 + logger.info(f"批量删除表情包: {emoji_id}") + else: + failed_count += 1 + failed_ids.append(emoji_id) + except Exception as e: + logger.error(f"删除表情包 {emoji_id} 失败: {e}") + failed_count += 1 + failed_ids.append(emoji_id) + + message = f"成功删除 {deleted_count} 个表情包" + if failed_count > 0: + message += f",{failed_count} 个失败" + + return BatchDeleteResponse( + success=True, + message=message, + deleted_count=deleted_count, + failed_count=failed_count, + failed_ids=failed_ids, + ) + + except HTTPException: + raise + except Exception as e: + logger.exception(f"批量删除表情包失败: {e}") + raise HTTPException(status_code=500, detail=f"批量删除失败: {str(e)}") from e diff --git a/src/webui/expression_routes.py b/src/webui/expression_routes.py index de2594ee..983918cf 100644 --- a/src/webui/expression_routes.py +++ b/src/webui/expression_routes.py @@ -1,4 +1,5 @@ """表达方式管理 API 路由""" + from fastapi import APIRouter, HTTPException, Header, Query from pydantic import BaseModel from typing import Optional, List @@ -15,6 +16,7 @@ router = APIRouter(prefix="/expression", tags=["Expression"]) class ExpressionResponse(BaseModel): """表达方式响应""" + id: int situation: str style: str @@ -27,6 +29,7 @@ class ExpressionResponse(BaseModel): class ExpressionListResponse(BaseModel): """表达方式列表响应""" + success: bool total: int page: int @@ -36,12 +39,14 @@ class ExpressionListResponse(BaseModel): class ExpressionDetailResponse(BaseModel): """表达方式详情响应""" + success: bool data: ExpressionResponse class ExpressionCreateRequest(BaseModel): """表达方式创建请求""" + situation: str style: str context: Optional[str] = None @@ -51,6 +56,7 @@ class ExpressionCreateRequest(BaseModel): class ExpressionUpdateRequest(BaseModel): """表达方式更新请求""" + situation: Optional[str] = None style: Optional[str] = None context: Optional[str] = None @@ -60,6 +66,7 @@ class ExpressionUpdateRequest(BaseModel): class ExpressionUpdateResponse(BaseModel): """表达方式更新响应""" + success: bool message: str data: Optional[ExpressionResponse] = None @@ -67,12 +74,14 @@ class ExpressionUpdateResponse(BaseModel): class ExpressionDeleteResponse(BaseModel): """表达方式删除响应""" + success: bool message: str class ExpressionCreateResponse(BaseModel): """表达方式创建响应""" + success: bool message: str data: ExpressionResponse @@ -82,13 +91,13 @@ def verify_auth_token(authorization: Optional[str]) -> bool: """验证认证 Token""" if not authorization or not authorization.startswith("Bearer "): raise HTTPException(status_code=401, detail="未提供有效的认证信息") - + token = authorization.replace("Bearer ", "") token_manager = get_token_manager() - + if not token_manager.verify_token(token): raise HTTPException(status_code=401, detail="Token 无效或已过期") - + return True @@ -112,64 +121,58 @@ async def get_expression_list( page_size: int = Query(20, ge=1, le=100, description="每页数量"), search: Optional[str] = Query(None, description="搜索关键词"), chat_id: Optional[str] = Query(None, description="聊天ID筛选"), - authorization: Optional[str] = Header(None) + authorization: Optional[str] = Header(None), ): """ 获取表达方式列表 - + Args: page: 页码 (从 1 开始) page_size: 每页数量 (1-100) search: 搜索关键词 (匹配 situation, style, context) chat_id: 聊天ID筛选 authorization: Authorization header - + Returns: 表达方式列表 """ try: verify_auth_token(authorization) - + # 构建查询 query = Expression.select() - + # 搜索过滤 if search: query = query.where( - (Expression.situation.contains(search)) | - (Expression.style.contains(search)) | - (Expression.context.contains(search)) + (Expression.situation.contains(search)) + | (Expression.style.contains(search)) + | (Expression.context.contains(search)) ) - + # 聊天ID过滤 if chat_id: query = query.where(Expression.chat_id == chat_id) - + # 排序:最后活跃时间倒序(NULL 值放在最后) from peewee import Case + query = query.order_by( - Case(None, [(Expression.last_active_time.is_null(), 1)], 0), - Expression.last_active_time.desc() + Case(None, [(Expression.last_active_time.is_null(), 1)], 0), Expression.last_active_time.desc() ) - + # 获取总数 total = query.count() - + # 分页 offset = (page - 1) * page_size expressions = query.offset(offset).limit(page_size) - + # 转换为响应对象 data = [expression_to_response(expr) for expr in expressions] - - return ExpressionListResponse( - success=True, - total=total, - page=page, - page_size=page_size, - data=data - ) - + + return ExpressionListResponse(success=True, total=total, page=page, page_size=page_size, data=data) + except HTTPException: raise except Exception as e: @@ -178,33 +181,27 @@ async def get_expression_list( @router.get("/{expression_id}", response_model=ExpressionDetailResponse) -async def get_expression_detail( - expression_id: int, - authorization: Optional[str] = Header(None) -): +async def get_expression_detail(expression_id: int, authorization: Optional[str] = Header(None)): """ 获取表达方式详细信息 - + Args: expression_id: 表达方式ID authorization: Authorization header - + Returns: 表达方式详细信息 """ try: verify_auth_token(authorization) - + expression = Expression.get_or_none(Expression.id == expression_id) - + if not expression: raise HTTPException(status_code=404, detail=f"未找到 ID 为 {expression_id} 的表达方式") - - return ExpressionDetailResponse( - success=True, - data=expression_to_response(expression) - ) - + + return ExpressionDetailResponse(success=True, data=expression_to_response(expression)) + except HTTPException: raise except Exception as e: @@ -213,25 +210,22 @@ async def get_expression_detail( @router.post("/", response_model=ExpressionCreateResponse) -async def create_expression( - request: ExpressionCreateRequest, - authorization: Optional[str] = Header(None) -): +async def create_expression(request: ExpressionCreateRequest, authorization: Optional[str] = Header(None)): """ 创建新的表达方式 - + Args: request: 创建请求 authorization: Authorization header - + Returns: 创建结果 """ try: verify_auth_token(authorization) - + current_time = time.time() - + # 创建表达方式 expression = Expression.create( situation=request.situation, @@ -242,15 +236,13 @@ async def create_expression( last_active_time=current_time, create_date=current_time, ) - + logger.info(f"表达方式已创建: ID={expression.id}, situation={request.situation}") - + return ExpressionCreateResponse( - success=True, - message="表达方式创建成功", - data=expression_to_response(expression) + success=True, message="表达方式创建成功", data=expression_to_response(expression) ) - + except HTTPException: raise except Exception as e: @@ -260,52 +252,48 @@ async def create_expression( @router.patch("/{expression_id}", response_model=ExpressionUpdateResponse) async def update_expression( - expression_id: int, - request: ExpressionUpdateRequest, - authorization: Optional[str] = Header(None) + expression_id: int, request: ExpressionUpdateRequest, authorization: Optional[str] = Header(None) ): """ 增量更新表达方式(只更新提供的字段) - + Args: expression_id: 表达方式ID request: 更新请求(只包含需要更新的字段) authorization: Authorization header - + Returns: 更新结果 """ try: verify_auth_token(authorization) - + expression = Expression.get_or_none(Expression.id == expression_id) - + if not expression: raise HTTPException(status_code=404, detail=f"未找到 ID 为 {expression_id} 的表达方式") - + # 只更新提供的字段 update_data = request.model_dump(exclude_unset=True) - + if not update_data: raise HTTPException(status_code=400, detail="未提供任何需要更新的字段") - + # 更新最后活跃时间 - update_data['last_active_time'] = time.time() - + update_data["last_active_time"] = time.time() + # 执行更新 for field, value in update_data.items(): setattr(expression, field, value) - + expression.save() - + logger.info(f"表达方式已更新: ID={expression_id}, 字段: {list(update_data.keys())}") - + return ExpressionUpdateResponse( - success=True, - message=f"成功更新 {len(update_data)} 个字段", - data=expression_to_response(expression) + success=True, message=f"成功更新 {len(update_data)} 个字段", data=expression_to_response(expression) ) - + except HTTPException: raise except Exception as e: @@ -314,41 +302,35 @@ async def update_expression( @router.delete("/{expression_id}", response_model=ExpressionDeleteResponse) -async def delete_expression( - expression_id: int, - authorization: Optional[str] = Header(None) -): +async def delete_expression(expression_id: int, authorization: Optional[str] = Header(None)): """ 删除表达方式 - + Args: expression_id: 表达方式ID authorization: Authorization header - + Returns: 删除结果 """ try: verify_auth_token(authorization) - + expression = Expression.get_or_none(Expression.id == expression_id) - + if not expression: raise HTTPException(status_code=404, detail=f"未找到 ID 为 {expression_id} 的表达方式") - + # 记录删除信息 situation = expression.situation - + # 执行删除 expression.delete_instance() - + logger.info(f"表达方式已删除: ID={expression_id}, situation={situation}") - - return ExpressionDeleteResponse( - success=True, - message=f"成功删除表达方式: {situation}" - ) - + + return ExpressionDeleteResponse(success=True, message=f"成功删除表达方式: {situation}") + except HTTPException: raise except Exception as e: @@ -356,47 +338,93 @@ async def delete_expression( raise HTTPException(status_code=500, detail=f"删除表达方式失败: {str(e)}") from e +class BatchDeleteRequest(BaseModel): + """批量删除请求""" + + ids: List[int] + + +@router.post("/batch/delete", response_model=ExpressionDeleteResponse) +async def batch_delete_expressions(request: BatchDeleteRequest, authorization: Optional[str] = Header(None)): + """ + 批量删除表达方式 + + Args: + request: 包含要删除的ID列表的请求 + authorization: Authorization header + + Returns: + 删除结果 + """ + try: + verify_auth_token(authorization) + + if not request.ids: + raise HTTPException(status_code=400, detail="未提供要删除的表达方式ID") + + # 查找所有要删除的表达方式 + expressions = Expression.select().where(Expression.id.in_(request.ids)) + found_ids = [expr.id for expr in expressions] + + # 检查是否有未找到的ID + not_found_ids = set(request.ids) - set(found_ids) + if not_found_ids: + logger.warning(f"部分表达方式未找到: {not_found_ids}") + + # 执行批量删除 + deleted_count = Expression.delete().where(Expression.id.in_(found_ids)).execute() + + logger.info(f"批量删除了 {deleted_count} 个表达方式") + + return ExpressionDeleteResponse(success=True, message=f"成功删除 {deleted_count} 个表达方式") + + except HTTPException: + raise + except Exception as e: + logger.exception(f"批量删除表达方式失败: {e}") + raise HTTPException(status_code=500, detail=f"批量删除表达方式失败: {str(e)}") from e + + @router.get("/stats/summary") -async def get_expression_stats( - authorization: Optional[str] = Header(None) -): +async def get_expression_stats(authorization: Optional[str] = Header(None)): """ 获取表达方式统计数据 - + Args: authorization: Authorization header - + Returns: 统计数据 """ try: verify_auth_token(authorization) - + total = Expression.select().count() - + # 按 chat_id 统计 chat_stats = {} for expr in Expression.select(Expression.chat_id): chat_id = expr.chat_id chat_stats[chat_id] = chat_stats.get(chat_id, 0) + 1 - + # 获取最近创建的记录数(7天内) seven_days_ago = time.time() - (7 * 24 * 60 * 60) - recent = Expression.select().where( - (Expression.create_date.is_null(False)) & - (Expression.create_date >= seven_days_ago) - ).count() - + recent = ( + Expression.select() + .where((Expression.create_date.is_null(False)) & (Expression.create_date >= seven_days_ago)) + .count() + ) + return { "success": True, "data": { "total": total, "recent_7days": recent, "chat_count": len(chat_stats), - "top_chats": dict(sorted(chat_stats.items(), key=lambda x: x[1], reverse=True)[:10]) - } + "top_chats": dict(sorted(chat_stats.items(), key=lambda x: x[1], reverse=True)[:10]), + }, } - + except HTTPException: raise except Exception as e: diff --git a/src/webui/git_mirror_service.py b/src/webui/git_mirror_service.py index 02645f70..df00cde9 100644 --- a/src/webui/git_mirror_service.py +++ b/src/webui/git_mirror_service.py @@ -1,4 +1,5 @@ """Git 镜像源服务 - 支持多镜像源、错误重试、Git 克隆和 Raw 文件获取""" + from typing import Optional, List, Dict, Any from enum import Enum import httpx @@ -15,6 +16,7 @@ logger = get_logger("webui.git_mirror") # 导入进度更新函数(避免循环导入) _update_progress = None + def set_update_progress_callback(callback): """设置进度更新回调函数""" global _update_progress @@ -23,6 +25,7 @@ def set_update_progress_callback(callback): class MirrorType(str, Enum): """镜像源类型""" + GH_PROXY = "gh-proxy" # gh-proxy 主节点 HK_GH_PROXY = "hk-gh-proxy" # gh-proxy 香港节点 CDN_GH_PROXY = "cdn-gh-proxy" # gh-proxy CDN 节点 @@ -34,10 +37,10 @@ class MirrorType(str, Enum): class GitMirrorConfig: """Git 镜像源配置管理""" - + # 配置文件路径 CONFIG_FILE = Path("data/webui.json") - + # 默认镜像源配置 DEFAULT_MIRRORS = [ { @@ -47,7 +50,7 @@ class GitMirrorConfig: "clone_prefix": "https://gh-proxy.org/https://github.com", "enabled": True, "priority": 1, - "created_at": None + "created_at": None, }, { "id": "hk-gh-proxy", @@ -56,7 +59,7 @@ class GitMirrorConfig: "clone_prefix": "https://hk.gh-proxy.org/https://github.com", "enabled": True, "priority": 2, - "created_at": None + "created_at": None, }, { "id": "cdn-gh-proxy", @@ -65,7 +68,7 @@ class GitMirrorConfig: "clone_prefix": "https://cdn.gh-proxy.org/https://github.com", "enabled": True, "priority": 3, - "created_at": None + "created_at": None, }, { "id": "edgeone-gh-proxy", @@ -74,7 +77,7 @@ class GitMirrorConfig: "clone_prefix": "https://edgeone.gh-proxy.org/https://github.com", "enabled": True, "priority": 4, - "created_at": None + "created_at": None, }, { "id": "meyzh-github", @@ -83,7 +86,7 @@ class GitMirrorConfig: "clone_prefix": "https://meyzh.github.io/https://github.com", "enabled": True, "priority": 5, - "created_at": None + "created_at": None, }, { "id": "github", @@ -92,23 +95,23 @@ class GitMirrorConfig: "clone_prefix": "https://github.com", "enabled": True, "priority": 999, - "created_at": None - } + "created_at": None, + }, ] - + def __init__(self): """初始化配置管理器""" self.config_file = self.CONFIG_FILE self.mirrors: List[Dict[str, Any]] = [] self._load_config() - + def _load_config(self) -> None: """加载配置文件""" try: if self.config_file.exists(): - with open(self.config_file, 'r', encoding='utf-8') as f: + with open(self.config_file, "r", encoding="utf-8") as f: data = json.load(f) - + # 检查是否有镜像源配置 if "git_mirrors" not in data or not data["git_mirrors"]: logger.info("配置文件中未找到镜像源配置,使用默认配置") @@ -122,59 +125,59 @@ class GitMirrorConfig: except Exception as e: logger.error(f"加载配置文件失败: {e}") self._init_default_mirrors() - + def _init_default_mirrors(self) -> None: """初始化默认镜像源""" current_time = datetime.now().isoformat() self.mirrors = [] - + for mirror in self.DEFAULT_MIRRORS: mirror_copy = mirror.copy() mirror_copy["created_at"] = current_time self.mirrors.append(mirror_copy) - + self._save_config() logger.info(f"已初始化 {len(self.mirrors)} 个默认镜像源") - + def _save_config(self) -> None: """保存配置到文件""" try: # 确保目录存在 self.config_file.parent.mkdir(parents=True, exist_ok=True) - + # 读取现有配置 existing_data = {} if self.config_file.exists(): - with open(self.config_file, 'r', encoding='utf-8') as f: + with open(self.config_file, "r", encoding="utf-8") as f: existing_data = json.load(f) - + # 更新镜像源配置 existing_data["git_mirrors"] = self.mirrors - + # 写入文件 - with open(self.config_file, 'w', encoding='utf-8') as f: + with open(self.config_file, "w", encoding="utf-8") as f: json.dump(existing_data, f, indent=2, ensure_ascii=False) - + logger.debug(f"配置已保存到 {self.config_file}") except Exception as e: logger.error(f"保存配置文件失败: {e}") - + def get_all_mirrors(self) -> List[Dict[str, Any]]: """获取所有镜像源""" return self.mirrors.copy() - + def get_enabled_mirrors(self) -> List[Dict[str, Any]]: """获取所有启用的镜像源,按优先级排序""" enabled = [m for m in self.mirrors if m.get("enabled", False)] return sorted(enabled, key=lambda x: x.get("priority", 999)) - + def get_mirror_by_id(self, mirror_id: str) -> Optional[Dict[str, Any]]: """根据 ID 获取镜像源""" for mirror in self.mirrors: if mirror.get("id") == mirror_id: return mirror.copy() return None - + def add_mirror( self, mirror_id: str, @@ -182,26 +185,26 @@ class GitMirrorConfig: raw_prefix: str, clone_prefix: str, enabled: bool = True, - priority: Optional[int] = None + priority: Optional[int] = None, ) -> Dict[str, Any]: """ 添加新的镜像源 - + Returns: 添加的镜像源配置 - + Raises: ValueError: 如果镜像源 ID 已存在 """ # 检查 ID 是否已存在 if self.get_mirror_by_id(mirror_id): raise ValueError(f"镜像源 ID 已存在: {mirror_id}") - + # 如果未指定优先级,使用最大优先级 + 1 if priority is None: max_priority = max((m.get("priority", 0) for m in self.mirrors), default=0) priority = max_priority + 1 - + new_mirror = { "id": mirror_id, "name": name, @@ -209,15 +212,15 @@ class GitMirrorConfig: "clone_prefix": clone_prefix, "enabled": enabled, "priority": priority, - "created_at": datetime.now().isoformat() + "created_at": datetime.now().isoformat(), } - + self.mirrors.append(new_mirror) self._save_config() - + logger.info(f"已添加镜像源: {mirror_id} - {name}") return new_mirror.copy() - + def update_mirror( self, mirror_id: str, @@ -225,11 +228,11 @@ class GitMirrorConfig: raw_prefix: Optional[str] = None, clone_prefix: Optional[str] = None, enabled: Optional[bool] = None, - priority: Optional[int] = None + priority: Optional[int] = None, ) -> Optional[Dict[str, Any]]: """ 更新镜像源配置 - + Returns: 更新后的镜像源配置,如果不存在则返回 None """ @@ -245,19 +248,19 @@ class GitMirrorConfig: mirror["enabled"] = enabled if priority is not None: mirror["priority"] = priority - + mirror["updated_at"] = datetime.now().isoformat() self._save_config() - + logger.info(f"已更新镜像源: {mirror_id}") return mirror.copy() - + return None - + def delete_mirror(self, mirror_id: str) -> bool: """ 删除镜像源 - + Returns: True 如果删除成功,False 如果镜像源不存在 """ @@ -267,9 +270,9 @@ class GitMirrorConfig: self._save_config() logger.info(f"已删除镜像源: {mirror_id}") return True - + return False - + def get_default_priority_list(self) -> List[str]: """获取默认优先级列表(仅启用的镜像源 ID)""" enabled = self.get_enabled_mirrors() @@ -278,16 +281,11 @@ class GitMirrorConfig: class GitMirrorService: """Git 镜像源服务""" - - def __init__( - self, - max_retries: int = 3, - timeout: int = 30, - config: Optional[GitMirrorConfig] = None - ): + + def __init__(self, max_retries: int = 3, timeout: int = 30, config: Optional[GitMirrorConfig] = None): """ 初始化 Git 镜像源服务 - + Args: max_retries: 最大重试次数 timeout: 请求超时时间(秒) @@ -297,16 +295,16 @@ class GitMirrorService: self.timeout = timeout self.config = config or GitMirrorConfig() logger.info(f"Git镜像源服务初始化完成,已加载 {len(self.config.get_enabled_mirrors())} 个启用的镜像源") - + def get_mirror_config(self) -> GitMirrorConfig: """获取镜像源配置管理器""" return self.config - + @staticmethod def check_git_installed() -> Dict[str, Any]: """ 检查本机是否安装了 Git - + Returns: Dict 包含: - installed: bool - 是否已安装 Git @@ -316,54 +314,33 @@ class GitMirrorService: """ import subprocess import shutil - + try: # 查找 git 可执行文件路径 git_path = shutil.which("git") - + if not git_path: logger.warning("未找到 Git 可执行文件") - return { - "installed": False, - "error": "系统中未找到 Git,请先安装 Git" - } - + return {"installed": False, "error": "系统中未找到 Git,请先安装 Git"} + # 获取 Git 版本 - result = subprocess.run( - ["git", "--version"], - capture_output=True, - text=True, - timeout=5 - ) - + result = subprocess.run(["git", "--version"], capture_output=True, text=True, timeout=5) + if result.returncode == 0: version = result.stdout.strip() logger.info(f"检测到 Git: {version} at {git_path}") - return { - "installed": True, - "version": version, - "path": git_path - } + return {"installed": True, "version": version, "path": git_path} else: logger.warning(f"Git 命令执行失败: {result.stderr}") - return { - "installed": False, - "error": f"Git 命令执行失败: {result.stderr}" - } - + return {"installed": False, "error": f"Git 命令执行失败: {result.stderr}"} + except subprocess.TimeoutExpired: logger.error("Git 版本检测超时") - return { - "installed": False, - "error": "Git 版本检测超时" - } + return {"installed": False, "error": "Git 版本检测超时"} except Exception as e: logger.error(f"检测 Git 时发生错误: {e}") - return { - "installed": False, - "error": f"检测 Git 时发生错误: {str(e)}" - } - + return {"installed": False, "error": f"检测 Git 时发生错误: {str(e)}"} + async def fetch_raw_file( self, owner: str, @@ -371,11 +348,11 @@ class GitMirrorService: branch: str, file_path: str, mirror_id: Optional[str] = None, - custom_url: Optional[str] = None + custom_url: Optional[str] = None, ) -> Dict[str, Any]: """ 获取 GitHub 仓库的 Raw 文件内容 - + Args: owner: 仓库所有者 repo: 仓库名称 @@ -383,7 +360,7 @@ class GitMirrorService: file_path: 文件路径 mirror_id: 指定的镜像源 ID custom_url: 自定义完整 URL(如果提供,将忽略其他参数) - + Returns: Dict 包含: - success: bool - 是否成功 @@ -393,29 +370,24 @@ class GitMirrorService: - attempts: int - 尝试次数 """ logger.info(f"开始获取 Raw 文件: {owner}/{repo}/{branch}/{file_path}") - + if custom_url: # 使用自定义 URL return await self._fetch_with_url(custom_url, "custom") - + # 确定要使用的镜像源列表 if mirror_id: # 使用指定的镜像源 mirror = self.config.get_mirror_by_id(mirror_id) if not mirror: - return { - "success": False, - "error": f"未找到镜像源: {mirror_id}", - "mirror_used": None, - "attempts": 0 - } + return {"success": False, "error": f"未找到镜像源: {mirror_id}", "mirror_used": None, "attempts": 0} mirrors_to_try = [mirror] else: # 使用所有启用的镜像源 mirrors_to_try = self.config.get_enabled_mirrors() - + total_mirrors = len(mirrors_to_try) - + # 依次尝试每个镜像源 for index, mirror in enumerate(mirrors_to_try, 1): # 推送进度:正在尝试第 N 个镜像源 @@ -427,15 +399,13 @@ class GitMirrorService: progress=progress, message=f"正在尝试镜像源 {index}/{total_mirrors}: {mirror['name']}", total_plugins=0, - loaded_plugins=0 + loaded_plugins=0, ) except Exception as e: logger.warning(f"推送进度失败: {e}") - - result = await self._fetch_raw_from_mirror( - owner, repo, branch, file_path, mirror - ) - + + result = await self._fetch_raw_from_mirror(owner, repo, branch, file_path, mirror) + if result["success"]: # 成功,推送进度 if _update_progress: @@ -445,15 +415,15 @@ class GitMirrorService: progress=70, message=f"成功从 {mirror['name']} 获取数据", total_plugins=0, - loaded_plugins=0 + loaded_plugins=0, ) except Exception as e: logger.warning(f"推送进度失败: {e}") return result - + # 失败,记录日志并推送失败信息 logger.warning(f"镜像源 {mirror['id']} 失败: {result.get('error')}") - + if _update_progress and index < total_mirrors: try: await _update_progress( @@ -461,39 +431,29 @@ class GitMirrorService: progress=30 + int(index / total_mirrors * 40), message=f"镜像源 {mirror['name']} 失败,尝试下一个...", total_plugins=0, - loaded_plugins=0 + loaded_plugins=0, ) except Exception as e: logger.warning(f"推送进度失败: {e}") - + # 所有镜像源都失败 - return { - "success": False, - "error": "所有镜像源均失败", - "mirror_used": None, - "attempts": len(mirrors_to_try) - } - + return {"success": False, "error": "所有镜像源均失败", "mirror_used": None, "attempts": len(mirrors_to_try)} + async def _fetch_raw_from_mirror( - self, - owner: str, - repo: str, - branch: str, - file_path: str, - mirror: Dict[str, Any] + self, owner: str, repo: str, branch: str, file_path: str, mirror: Dict[str, Any] ) -> Dict[str, Any]: """从指定镜像源获取文件""" # 构建 URL raw_prefix = mirror["raw_prefix"] url = f"{raw_prefix}/{owner}/{repo}/{branch}/{file_path}" - + return await self._fetch_with_url(url, mirror["id"]) - + async def _fetch_with_url(self, url: str, mirror_type: str) -> Dict[str, Any]: """使用指定 URL 获取文件,支持重试""" attempts = 0 last_error = None - + for attempt in range(self.max_retries): attempts += 1 try: @@ -501,14 +461,14 @@ class GitMirrorService: async with httpx.AsyncClient(timeout=self.timeout) as client: response = await client.get(url) response.raise_for_status() - + logger.info(f"成功获取文件: {url}") return { "success": True, "data": response.text, "mirror_used": mirror_type, "attempts": attempts, - "url": url + "url": url, } except httpx.HTTPStatusError as e: last_error = f"HTTP {e.response.status_code}: {e}" @@ -519,15 +479,9 @@ class GitMirrorService: except Exception as e: last_error = f"未知错误: {e}" logger.error(f"错误 (尝试 {attempt + 1}/{self.max_retries}): {last_error}") - - return { - "success": False, - "error": last_error, - "mirror_used": mirror_type, - "attempts": attempts, - "url": url - } - + + return {"success": False, "error": last_error, "mirror_used": mirror_type, "attempts": attempts, "url": url} + async def clone_repository( self, owner: str, @@ -536,11 +490,11 @@ class GitMirrorService: branch: Optional[str] = None, mirror_id: Optional[str] = None, custom_url: Optional[str] = None, - depth: Optional[int] = None + depth: Optional[int] = None, ) -> Dict[str, Any]: """ 克隆 GitHub 仓库 - + Args: owner: 仓库所有者 repo: 仓库名称 @@ -549,7 +503,7 @@ class GitMirrorService: mirror_id: 指定的镜像源 ID custom_url: 自定义克隆 URL depth: 克隆深度(浅克隆) - + Returns: Dict 包含: - success: bool - 是否成功 @@ -559,44 +513,32 @@ class GitMirrorService: - attempts: int - 尝试次数 """ logger.info(f"开始克隆仓库: {owner}/{repo} 到 {target_path}") - + if custom_url: # 使用自定义 URL return await self._clone_with_url(custom_url, target_path, branch, depth, "custom") - + # 确定要使用的镜像源列表 if mirror_id: # 使用指定的镜像源 mirror = self.config.get_mirror_by_id(mirror_id) if not mirror: - return { - "success": False, - "error": f"未找到镜像源: {mirror_id}", - "mirror_used": None, - "attempts": 0 - } + return {"success": False, "error": f"未找到镜像源: {mirror_id}", "mirror_used": None, "attempts": 0} mirrors_to_try = [mirror] else: # 使用所有启用的镜像源 mirrors_to_try = self.config.get_enabled_mirrors() - + # 依次尝试每个镜像源 for mirror in mirrors_to_try: - result = await self._clone_from_mirror( - owner, repo, target_path, branch, depth, mirror - ) + result = await self._clone_from_mirror(owner, repo, target_path, branch, depth, mirror) if result["success"]: return result logger.warning(f"镜像源 {mirror['id']} 克隆失败: {result.get('error')}") - + # 所有镜像源都失败 - return { - "success": False, - "error": "所有镜像源克隆均失败", - "mirror_used": None, - "attempts": len(mirrors_to_try) - } - + return {"success": False, "error": "所有镜像源克隆均失败", "mirror_used": None, "attempts": len(mirrors_to_try)} + async def _clone_from_mirror( self, owner: str, @@ -604,52 +546,47 @@ class GitMirrorService: target_path: Path, branch: Optional[str], depth: Optional[int], - mirror: Dict[str, Any] + mirror: Dict[str, Any], ) -> Dict[str, Any]: """从指定镜像源克隆仓库""" # 构建克隆 URL clone_prefix = mirror["clone_prefix"] url = f"{clone_prefix}/{owner}/{repo}.git" - + return await self._clone_with_url(url, target_path, branch, depth, mirror["id"]) - + async def _clone_with_url( - self, - url: str, - target_path: Path, - branch: Optional[str], - depth: Optional[int], - mirror_type: str + self, url: str, target_path: Path, branch: Optional[str], depth: Optional[int], mirror_type: str ) -> Dict[str, Any]: """使用指定 URL 克隆仓库,支持重试""" attempts = 0 last_error = None - + for attempt in range(self.max_retries): attempts += 1 - + try: # 确保目标路径不存在 if target_path.exists(): logger.warning(f"目标路径已存在,删除: {target_path}") shutil.rmtree(target_path, ignore_errors=True) - + # 构建 git clone 命令 cmd = ["git", "clone"] - + # 添加分支参数 if branch: cmd.extend(["-b", branch]) - + # 添加深度参数(浅克隆) if depth: cmd.extend(["--depth", str(depth)]) - + # 添加 URL 和目标路径 cmd.extend([url, str(target_path)]) - + logger.info(f"尝试克隆 #{attempt + 1}: {' '.join(cmd)}") - + # 推送进度 if _update_progress: try: @@ -657,24 +594,24 @@ class GitMirrorService: stage="loading", progress=20 + attempt * 10, message=f"正在克隆仓库 (尝试 {attempt + 1}/{self.max_retries})...", - operation="install" + operation="install", ) except Exception as e: logger.warning(f"推送进度失败: {e}") - + # 执行 git clone(在线程池中运行以避免阻塞) loop = asyncio.get_event_loop() - + def run_git_clone(): return subprocess.run( cmd, capture_output=True, text=True, - timeout=300 # 5分钟超时 + timeout=300, # 5分钟超时 ) - + process = await loop.run_in_executor(None, run_git_clone) - + if process.returncode == 0: logger.info(f"成功克隆仓库: {url} -> {target_path}") return { @@ -683,40 +620,34 @@ class GitMirrorService: "mirror_used": mirror_type, "attempts": attempts, "url": url, - "branch": branch or "default" + "branch": branch or "default", } else: last_error = f"Git 克隆失败: {process.stderr}" logger.warning(f"克隆失败 (尝试 {attempt + 1}/{self.max_retries}): {last_error}") - + except subprocess.TimeoutExpired: last_error = "克隆超时(超过 5 分钟)" logger.warning(f"克隆超时 (尝试 {attempt + 1}/{self.max_retries})") - + # 清理可能的部分克隆 if target_path.exists(): shutil.rmtree(target_path, ignore_errors=True) - + except FileNotFoundError: last_error = "Git 未安装或不在 PATH 中" logger.error(f"Git 未找到: {last_error}") break # Git 不存在,不需要重试 - + except Exception as e: last_error = f"未知错误: {e}" logger.error(f"克隆错误 (尝试 {attempt + 1}/{self.max_retries}): {last_error}") - + # 清理可能的部分克隆 if target_path.exists(): shutil.rmtree(target_path, ignore_errors=True) - - return { - "success": False, - "error": last_error, - "mirror_used": mirror_type, - "attempts": attempts, - "url": url - } + + return {"success": False, "error": last_error, "mirror_used": mirror_type, "attempts": attempts, "url": url} # 全局服务实例 diff --git a/src/webui/logs_ws.py b/src/webui/logs_ws.py index d8ef65aa..e0e0a9a1 100644 --- a/src/webui/logs_ws.py +++ b/src/webui/logs_ws.py @@ -1,4 +1,5 @@ """WebSocket 日志推送模块""" + from fastapi import APIRouter, WebSocket, WebSocketDisconnect from typing import Set import json @@ -14,30 +15,30 @@ active_connections: Set[WebSocket] = set() def load_recent_logs(limit: int = 100) -> list[dict]: """从日志文件中加载最近的日志 - + Args: limit: 返回的最大日志条数 - + Returns: 日志列表 """ logs = [] log_dir = Path("logs") - + if not log_dir.exists(): return logs - + # 获取所有日志文件,按修改时间排序 log_files = sorted(log_dir.glob("app_*.log.jsonl"), key=lambda f: f.stat().st_mtime, reverse=True) - + # 用于生成唯一 ID 的计数器 log_counter = 0 - + # 从最新的文件开始读取 for log_file in log_files: if len(logs) >= limit: break - + try: with open(log_file, "r", encoding="utf-8") as f: lines = f.readlines() @@ -49,7 +50,9 @@ def load_recent_logs(limit: int = 100) -> list[dict]: log_entry = json.loads(line.strip()) # 转换为前端期望的格式 # 使用时间戳 + 计数器生成唯一 ID - timestamp_id = log_entry.get("timestamp", "0").replace("-", "").replace(" ", "").replace(":", "") + timestamp_id = ( + log_entry.get("timestamp", "0").replace("-", "").replace(" ", "").replace(":", "") + ) formatted_log = { "id": f"{timestamp_id}_{log_counter}", "timestamp": log_entry.get("timestamp", ""), @@ -64,7 +67,7 @@ def load_recent_logs(limit: int = 100) -> list[dict]: except Exception as e: logger.error(f"读取日志文件失败 {log_file}: {e}") continue - + # 反转列表,使其按时间顺序排列(旧到新) return list(reversed(logs)) @@ -72,35 +75,35 @@ def load_recent_logs(limit: int = 100) -> list[dict]: @router.websocket("/ws/logs") async def websocket_logs(websocket: WebSocket): """WebSocket 日志推送端点 - + 客户端连接后会持续接收服务器端的日志消息 """ await websocket.accept() active_connections.add(websocket) logger.info(f"📡 WebSocket 客户端已连接,当前连接数: {len(active_connections)}") - + # 连接建立后,立即发送历史日志 try: recent_logs = load_recent_logs(limit=100) logger.info(f"发送 {len(recent_logs)} 条历史日志到客户端") - + for log_entry in recent_logs: await websocket.send_text(json.dumps(log_entry, ensure_ascii=False)) except Exception as e: logger.error(f"发送历史日志失败: {e}") - + try: # 保持连接,等待客户端消息或断开 while True: # 接收客户端消息(用于心跳或控制指令) data = await websocket.receive_text() - + # 可以处理客户端的控制消息,例如: # - "ping" -> 心跳检测 # - {"filter": "ERROR"} -> 设置日志级别过滤 if data == "ping": await websocket.send_text("pong") - + except WebSocketDisconnect: active_connections.discard(websocket) logger.info(f"📡 WebSocket 客户端已断开,当前连接数: {len(active_connections)}") @@ -111,19 +114,19 @@ async def websocket_logs(websocket: WebSocket): async def broadcast_log(log_data: dict): """广播日志到所有连接的 WebSocket 客户端 - + Args: log_data: 日志数据字典 """ if not active_connections: return - + # 格式化为 JSON message = json.dumps(log_data, ensure_ascii=False) - + # 记录需要断开的连接 disconnected = set() - + # 广播到所有客户端 for connection in active_connections: try: @@ -131,7 +134,7 @@ async def broadcast_log(log_data: dict): except Exception: # 发送失败,标记为断开 disconnected.add(connection) - + # 清理断开的连接 if disconnected: active_connections.difference_update(disconnected) diff --git a/src/webui/manager.py b/src/webui/manager.py deleted file mode 100644 index 3919df17..00000000 --- a/src/webui/manager.py +++ /dev/null @@ -1,108 +0,0 @@ -"""WebUI 管理器 - 处理开发/生产环境的 WebUI 启动""" -import os -from pathlib import Path -from src.common.logger import get_logger -from .token_manager import get_token_manager - -logger = get_logger("webui") - - -def setup_webui(mode: str = "production") -> bool: - """ - 设置 WebUI - - Args: - mode: 运行模式,"development" 或 "production" - - Returns: - bool: 是否成功设置 - """ - # 初始化 Token 管理器(确保 token 文件存在) - token_manager = get_token_manager() - current_token = token_manager.get_token() - logger.info(f"🔑 WebUI Access Token: {current_token}") - logger.info("💡 请使用此 Token 登录 WebUI") - - if mode == "development": - return setup_dev_mode() - else: - return setup_production_mode() - - -def setup_dev_mode() -> bool: - """设置开发模式 - 仅启用 CORS,前端自行启动""" - from src.common.server import get_global_server - from .logs_ws import router as logs_router - - # 注册 WebSocket 日志路由(开发模式也需要) - server = get_global_server() - server.register_router(logs_router) - logger.info("✅ WebSocket 日志推送路由已注册") - - logger.info("📝 WebUI 开发模式已启用") - logger.info("🌐 请手动启动前端开发服务器: cd webui && npm run dev") - logger.info("💡 前端将运行在 http://localhost:7999") - return True - - -def setup_production_mode() -> bool: - """设置生产模式 - 挂载静态文件""" - try: - from src.common.server import get_global_server - from starlette.responses import FileResponse - from .logs_ws import router as logs_router - import mimetypes - - # 确保正确的 MIME 类型映射 - mimetypes.init() - mimetypes.add_type('application/javascript', '.js') - mimetypes.add_type('application/javascript', '.mjs') - mimetypes.add_type('text/css', '.css') - mimetypes.add_type('application/json', '.json') - - server = get_global_server() - - # 注册 WebSocket 日志路由 - server.register_router(logs_router) - logger.info("✅ WebSocket 日志推送路由已注册") - - base_dir = Path(__file__).parent.parent.parent - static_path = base_dir / "webui" / "dist" - - if not static_path.exists(): - logger.warning(f"❌ WebUI 静态文件目录不存在: {static_path}") - logger.warning("💡 请先构建前端: cd webui && npm run build") - return False - - if not (static_path / "index.html").exists(): - logger.warning(f"❌ 未找到 index.html: {static_path / 'index.html'}") - logger.warning("💡 请确认前端已正确构建") - return False - - # 处理 SPA 路由 - @server.app.get("/{full_path:path}") - async def serve_spa(full_path: str): - """服务单页应用""" - # API 路由不处理 - if full_path.startswith("api/"): - return None - - # 检查文件是否存在 - file_path = static_path / full_path - if file_path.is_file(): - # 自动检测 MIME 类型 - media_type = mimetypes.guess_type(str(file_path))[0] - return FileResponse(file_path, media_type=media_type) - - # 返回 index.html(SPA 路由) - return FileResponse(static_path / "index.html", media_type="text/html") - - host = os.getenv("HOST", "127.0.0.1") - port = os.getenv("PORT", "8000") - logger.info("✅ WebUI 生产模式已挂载") - logger.info(f"🌐 访问 http://{host}:{port} 查看 WebUI") - return True - - except Exception as e: - logger.error(f"挂载 WebUI 静态文件失败: {e}") - return False diff --git a/src/webui/person_routes.py b/src/webui/person_routes.py index a5488d49..5935a2fa 100644 --- a/src/webui/person_routes.py +++ b/src/webui/person_routes.py @@ -1,4 +1,5 @@ """人物信息管理 API 路由""" + from fastapi import APIRouter, HTTPException, Header, Query from pydantic import BaseModel from typing import Optional, List, Dict @@ -16,6 +17,7 @@ router = APIRouter(prefix="/person", tags=["Person"]) class PersonInfoResponse(BaseModel): """人物信息响应""" + id: int is_known: bool person_id: str @@ -33,6 +35,7 @@ class PersonInfoResponse(BaseModel): class PersonListResponse(BaseModel): """人物列表响应""" + success: bool total: int page: int @@ -42,12 +45,14 @@ class PersonListResponse(BaseModel): class PersonDetailResponse(BaseModel): """人物详情响应""" + success: bool data: PersonInfoResponse class PersonUpdateRequest(BaseModel): """人物信息更新请求""" + person_name: Optional[str] = None name_reason: Optional[str] = None nickname: Optional[str] = None @@ -57,6 +62,7 @@ class PersonUpdateRequest(BaseModel): class PersonUpdateResponse(BaseModel): """人物信息更新响应""" + success: bool message: str data: Optional[PersonInfoResponse] = None @@ -64,21 +70,38 @@ class PersonUpdateResponse(BaseModel): class PersonDeleteResponse(BaseModel): """人物删除响应""" + success: bool message: str +class BatchDeleteRequest(BaseModel): + """批量删除请求""" + + person_ids: List[str] + + +class BatchDeleteResponse(BaseModel): + """批量删除响应""" + + success: bool + message: str + deleted_count: int + failed_count: int + failed_ids: List[str] = [] + + def verify_auth_token(authorization: Optional[str]) -> bool: """验证认证 Token""" if not authorization or not authorization.startswith("Bearer "): raise HTTPException(status_code=401, detail="未提供有效的认证信息") - + token = authorization.replace("Bearer ", "") token_manager = get_token_manager() - + if not token_manager.verify_token(token): raise HTTPException(status_code=401, detail="Token 无效或已过期") - + return True @@ -118,11 +141,11 @@ async def get_person_list( search: Optional[str] = Query(None, description="搜索关键词"), is_known: Optional[bool] = Query(None, description="是否已认识筛选"), platform: Optional[str] = Query(None, description="平台筛选"), - authorization: Optional[str] = Header(None) + authorization: Optional[str] = Header(None), ): """ 获取人物信息列表 - + Args: page: 页码 (从 1 开始) page_size: 每页数量 (1-100) @@ -130,58 +153,50 @@ async def get_person_list( is_known: 是否已认识筛选 platform: 平台筛选 authorization: Authorization header - + Returns: 人物信息列表 """ try: verify_auth_token(authorization) - + # 构建查询 query = PersonInfo.select() - + # 搜索过滤 if search: query = query.where( - (PersonInfo.person_name.contains(search)) | - (PersonInfo.nickname.contains(search)) | - (PersonInfo.user_id.contains(search)) + (PersonInfo.person_name.contains(search)) + | (PersonInfo.nickname.contains(search)) + | (PersonInfo.user_id.contains(search)) ) - + # 已认识状态过滤 if is_known is not None: query = query.where(PersonInfo.is_known == is_known) - + # 平台过滤 if platform: query = query.where(PersonInfo.platform == platform) - + # 排序:最后更新时间倒序(NULL 值放在最后) # Peewee 不支持 nulls_last,使用 CASE WHEN 来实现 from peewee import Case - query = query.order_by( - Case(None, [(PersonInfo.last_know.is_null(), 1)], 0), - PersonInfo.last_know.desc() - ) - + + query = query.order_by(Case(None, [(PersonInfo.last_know.is_null(), 1)], 0), PersonInfo.last_know.desc()) + # 获取总数 total = query.count() - + # 分页 offset = (page - 1) * page_size persons = query.offset(offset).limit(page_size) - + # 转换为响应对象 data = [person_to_response(person) for person in persons] - - return PersonListResponse( - success=True, - total=total, - page=page, - page_size=page_size, - data=data - ) - + + return PersonListResponse(success=True, total=total, page=page, page_size=page_size, data=data) + except HTTPException: raise except Exception as e: @@ -190,33 +205,27 @@ async def get_person_list( @router.get("/{person_id}", response_model=PersonDetailResponse) -async def get_person_detail( - person_id: str, - authorization: Optional[str] = Header(None) -): +async def get_person_detail(person_id: str, authorization: Optional[str] = Header(None)): """ 获取人物详细信息 - + Args: person_id: 人物唯一 ID authorization: Authorization header - + Returns: 人物详细信息 """ try: verify_auth_token(authorization) - + person = PersonInfo.get_or_none(PersonInfo.person_id == person_id) - + if not person: raise HTTPException(status_code=404, detail=f"未找到 ID 为 {person_id} 的人物信息") - - return PersonDetailResponse( - success=True, - data=person_to_response(person) - ) - + + return PersonDetailResponse(success=True, data=person_to_response(person)) + except HTTPException: raise except Exception as e: @@ -225,53 +234,47 @@ async def get_person_detail( @router.patch("/{person_id}", response_model=PersonUpdateResponse) -async def update_person( - person_id: str, - request: PersonUpdateRequest, - authorization: Optional[str] = Header(None) -): +async def update_person(person_id: str, request: PersonUpdateRequest, authorization: Optional[str] = Header(None)): """ 增量更新人物信息(只更新提供的字段) - + Args: person_id: 人物唯一 ID request: 更新请求(只包含需要更新的字段) authorization: Authorization header - + Returns: 更新结果 """ try: verify_auth_token(authorization) - + person = PersonInfo.get_or_none(PersonInfo.person_id == person_id) - + if not person: raise HTTPException(status_code=404, detail=f"未找到 ID 为 {person_id} 的人物信息") - + # 只更新提供的字段 update_data = request.model_dump(exclude_unset=True) - + if not update_data: raise HTTPException(status_code=400, detail="未提供任何需要更新的字段") - + # 更新最后修改时间 - update_data['last_know'] = time.time() - + update_data["last_know"] = time.time() + # 执行更新 for field, value in update_data.items(): setattr(person, field, value) - + person.save() - + logger.info(f"人物信息已更新: {person_id}, 字段: {list(update_data.keys())}") - + return PersonUpdateResponse( - success=True, - message=f"成功更新 {len(update_data)} 个字段", - data=person_to_response(person) + success=True, message=f"成功更新 {len(update_data)} 个字段", data=person_to_response(person) ) - + except HTTPException: raise except Exception as e: @@ -280,41 +283,35 @@ async def update_person( @router.delete("/{person_id}", response_model=PersonDeleteResponse) -async def delete_person( - person_id: str, - authorization: Optional[str] = Header(None) -): +async def delete_person(person_id: str, authorization: Optional[str] = Header(None)): """ 删除人物信息 - + Args: person_id: 人物唯一 ID authorization: Authorization header - + Returns: 删除结果 """ try: verify_auth_token(authorization) - + person = PersonInfo.get_or_none(PersonInfo.person_id == person_id) - + if not person: raise HTTPException(status_code=404, detail=f"未找到 ID 为 {person_id} 的人物信息") - + # 记录删除信息 person_name = person.person_name or person.nickname or person.user_id - + # 执行删除 person.delete_instance() - + logger.info(f"人物信息已删除: {person_id} ({person_name})") - - return PersonDeleteResponse( - success=True, - message=f"成功删除人物信息: {person_name}" - ) - + + return PersonDeleteResponse(success=True, message=f"成功删除人物信息: {person_name}") + except HTTPException: raise except Exception as e: @@ -323,43 +320,89 @@ async def delete_person( @router.get("/stats/summary") -async def get_person_stats( - authorization: Optional[str] = Header(None) -): +async def get_person_stats(authorization: Optional[str] = Header(None)): """ 获取人物信息统计数据 - + Args: authorization: Authorization header - + Returns: 统计数据 """ try: verify_auth_token(authorization) - + total = PersonInfo.select().count() known = PersonInfo.select().where(PersonInfo.is_known).count() unknown = total - known - + # 按平台统计 platforms = {} for person in PersonInfo.select(PersonInfo.platform): platform = person.platform platforms[platform] = platforms.get(platform, 0) + 1 - - return { - "success": True, - "data": { - "total": total, - "known": known, - "unknown": unknown, - "platforms": platforms - } - } - + + return {"success": True, "data": {"total": total, "known": known, "unknown": unknown, "platforms": platforms}} + except HTTPException: raise except Exception as e: logger.exception(f"获取统计数据失败: {e}") raise HTTPException(status_code=500, detail=f"获取统计数据失败: {str(e)}") from e + + +@router.post("/batch/delete", response_model=BatchDeleteResponse) +async def batch_delete_persons(request: BatchDeleteRequest, authorization: Optional[str] = Header(None)): + """ + 批量删除人物信息 + + Args: + request: 包含person_ids列表的请求 + authorization: Authorization header + + Returns: + 批量删除结果 + """ + try: + verify_auth_token(authorization) + + if not request.person_ids: + raise HTTPException(status_code=400, detail="未提供要删除的人物ID") + + deleted_count = 0 + failed_count = 0 + failed_ids = [] + + for person_id in request.person_ids: + try: + person = PersonInfo.get_or_none(PersonInfo.person_id == person_id) + if person: + person.delete_instance() + deleted_count += 1 + logger.info(f"批量删除: {person_id}") + else: + failed_count += 1 + failed_ids.append(person_id) + except Exception as e: + logger.error(f"删除 {person_id} 失败: {e}") + failed_count += 1 + failed_ids.append(person_id) + + message = f"成功删除 {deleted_count} 个人物" + if failed_count > 0: + message += f",{failed_count} 个失败" + + return BatchDeleteResponse( + success=True, + message=message, + deleted_count=deleted_count, + failed_count=failed_count, + failed_ids=failed_ids, + ) + + except HTTPException: + raise + except Exception as e: + logger.exception(f"批量删除人物信息失败: {e}") + raise HTTPException(status_code=500, detail=f"批量删除失败: {str(e)}") from e diff --git a/src/webui/plugin_progress_ws.py b/src/webui/plugin_progress_ws.py index 927dbb13..7e0fb647 100644 --- a/src/webui/plugin_progress_ws.py +++ b/src/webui/plugin_progress_ws.py @@ -1,4 +1,5 @@ """WebSocket 插件加载进度推送模块""" + from fastapi import APIRouter, WebSocket, WebSocketDisconnect from typing import Set, Dict, Any import json @@ -22,7 +23,7 @@ current_progress: Dict[str, Any] = { "error": None, "plugin_id": None, # 当前操作的插件 ID "total_plugins": 0, - "loaded_plugins": 0 + "loaded_plugins": 0, } @@ -30,20 +31,20 @@ async def broadcast_progress(progress_data: Dict[str, Any]): """广播进度更新到所有连接的客户端""" global current_progress current_progress = progress_data.copy() - + if not active_connections: return - + message = json.dumps(progress_data, ensure_ascii=False) disconnected = set() - + for websocket in active_connections: try: await websocket.send_text(message) except Exception as e: logger.error(f"发送进度更新失败: {e}") disconnected.add(websocket) - + # 移除断开的连接 for websocket in disconnected: active_connections.discard(websocket) @@ -57,10 +58,10 @@ async def update_progress( error: str = None, plugin_id: str = None, total_plugins: int = 0, - loaded_plugins: int = 0 + loaded_plugins: int = 0, ): """更新并广播进度 - + Args: stage: 阶段 (idle, loading, success, error) progress: 进度百分比 (0-100) @@ -80,9 +81,9 @@ async def update_progress( "plugin_id": plugin_id, "total_plugins": total_plugins, "loaded_plugins": loaded_plugins, - "timestamp": asyncio.get_event_loop().time() + "timestamp": asyncio.get_event_loop().time(), } - + await broadcast_progress(progress_data) logger.debug(f"进度更新: [{operation}] {stage} - {progress}% - {message}") @@ -90,30 +91,30 @@ async def update_progress( @router.websocket("/ws/plugin-progress") async def websocket_plugin_progress(websocket: WebSocket): """WebSocket 插件加载进度推送端点 - + 客户端连接后会立即收到当前进度状态 """ await websocket.accept() active_connections.add(websocket) logger.info(f"📡 插件进度 WebSocket 客户端已连接,当前连接数: {len(active_connections)}") - + try: # 发送当前进度状态 await websocket.send_text(json.dumps(current_progress, ensure_ascii=False)) - + # 保持连接并处理客户端消息 while True: try: data = await websocket.receive_text() - + # 处理客户端心跳 if data == "ping": await websocket.send_text("pong") - + except Exception as e: logger.error(f"处理客户端消息时出错: {e}") break - + except WebSocketDisconnect: active_connections.discard(websocket) logger.info(f"📡 插件进度 WebSocket 客户端已断开,当前连接数: {len(active_connections)}") diff --git a/src/webui/plugin_routes.py b/src/webui/plugin_routes.py index 5054a391..cb559fb7 100644 --- a/src/webui/plugin_routes.py +++ b/src/webui/plugin_routes.py @@ -21,22 +21,22 @@ set_update_progress_callback(update_progress) def parse_version(version_str: str) -> tuple[int, int, int]: """ 解析版本号字符串 - + 支持格式: - 0.11.2 -> (0, 11, 2) - 0.11.2.snapshot.2 -> (0, 11, 2) - + Returns: (major, minor, patch) 三元组 """ # 移除 snapshot 等后缀 - base_version = version_str.split('.snapshot')[0].split('.dev')[0].split('.alpha')[0].split('.beta')[0] - - parts = base_version.split('.') + base_version = version_str.split(".snapshot")[0].split(".dev")[0].split(".alpha")[0].split(".beta")[0] + + parts = base_version.split(".") if len(parts) < 3: # 补齐到 3 位 - parts.extend(['0'] * (3 - len(parts))) - + parts.extend(["0"] * (3 - len(parts))) + try: major = int(parts[0]) minor = int(parts[1]) @@ -49,8 +49,10 @@ def parse_version(version_str: str) -> tuple[int, int, int]: # ============ 请求/响应模型 ============ + class FetchRawFileRequest(BaseModel): """获取 Raw 文件请求""" + owner: str = Field(..., description="仓库所有者", example="MaiM-with-u") repo: str = Field(..., description="仓库名称", example="plugin-repo") branch: str = Field(..., description="分支名称", example="main") @@ -61,6 +63,7 @@ class FetchRawFileRequest(BaseModel): class FetchRawFileResponse(BaseModel): """获取 Raw 文件响应""" + success: bool = Field(..., description="是否成功") data: Optional[str] = Field(None, description="文件内容") error: Optional[str] = Field(None, description="错误信息") @@ -71,6 +74,7 @@ class FetchRawFileResponse(BaseModel): class CloneRepositoryRequest(BaseModel): """克隆仓库请求""" + owner: str = Field(..., description="仓库所有者", example="MaiM-with-u") repo: str = Field(..., description="仓库名称", example="plugin-repo") target_path: str = Field(..., description="目标路径(相对于插件目录)") @@ -82,6 +86,7 @@ class CloneRepositoryRequest(BaseModel): class CloneRepositoryResponse(BaseModel): """克隆仓库响应""" + success: bool = Field(..., description="是否成功") path: Optional[str] = Field(None, description="克隆路径") error: Optional[str] = Field(None, description="错误信息") @@ -93,6 +98,7 @@ class CloneRepositoryResponse(BaseModel): class MirrorConfigResponse(BaseModel): """镜像源配置响应""" + id: str = Field(..., description="镜像源 ID") name: str = Field(..., description="镜像源名称") raw_prefix: str = Field(..., description="Raw 文件前缀") @@ -103,12 +109,14 @@ class MirrorConfigResponse(BaseModel): class AvailableMirrorsResponse(BaseModel): """可用镜像源列表响应""" + mirrors: List[MirrorConfigResponse] = Field(..., description="镜像源列表") default_priority: List[str] = Field(..., description="默认优先级顺序(ID 列表)") class AddMirrorRequest(BaseModel): """添加镜像源请求""" + id: str = Field(..., description="镜像源 ID", example="custom-mirror") name: str = Field(..., description="镜像源名称", example="自定义镜像源") raw_prefix: str = Field(..., description="Raw 文件前缀", example="https://example.com/raw") @@ -119,6 +127,7 @@ class AddMirrorRequest(BaseModel): class UpdateMirrorRequest(BaseModel): """更新镜像源请求""" + name: Optional[str] = Field(None, description="镜像源名称") raw_prefix: Optional[str] = Field(None, description="Raw 文件前缀") clone_prefix: Optional[str] = Field(None, description="克隆前缀") @@ -128,6 +137,7 @@ class UpdateMirrorRequest(BaseModel): class GitStatusResponse(BaseModel): """Git 安装状态响应""" + installed: bool = Field(..., description="是否已安装 Git") version: Optional[str] = Field(None, description="Git 版本号") path: Optional[str] = Field(None, description="Git 可执行文件路径") @@ -136,6 +146,7 @@ class GitStatusResponse(BaseModel): class InstallPluginRequest(BaseModel): """安装插件请求""" + plugin_id: str = Field(..., description="插件 ID") repository_url: str = Field(..., description="插件仓库 URL") branch: Optional[str] = Field("main", description="分支名称") @@ -144,6 +155,7 @@ class InstallPluginRequest(BaseModel): class VersionResponse(BaseModel): """麦麦版本响应""" + version: str = Field(..., description="麦麦版本号") version_major: int = Field(..., description="主版本号") version_minor: int = Field(..., description="次版本号") @@ -152,11 +164,13 @@ class VersionResponse(BaseModel): class UninstallPluginRequest(BaseModel): """卸载插件请求""" + plugin_id: str = Field(..., description="插件 ID") class UpdatePluginRequest(BaseModel): """更新插件请求""" + plugin_id: str = Field(..., description="插件 ID") repository_url: str = Field(..., description="插件仓库 URL") branch: Optional[str] = Field("main", description="分支名称") @@ -165,40 +179,34 @@ class UpdatePluginRequest(BaseModel): # ============ API 路由 ============ + @router.get("/version", response_model=VersionResponse) async def get_maimai_version() -> VersionResponse: """ 获取麦麦版本信息 - + 此接口无需认证,用于前端检查插件兼容性 """ major, minor, patch = parse_version(MMC_VERSION) - - return VersionResponse( - version=MMC_VERSION, - version_major=major, - version_minor=minor, - version_patch=patch - ) + + return VersionResponse(version=MMC_VERSION, version_major=major, version_minor=minor, version_patch=patch) @router.get("/git-status", response_model=GitStatusResponse) async def check_git_status() -> GitStatusResponse: """ 检查本机 Git 安装状态 - + 此接口无需认证,用于前端快速检测是否可以使用插件安装功能 """ service = get_git_mirror_service() result = service.check_git_installed() - + return GitStatusResponse(**result) @router.get("/mirrors", response_model=AvailableMirrorsResponse) -async def get_available_mirrors( - authorization: Optional[str] = Header(None) -) -> AvailableMirrorsResponse: +async def get_available_mirrors(authorization: Optional[str] = Header(None)) -> AvailableMirrorsResponse: """ 获取所有可用的镜像源配置 """ @@ -207,10 +215,10 @@ async def get_available_mirrors( token_manager = get_token_manager() if not token or not token_manager.verify_token(token): raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - + service = get_git_mirror_service() config = service.get_mirror_config() - + all_mirrors = config.get_all_mirrors() mirrors = [ MirrorConfigResponse( @@ -219,22 +227,16 @@ async def get_available_mirrors( raw_prefix=m["raw_prefix"], clone_prefix=m["clone_prefix"], enabled=m["enabled"], - priority=m["priority"] + priority=m["priority"], ) for m in all_mirrors ] - - return AvailableMirrorsResponse( - mirrors=mirrors, - default_priority=config.get_default_priority_list() - ) + + return AvailableMirrorsResponse(mirrors=mirrors, default_priority=config.get_default_priority_list()) @router.post("/mirrors", response_model=MirrorConfigResponse) -async def add_mirror( - request: AddMirrorRequest, - authorization: Optional[str] = Header(None) -) -> MirrorConfigResponse: +async def add_mirror(request: AddMirrorRequest, authorization: Optional[str] = Header(None)) -> MirrorConfigResponse: """ 添加新的镜像源 """ @@ -243,27 +245,27 @@ async def add_mirror( token_manager = get_token_manager() if not token or not token_manager.verify_token(token): raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - + try: service = get_git_mirror_service() config = service.get_mirror_config() - + mirror = config.add_mirror( mirror_id=request.id, name=request.name, raw_prefix=request.raw_prefix, clone_prefix=request.clone_prefix, enabled=request.enabled, - priority=request.priority + priority=request.priority, ) - + return MirrorConfigResponse( id=mirror["id"], name=mirror["name"], raw_prefix=mirror["raw_prefix"], clone_prefix=mirror["clone_prefix"], enabled=mirror["enabled"], - priority=mirror["priority"] + priority=mirror["priority"], ) except ValueError as e: raise HTTPException(status_code=400, detail=str(e)) from e @@ -274,9 +276,7 @@ async def add_mirror( @router.put("/mirrors/{mirror_id}", response_model=MirrorConfigResponse) async def update_mirror( - mirror_id: str, - request: UpdateMirrorRequest, - authorization: Optional[str] = Header(None) + mirror_id: str, request: UpdateMirrorRequest, authorization: Optional[str] = Header(None) ) -> MirrorConfigResponse: """ 更新镜像源配置 @@ -286,30 +286,30 @@ async def update_mirror( token_manager = get_token_manager() if not token or not token_manager.verify_token(token): raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - + try: service = get_git_mirror_service() config = service.get_mirror_config() - + mirror = config.update_mirror( mirror_id=mirror_id, name=request.name, raw_prefix=request.raw_prefix, clone_prefix=request.clone_prefix, enabled=request.enabled, - priority=request.priority + priority=request.priority, ) - + if not mirror: raise HTTPException(status_code=404, detail=f"未找到镜像源: {mirror_id}") - + return MirrorConfigResponse( id=mirror["id"], name=mirror["name"], raw_prefix=mirror["raw_prefix"], clone_prefix=mirror["clone_prefix"], enabled=mirror["enabled"], - priority=mirror["priority"] + priority=mirror["priority"], ) except HTTPException: raise @@ -319,10 +319,7 @@ async def update_mirror( @router.delete("/mirrors/{mirror_id}") -async def delete_mirror( - mirror_id: str, - authorization: Optional[str] = Header(None) -) -> Dict[str, Any]: +async def delete_mirror(mirror_id: str, authorization: Optional[str] = Header(None)) -> Dict[str, Any]: """ 删除镜像源 """ @@ -331,57 +328,53 @@ async def delete_mirror( token_manager = get_token_manager() if not token or not token_manager.verify_token(token): raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - + service = get_git_mirror_service() config = service.get_mirror_config() - + success = config.delete_mirror(mirror_id) - + if not success: raise HTTPException(status_code=404, detail=f"未找到镜像源: {mirror_id}") - - return { - "success": True, - "message": f"已删除镜像源: {mirror_id}" - } + + return {"success": True, "message": f"已删除镜像源: {mirror_id}"} @router.post("/fetch-raw", response_model=FetchRawFileResponse) async def fetch_raw_file( - request: FetchRawFileRequest, - authorization: Optional[str] = Header(None) + request: FetchRawFileRequest, authorization: Optional[str] = Header(None) ) -> FetchRawFileResponse: """ 获取 GitHub 仓库的 Raw 文件内容 - + 支持多镜像源自动切换和错误重试 - + 注意:此接口可公开访问,用于获取插件仓库等公开资源 """ # Token 验证(可选,用于日志记录) token = authorization.replace("Bearer ", "") if authorization else None token_manager = get_token_manager() is_authenticated = token and token_manager.verify_token(token) - + # 对于公开仓库的访问,不强制要求认证 # 只在日志中记录是否认证 logger.info( f"收到获取 Raw 文件请求 (认证: {is_authenticated}): " f"{request.owner}/{request.repo}/{request.branch}/{request.file_path}" ) - + # 发送开始加载进度 await update_progress( stage="loading", progress=10, message=f"正在获取插件列表: {request.file_path}", total_plugins=0, - loaded_plugins=0 + loaded_plugins=0, ) - + try: service = get_git_mirror_service() - + # git_mirror_service 会自动推送 30%-70% 的详细镜像源尝试进度 result = await service.fetch_raw_file( owner=request.owner, @@ -389,69 +382,56 @@ async def fetch_raw_file( branch=request.branch, file_path=request.file_path, mirror_id=request.mirror_id, - custom_url=request.custom_url + custom_url=request.custom_url, ) - + if result.get("success"): # 更新进度:成功获取 await update_progress( - stage="loading", - progress=70, - message="正在解析插件数据...", - total_plugins=0, - loaded_plugins=0 + stage="loading", progress=70, message="正在解析插件数据...", total_plugins=0, loaded_plugins=0 ) - + # 尝试解析插件数量 try: import json + data = json.loads(result.get("data", "[]")) total = len(data) if isinstance(data, list) else 0 - + # 发送成功状态 await update_progress( stage="success", progress=100, message=f"成功加载 {total} 个插件", total_plugins=total, - loaded_plugins=total + loaded_plugins=total, ) except Exception: # 如果解析失败,仍然发送成功状态 await update_progress( - stage="success", - progress=100, - message="加载完成", - total_plugins=0, - loaded_plugins=0 + stage="success", progress=100, message="加载完成", total_plugins=0, loaded_plugins=0 ) - + return FetchRawFileResponse(**result) - + except Exception as e: logger.error(f"获取 Raw 文件失败: {e}") - + # 发送错误进度 await update_progress( - stage="error", - progress=0, - message="加载失败", - error=str(e), - total_plugins=0, - loaded_plugins=0 + stage="error", progress=0, message="加载失败", error=str(e), total_plugins=0, loaded_plugins=0 ) - + raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e @router.post("/clone", response_model=CloneRepositoryResponse) async def clone_repository( - request: CloneRepositoryRequest, - authorization: Optional[str] = Header(None) + request: CloneRepositoryRequest, authorization: Optional[str] = Header(None) ) -> CloneRepositoryResponse: """ 克隆 GitHub 仓库到本地 - + 支持多镜像源自动切换和错误重试 """ # Token 验证 @@ -459,17 +439,15 @@ async def clone_repository( token_manager = get_token_manager() if not token or not token_manager.verify_token(token): raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - - logger.info( - f"收到克隆仓库请求: {request.owner}/{request.repo} -> {request.target_path}" - ) - + + logger.info(f"收到克隆仓库请求: {request.owner}/{request.repo} -> {request.target_path}") + try: # TODO: 验证 target_path 的安全性,防止路径遍历攻击 # TODO: 确定实际的插件目录基路径 base_plugin_path = Path("./plugins") # 临时路径 target_path = base_plugin_path / request.target_path - + service = get_git_mirror_service() result = await service.clone_repository( owner=request.owner, @@ -478,24 +456,21 @@ async def clone_repository( branch=request.branch, mirror_id=request.mirror_id, custom_url=request.custom_url, - depth=request.depth + depth=request.depth, ) - + return CloneRepositoryResponse(**result) - + except Exception as e: logger.error(f"克隆仓库失败: {e}") raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e @router.post("/install") -async def install_plugin( - request: InstallPluginRequest, - authorization: Optional[str] = Header(None) -) -> Dict[str, Any]: +async def install_plugin(request: InstallPluginRequest, authorization: Optional[str] = Header(None)) -> Dict[str, Any]: """ 安装插件 - + 从 Git 仓库克隆插件到本地插件目录 """ # Token 验证 @@ -503,9 +478,9 @@ async def install_plugin( token_manager = get_token_manager() if not token or not token_manager.verify_token(token): raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - + logger.info(f"收到安装插件请求: {request.plugin_id}") - + try: # 推送进度:开始安装 await update_progress( @@ -513,80 +488,75 @@ async def install_plugin( progress=5, message=f"开始安装插件: {request.plugin_id}", operation="install", - plugin_id=request.plugin_id + plugin_id=request.plugin_id, ) - + # 1. 解析仓库 URL # repository_url 格式: https://github.com/owner/repo - repo_url = request.repository_url.rstrip('/') - if repo_url.endswith('.git'): + repo_url = request.repository_url.rstrip("/") + if repo_url.endswith(".git"): repo_url = repo_url[:-4] - - parts = repo_url.split('/') + + parts = repo_url.split("/") if len(parts) < 2: raise HTTPException(status_code=400, detail="无效的仓库 URL") - + owner = parts[-2] repo = parts[-1] - + await update_progress( stage="loading", progress=10, message=f"解析仓库信息: {owner}/{repo}", operation="install", - plugin_id=request.plugin_id + plugin_id=request.plugin_id, ) - + # 2. 确定插件安装路径 plugins_dir = Path("plugins") plugins_dir.mkdir(exist_ok=True) - + target_path = plugins_dir / request.plugin_id - + # 检查插件是否已安装 if target_path.exists(): await update_progress( stage="error", progress=0, - message=f"插件已存在", + message="插件已存在", operation="install", plugin_id=request.plugin_id, - error="插件已安装,请先卸载" + error="插件已安装,请先卸载", ) raise HTTPException(status_code=400, detail="插件已安装") - + await update_progress( stage="loading", progress=15, message=f"准备克隆到: {target_path}", operation="install", - plugin_id=request.plugin_id + plugin_id=request.plugin_id, ) - + # 3. 克隆仓库(这里会自动推送 20%-80% 的进度) service = get_git_mirror_service() - + # 如果是 GitHub 仓库,使用镜像源 - if 'github.com' in repo_url: + if "github.com" in repo_url: result = await service.clone_repository( owner=owner, repo=repo, target_path=target_path, branch=request.branch, mirror_id=request.mirror_id, - depth=1 # 浅克隆,节省时间和空间 + depth=1, # 浅克隆,节省时间和空间 ) else: # 自定义仓库,直接使用 URL result = await service.clone_repository( - owner=owner, - repo=repo, - target_path=target_path, - branch=request.branch, - custom_url=repo_url, - depth=1 + owner=owner, repo=repo, target_path=target_path, branch=request.branch, custom_url=repo_url, depth=1 ) - + if not result.get("success"): error_msg = result.get("error", "克隆失败") await update_progress( @@ -595,113 +565,107 @@ async def install_plugin( message="克隆仓库失败", operation="install", plugin_id=request.plugin_id, - error=error_msg + error=error_msg, ) raise HTTPException(status_code=500, detail=error_msg) - + # 4. 验证插件完整性 await update_progress( - stage="loading", - progress=85, - message="验证插件文件...", - operation="install", - plugin_id=request.plugin_id + stage="loading", progress=85, message="验证插件文件...", operation="install", plugin_id=request.plugin_id ) - + manifest_path = target_path / "_manifest.json" if not manifest_path.exists(): # 清理失败的安装 import shutil + shutil.rmtree(target_path, ignore_errors=True) - + await update_progress( stage="error", progress=0, message="插件缺少 _manifest.json", operation="install", plugin_id=request.plugin_id, - error="无效的插件格式" + error="无效的插件格式", ) raise HTTPException(status_code=400, detail="无效的插件:缺少 _manifest.json") - + # 5. 读取并验证 manifest await update_progress( - stage="loading", - progress=90, - message="读取插件配置...", - operation="install", - plugin_id=request.plugin_id + stage="loading", progress=90, message="读取插件配置...", operation="install", plugin_id=request.plugin_id ) - + try: import json as json_module - with open(manifest_path, 'r', encoding='utf-8') as f: + + with open(manifest_path, "r", encoding="utf-8") as f: manifest = json_module.load(f) - + # 基本验证 - required_fields = ['manifest_version', 'name', 'version', 'author'] + required_fields = ["manifest_version", "name", "version", "author"] for field in required_fields: if field not in manifest: raise ValueError(f"缺少必需字段: {field}") - + except Exception as e: # 清理失败的安装 import shutil + shutil.rmtree(target_path, ignore_errors=True) - + await update_progress( stage="error", progress=0, message="_manifest.json 无效", operation="install", plugin_id=request.plugin_id, - error=str(e) + error=str(e), ) raise HTTPException(status_code=400, detail=f"无效的 _manifest.json: {e}") from e - + # 6. 安装成功 await update_progress( stage="success", progress=100, message=f"成功安装插件: {manifest['name']} v{manifest['version']}", operation="install", - plugin_id=request.plugin_id + plugin_id=request.plugin_id, ) - + return { "success": True, "message": "插件安装成功", "plugin_id": request.plugin_id, - "plugin_name": manifest['name'], - "version": manifest['version'], - "path": str(target_path) + "plugin_name": manifest["name"], + "version": manifest["version"], + "path": str(target_path), } - + except HTTPException: raise except Exception as e: logger.error(f"安装插件失败: {e}", exc_info=True) - + await update_progress( stage="error", progress=0, message="安装失败", operation="install", plugin_id=request.plugin_id, - error=str(e) + error=str(e), ) - + raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e @router.post("/uninstall") async def uninstall_plugin( - request: UninstallPluginRequest, - authorization: Optional[str] = Header(None) + request: UninstallPluginRequest, authorization: Optional[str] = Header(None) ) -> Dict[str, Any]: """ 卸载插件 - + 删除插件目录及其所有文件 """ # Token 验证 @@ -709,9 +673,9 @@ async def uninstall_plugin( token_manager = get_token_manager() if not token or not token_manager.verify_token(token): raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - + logger.info(f"收到卸载插件请求: {request.plugin_id}") - + try: # 推送进度:开始卸载 await update_progress( @@ -719,13 +683,13 @@ async def uninstall_plugin( progress=10, message=f"开始卸载插件: {request.plugin_id}", operation="uninstall", - plugin_id=request.plugin_id + plugin_id=request.plugin_id, ) - + # 1. 检查插件是否存在 plugins_dir = Path("plugins") plugin_path = plugins_dir / request.plugin_id - + if not plugin_path.exists(): await update_progress( stage="error", @@ -733,107 +697,101 @@ async def uninstall_plugin( message="插件不存在", operation="uninstall", plugin_id=request.plugin_id, - error="插件未安装或已被删除" + error="插件未安装或已被删除", ) raise HTTPException(status_code=404, detail="插件未安装") - + await update_progress( stage="loading", progress=30, message=f"正在删除插件文件: {plugin_path}", operation="uninstall", - plugin_id=request.plugin_id + plugin_id=request.plugin_id, ) - + # 2. 读取插件信息(用于日志) manifest_path = plugin_path / "_manifest.json" plugin_name = request.plugin_id - + if manifest_path.exists(): try: import json as json_module - with open(manifest_path, 'r', encoding='utf-8') as f: + + with open(manifest_path, "r", encoding="utf-8") as f: manifest = json_module.load(f) plugin_name = manifest.get("name", request.plugin_id) except Exception: pass # 如果读取失败,使用插件 ID 作为名称 - + await update_progress( stage="loading", progress=50, message=f"正在删除 {plugin_name}...", operation="uninstall", - plugin_id=request.plugin_id + plugin_id=request.plugin_id, ) - + # 3. 删除插件目录 import shutil import stat - + def remove_readonly(func, path, _): """清除只读属性并删除文件""" import os + os.chmod(path, stat.S_IWRITE) func(path) - + shutil.rmtree(plugin_path, onerror=remove_readonly) - + logger.info(f"成功卸载插件: {request.plugin_id} ({plugin_name})") - + # 4. 推送成功状态 await update_progress( stage="success", progress=100, message=f"成功卸载插件: {plugin_name}", operation="uninstall", - plugin_id=request.plugin_id + plugin_id=request.plugin_id, ) - - return { - "success": True, - "message": "插件卸载成功", - "plugin_id": request.plugin_id, - "plugin_name": plugin_name - } - + + return {"success": True, "message": "插件卸载成功", "plugin_id": request.plugin_id, "plugin_name": plugin_name} + except HTTPException: raise except PermissionError as e: logger.error(f"卸载插件失败(权限错误): {e}") - + await update_progress( stage="error", progress=0, message="卸载失败", operation="uninstall", plugin_id=request.plugin_id, - error="权限不足,无法删除插件文件" + error="权限不足,无法删除插件文件", ) - + raise HTTPException(status_code=500, detail="权限不足,无法删除插件文件") from e except Exception as e: logger.error(f"卸载插件失败: {e}", exc_info=True) - + await update_progress( stage="error", progress=0, message="卸载失败", operation="uninstall", plugin_id=request.plugin_id, - error=str(e) + error=str(e), ) - + raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e @router.post("/update") -async def update_plugin( - request: UpdatePluginRequest, - authorization: Optional[str] = Header(None) -) -> Dict[str, Any]: +async def update_plugin(request: UpdatePluginRequest, authorization: Optional[str] = Header(None)) -> Dict[str, Any]: """ 更新插件 - + 删除旧版本,重新克隆新版本 """ # Token 验证 @@ -841,9 +799,9 @@ async def update_plugin( token_manager = get_token_manager() if not token or not token_manager.verify_token(token): raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - + logger.info(f"收到更新插件请求: {request.plugin_id}") - + try: # 推送进度:开始更新 await update_progress( @@ -851,13 +809,13 @@ async def update_plugin( progress=5, message=f"开始更新插件: {request.plugin_id}", operation="update", - plugin_id=request.plugin_id + plugin_id=request.plugin_id, ) - + # 1. 检查插件是否已安装 plugins_dir = Path("plugins") plugin_path = plugins_dir / request.plugin_id - + if not plugin_path.exists(): await update_progress( stage="error", @@ -865,97 +823,90 @@ async def update_plugin( message="插件不存在", operation="update", plugin_id=request.plugin_id, - error="插件未安装,请先安装" + error="插件未安装,请先安装", ) raise HTTPException(status_code=404, detail="插件未安装") - + # 2. 读取旧版本信息 manifest_path = plugin_path / "_manifest.json" old_version = "unknown" plugin_name = request.plugin_id - + if manifest_path.exists(): try: import json as json_module - with open(manifest_path, 'r', encoding='utf-8') as f: + + with open(manifest_path, "r", encoding="utf-8") as f: manifest = json_module.load(f) old_version = manifest.get("version", "unknown") - plugin_name = manifest.get("name", request.plugin_id) + _plugin_name = manifest.get("name", request.plugin_id) except Exception: pass - + await update_progress( stage="loading", progress=10, message=f"当前版本: {old_version},准备更新...", operation="update", - plugin_id=request.plugin_id + plugin_id=request.plugin_id, ) - + # 3. 删除旧版本 await update_progress( - stage="loading", - progress=20, - message="正在删除旧版本...", - operation="update", - plugin_id=request.plugin_id + stage="loading", progress=20, message="正在删除旧版本...", operation="update", plugin_id=request.plugin_id ) - + import shutil import stat - + def remove_readonly(func, path, _): """清除只读属性并删除文件""" import os + os.chmod(path, stat.S_IWRITE) func(path) - + shutil.rmtree(plugin_path, onerror=remove_readonly) - + logger.info(f"已删除旧版本: {request.plugin_id} v{old_version}") - + # 4. 解析仓库 URL await update_progress( stage="loading", progress=30, message="正在准备下载新版本...", operation="update", - plugin_id=request.plugin_id + plugin_id=request.plugin_id, ) - - repo_url = request.repository_url.rstrip('/') - if repo_url.endswith('.git'): + + repo_url = request.repository_url.rstrip("/") + if repo_url.endswith(".git"): repo_url = repo_url[:-4] - - parts = repo_url.split('/') + + parts = repo_url.split("/") if len(parts) < 2: raise HTTPException(status_code=400, detail="无效的仓库 URL") - + owner = parts[-2] repo = parts[-1] - + # 5. 克隆新版本(这里会推送 35%-85% 的进度) service = get_git_mirror_service() - - if 'github.com' in repo_url: + + if "github.com" in repo_url: result = await service.clone_repository( owner=owner, repo=repo, target_path=plugin_path, branch=request.branch, mirror_id=request.mirror_id, - depth=1 + depth=1, ) else: result = await service.clone_repository( - owner=owner, - repo=repo, - target_path=plugin_path, - branch=request.branch, - custom_url=repo_url, - depth=1 + owner=owner, repo=repo, target_path=plugin_path, branch=request.branch, custom_url=repo_url, depth=1 ) - + if not result.get("success"): error_msg = result.get("error", "克隆失败") await update_progress( @@ -964,106 +915,96 @@ async def update_plugin( message="下载新版本失败", operation="update", plugin_id=request.plugin_id, - error=error_msg + error=error_msg, ) raise HTTPException(status_code=500, detail=error_msg) - + # 6. 验证新版本 await update_progress( - stage="loading", - progress=90, - message="验证新版本...", - operation="update", - plugin_id=request.plugin_id + stage="loading", progress=90, message="验证新版本...", operation="update", plugin_id=request.plugin_id ) - + new_manifest_path = plugin_path / "_manifest.json" if not new_manifest_path.exists(): # 清理失败的更新 def remove_readonly(func, path, _): """清除只读属性并删除文件""" import os + os.chmod(path, stat.S_IWRITE) func(path) - + shutil.rmtree(plugin_path, onerror=remove_readonly) - + await update_progress( stage="error", progress=0, message="新版本缺少 _manifest.json", operation="update", plugin_id=request.plugin_id, - error="无效的插件格式" + error="无效的插件格式", ) raise HTTPException(status_code=400, detail="无效的插件:缺少 _manifest.json") - + # 7. 读取新版本信息 try: - with open(new_manifest_path, 'r', encoding='utf-8') as f: + with open(new_manifest_path, "r", encoding="utf-8") as f: new_manifest = json_module.load(f) - + new_version = new_manifest.get("version", "unknown") new_name = new_manifest.get("name", request.plugin_id) - + logger.info(f"成功更新插件: {request.plugin_id} {old_version} → {new_version}") - + # 8. 推送成功状态 await update_progress( stage="success", progress=100, message=f"成功更新 {new_name}: {old_version} → {new_version}", operation="update", - plugin_id=request.plugin_id + plugin_id=request.plugin_id, ) - + return { "success": True, "message": "插件更新成功", "plugin_id": request.plugin_id, "plugin_name": new_name, "old_version": old_version, - "new_version": new_version + "new_version": new_version, } - + except Exception as e: # 清理失败的更新 shutil.rmtree(plugin_path, ignore_errors=True) - + await update_progress( stage="error", progress=0, message="_manifest.json 无效", operation="update", plugin_id=request.plugin_id, - error=str(e) + error=str(e), ) raise HTTPException(status_code=400, detail=f"无效的 _manifest.json: {e}") from e - + except HTTPException: raise except Exception as e: logger.error(f"更新插件失败: {e}", exc_info=True) - + await update_progress( - stage="error", - progress=0, - message="更新失败", - operation="update", - plugin_id=request.plugin_id, - error=str(e) + stage="error", progress=0, message="更新失败", operation="update", plugin_id=request.plugin_id, error=str(e) ) - + raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e @router.get("/installed") -async def get_installed_plugins( - authorization: Optional[str] = Header(None) -) -> Dict[str, Any]: +async def get_installed_plugins(authorization: Optional[str] = Header(None)) -> Dict[str, Any]: """ 获取已安装的插件列表 - + 扫描 plugins 目录,返回所有已安装插件的 ID 和基本信息 """ # Token 验证 @@ -1071,75 +1012,71 @@ async def get_installed_plugins( token_manager = get_token_manager() if not token or not token_manager.verify_token(token): raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - + logger.info("收到获取已安装插件列表请求") - + try: plugins_dir = Path("plugins") - + # 如果插件目录不存在,返回空列表 if not plugins_dir.exists(): logger.info("插件目录不存在,创建目录") plugins_dir.mkdir(exist_ok=True) - return { - "success": True, - "plugins": [] - } - + return {"success": True, "plugins": []} + installed_plugins = [] - + # 遍历插件目录 for plugin_path in plugins_dir.iterdir(): # 只处理目录 if not plugin_path.is_dir(): continue - + # 目录名即为插件 ID plugin_id = plugin_path.name - + # 跳过隐藏目录和特殊目录 - if plugin_id.startswith('.') or plugin_id.startswith('__'): + if plugin_id.startswith(".") or plugin_id.startswith("__"): continue - + # 读取 _manifest.json manifest_path = plugin_path / "_manifest.json" - + if not manifest_path.exists(): logger.warning(f"插件 {plugin_id} 缺少 _manifest.json,跳过") continue - + try: import json as json_module - with open(manifest_path, 'r', encoding='utf-8') as f: + + with open(manifest_path, "r", encoding="utf-8") as f: manifest = json_module.load(f) - + # 基本验证 - if 'name' not in manifest or 'version' not in manifest: + if "name" not in manifest or "version" not in manifest: logger.warning(f"插件 {plugin_id} 的 _manifest.json 格式无效,跳过") continue - + # 添加到已安装列表(返回完整的 manifest 信息) - installed_plugins.append({ - "id": plugin_id, - "manifest": manifest, # 返回完整的 manifest 对象 - "path": str(plugin_path.absolute()) - }) - + installed_plugins.append( + { + "id": plugin_id, + "manifest": manifest, # 返回完整的 manifest 对象 + "path": str(plugin_path.absolute()), + } + ) + except json.JSONDecodeError as e: logger.warning(f"插件 {plugin_id} 的 _manifest.json 解析失败: {e}") continue except Exception as e: logger.error(f"读取插件 {plugin_id} 信息时出错: {e}") continue - + logger.info(f"找到 {len(installed_plugins)} 个已安装插件") - - return { - "success": True, - "plugins": installed_plugins, - "total": len(installed_plugins) - } - + + return {"success": True, "plugins": installed_plugins, "total": len(installed_plugins)} + except Exception as e: logger.error(f"获取已安装插件列表失败: {e}", exc_info=True) raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e diff --git a/src/webui/routers/system.py b/src/webui/routers/system.py new file mode 100644 index 00000000..fb203f79 --- /dev/null +++ b/src/webui/routers/system.py @@ -0,0 +1,97 @@ +""" +系统控制路由 + +提供系统重启、状态查询等功能 +""" + +import os +import sys +import time +from datetime import datetime +from fastapi import APIRouter, HTTPException +from pydantic import BaseModel +from src.config.config import MMC_VERSION + +router = APIRouter(prefix="/system", tags=["system"]) + +# 记录启动时间 +_start_time = time.time() + + +class RestartResponse(BaseModel): + """重启响应""" + + success: bool + message: str + + +class StatusResponse(BaseModel): + """状态响应""" + + running: bool + uptime: float + version: str + start_time: str + + +@router.post("/restart", response_model=RestartResponse) +async def restart_maibot(): + """ + 重启麦麦主程序 + + 使用 os.execv 重启当前进程,配置更改将在重启后生效。 + 注意:此操作会使麦麦暂时离线。 + """ + try: + # 记录重启操作 + print(f"[{datetime.now()}] WebUI 触发重启操作") + + # 使用 os.execv 重启当前进程 + # 这会替换当前进程,保持相同的 PID + python = sys.executable + args = [python] + sys.argv + + # 返回成功响应(实际上这个响应可能不会发送,因为进程会立即重启) + # 但我们仍然返回它以保持 API 一致性 + os.execv(python, args) + + return RestartResponse(success=True, message="麦麦正在重启中...") + except Exception as e: + raise HTTPException(status_code=500, detail=f"重启失败: {str(e)}") from e + + +@router.get("/status", response_model=StatusResponse) +async def get_maibot_status(): + """ + 获取麦麦运行状态 + + 返回麦麦的运行状态、运行时长和版本信息。 + """ + try: + uptime = time.time() - _start_time + + # 尝试获取版本信息(需要根据实际情况调整) + version = MMC_VERSION # 可以从配置或常量中读取 + + return StatusResponse( + running=True, uptime=uptime, version=version, start_time=datetime.fromtimestamp(_start_time).isoformat() + ) + except Exception as e: + raise HTTPException(status_code=500, detail=f"获取状态失败: {str(e)}") from e + + +# 可选:添加更多系统控制功能 + + +@router.post("/reload-config") +async def reload_config(): + """ + 热重载配置(不重启进程) + + 仅重新加载配置文件,某些配置可能需要重启才能生效。 + 此功能需要在主程序中实现配置热重载逻辑。 + """ + # 这里需要调用主程序的配置重载函数 + # 示例:await app_instance.reload_config() + + return {"success": True, "message": "配置重载功能待实现"} diff --git a/src/webui/routes.py b/src/webui/routes.py index a3397e83..3eb7e673 100644 --- a/src/webui/routes.py +++ b/src/webui/routes.py @@ -1,4 +1,5 @@ """WebUI API 路由""" + from fastapi import APIRouter, HTTPException, Header from pydantic import BaseModel, Field from typing import Optional @@ -11,6 +12,7 @@ from .expression_routes import router as expression_router from .emoji_routes import router as emoji_router from .plugin_routes import router as plugin_router from .plugin_progress_ws import get_progress_router +from .routers.system import router as system_router logger = get_logger("webui.api") @@ -31,37 +33,65 @@ router.include_router(emoji_router) router.include_router(plugin_router) # 注册插件进度 WebSocket 路由 router.include_router(get_progress_router()) +# 注册系统控制路由 +router.include_router(system_router) class TokenVerifyRequest(BaseModel): """Token 验证请求""" + token: str = Field(..., description="访问令牌") class TokenVerifyResponse(BaseModel): """Token 验证响应""" + valid: bool = Field(..., description="Token 是否有效") message: str = Field(..., description="验证结果消息") class TokenUpdateRequest(BaseModel): """Token 更新请求""" + new_token: str = Field(..., description="新的访问令牌", min_length=10) class TokenUpdateResponse(BaseModel): """Token 更新响应""" + success: bool = Field(..., description="是否更新成功") message: str = Field(..., description="更新结果消息") class TokenRegenerateResponse(BaseModel): """Token 重新生成响应""" + success: bool = Field(..., description="是否生成成功") token: str = Field(..., description="新生成的令牌") message: str = Field(..., description="生成结果消息") +class FirstSetupStatusResponse(BaseModel): + """首次配置状态响应""" + + is_first_setup: bool = Field(..., description="是否为首次配置") + message: str = Field(..., description="状态消息") + + +class CompleteSetupResponse(BaseModel): + """完成配置响应""" + + success: bool = Field(..., description="是否成功") + message: str = Field(..., description="结果消息") + + +class ResetSetupResponse(BaseModel): + """重置配置响应""" + + success: bool = Field(..., description="是否成功") + message: str = Field(..., description="结果消息") + + @router.get("/health") async def health_check(): """健康检查""" @@ -72,44 +102,35 @@ async def health_check(): async def verify_token(request: TokenVerifyRequest): """ 验证访问令牌 - + Args: request: 包含 token 的验证请求 - + Returns: 验证结果 """ try: token_manager = get_token_manager() is_valid = token_manager.verify_token(request.token) - + if is_valid: - return TokenVerifyResponse( - valid=True, - message="Token 验证成功" - ) + return TokenVerifyResponse(valid=True, message="Token 验证成功") else: - return TokenVerifyResponse( - valid=False, - message="Token 无效或已过期" - ) + return TokenVerifyResponse(valid=False, message="Token 无效或已过期") except Exception as e: logger.error(f"Token 验证失败: {e}") raise HTTPException(status_code=500, detail="Token 验证失败") from e @router.post("/auth/update", response_model=TokenUpdateResponse) -async def update_token( - request: TokenUpdateRequest, - authorization: Optional[str] = Header(None) -): +async def update_token(request: TokenUpdateRequest, authorization: Optional[str] = Header(None)): """ 更新访问令牌(需要当前有效的 token) - + Args: request: 包含新 token 的更新请求 authorization: Authorization header (Bearer token) - + Returns: 更新结果 """ @@ -117,20 +138,17 @@ async def update_token( # 验证当前 token if not authorization or not authorization.startswith("Bearer "): raise HTTPException(status_code=401, detail="未提供有效的认证信息") - + current_token = authorization.replace("Bearer ", "") token_manager = get_token_manager() - + if not token_manager.verify_token(current_token): raise HTTPException(status_code=401, detail="当前 Token 无效") - + # 更新 token success, message = token_manager.update_token(request.new_token) - - return TokenUpdateResponse( - success=success, - message=message - ) + + return TokenUpdateResponse(success=success, message=message) except HTTPException: raise except Exception as e: @@ -142,10 +160,10 @@ async def update_token( async def regenerate_token(authorization: Optional[str] = Header(None)): """ 重新生成访问令牌(需要当前有效的 token) - + Args: authorization: Authorization header (Bearer token) - + Returns: 新生成的 token """ @@ -153,24 +171,118 @@ async def regenerate_token(authorization: Optional[str] = Header(None)): # 验证当前 token if not authorization or not authorization.startswith("Bearer "): raise HTTPException(status_code=401, detail="未提供有效的认证信息") - + current_token = authorization.replace("Bearer ", "") token_manager = get_token_manager() - + if not token_manager.verify_token(current_token): raise HTTPException(status_code=401, detail="当前 Token 无效") - + # 重新生成 token new_token = token_manager.regenerate_token() - - return TokenRegenerateResponse( - success=True, - token=new_token, - message="Token 已重新生成" - ) + + return TokenRegenerateResponse(success=True, token=new_token, message="Token 已重新生成") except HTTPException: raise except Exception as e: logger.error(f"Token 重新生成失败: {e}") raise HTTPException(status_code=500, detail="Token 重新生成失败") from e + +@router.get("/setup/status", response_model=FirstSetupStatusResponse) +async def get_setup_status(authorization: Optional[str] = Header(None)): + """ + 获取首次配置状态 + + Args: + authorization: Authorization header (Bearer token) + + Returns: + 首次配置状态 + """ + try: + # 验证 token + if not authorization or not authorization.startswith("Bearer "): + raise HTTPException(status_code=401, detail="未提供有效的认证信息") + + current_token = authorization.replace("Bearer ", "") + token_manager = get_token_manager() + + if not token_manager.verify_token(current_token): + raise HTTPException(status_code=401, detail="Token 无效") + + # 检查是否为首次配置 + is_first = token_manager.is_first_setup() + + return FirstSetupStatusResponse(is_first_setup=is_first, message="首次配置" if is_first else "已完成配置") + except HTTPException: + raise + except Exception as e: + logger.error(f"获取配置状态失败: {e}") + raise HTTPException(status_code=500, detail="获取配置状态失败") from e + + +@router.post("/setup/complete", response_model=CompleteSetupResponse) +async def complete_setup(authorization: Optional[str] = Header(None)): + """ + 标记首次配置完成 + + Args: + authorization: Authorization header (Bearer token) + + Returns: + 完成结果 + """ + try: + # 验证 token + if not authorization or not authorization.startswith("Bearer "): + raise HTTPException(status_code=401, detail="未提供有效的认证信息") + + current_token = authorization.replace("Bearer ", "") + token_manager = get_token_manager() + + if not token_manager.verify_token(current_token): + raise HTTPException(status_code=401, detail="Token 无效") + + # 标记配置完成 + success = token_manager.mark_setup_completed() + + return CompleteSetupResponse(success=success, message="配置已完成" if success else "标记失败") + except HTTPException: + raise + except Exception as e: + logger.error(f"标记配置完成失败: {e}") + raise HTTPException(status_code=500, detail="标记配置完成失败") from e + + +@router.post("/setup/reset", response_model=ResetSetupResponse) +async def reset_setup(authorization: Optional[str] = Header(None)): + """ + 重置首次配置状态,允许重新进入配置向导 + + Args: + authorization: Authorization header (Bearer token) + + Returns: + 重置结果 + """ + try: + # 验证 token + if not authorization or not authorization.startswith("Bearer "): + raise HTTPException(status_code=401, detail="未提供有效的认证信息") + + current_token = authorization.replace("Bearer ", "") + token_manager = get_token_manager() + + if not token_manager.verify_token(current_token): + raise HTTPException(status_code=401, detail="Token 无效") + + # 重置配置状态 + success = token_manager.reset_setup_status() + + return ResetSetupResponse(success=success, message="配置状态已重置" if success else "重置失败") + except HTTPException: + raise + except Exception as e: + logger.error(f"重置配置状态失败: {e}") + raise HTTPException(status_code=500, detail="重置配置状态失败") from e diff --git a/src/webui/statistics_routes.py b/src/webui/statistics_routes.py index 01d5ea28..b0a3664c 100644 --- a/src/webui/statistics_routes.py +++ b/src/webui/statistics_routes.py @@ -1,9 +1,10 @@ """统计数据 API 路由""" + from fastapi import APIRouter, HTTPException from pydantic import BaseModel, Field from typing import Dict, Any, List from datetime import datetime, timedelta -from collections import defaultdict +from peewee import fn from src.common.logger import get_logger from src.common.database.database_model import LLMUsage, OnlineTime, Messages @@ -15,6 +16,7 @@ router = APIRouter(prefix="/statistics", tags=["statistics"]) class StatisticsSummary(BaseModel): """统计数据摘要""" + total_requests: int = Field(0, description="总请求数") total_cost: float = Field(0.0, description="总花费") total_tokens: int = Field(0, description="总token数") @@ -28,6 +30,7 @@ class StatisticsSummary(BaseModel): class ModelStatistics(BaseModel): """模型统计""" + model_name: str request_count: int total_cost: float @@ -37,6 +40,7 @@ class ModelStatistics(BaseModel): class TimeSeriesData(BaseModel): """时间序列数据""" + timestamp: str requests: int = 0 cost: float = 0.0 @@ -45,6 +49,7 @@ class TimeSeriesData(BaseModel): class DashboardData(BaseModel): """仪表盘数据""" + summary: StatisticsSummary model_stats: List[ModelStatistics] hourly_data: List[TimeSeriesData] @@ -56,39 +61,39 @@ class DashboardData(BaseModel): async def get_dashboard_data(hours: int = 24): """ 获取仪表盘统计数据 - + Args: hours: 统计时间范围(小时),默认24小时 - + Returns: 仪表盘数据 """ try: now = datetime.now() start_time = now - timedelta(hours=hours) - + # 获取摘要数据 summary = await _get_summary_statistics(start_time, now) - + # 获取模型统计 model_stats = await _get_model_statistics(start_time) - + # 获取小时级时间序列数据 hourly_data = await _get_hourly_statistics(start_time, now) - + # 获取日级时间序列数据(最近7天) daily_start = now - timedelta(days=7) daily_data = await _get_daily_statistics(daily_start, now) - + # 获取最近活动 recent_activity = await _get_recent_activity(limit=10) - + return DashboardData( summary=summary, model_stats=model_stats, hourly_data=hourly_data, daily_data=daily_data, - recent_activity=recent_activity + recent_activity=recent_activity, ) except Exception as e: logger.error(f"获取仪表盘数据失败: {e}") @@ -96,200 +101,176 @@ async def get_dashboard_data(hours: int = 24): async def _get_summary_statistics(start_time: datetime, end_time: datetime) -> StatisticsSummary: - """获取摘要统计数据""" + """获取摘要统计数据(优化:使用数据库聚合)""" summary = StatisticsSummary() - - # 查询 LLM 使用记录 - llm_records = list( - LLMUsage.select() - .where(LLMUsage.timestamp >= start_time) - .where(LLMUsage.timestamp <= end_time) - ) - - total_time_cost = 0.0 - time_cost_count = 0 - - for record in llm_records: - summary.total_requests += 1 - summary.total_cost += record.cost or 0.0 - summary.total_tokens += (record.prompt_tokens or 0) + (record.completion_tokens or 0) - - if record.time_cost and record.time_cost > 0: - total_time_cost += record.time_cost - time_cost_count += 1 - - # 计算平均响应时间 - if time_cost_count > 0: - summary.avg_response_time = total_time_cost / time_cost_count - - # 查询在线时间 + + # 使用聚合查询替代全量加载 + query = LLMUsage.select( + fn.COUNT(LLMUsage.id).alias("total_requests"), + fn.COALESCE(fn.SUM(LLMUsage.cost), 0).alias("total_cost"), + fn.COALESCE(fn.SUM(LLMUsage.prompt_tokens + LLMUsage.completion_tokens), 0).alias("total_tokens"), + fn.COALESCE(fn.AVG(LLMUsage.time_cost), 0).alias("avg_response_time"), + ).where((LLMUsage.timestamp >= start_time) & (LLMUsage.timestamp <= end_time)) + + result = query.dicts().get() + summary.total_requests = result["total_requests"] + summary.total_cost = result["total_cost"] + summary.total_tokens = result["total_tokens"] + summary.avg_response_time = result["avg_response_time"] or 0.0 + + # 查询在线时间 - 这个数据量通常不大,保留原逻辑 online_records = list( - OnlineTime.select() - .where( - (OnlineTime.start_timestamp >= start_time) | - (OnlineTime.end_timestamp >= start_time) - ) + OnlineTime.select().where((OnlineTime.start_timestamp >= start_time) | (OnlineTime.end_timestamp >= start_time)) ) - + for record in online_records: start = max(record.start_timestamp, start_time) end = min(record.end_timestamp, end_time) if end > start: summary.online_time += (end - start).total_seconds() - - # 查询消息数量 - messages = list( - Messages.select() - .where(Messages.time >= start_time.timestamp()) - .where(Messages.time <= end_time.timestamp()) + + # 查询消息数量 - 使用聚合优化 + messages_query = Messages.select(fn.COUNT(Messages.id).alias("total")).where( + (Messages.time >= start_time.timestamp()) & (Messages.time <= end_time.timestamp()) ) - - summary.total_messages = len(messages) - # 简单统计:如果 reply_to 不为空,则认为是回复 - summary.total_replies = len([m for m in messages if m.reply_to]) - + summary.total_messages = messages_query.scalar() or 0 + + # 统计回复数量 + replies_query = Messages.select(fn.COUNT(Messages.id).alias("total")).where( + (Messages.time >= start_time.timestamp()) + & (Messages.time <= end_time.timestamp()) + & (Messages.reply_to.is_null(False)) + ) + summary.total_replies = replies_query.scalar() or 0 + # 计算派生指标 if summary.online_time > 0: online_hours = summary.online_time / 3600.0 summary.cost_per_hour = summary.total_cost / online_hours summary.tokens_per_hour = summary.total_tokens / online_hours - + return summary async def _get_model_statistics(start_time: datetime) -> List[ModelStatistics]: - """获取模型统计数据""" - model_data = defaultdict(lambda: { - 'request_count': 0, - 'total_cost': 0.0, - 'total_tokens': 0, - 'time_costs': [] - }) - - records = list( - LLMUsage.select() + """获取模型统计数据(优化:使用数据库聚合和分组)""" + # 使用GROUP BY聚合,避免全量加载 + query = ( + LLMUsage.select( + fn.COALESCE(LLMUsage.model_assign_name, LLMUsage.model_name, "unknown").alias("model_name"), + fn.COUNT(LLMUsage.id).alias("request_count"), + fn.COALESCE(fn.SUM(LLMUsage.cost), 0).alias("total_cost"), + fn.COALESCE(fn.SUM(LLMUsage.prompt_tokens + LLMUsage.completion_tokens), 0).alias("total_tokens"), + fn.COALESCE(fn.AVG(LLMUsage.time_cost), 0).alias("avg_response_time"), + ) .where(LLMUsage.timestamp >= start_time) + .group_by(fn.COALESCE(LLMUsage.model_assign_name, LLMUsage.model_name, "unknown")) + .order_by(fn.COUNT(LLMUsage.id).desc()) + .limit(10) # 只取前10个 ) - - for record in records: - model_name = record.model_assign_name or record.model_name or "unknown" - model_data[model_name]['request_count'] += 1 - model_data[model_name]['total_cost'] += record.cost or 0.0 - model_data[model_name]['total_tokens'] += (record.prompt_tokens or 0) + (record.completion_tokens or 0) - - if record.time_cost and record.time_cost > 0: - model_data[model_name]['time_costs'].append(record.time_cost) - - # 转换为列表并排序 + result = [] - for model_name, data in model_data.items(): - avg_time = sum(data['time_costs']) / len(data['time_costs']) if data['time_costs'] else 0.0 - result.append(ModelStatistics( - model_name=model_name, - request_count=data['request_count'], - total_cost=data['total_cost'], - total_tokens=data['total_tokens'], - avg_response_time=avg_time - )) - - # 按请求数排序 - result.sort(key=lambda x: x.request_count, reverse=True) - return result[:10] # 返回前10个 + for row in query.dicts(): + result.append( + ModelStatistics( + model_name=row["model_name"], + request_count=row["request_count"], + total_cost=row["total_cost"], + total_tokens=row["total_tokens"], + avg_response_time=row["avg_response_time"] or 0.0, + ) + ) + + return result async def _get_hourly_statistics(start_time: datetime, end_time: datetime) -> List[TimeSeriesData]: - """获取小时级统计数据""" - # 创建小时桶 - hourly_buckets = defaultdict(lambda: {'requests': 0, 'cost': 0.0, 'tokens': 0}) - - records = list( - LLMUsage.select() - .where(LLMUsage.timestamp >= start_time) - .where(LLMUsage.timestamp <= end_time) + """获取小时级统计数据(优化:使用数据库聚合)""" + # SQLite的日期时间函数进行小时分组 + # 使用strftime将timestamp格式化为小时级别 + query = ( + LLMUsage.select( + fn.strftime("%Y-%m-%dT%H:00:00", LLMUsage.timestamp).alias("hour"), + fn.COUNT(LLMUsage.id).alias("requests"), + fn.COALESCE(fn.SUM(LLMUsage.cost), 0).alias("cost"), + fn.COALESCE(fn.SUM(LLMUsage.prompt_tokens + LLMUsage.completion_tokens), 0).alias("tokens"), + ) + .where((LLMUsage.timestamp >= start_time) & (LLMUsage.timestamp <= end_time)) + .group_by(fn.strftime("%Y-%m-%dT%H:00:00", LLMUsage.timestamp)) ) - - for record in records: - # 获取小时键(去掉分钟和秒) - hour_key = record.timestamp.replace(minute=0, second=0, microsecond=0) - hour_str = hour_key.isoformat() - - hourly_buckets[hour_str]['requests'] += 1 - hourly_buckets[hour_str]['cost'] += record.cost or 0.0 - hourly_buckets[hour_str]['tokens'] += (record.prompt_tokens or 0) + (record.completion_tokens or 0) - + + # 转换为字典以快速查找 + data_dict = {row["hour"]: row for row in query.dicts()} + # 填充所有小时(包括没有数据的) result = [] current = start_time.replace(minute=0, second=0, microsecond=0) while current <= end_time: - hour_str = current.isoformat() - data = hourly_buckets.get(hour_str, {'requests': 0, 'cost': 0.0, 'tokens': 0}) - result.append(TimeSeriesData( - timestamp=hour_str, - requests=data['requests'], - cost=data['cost'], - tokens=data['tokens'] - )) + hour_str = current.strftime("%Y-%m-%dT%H:00:00") + if hour_str in data_dict: + row = data_dict[hour_str] + result.append( + TimeSeriesData(timestamp=hour_str, requests=row["requests"], cost=row["cost"], tokens=row["tokens"]) + ) + else: + result.append(TimeSeriesData(timestamp=hour_str, requests=0, cost=0.0, tokens=0)) current += timedelta(hours=1) - + return result async def _get_daily_statistics(start_time: datetime, end_time: datetime) -> List[TimeSeriesData]: - """获取日级统计数据""" - daily_buckets = defaultdict(lambda: {'requests': 0, 'cost': 0.0, 'tokens': 0}) - - records = list( - LLMUsage.select() - .where(LLMUsage.timestamp >= start_time) - .where(LLMUsage.timestamp <= end_time) + """获取日级统计数据(优化:使用数据库聚合)""" + # 使用strftime按日期分组 + query = ( + LLMUsage.select( + fn.strftime("%Y-%m-%dT00:00:00", LLMUsage.timestamp).alias("day"), + fn.COUNT(LLMUsage.id).alias("requests"), + fn.COALESCE(fn.SUM(LLMUsage.cost), 0).alias("cost"), + fn.COALESCE(fn.SUM(LLMUsage.prompt_tokens + LLMUsage.completion_tokens), 0).alias("tokens"), + ) + .where((LLMUsage.timestamp >= start_time) & (LLMUsage.timestamp <= end_time)) + .group_by(fn.strftime("%Y-%m-%dT00:00:00", LLMUsage.timestamp)) ) - - for record in records: - # 获取日期键 - day_key = record.timestamp.replace(hour=0, minute=0, second=0, microsecond=0) - day_str = day_key.isoformat() - - daily_buckets[day_str]['requests'] += 1 - daily_buckets[day_str]['cost'] += record.cost or 0.0 - daily_buckets[day_str]['tokens'] += (record.prompt_tokens or 0) + (record.completion_tokens or 0) - + + # 转换为字典 + data_dict = {row["day"]: row for row in query.dicts()} + # 填充所有天 result = [] current = start_time.replace(hour=0, minute=0, second=0, microsecond=0) while current <= end_time: - day_str = current.isoformat() - data = daily_buckets.get(day_str, {'requests': 0, 'cost': 0.0, 'tokens': 0}) - result.append(TimeSeriesData( - timestamp=day_str, - requests=data['requests'], - cost=data['cost'], - tokens=data['tokens'] - )) + day_str = current.strftime("%Y-%m-%dT00:00:00") + if day_str in data_dict: + row = data_dict[day_str] + result.append( + TimeSeriesData(timestamp=day_str, requests=row["requests"], cost=row["cost"], tokens=row["tokens"]) + ) + else: + result.append(TimeSeriesData(timestamp=day_str, requests=0, cost=0.0, tokens=0)) current += timedelta(days=1) - + return result async def _get_recent_activity(limit: int = 10) -> List[Dict[str, Any]]: """获取最近活动""" - records = list( - LLMUsage.select() - .order_by(LLMUsage.timestamp.desc()) - .limit(limit) - ) - + records = list(LLMUsage.select().order_by(LLMUsage.timestamp.desc()).limit(limit)) + activities = [] for record in records: - activities.append({ - 'timestamp': record.timestamp.isoformat(), - 'model': record.model_assign_name or record.model_name, - 'request_type': record.request_type, - 'tokens': (record.prompt_tokens or 0) + (record.completion_tokens or 0), - 'cost': record.cost or 0.0, - 'time_cost': record.time_cost or 0.0, - 'status': record.status - }) - + activities.append( + { + "timestamp": record.timestamp.isoformat(), + "model": record.model_assign_name or record.model_name, + "request_type": record.request_type, + "tokens": (record.prompt_tokens or 0) + (record.completion_tokens or 0), + "cost": record.cost or 0.0, + "time_cost": record.time_cost or 0.0, + "status": record.status, + } + ) + return activities @@ -297,7 +278,7 @@ async def _get_recent_activity(limit: int = 10) -> List[Dict[str, Any]]: async def get_summary(hours: int = 24): """ 获取统计摘要 - + Args: hours: 统计时间范围(小时) """ @@ -315,7 +296,7 @@ async def get_summary(hours: int = 24): async def get_model_stats(hours: int = 24): """ 获取模型统计 - + Args: hours: 统计时间范围(小时) """ diff --git a/src/webui/token_manager.py b/src/webui/token_manager.py index 2b606b84..69abf1d8 100644 --- a/src/webui/token_manager.py +++ b/src/webui/token_manager.py @@ -19,7 +19,7 @@ class TokenManager: def __init__(self, config_path: Optional[Path] = None): """ 初始化 Token 管理器 - + Args: config_path: 配置文件路径,默认为项目根目录的 data/webui.json """ @@ -27,10 +27,10 @@ class TokenManager: # 获取项目根目录 (src/webui -> src -> 根目录) project_root = Path(__file__).parent.parent.parent config_path = project_root / "data" / "webui.json" - + self.config_path = config_path self.config_path.parent.mkdir(parents=True, exist_ok=True) - + # 确保配置文件存在并包含有效的 token self._ensure_config() @@ -75,21 +75,23 @@ class TokenManager: """生成新的 64 位随机 token""" # 生成 64 位十六进制字符串 (32 字节 = 64 hex 字符) token = secrets.token_hex(32) - + config = { "access_token": token, "created_at": self._get_current_timestamp(), - "updated_at": self._get_current_timestamp() + "updated_at": self._get_current_timestamp(), + "first_setup_completed": False, # 标记首次配置未完成 } - + self._save_config(config) logger.info(f"新的 WebUI Token 已生成: {token[:8]}...") - + return token def _get_current_timestamp(self) -> str: """获取当前时间戳字符串""" from datetime import datetime + return datetime.now().isoformat() def get_token(self) -> str: @@ -100,38 +102,38 @@ class TokenManager: def verify_token(self, token: str) -> bool: """ 验证 token 是否有效 - + Args: token: 待验证的 token - + Returns: bool: token 是否有效 """ if not token: return False - + current_token = self.get_token() if not current_token: logger.error("系统中没有有效的 token") return False - + # 使用 secrets.compare_digest 防止时序攻击 is_valid = secrets.compare_digest(token, current_token) - + if is_valid: logger.debug("Token 验证成功") else: logger.warning("Token 验证失败") - + return is_valid def update_token(self, new_token: str) -> tuple[bool, str]: """ 更新 token - + Args: new_token: 新的 token (最少 10 位,必须包含大小写字母和特殊符号) - + Returns: tuple[bool, str]: (是否更新成功, 错误消息) """ @@ -140,17 +142,17 @@ class TokenManager: if not is_valid: logger.error(f"Token 格式无效: {error_msg}") return False, error_msg - + try: config = self._load_config() old_token = config.get("access_token", "")[:8] - + config["access_token"] = new_token config["updated_at"] = self._get_current_timestamp() - + self._save_config(config) logger.info(f"Token 已更新: {old_token}... -> {new_token[:8]}...") - + return True, "Token 更新成功" except Exception as e: logger.error(f"更新 Token 失败: {e}") @@ -159,7 +161,7 @@ class TokenManager: def regenerate_token(self) -> str: """ 重新生成 token - + Returns: str: 新生成的 token """ @@ -169,20 +171,20 @@ class TokenManager: def _validate_token_format(self, token: str) -> bool: """ 验证 token 格式是否正确(旧的 64 位十六进制验证,保留用于系统生成的 token) - + Args: token: 待验证的 token - + Returns: bool: 格式是否正确 """ if not token or not isinstance(token, str): return False - + # 必须是 64 位十六进制字符串 if len(token) != 64: return False - + # 验证是否为有效的十六进制字符串 try: int(token, 16) @@ -193,44 +195,91 @@ class TokenManager: def _validate_custom_token(self, token: str) -> tuple[bool, str]: """ 验证自定义 token 格式 - + 要求: - 最少 10 位 - 包含大写字母 - 包含小写字母 - 包含特殊符号 - + Args: token: 待验证的 token - + Returns: tuple[bool, str]: (是否有效, 错误消息) """ if not token or not isinstance(token, str): return False, "Token 不能为空" - + # 检查长度 if len(token) < 10: return False, "Token 长度至少为 10 位" - + # 检查是否包含大写字母 has_upper = any(c.isupper() for c in token) if not has_upper: return False, "Token 必须包含大写字母" - + # 检查是否包含小写字母 has_lower = any(c.islower() for c in token) if not has_lower: return False, "Token 必须包含小写字母" - + # 检查是否包含特殊符号 special_chars = "!@#$%^&*()_+-=[]{}|;:,.<>?/" has_special = any(c in special_chars for c in token) if not has_special: return False, f"Token 必须包含特殊符号 ({special_chars})" - + return True, "Token 格式正确" + def is_first_setup(self) -> bool: + """ + 检查是否为首次配置 + + Returns: + bool: 是否为首次配置 + """ + config = self._load_config() + return not config.get("first_setup_completed", False) + + def mark_setup_completed(self) -> bool: + """ + 标记首次配置已完成 + + Returns: + bool: 是否标记成功 + """ + try: + config = self._load_config() + config["first_setup_completed"] = True + config["setup_completed_at"] = self._get_current_timestamp() + self._save_config(config) + logger.info("首次配置已标记为完成") + return True + except Exception as e: + logger.error(f"标记首次配置完成失败: {e}") + return False + + def reset_setup_status(self) -> bool: + """ + 重置首次配置状态,允许重新进入配置向导 + + Returns: + bool: 是否重置成功 + """ + try: + config = self._load_config() + config["first_setup_completed"] = False + if "setup_completed_at" in config: + del config["setup_completed_at"] + self._save_config(config) + logger.info("首次配置状态已重置") + return True + except Exception as e: + logger.error(f"重置首次配置状态失败: {e}") + return False + # 全局单例 _token_manager_instance: Optional[TokenManager] = None diff --git a/src/webui/webui_server.py b/src/webui/webui_server.py new file mode 100644 index 00000000..61d279e2 --- /dev/null +++ b/src/webui/webui_server.py @@ -0,0 +1,148 @@ +"""独立的 WebUI 服务器 - 运行在 0.0.0.0:8001""" + +import os +import asyncio +import mimetypes +from pathlib import Path +from fastapi import FastAPI +from fastapi.responses import FileResponse +from uvicorn import Config, Server as UvicornServer +from src.common.logger import get_logger + +logger = get_logger("webui_server") + + +class WebUIServer: + """独立的 WebUI 服务器""" + + def __init__(self, host: str = "0.0.0.0", port: int = 8001): + self.host = host + self.port = port + self.app = FastAPI(title="MaiBot WebUI") + self._server = None + + # 显示 Access Token + self._show_access_token() + + # 重要:先注册 API 路由,再设置静态文件 + self._register_api_routes() + self._setup_static_files() + + def _show_access_token(self): + """显示 WebUI Access Token""" + try: + from src.webui.token_manager import get_token_manager + + token_manager = get_token_manager() + current_token = token_manager.get_token() + logger.info(f"🔑 WebUI Access Token: {current_token}") + logger.info("💡 请使用此 Token 登录 WebUI") + except Exception as e: + logger.error(f"❌ 获取 Access Token 失败: {e}") + + def _setup_static_files(self): + """设置静态文件服务""" + # 确保正确的 MIME 类型映射 + mimetypes.init() + mimetypes.add_type("application/javascript", ".js") + mimetypes.add_type("application/javascript", ".mjs") + mimetypes.add_type("text/css", ".css") + mimetypes.add_type("application/json", ".json") + + base_dir = Path(__file__).parent.parent.parent + static_path = base_dir / "webui" / "dist" + + if not static_path.exists(): + logger.warning(f"❌ WebUI 静态文件目录不存在: {static_path}") + logger.warning("💡 请先构建前端: cd webui && npm run build") + return + + if not (static_path / "index.html").exists(): + logger.warning(f"❌ 未找到 index.html: {static_path / 'index.html'}") + logger.warning("💡 请确认前端已正确构建") + return + + # 处理 SPA 路由 - 注意:这个路由优先级最低 + @self.app.get("/{full_path:path}", include_in_schema=False) + async def serve_spa(full_path: str): + """服务单页应用 - 只处理非 API 请求""" + # 如果是根路径,直接返回 index.html + if not full_path or full_path == "/": + return FileResponse(static_path / "index.html", media_type="text/html") + + # 检查是否是静态文件 + file_path = static_path / full_path + if file_path.is_file() and file_path.exists(): + # 自动检测 MIME 类型 + media_type = mimetypes.guess_type(str(file_path))[0] + return FileResponse(file_path, media_type=media_type) + + # 其他路径返回 index.html(SPA 路由) + return FileResponse(static_path / "index.html", media_type="text/html") + + logger.info(f"✅ WebUI 静态文件服务已配置: {static_path}") + + def _register_api_routes(self): + """注册所有 WebUI API 路由""" + try: + # 导入所有 WebUI 路由 + from src.webui.routes import router as webui_router + from src.webui.logs_ws import router as logs_router + + # 注册路由 + self.app.include_router(webui_router) + self.app.include_router(logs_router) + + logger.info("✅ WebUI API 路由已注册") + except Exception as e: + logger.error(f"❌ 注册 WebUI API 路由失败: {e}") + + async def start(self): + """启动服务器""" + config = Config( + app=self.app, + host=self.host, + port=self.port, + log_config=None, + access_log=False, + ) + self._server = UvicornServer(config=config) + + logger.info("🌐 WebUI 服务器启动中...") + logger.info(f"🌐 访问地址: http://{self.host}:{self.port}") + + try: + await self._server.serve() + except Exception as e: + logger.error(f"❌ WebUI 服务器运行错误: {e}") + raise + + async def shutdown(self): + """关闭服务器""" + if self._server: + logger.info("正在关闭 WebUI 服务器...") + self._server.should_exit = True + try: + await asyncio.wait_for(self._server.shutdown(), timeout=3.0) + logger.info("✅ WebUI 服务器已关闭") + except asyncio.TimeoutError: + logger.warning("⚠️ WebUI 服务器关闭超时") + except Exception as e: + logger.error(f"❌ WebUI 服务器关闭失败: {e}") + finally: + self._server = None + + +# 全局 WebUI 服务器实例 +_webui_server = None + + +def get_webui_server() -> WebUIServer: + """获取全局 WebUI 服务器实例""" + global _webui_server + if _webui_server is None: + # 从环境变量读取配置 + host = os.getenv("WEBUI_HOST", "0.0.0.0") + port = int(os.getenv("WEBUI_PORT", "8001")) + _webui_server = WebUIServer(host=host, port=port) + return _webui_server diff --git a/template/bot_config_template.toml b/template/bot_config_template.toml index 8bbfaf9d..2c1da1be 100644 --- a/template/bot_config_template.toml +++ b/template/bot_config_template.toml @@ -1,5 +1,5 @@ [inner] -version = "6.21.6" +version = "6.21.8" #----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- #如果你想要修改配置文件,请递增version的值 @@ -211,6 +211,9 @@ show_prompt = false # 是否显示prompt show_replyer_prompt = false # 是否显示回复器prompt show_replyer_reasoning = false # 是否显示回复器推理 show_jargon_prompt = false # 是否显示jargon相关提示词 +show_memory_prompt = false # 是否显示记忆检索相关提示词 +show_planner_prompt = false # 是否显示planner的prompt和原始返回结果 +show_lpmm_paragraph = false # 是否显示lpmm找到的相关文段日志 [maim_message] auth_token = [] # 认证令牌,用于API验证,为空则不启用验证 diff --git a/template/template.env b/template/template.env index b9d612af..b6dd0e5c 100644 --- a/template/template.env +++ b/template/template.env @@ -1,7 +1,9 @@ +# 麦麦主程序配置 HOST=127.0.0.1 PORT=8000 -# WebUI 配置 -# WEBUI_ENABLED=true -# WEBUI_MODE=development # 开发模式(需手动启动前端: cd webui && npm run dev,端口 7999) -# WEBUI_MODE=production # 生产模式(需先构建前端: cd webui && npm run build) \ No newline at end of file +# WebUI 独立服务器配置 +WEBUI_ENABLED=true +WEBUI_MODE=production # 模式: development(开发) 或 production(生产) +WEBUI_HOST=0.0.0.0 # WebUI 服务器监听地址 +WEBUI_PORT=8001 # WebUI 服务器端口 \ No newline at end of file diff --git a/webui/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 b/webui/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 new file mode 100644 index 00000000..0acaaff0 Binary files /dev/null and b/webui/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 differ diff --git a/webui/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff b/webui/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff new file mode 100644 index 00000000..b804d7b3 Binary files /dev/null and b/webui/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff differ diff --git a/webui/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf b/webui/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf new file mode 100644 index 00000000..c6f9a5e7 Binary files /dev/null and b/webui/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf differ diff --git a/webui/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf b/webui/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf new file mode 100644 index 00000000..9ff4a5e0 Binary files /dev/null and b/webui/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf differ diff --git a/webui/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff b/webui/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff new file mode 100644 index 00000000..9759710d Binary files /dev/null and b/webui/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff differ diff --git a/webui/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 b/webui/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 new file mode 100644 index 00000000..f390922e Binary files /dev/null and b/webui/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 differ diff --git a/webui/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff b/webui/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff new file mode 100644 index 00000000..9bdd534f Binary files /dev/null and b/webui/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff differ diff --git a/webui/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 b/webui/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 new file mode 100644 index 00000000..75344a1f Binary files /dev/null and b/webui/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 differ diff --git a/webui/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf b/webui/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf new file mode 100644 index 00000000..f522294f Binary files /dev/null and b/webui/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf differ diff --git a/webui/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf b/webui/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf new file mode 100644 index 00000000..4e98259c Binary files /dev/null and b/webui/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf differ diff --git a/webui/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff b/webui/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff new file mode 100644 index 00000000..e7730f66 Binary files /dev/null and b/webui/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff differ diff --git a/webui/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 b/webui/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 new file mode 100644 index 00000000..395f28be Binary files /dev/null and b/webui/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 differ diff --git a/webui/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf b/webui/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf new file mode 100644 index 00000000..b8461b27 Binary files /dev/null and b/webui/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf differ diff --git a/webui/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 b/webui/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 new file mode 100644 index 00000000..735f6948 Binary files /dev/null and b/webui/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 differ diff --git a/webui/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff b/webui/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff new file mode 100644 index 00000000..acab069f Binary files /dev/null and b/webui/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff differ diff --git a/webui/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 b/webui/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 new file mode 100644 index 00000000..ab2ad21d Binary files /dev/null and b/webui/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 differ diff --git a/webui/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff b/webui/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff new file mode 100644 index 00000000..f38136ac Binary files /dev/null and b/webui/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff differ diff --git a/webui/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf b/webui/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf new file mode 100644 index 00000000..4060e627 Binary files /dev/null and b/webui/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf differ diff --git a/webui/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 b/webui/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 new file mode 100644 index 00000000..5931794d Binary files /dev/null and b/webui/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 differ diff --git a/webui/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf b/webui/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf new file mode 100644 index 00000000..dc007977 Binary files /dev/null and b/webui/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf differ diff --git a/webui/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff b/webui/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff new file mode 100644 index 00000000..67807b0b Binary files /dev/null and b/webui/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff differ diff --git a/webui/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf b/webui/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf new file mode 100644 index 00000000..0e9b0f35 Binary files /dev/null and b/webui/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf differ diff --git a/webui/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff b/webui/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff new file mode 100644 index 00000000..6f43b594 Binary files /dev/null and b/webui/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff differ diff --git a/webui/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 b/webui/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 new file mode 100644 index 00000000..b50920e1 Binary files /dev/null and b/webui/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 differ diff --git a/webui/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 b/webui/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 new file mode 100644 index 00000000..eb24a7ba Binary files /dev/null and b/webui/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 differ diff --git a/webui/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff b/webui/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff new file mode 100644 index 00000000..21f58129 Binary files /dev/null and b/webui/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff differ diff --git a/webui/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf b/webui/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf new file mode 100644 index 00000000..dd45e1ed Binary files /dev/null and b/webui/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf differ diff --git a/webui/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf b/webui/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf new file mode 100644 index 00000000..728ce7a1 Binary files /dev/null and b/webui/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf differ diff --git a/webui/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 b/webui/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 new file mode 100644 index 00000000..29657023 Binary files /dev/null and b/webui/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 differ diff --git a/webui/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff b/webui/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff new file mode 100644 index 00000000..0ae390d7 Binary files /dev/null and b/webui/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff differ diff --git a/webui/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff b/webui/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff new file mode 100644 index 00000000..eb5159d4 Binary files /dev/null and b/webui/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff differ diff --git a/webui/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf b/webui/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf new file mode 100644 index 00000000..70d559b4 Binary files /dev/null and b/webui/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf differ diff --git a/webui/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 b/webui/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 new file mode 100644 index 00000000..215c143f Binary files /dev/null and b/webui/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 differ diff --git a/webui/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf b/webui/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf new file mode 100644 index 00000000..2f65a8a3 Binary files /dev/null and b/webui/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf differ diff --git a/webui/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 b/webui/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 new file mode 100644 index 00000000..cfaa3bda Binary files /dev/null and b/webui/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 differ diff --git a/webui/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff b/webui/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff new file mode 100644 index 00000000..8d47c02d Binary files /dev/null and b/webui/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff differ diff --git a/webui/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 b/webui/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 new file mode 100644 index 00000000..349c06dc Binary files /dev/null and b/webui/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 differ diff --git a/webui/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff b/webui/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff new file mode 100644 index 00000000..7e02df96 Binary files /dev/null and b/webui/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff differ diff --git a/webui/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf b/webui/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf new file mode 100644 index 00000000..d5850df9 Binary files /dev/null and b/webui/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf differ diff --git a/webui/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf b/webui/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf new file mode 100644 index 00000000..537279f6 Binary files /dev/null and b/webui/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf differ diff --git a/webui/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff b/webui/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff new file mode 100644 index 00000000..31b84829 Binary files /dev/null and b/webui/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff differ diff --git a/webui/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 b/webui/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 new file mode 100644 index 00000000..a90eea85 Binary files /dev/null and b/webui/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 differ diff --git a/webui/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf b/webui/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf new file mode 100644 index 00000000..fd679bf3 Binary files /dev/null and b/webui/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf differ diff --git a/webui/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 b/webui/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 new file mode 100644 index 00000000..b3048fc1 Binary files /dev/null and b/webui/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 differ diff --git a/webui/dist/assets/KaTeX_Script-Regular-D5yQViql.woff b/webui/dist/assets/KaTeX_Script-Regular-D5yQViql.woff new file mode 100644 index 00000000..0e7da821 Binary files /dev/null and b/webui/dist/assets/KaTeX_Script-Regular-D5yQViql.woff differ diff --git a/webui/dist/assets/KaTeX_Size1-Regular-C195tn64.woff b/webui/dist/assets/KaTeX_Size1-Regular-C195tn64.woff new file mode 100644 index 00000000..7f292d91 Binary files /dev/null and b/webui/dist/assets/KaTeX_Size1-Regular-C195tn64.woff differ diff --git a/webui/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf b/webui/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf new file mode 100644 index 00000000..871fd7d1 Binary files /dev/null and b/webui/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf differ diff --git a/webui/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 b/webui/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 new file mode 100644 index 00000000..c5a8462f Binary files /dev/null and b/webui/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 differ diff --git a/webui/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf b/webui/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf new file mode 100644 index 00000000..7a212caf Binary files /dev/null and b/webui/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf differ diff --git a/webui/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 b/webui/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 new file mode 100644 index 00000000..e1bccfe2 Binary files /dev/null and b/webui/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 differ diff --git a/webui/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff b/webui/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff new file mode 100644 index 00000000..d241d9be Binary files /dev/null and b/webui/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff differ diff --git a/webui/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff b/webui/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff new file mode 100644 index 00000000..e6e9b658 Binary files /dev/null and b/webui/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff differ diff --git a/webui/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf b/webui/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf new file mode 100644 index 00000000..00bff349 Binary files /dev/null and b/webui/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf differ diff --git a/webui/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff b/webui/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff new file mode 100644 index 00000000..e1ec5457 Binary files /dev/null and b/webui/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff differ diff --git a/webui/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf b/webui/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf new file mode 100644 index 00000000..74f08921 Binary files /dev/null and b/webui/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf differ diff --git a/webui/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 b/webui/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 new file mode 100644 index 00000000..680c1308 Binary files /dev/null and b/webui/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 differ diff --git a/webui/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff b/webui/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff new file mode 100644 index 00000000..2432419f Binary files /dev/null and b/webui/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff differ diff --git a/webui/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 b/webui/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 new file mode 100644 index 00000000..771f1af7 Binary files /dev/null and b/webui/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 differ diff --git a/webui/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf b/webui/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf new file mode 100644 index 00000000..c83252c5 Binary files /dev/null and b/webui/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf differ diff --git a/webui/dist/assets/charts-B1JvyJzO.js b/webui/dist/assets/charts-B1JvyJzO.js new file mode 100644 index 00000000..7d2ae929 --- /dev/null +++ b/webui/dist/assets/charts-B1JvyJzO.js @@ -0,0 +1,65 @@ +import{r as N,R as S,i as Qt}from"./router-BWgTyY51.js";import{c as vi,g as oe}from"./react-vendor-Dtc2IqVY.js";function Ub(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t-1}return Ho=t,Ho}var Ko,Op;function TO(){if(Op)return Ko;Op=1;var e=ja();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return Ko=t,Ko}var Go,_p;function Ma(){if(_p)return Go;_p=1;var e=_O(),t=AO(),r=SO(),n=PO(),i=TO();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u0?1:-1},Gt=function(t){return er(t)&&t.indexOf("%")===t.length-1},q=function(t){return YO(t)&&!oi(t)},ZO=function(t){return Y(t)},Ae=function(t){return q(t)||er(t)},JO=0,Zr=function(t){var r=++JO;return"".concat(t||"").concat(r)},Ie=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!q(t)&&!er(t))return n;var a;if(Gt(t)){var o=t.indexOf("%");a=r*parseFloat(t.slice(0,o))/100}else a=+t;return oi(a)&&(a=n),i&&a>r&&(a=r),a},Mt=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},QO=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function o_(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function ml(e){"@babel/helpers - typeof";return ml=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ml(e)}var Zp={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},bt=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},Jp=null,bu=null,Kf=function e(t){if(t===Jp&&Array.isArray(bu))return bu;var r=[];return N.Children.forEach(t,function(n){Y(n)||(KO.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),bu=r,Jp=t,r};function Ke(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(i){return bt(i)}):n=[bt(t)],Kf(e).forEach(function(i){var a=He(i,"type.displayName")||He(i,"type.name");n.indexOf(a)!==-1&&r.push(i)}),r}function We(e,t){var r=Ke(e,t);return r&&r[0]}var Qp=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,i=r.height;return!(!q(n)||n<=0||!q(i)||i<=0)},u_=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],c_=function(t){return t&&t.type&&er(t.type)&&u_.indexOf(t.type)>=0},s_=function(t){return t&&ml(t)==="object"&&"clipDot"in t},l_=function(t,r,n,i){var a,o=(a=gu?.[i])!==null&&a!==void 0?a:[];return r.startsWith("data-")||!X(t)&&(i&&o.includes(r)||r_.includes(r))||n&&Hf.includes(r)},H=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(N.isValidElement(t)&&(i=t.props),!Yr(i))return null;var a={};return Object.keys(i).forEach(function(o){var u;l_((u=i)===null||u===void 0?void 0:u[o],o,r,n)&&(a[o]=i[o])}),a},gl=function e(t,r){if(t===r)return!0;var n=N.Children.count(t);if(n!==N.Children.count(r))return!1;if(n===0)return!0;if(n===1)return ed(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function v_(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function xl(e){var t=e.children,r=e.width,n=e.height,i=e.viewBox,a=e.className,o=e.style,u=e.title,c=e.desc,s=d_(e,p_),f=i||{width:r,height:n,x:0,y:0},l=J("recharts-surface",a);return S.createElement("svg",bl({},H(s,!0,"svg"),{className:l,width:r,height:n,style:o,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height)}),S.createElement("title",null,u),S.createElement("desc",null,c),t)}var y_=["children","className"];function wl(){return wl=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function g_(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var te=S.forwardRef(function(e,t){var r=e.children,n=e.className,i=m_(e,y_),a=J("recharts-layer",n);return S.createElement("g",wl({className:a},H(i,!0),{ref:t}),r)}),it=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;aa?0:a+r),n=n>a?a:n,n<0&&(n+=a),a=r>n?0:n-r>>>0,r>>>=0;for(var o=Array(a);++i=a?r:e(r,n,i)}return wu=t,wu}var Ou,id;function Jb(){if(id)return Ou;id=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="\\u200d",u=RegExp("["+o+e+i+a+"]");function c(s){return u.test(s)}return Ou=c,Ou}var _u,ad;function w_(){if(ad)return _u;ad=1;function e(t){return t.split("")}return _u=e,_u}var Au,od;function O_(){if(od)return Au;od=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="["+e+"]",u="["+i+"]",c="\\ud83c[\\udffb-\\udfff]",s="(?:"+u+"|"+c+")",f="[^"+e+"]",l="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",d="\\u200d",y=s+"?",v="["+a+"]?",p="(?:"+d+"(?:"+[f,l,h].join("|")+")"+v+y+")*",g=v+y+p,x="(?:"+[f+u+"?",u,l,h,o].join("|")+")",w=RegExp(c+"(?="+c+")|"+x+g,"g");function O(m){return m.match(w)||[]}return Au=O,Au}var Su,ud;function __(){if(ud)return Su;ud=1;var e=w_(),t=Jb(),r=O_();function n(i){return t(i)?r(i):e(i)}return Su=n,Su}var Pu,cd;function A_(){if(cd)return Pu;cd=1;var e=x_(),t=Jb(),r=__(),n=Vb();function i(a){return function(o){o=n(o);var u=t(o)?r(o):void 0,c=u?u[0]:o.charAt(0),s=u?e(u,1).join(""):o.slice(1);return c[a]()+s}}return Pu=i,Pu}var Tu,sd;function S_(){if(sd)return Tu;sd=1;var e=A_(),t=e("toUpperCase");return Tu=t,Tu}var P_=S_();const Ia=oe(P_);function se(e){return function(){return e}}const Qb=Math.cos,Ci=Math.sin,at=Math.sqrt,Ii=Math.PI,ka=2*Ii,Ol=Math.PI,_l=2*Ol,Ut=1e-6,T_=_l-Ut;function e0(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return e0;const r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;iUt)if(!(Math.abs(l*c-s*f)>Ut)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let d=n-o,y=i-u,v=c*c+s*s,p=d*d+y*y,g=Math.sqrt(v),x=Math.sqrt(h),w=a*Math.tan((Ol-Math.acos((v+h-p)/(2*g*x)))/2),O=w/x,m=w/g;Math.abs(O-1)>Ut&&this._append`L${t+O*f},${r+O*l}`,this._append`A${a},${a},0,0,${+(l*d>f*y)},${this._x1=t+m*c},${this._y1=r+m*s}`}}arc(t,r,n,i,a,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let u=n*Math.cos(i),c=n*Math.sin(i),s=t+u,f=r+c,l=1^o,h=o?i-a:a-i;this._x1===null?this._append`M${s},${f}`:(Math.abs(this._x1-s)>Ut||Math.abs(this._y1-f)>Ut)&&this._append`L${s},${f}`,n&&(h<0&&(h=h%_l+_l),h>T_?this._append`A${n},${n},0,1,${l},${t-u},${r-c}A${n},${n},0,1,${l},${this._x1=s},${this._y1=f}`:h>Ut&&this._append`A${n},${n},0,${+(h>=Ol)},${l},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function Gf(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new j_(t)}function Vf(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function t0(e){this._context=e}t0.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Ra(e){return new t0(e)}function r0(e){return e[0]}function n0(e){return e[1]}function i0(e,t){var r=se(!0),n=null,i=Ra,a=null,o=Gf(u);e=typeof e=="function"?e:e===void 0?r0:se(e),t=typeof t=="function"?t:t===void 0?n0:se(t);function u(c){var s,f=(c=Vf(c)).length,l,h=!1,d;for(n==null&&(a=i(d=o())),s=0;s<=f;++s)!(s=d;--y)u.point(w[y],O[y]);u.lineEnd(),u.areaEnd()}g&&(w[h]=+e(p,h,l),O[h]=+t(p,h,l),u.point(n?+n(p,h,l):w[h],r?+r(p,h,l):O[h]))}if(x)return u=null,x+""||null}function f(){return i0().defined(i).curve(o).context(a)}return s.x=function(l){return arguments.length?(e=typeof l=="function"?l:se(+l),n=null,s):e},s.x0=function(l){return arguments.length?(e=typeof l=="function"?l:se(+l),s):e},s.x1=function(l){return arguments.length?(n=l==null?null:typeof l=="function"?l:se(+l),s):n},s.y=function(l){return arguments.length?(t=typeof l=="function"?l:se(+l),r=null,s):t},s.y0=function(l){return arguments.length?(t=typeof l=="function"?l:se(+l),s):t},s.y1=function(l){return arguments.length?(r=l==null?null:typeof l=="function"?l:se(+l),s):r},s.lineX0=s.lineY0=function(){return f().x(e).y(t)},s.lineY1=function(){return f().x(e).y(r)},s.lineX1=function(){return f().x(n).y(t)},s.defined=function(l){return arguments.length?(i=typeof l=="function"?l:se(!!l),s):i},s.curve=function(l){return arguments.length?(o=l,a!=null&&(u=o(a)),s):o},s.context=function(l){return arguments.length?(l==null?a=u=null:u=o(a=l),s):a},s}class a0{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function M_(e){return new a0(e,!0)}function $_(e){return new a0(e,!1)}const Xf={draw(e,t){const r=at(t/Ii);e.moveTo(r,0),e.arc(0,0,r,0,ka)}},C_={draw(e,t){const r=at(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},o0=at(1/3),I_=o0*2,k_={draw(e,t){const r=at(t/I_),n=r*o0;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},R_={draw(e,t){const r=at(t),n=-r/2;e.rect(n,n,r,r)}},D_=.8908130915292852,u0=Ci(Ii/10)/Ci(7*Ii/10),N_=Ci(ka/10)*u0,q_=-Qb(ka/10)*u0,L_={draw(e,t){const r=at(t*D_),n=N_*r,i=q_*r;e.moveTo(0,-r),e.lineTo(n,i);for(let a=1;a<5;++a){const o=ka*a/5,u=Qb(o),c=Ci(o);e.lineTo(c*r,-u*r),e.lineTo(u*n-c*i,c*n+u*i)}e.closePath()}},Eu=at(3),B_={draw(e,t){const r=-at(t/(Eu*3));e.moveTo(0,r*2),e.lineTo(-Eu*r,-r),e.lineTo(Eu*r,-r),e.closePath()}},Ge=-.5,Ve=at(3)/2,Al=1/at(12),F_=(Al/2+1)*3,W_={draw(e,t){const r=at(t/F_),n=r/2,i=r*Al,a=n,o=r*Al+r,u=-a,c=o;e.moveTo(n,i),e.lineTo(a,o),e.lineTo(u,c),e.lineTo(Ge*n-Ve*i,Ve*n+Ge*i),e.lineTo(Ge*a-Ve*o,Ve*a+Ge*o),e.lineTo(Ge*u-Ve*c,Ve*u+Ge*c),e.lineTo(Ge*n+Ve*i,Ge*i-Ve*n),e.lineTo(Ge*a+Ve*o,Ge*o-Ve*a),e.lineTo(Ge*u+Ve*c,Ge*c-Ve*u),e.closePath()}};function z_(e,t){let r=null,n=Gf(i);e=typeof e=="function"?e:se(e||Xf),t=typeof t=="function"?t:se(t===void 0?64:+t);function i(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:se(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:se(+a),i):t},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function ki(){}function Ri(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function c0(e){this._context=e}c0.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Ri(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ri(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function U_(e){return new c0(e)}function s0(e){this._context=e}s0.prototype={areaStart:ki,areaEnd:ki,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Ri(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function H_(e){return new s0(e)}function l0(e){this._context=e}l0.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Ri(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function K_(e){return new l0(e)}function f0(e){this._context=e}f0.prototype={areaStart:ki,areaEnd:ki,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function G_(e){return new f0(e)}function ld(e){return e<0?-1:1}function fd(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),u=(a*i+o*n)/(n+i);return(ld(a)+ld(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(u))||0}function hd(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function ju(e,t,r){var n=e._x0,i=e._y0,a=e._x1,o=e._y1,u=(a-n)/3;e._context.bezierCurveTo(n+u,i+u*t,a-u,o-u*r,a,o)}function Di(e){this._context=e}Di.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:ju(this,this._t0,hd(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,ju(this,hd(this,r=fd(this,e,t)),r);break;default:ju(this,this._t0,r=fd(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function h0(e){this._context=new p0(e)}(h0.prototype=Object.create(Di.prototype)).point=function(e,t){Di.prototype.point.call(this,t,e)};function p0(e){this._context=e}p0.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}};function V_(e){return new Di(e)}function X_(e){return new h0(e)}function d0(e){this._context=e}d0.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=pd(e),i=pd(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function Z_(e){return new Da(e,.5)}function J_(e){return new Da(e,0)}function Q_(e){return new Da(e,1)}function Ar(e,t){if((o=e.length)>1)for(var r=1,n,i,a=e[t[0]],o,u=a.length;r=0;)r[t]=t;return r}function e1(e,t){return e[t]}function t1(e){const t=[];return t.key=e,t}function r1(){var e=se([]),t=Sl,r=Ar,n=e1;function i(a){var o=Array.from(e.apply(this,arguments),t1),u,c=o.length,s=-1,f;for(const l of a)for(u=0,++s;u0){for(var r,n,i=0,a=e[0].length,o;i0){for(var r=0,n=e[t[0]],i,a=n.length;r0)||!((a=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,a,o;n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function f1(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var v0={symbolCircle:Xf,symbolCross:C_,symbolDiamond:k_,symbolSquare:R_,symbolStar:L_,symbolTriangle:B_,symbolWye:W_},h1=Math.PI/180,p1=function(t){var r="symbol".concat(Ia(t));return v0[r]||Xf},d1=function(t,r,n){if(r==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*h1;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},v1=function(t,r){v0["symbol".concat(Ia(t))]=r},Yf=function(t){var r=t.type,n=r===void 0?"circle":r,i=t.size,a=i===void 0?64:i,o=t.sizeType,u=o===void 0?"area":o,c=l1(t,o1),s=vd(vd({},c),{},{type:n,size:a,sizeType:u}),f=function(){var p=p1(n),g=z_().type(p).size(d1(a,u,n));return g()},l=s.className,h=s.cx,d=s.cy,y=H(s,!0);return h===+h&&d===+d&&a===+a?S.createElement("path",Pl({},y,{className:J("recharts-symbols",l),transform:"translate(".concat(h,", ").concat(d,")"),d:f()})):null};Yf.registerSymbol=v1;function Sr(e){"@babel/helpers - typeof";return Sr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sr(e)}function Tl(){return Tl=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var x=d.inactive?s:d.color;return S.createElement("li",Tl({className:p,style:l,key:"legend-item-".concat(y)},tr(n.props,d,y)),S.createElement(xl,{width:o,height:o,viewBox:f,style:h},n.renderIcon(d)),S.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},v?v(g,d,y):g))})}},{key:"render",value:function(){var n=this.props,i=n.payload,a=n.layout,o=n.align;if(!i||!i.length)return null;var u={padding:0,margin:0,textAlign:a==="horizontal"?o:"left"};return S.createElement("ul",{className:"recharts-default-legend",style:u},this.renderItems())}}])})(N.PureComponent);Sn(Zf,"displayName","Legend");Sn(Zf,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var Mu,md;function S1(){if(md)return Mu;md=1;var e=Ma();function t(){this.__data__=new e,this.size=0}return Mu=t,Mu}var $u,gd;function P1(){if(gd)return $u;gd=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return $u=e,$u}var Cu,bd;function T1(){if(bd)return Cu;bd=1;function e(t){return this.__data__.get(t)}return Cu=e,Cu}var Iu,xd;function E1(){if(xd)return Iu;xd=1;function e(t){return this.__data__.has(t)}return Iu=e,Iu}var ku,wd;function j1(){if(wd)return ku;wd=1;var e=Ma(),t=Ff(),r=Wf(),n=200;function i(a,o){var u=this.__data__;if(u instanceof e){var c=u.__data__;if(!t||c.lengthd))return!1;var v=l.get(o),p=l.get(u);if(v&&p)return v==u&&p==o;var g=-1,x=!0,w=c&i?new e:void 0;for(l.set(o,u),l.set(u,o);++g-1&&n%1==0&&n-1&&r%1==0&&r<=e}return rc=t,rc}var nc,Hd;function W1(){if(Hd)return nc;Hd=1;var e=St(),t=th(),r=Pt(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",o="[object Date]",u="[object Error]",c="[object Function]",s="[object Map]",f="[object Number]",l="[object Object]",h="[object RegExp]",d="[object Set]",y="[object String]",v="[object WeakMap]",p="[object ArrayBuffer]",g="[object DataView]",x="[object Float32Array]",w="[object Float64Array]",O="[object Int8Array]",m="[object Int16Array]",b="[object Int32Array]",_="[object Uint8Array]",A="[object Uint8ClampedArray]",T="[object Uint16Array]",M="[object Uint32Array]",P={};P[x]=P[w]=P[O]=P[m]=P[b]=P[_]=P[A]=P[T]=P[M]=!0,P[n]=P[i]=P[p]=P[a]=P[g]=P[o]=P[u]=P[c]=P[s]=P[f]=P[l]=P[h]=P[d]=P[y]=P[v]=!1;function E(j){return r(j)&&t(j.length)&&!!P[e(j)]}return nc=E,nc}var ic,Kd;function S0(){if(Kd)return ic;Kd=1;function e(t){return function(r){return t(r)}}return ic=e,ic}var vn={exports:{}};vn.exports;var Gd;function z1(){return Gd||(Gd=1,(function(e,t){var r=Hb(),n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===n,o=a&&r.process,u=(function(){try{var c=i&&i.require&&i.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}})();e.exports=u})(vn,vn.exports)),vn.exports}var ac,Vd;function P0(){if(Vd)return ac;Vd=1;var e=W1(),t=S0(),r=z1(),n=r&&r.isTypedArray,i=n?t(n):e;return ac=i,ac}var oc,Xd;function U1(){if(Xd)return oc;Xd=1;var e=L1(),t=Qf(),r=qe(),n=A0(),i=eh(),a=P0(),o=Object.prototype,u=o.hasOwnProperty;function c(s,f){var l=r(s),h=!l&&t(s),d=!l&&!h&&n(s),y=!l&&!h&&!d&&a(s),v=l||h||d||y,p=v?e(s.length,String):[],g=p.length;for(var x in s)(f||u.call(s,x))&&!(v&&(x=="length"||d&&(x=="offset"||x=="parent")||y&&(x=="buffer"||x=="byteLength"||x=="byteOffset")||i(x,g)))&&p.push(x);return p}return oc=c,oc}var uc,Yd;function H1(){if(Yd)return uc;Yd=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,i=typeof n=="function"&&n.prototype||e;return r===i}return uc=t,uc}var cc,Zd;function T0(){if(Zd)return cc;Zd=1;function e(t,r){return function(n){return t(r(n))}}return cc=e,cc}var sc,Jd;function K1(){if(Jd)return sc;Jd=1;var e=T0(),t=e(Object.keys,Object);return sc=t,sc}var lc,Qd;function G1(){if(Qd)return lc;Qd=1;var e=H1(),t=K1(),r=Object.prototype,n=r.hasOwnProperty;function i(a){if(!e(a))return t(a);var o=[];for(var u in Object(a))n.call(a,u)&&u!="constructor"&&o.push(u);return o}return lc=i,lc}var fc,ev;function ui(){if(ev)return fc;ev=1;var e=Lf(),t=th();function r(n){return n!=null&&t(n.length)&&!e(n)}return fc=r,fc}var hc,tv;function Na(){if(tv)return hc;tv=1;var e=U1(),t=G1(),r=ui();function n(i){return r(i)?e(i):t(i)}return hc=n,hc}var pc,rv;function V1(){if(rv)return pc;rv=1;var e=R1(),t=q1(),r=Na();function n(i){return e(i,r,t)}return pc=n,pc}var dc,nv;function X1(){if(nv)return dc;nv=1;var e=V1(),t=1,r=Object.prototype,n=r.hasOwnProperty;function i(a,o,u,c,s,f){var l=u&t,h=e(a),d=h.length,y=e(o),v=y.length;if(d!=v&&!l)return!1;for(var p=d;p--;){var g=h[p];if(!(l?g in o:n.call(o,g)))return!1}var x=f.get(a),w=f.get(o);if(x&&w)return x==o&&w==a;var O=!0;f.set(a,o),f.set(o,a);for(var m=l;++p-1}return Bc=t,Bc}var Fc,Mv;function vA(){if(Mv)return Fc;Mv=1;function e(t,r,n){for(var i=-1,a=t==null?0:t.length;++i=o){var g=s?null:i(c);if(g)return a(g);y=!1,h=n,p=new e}else p=s?[]:v;e:for(;++l=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function MA(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function $A(e){return e.value}function CA(e,t){if(S.isValidElement(e))return S.cloneElement(e,t);if(typeof e=="function")return S.createElement(e,t);t.ref;var r=jA(t,wA);return S.createElement(Zf,r)}var qv=1,wr=(function(e){function t(){var r;OA(this,t);for(var n=arguments.length,i=new Array(n),a=0;aqv||Math.abs(i.height-this.lastBoundingBox.height)>qv)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,n&&n(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?pt({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var i=this.props,a=i.layout,o=i.align,u=i.verticalAlign,c=i.margin,s=i.chartWidth,f=i.chartHeight,l,h;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(o==="center"&&a==="vertical"){var d=this.getBBoxSnapshot();l={left:((s||0)-d.width)/2}}else l=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(u==="middle"){var y=this.getBBoxSnapshot();h={top:((f||0)-y.height)/2}}else h=u==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return pt(pt({},l),h)}},{key:"render",value:function(){var n=this,i=this.props,a=i.content,o=i.width,u=i.height,c=i.wrapperStyle,s=i.payloadUniqBy,f=i.payload,l=pt(pt({position:"absolute",width:o||"auto",height:u||"auto"},this.getDefaultPosition(c)),c);return S.createElement("div",{className:"recharts-legend-wrapper",style:l,ref:function(d){n.wrapperNode=d}},CA(a,pt(pt({},this.props),{},{payload:C0(f,s,$A)})))}}],[{key:"getWithHeight",value:function(n,i){var a=pt(pt({},this.defaultProps),n.props),o=a.layout;return o==="vertical"&&q(n.props.height)?{height:n.props.height}:o==="horizontal"?{width:n.props.width||i}:null}}])})(N.PureComponent);qa(wr,"displayName","Legend");qa(wr,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var Kc,Lv;function IA(){if(Lv)return Kc;Lv=1;var e=ai(),t=Qf(),r=qe(),n=e?e.isConcatSpreadable:void 0;function i(a){return r(a)||t(a)||!!(n&&a&&a[n])}return Kc=i,Kc}var Gc,Bv;function R0(){if(Bv)return Gc;Bv=1;var e=_0(),t=IA();function r(n,i,a,o,u){var c=-1,s=n.length;for(a||(a=t),u||(u=[]);++c0&&a(f)?i>1?r(f,i-1,a,o,u):e(u,f):o||(u[u.length]=f)}return u}return Gc=r,Gc}var Vc,Fv;function kA(){if(Fv)return Vc;Fv=1;function e(t){return function(r,n,i){for(var a=-1,o=Object(r),u=i(r),c=u.length;c--;){var s=u[t?c:++a];if(n(o[s],s,o)===!1)break}return r}}return Vc=e,Vc}var Xc,Wv;function RA(){if(Wv)return Xc;Wv=1;var e=kA(),t=e();return Xc=t,Xc}var Yc,zv;function D0(){if(zv)return Yc;zv=1;var e=RA(),t=Na();function r(n,i){return n&&e(n,i,t)}return Yc=r,Yc}var Zc,Uv;function DA(){if(Uv)return Zc;Uv=1;var e=ui();function t(r,n){return function(i,a){if(i==null)return i;if(!e(i))return r(i,a);for(var o=i.length,u=n?o:-1,c=Object(i);(n?u--:++un||u&&c&&f&&!s&&!l||a&&c&&f||!i&&f||!o)return 1;if(!a&&!u&&!l&&r=s)return f;var l=i[a];return f*(l=="desc"?-1:1)}}return r.index-n.index}return rs=t,rs}var ns,Yv;function BA(){if(Yv)return ns;Yv=1;var e=zf(),t=Uf(),r=ht(),n=N0(),i=NA(),a=S0(),o=LA(),u=Jr(),c=qe();function s(f,l,h){l.length?l=e(l,function(v){return c(v)?function(p){return t(p,v.length===1?v[0]:v)}:v}):l=[u];var d=-1;l=e(l,a(r));var y=n(f,function(v,p,g){var x=e(l,function(w){return w(v)});return{criteria:x,index:++d,value:v}});return i(y,function(v,p){return o(v,p,h)})}return ns=s,ns}var is,Zv;function FA(){if(Zv)return is;Zv=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return is=e,is}var as,Jv;function WA(){if(Jv)return as;Jv=1;var e=FA(),t=Math.max;function r(n,i,a){return i=t(i===void 0?n.length-1:i,0),function(){for(var o=arguments,u=-1,c=t(o.length-i,0),s=Array(c);++u0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return ss=n,ss}var ls,ny;function KA(){if(ny)return ls;ny=1;var e=UA(),t=HA(),r=t(e);return ls=r,ls}var fs,iy;function GA(){if(iy)return fs;iy=1;var e=Jr(),t=WA(),r=KA();function n(i,a){return r(t(i,a,e),i+"")}return fs=n,fs}var hs,ay;function La(){if(ay)return hs;ay=1;var e=Bf(),t=ui(),r=eh(),n=It();function i(a,o,u){if(!n(u))return!1;var c=typeof o;return(c=="number"?t(u)&&r(o,u.length):c=="string"&&o in u)?e(u[o],a):!1}return hs=i,hs}var ps,oy;function VA(){if(oy)return ps;oy=1;var e=R0(),t=BA(),r=GA(),n=La(),i=r(function(a,o){if(a==null)return[];var u=o.length;return u>1&&n(a,o[0],o[1])?o=[]:u>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),t(a,e(o,1),[])});return ps=i,ps}var XA=VA();const ih=oe(XA);function Pn(e){"@babel/helpers - typeof";return Pn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pn(e)}function Ml(){return Ml=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=t.x),"".concat(an,"-left"),q(r)&&t&&q(t.x)&&r=t.y),"".concat(an,"-top"),q(n)&&t&&q(t.y)&&nv?Math.max(f,c[n]):Math.max(l,c[n])}function lS(e){var t=e.translateX,r=e.translateY,n=e.useTranslate3d;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function fS(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.offsetTopLeft,i=e.position,a=e.reverseDirection,o=e.tooltipBox,u=e.useTranslate3d,c=e.viewBox,s,f,l;return o.height>0&&o.width>0&&r?(f=sy({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),l=sy({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),s=lS({translateX:f,translateY:l,useTranslate3d:u})):s=cS,{cssProperties:s,cssClasses:sS({translateX:f,translateY:l,coordinate:r})}}function Tr(e){"@babel/helpers - typeof";return Tr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tr(e)}function ly(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function fy(e){for(var t=1;thy||Math.abs(n.height-this.state.lastBoundingBox.height)>hy)&&this.setState({lastBoundingBox:{width:n.width,height:n.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var n,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var n=this,i=this.props,a=i.active,o=i.allowEscapeViewBox,u=i.animationDuration,c=i.animationEasing,s=i.children,f=i.coordinate,l=i.hasPayload,h=i.isAnimationActive,d=i.offset,y=i.position,v=i.reverseDirection,p=i.useTranslate3d,g=i.viewBox,x=i.wrapperStyle,w=fS({allowEscapeViewBox:o,coordinate:f,offsetTopLeft:d,position:y,reverseDirection:v,tooltipBox:this.state.lastBoundingBox,useTranslate3d:p,viewBox:g}),O=w.cssClasses,m=w.cssProperties,b=fy(fy({transition:h&&a?"transform ".concat(u,"ms ").concat(c):void 0},m),{},{pointerEvents:"none",visibility:!this.state.dismissed&&a&&l?"visible":"hidden",position:"absolute",top:0,left:0},x);return S.createElement("div",{tabIndex:-1,className:O,style:b,ref:function(A){n.wrapperNode=A}},s)}}])})(N.PureComponent),wS=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},or={isSsr:wS()};function Er(e){"@babel/helpers - typeof";return Er=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Er(e)}function py(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function dy(e){for(var t=1;t0;return S.createElement(xS,{allowEscapeViewBox:o,animationDuration:u,animationEasing:c,isAnimationActive:h,active:a,coordinate:f,hasPayload:b,offset:d,position:p,reverseDirection:g,useTranslate3d:x,viewBox:w,wrapperStyle:O},$S(s,dy(dy({},this.props),{},{payload:m})))}}])})(N.PureComponent);ah(dt,"displayName","Tooltip");ah(dt,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!or.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var vs,vy;function CS(){if(vy)return vs;vy=1;var e=ft(),t=function(){return e.Date.now()};return vs=t,vs}var ys,yy;function IS(){if(yy)return ys;yy=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return ys=t,ys}var ms,my;function kS(){if(my)return ms;my=1;var e=IS(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return ms=r,ms}var gs,gy;function z0(){if(gy)return gs;gy=1;var e=kS(),t=It(),r=Xr(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,u=parseInt;function c(s){if(typeof s=="number")return s;if(r(s))return n;if(t(s)){var f=typeof s.valueOf=="function"?s.valueOf():s;s=t(f)?f+"":f}if(typeof s!="string")return s===0?s:+s;s=e(s);var l=a.test(s);return l||o.test(s)?u(s.slice(2),l?2:8):i.test(s)?n:+s}return gs=c,gs}var bs,by;function RS(){if(by)return bs;by=1;var e=It(),t=CS(),r=z0(),n="Expected a function",i=Math.max,a=Math.min;function o(u,c,s){var f,l,h,d,y,v,p=0,g=!1,x=!1,w=!0;if(typeof u!="function")throw new TypeError(n);c=r(c)||0,e(s)&&(g=!!s.leading,x="maxWait"in s,h=x?i(r(s.maxWait)||0,c):h,w="trailing"in s?!!s.trailing:w);function O(j){var C=f,$=l;return f=l=void 0,p=j,d=u.apply($,C),d}function m(j){return p=j,y=setTimeout(A,c),g?O(j):d}function b(j){var C=j-v,$=j-p,k=c-C;return x?a(k,h-$):k}function _(j){var C=j-v,$=j-p;return v===void 0||C>=c||C<0||x&&$>=h}function A(){var j=t();if(_(j))return T(j);y=setTimeout(A,b(j))}function T(j){return y=void 0,w&&f?O(j):(f=l=void 0,d)}function M(){y!==void 0&&clearTimeout(y),p=0,f=v=l=y=void 0}function P(){return y===void 0?d:T(t())}function E(){var j=t(),C=_(j);if(f=arguments,l=this,v=j,C){if(y===void 0)return m(v);if(x)return clearTimeout(y),y=setTimeout(A,c),O(v)}return y===void 0&&(y=setTimeout(A,c)),d}return E.cancel=M,E.flush=P,E}return bs=o,bs}var xs,xy;function DS(){if(xy)return xs;xy=1;var e=RS(),t=It(),r="Expected a function";function n(i,a,o){var u=!0,c=!0;if(typeof i!="function")throw new TypeError(r);return t(o)&&(u="leading"in o?!!o.leading:u,c="trailing"in o?!!o.trailing:c),e(i,a,{leading:u,maxWait:a,trailing:c})}return xs=n,xs}var NS=DS();const U0=oe(NS);function En(e){"@babel/helpers - typeof";return En=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},En(e)}function wy(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function gi(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&(j=U0(j,v,{trailing:!0,leading:!1}));var C=new ResizeObserver(j),$=m.current.getBoundingClientRect(),k=$.width,R=$.height;return P(k,R),C.observe(m.current),function(){C.disconnect()}},[P,v]);var E=N.useMemo(function(){var j=T.containerWidth,C=T.containerHeight;if(j<0||C<0)return null;it(Gt(o)||Gt(c),`The width(%s) and height(%s) are both fixed numbers, + maybe you don't need to use a ResponsiveContainer.`,o,c),it(!r||r>0,"The aspect(%s) must be greater than zero.",r);var $=Gt(o)?j:o,k=Gt(c)?C:c;r&&r>0&&($?k=$/r:k&&($=k*r),h&&k>h&&(k=h)),it($>0||k>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,$,k,o,c,f,l,r);var R=!Array.isArray(d)&&bt(d.type).endsWith("Chart");return S.Children.map(d,function(L){return S.isValidElement(L)?N.cloneElement(L,gi({width:$,height:k},R?{style:gi({height:"100%",width:"100%",maxHeight:k,maxWidth:$},L.props.style)}:{})):L})},[r,d,c,h,l,f,T,o]);return S.createElement("div",{id:p?"".concat(p):void 0,className:J("recharts-responsive-container",g),style:gi(gi({},O),{},{width:o,height:c,minWidth:f,minHeight:l,maxHeight:h}),ref:m},E)}),oh=function(t){return null};oh.displayName="Cell";function jn(e){"@babel/helpers - typeof";return jn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jn(e)}function _y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function kl(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||or.isSsr)return{width:0,height:0};var n=ZS(r),i=JSON.stringify({text:t,copyStyle:n});if(fr.widthCache[i])return fr.widthCache[i];try{var a=document.getElementById(Ay);a||(a=document.createElement("span"),a.setAttribute("id",Ay),a.setAttribute("aria-hidden","true"),document.body.appendChild(a));var o=kl(kl({},YS),n);Object.assign(a.style,o),a.textContent="".concat(t);var u=a.getBoundingClientRect(),c={width:u.width,height:u.height};return fr.widthCache[i]=c,++fr.cacheCount>XS&&(fr.cacheCount=0,fr.widthCache={}),c}catch{return{width:0,height:0}}},JS=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Mn(e){"@babel/helpers - typeof";return Mn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mn(e)}function Fi(e,t){return rP(e)||tP(e,t)||eP(e,t)||QS()}function QS(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eP(e,t){if(e){if(typeof e=="string")return Sy(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Sy(e,t)}}function Sy(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function yP(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function $y(e,t){return xP(e)||bP(e,t)||gP(e,t)||mP()}function mP(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gP(e,t){if(e){if(typeof e=="string")return Cy(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Cy(e,t)}}function Cy(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&arguments[0]!==void 0?arguments[0]:[];return $.reduce(function(k,R){var L=R.word,B=R.width,U=k[k.length-1];if(U&&(i==null||a||U.width+B+nR.width?k:R})};if(!f)return d;for(var v="…",p=function($){var k=l.slice(0,$),R=V0({breakAll:s,style:c,children:k+v}).wordsWithComputedWidth,L=h(R),B=L.length>o||y(L).width>Number(i);return[B,L]},g=0,x=l.length-1,w=0,O;g<=x&&w<=l.length-1;){var m=Math.floor((g+x)/2),b=m-1,_=p(b),A=$y(_,2),T=A[0],M=A[1],P=p(m),E=$y(P,1),j=E[0];if(!T&&!j&&(g=m+1),T&&j&&(x=m-1),!T&&j){O=M;break}w++}return O||d},Iy=function(t){var r=Y(t)?[]:t.toString().split(G0);return[{words:r}]},OP=function(t){var r=t.width,n=t.scaleToFit,i=t.children,a=t.style,o=t.breakAll,u=t.maxLines;if((r||n)&&!or.isSsr){var c,s,f=V0({breakAll:o,children:i,style:a});if(f){var l=f.wordsWithComputedWidth,h=f.spaceWidth;c=l,s=h}else return Iy(i);return wP({breakAll:o,children:i,maxLines:u,style:a},c,s,r,n)}return Iy(i)},ky="#808080",rr=function(t){var r=t.x,n=r===void 0?0:r,i=t.y,a=i===void 0?0:i,o=t.lineHeight,u=o===void 0?"1em":o,c=t.capHeight,s=c===void 0?"0.71em":c,f=t.scaleToFit,l=f===void 0?!1:f,h=t.textAnchor,d=h===void 0?"start":h,y=t.verticalAnchor,v=y===void 0?"end":y,p=t.fill,g=p===void 0?ky:p,x=My(t,dP),w=N.useMemo(function(){return OP({breakAll:x.breakAll,children:x.children,maxLines:x.maxLines,scaleToFit:l,style:x.style,width:x.width})},[x.breakAll,x.children,x.maxLines,l,x.style,x.width]),O=x.dx,m=x.dy,b=x.angle,_=x.className,A=x.breakAll,T=My(x,vP);if(!Ae(n)||!Ae(a))return null;var M=n+(q(O)?O:0),P=a+(q(m)?m:0),E;switch(v){case"start":E=ws("calc(".concat(s,")"));break;case"middle":E=ws("calc(".concat((w.length-1)/2," * -").concat(u," + (").concat(s," / 2))"));break;default:E=ws("calc(".concat(w.length-1," * -").concat(u,")"));break}var j=[];if(l){var C=w[0].width,$=x.width;j.push("scale(".concat((q($)?$/C:1)/C,")"))}return b&&j.push("rotate(".concat(b,", ").concat(M,", ").concat(P,")")),j.length&&(T.transform=j.join(" ")),S.createElement("text",Rl({},H(T,!0),{x:M,y:P,className:J("recharts-text",_),textAnchor:d,fill:g.includes("url")?ky:g}),w.map(function(k,R){var L=k.words.join(A?"":" ");return S.createElement("tspan",{x:M,dy:R===0?E:u,key:"".concat(L,"-").concat(R)},L)}))};function Ct(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function _P(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function uh(e){let t,r,n;e.length!==2?(t=Ct,r=(u,c)=>Ct(e(u),c),n=(u,c)=>e(u)-c):(t=e===Ct||e===_P?e:AP,r=e,n=e);function i(u,c,s=0,f=u.length){if(s>>1;r(u[l],c)<0?s=l+1:f=l}while(s>>1;r(u[l],c)<=0?s=l+1:f=l}while(ss&&n(u[l-1],c)>-n(u[l],c)?l-1:l}return{left:i,center:o,right:a}}function AP(){return 0}function X0(e){return e===null?NaN:+e}function*SP(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const PP=uh(Ct),ci=PP.right;uh(X0).center;class Ry extends Map{constructor(t,r=jP){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,i]of t)this.set(n,i)}get(t){return super.get(Dy(this,t))}has(t){return super.has(Dy(this,t))}set(t,r){return super.set(TP(this,t),r)}delete(t){return super.delete(EP(this,t))}}function Dy({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function TP({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function EP({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function jP(e){return e!==null&&typeof e=="object"?e.valueOf():e}function MP(e=Ct){if(e===Ct)return Y0;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function Y0(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const $P=Math.sqrt(50),CP=Math.sqrt(10),IP=Math.sqrt(2);function Wi(e,t,r){const n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),a=n/Math.pow(10,i),o=a>=$P?10:a>=CP?5:a>=IP?2:1;let u,c,s;return i<0?(s=Math.pow(10,-i)/o,u=Math.round(e*s),c=Math.round(t*s),u/st&&--c,s=-s):(s=Math.pow(10,i)*o,u=Math.round(e/s),c=Math.round(t/s),u*st&&--c),c0))return[];if(e===t)return[e];const n=t=i))return[];const u=a-i+1,c=new Array(u);if(n)if(o<0)for(let s=0;s=n)&&(r=n);return r}function qy(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function Z0(e,t,r=0,n=1/0,i){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(i=i===void 0?Y0:MP(i);n>r;){if(n-r>600){const c=n-r+1,s=t-r+1,f=Math.log(c),l=.5*Math.exp(2*f/3),h=.5*Math.sqrt(f*l*(c-l)/c)*(s-c/2<0?-1:1),d=Math.max(r,Math.floor(t-s*l/c+h)),y=Math.min(n,Math.floor(t+(c-s)*l/c+h));Z0(e,t,d,y,i)}const a=e[t];let o=r,u=n;for(on(e,r,t),i(e[n],a)>0&&on(e,r,n);o0;)--u}i(e[r],a)===0?on(e,r,u):(++u,on(e,u,n)),u<=t&&(r=u+1),t<=u&&(n=u-1)}return e}function on(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function kP(e,t,r){if(e=Float64Array.from(SP(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return qy(e);if(t>=1)return Ny(e);var n,i=(n-1)*t,a=Math.floor(i),o=Ny(Z0(e,a).subarray(0,a+1)),u=qy(e.subarray(a+1));return o+(u-o)*(i-a)}}function RP(e,t,r=X0){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,a=Math.floor(i),o=+r(e[a],a,e),u=+r(e[a+1],a+1,e);return o+(u-o)*(i-a)}}function DP(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,a=new Array(i);++n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?xi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?xi(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=qP.exec(e))?new Ne(t[1],t[2],t[3],1):(t=LP.exec(e))?new Ne(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=BP.exec(e))?xi(t[1],t[2],t[3],t[4]):(t=FP.exec(e))?xi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=WP.exec(e))?Hy(t[1],t[2]/100,t[3]/100,1):(t=zP.exec(e))?Hy(t[1],t[2]/100,t[3]/100,t[4]):Ly.hasOwnProperty(e)?Wy(Ly[e]):e==="transparent"?new Ne(NaN,NaN,NaN,0):null}function Wy(e){return new Ne(e>>16&255,e>>8&255,e&255,1)}function xi(e,t,r,n){return n<=0&&(e=t=r=NaN),new Ne(e,t,r,n)}function KP(e){return e instanceof si||(e=kn(e)),e?(e=e.rgb(),new Ne(e.r,e.g,e.b,e.opacity)):new Ne}function Bl(e,t,r,n){return arguments.length===1?KP(e):new Ne(e,t,r,n??1)}function Ne(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}sh(Ne,Bl,Q0(si,{brighter(e){return e=e==null?zi:Math.pow(zi,e),new Ne(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Cn:Math.pow(Cn,e),new Ne(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ne(Zt(this.r),Zt(this.g),Zt(this.b),Ui(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:zy,formatHex:zy,formatHex8:GP,formatRgb:Uy,toString:Uy}));function zy(){return`#${Vt(this.r)}${Vt(this.g)}${Vt(this.b)}`}function GP(){return`#${Vt(this.r)}${Vt(this.g)}${Vt(this.b)}${Vt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Uy(){const e=Ui(this.opacity);return`${e===1?"rgb(":"rgba("}${Zt(this.r)}, ${Zt(this.g)}, ${Zt(this.b)}${e===1?")":`, ${e})`}`}function Ui(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Zt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Vt(e){return e=Zt(e),(e<16?"0":"")+e.toString(16)}function Hy(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new nt(e,t,r,n)}function ex(e){if(e instanceof nt)return new nt(e.h,e.s,e.l,e.opacity);if(e instanceof si||(e=kn(e)),!e)return new nt;if(e instanceof nt)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,u=a-i,c=(a+i)/2;return u?(t===a?o=(r-n)/u+(r0&&c<1?0:o,new nt(o,u,c,e.opacity)}function VP(e,t,r,n){return arguments.length===1?ex(e):new nt(e,t,r,n??1)}function nt(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}sh(nt,VP,Q0(si,{brighter(e){return e=e==null?zi:Math.pow(zi,e),new nt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Cn:Math.pow(Cn,e),new nt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new Ne(Os(e>=240?e-240:e+120,i,n),Os(e,i,n),Os(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new nt(Ky(this.h),wi(this.s),wi(this.l),Ui(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Ui(this.opacity);return`${e===1?"hsl(":"hsla("}${Ky(this.h)}, ${wi(this.s)*100}%, ${wi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ky(e){return e=(e||0)%360,e<0?e+360:e}function wi(e){return Math.max(0,Math.min(1,e||0))}function Os(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const lh=e=>()=>e;function XP(e,t){return function(r){return e+r*t}}function YP(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function ZP(e){return(e=+e)==1?tx:function(t,r){return r-t?YP(t,r,e):lh(isNaN(t)?r:t)}}function tx(e,t){var r=t-e;return r?XP(e,r):lh(isNaN(e)?t:e)}const Gy=(function e(t){var r=ZP(t);function n(i,a){var o=r((i=Bl(i)).r,(a=Bl(a)).r),u=r(i.g,a.g),c=r(i.b,a.b),s=tx(i.opacity,a.opacity);return function(f){return i.r=o(f),i.g=u(f),i.b=c(f),i.opacity=s(f),i+""}}return n.gamma=e,n})(1);function JP(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(a){for(i=0;ir&&(a=t.slice(r,a),u[o]?u[o]+=a:u[++o]=a),(n=n[0])===(i=i[0])?u[o]?u[o]+=i:u[++o]=i:(u[++o]=null,c.push({i:o,x:Hi(n,i)})),r=_s.lastIndex;return rt&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function sT(e,t,r){var n=e[0],i=e[1],a=t[0],o=t[1];return i2?lT:sT,c=s=null,l}function l(h){return h==null||isNaN(h=+h)?a:(c||(c=u(e.map(n),t,r)))(n(o(h)))}return l.invert=function(h){return o(i((s||(s=u(t,e.map(n),Hi)))(h)))},l.domain=function(h){return arguments.length?(e=Array.from(h,Ki),f()):e.slice()},l.range=function(h){return arguments.length?(t=Array.from(h),f()):t.slice()},l.rangeRound=function(h){return t=Array.from(h),r=fh,f()},l.clamp=function(h){return arguments.length?(o=h?!0:ke,f()):o!==ke},l.interpolate=function(h){return arguments.length?(r=h,f()):r},l.unknown=function(h){return arguments.length?(a=h,l):a},function(h,d){return n=h,i=d,f()}}function hh(){return Ba()(ke,ke)}function fT(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Gi(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function jr(e){return e=Gi(Math.abs(e)),e?e[1]:NaN}function hT(e,t){return function(r,n){for(var i=r.length,a=[],o=0,u=e[0],c=0;i>0&&u>0&&(c+u+1>n&&(u=Math.max(1,n-c)),a.push(r.substring(i-=u,i+u)),!((c+=u+1)>n));)u=e[o=(o+1)%e.length];return a.reverse().join(t)}}function pT(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var dT=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Rn(e){if(!(t=dT.exec(e)))throw new Error("invalid format: "+e);var t;return new ph({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Rn.prototype=ph.prototype;function ph(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}ph.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function vT(e){e:for(var t=e.length,r=1,n=-1,i;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var rx;function yT(e,t){var r=Gi(e,t);if(!r)return e+"";var n=r[0],i=r[1],a=i-(rx=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=n.length;return a===o?n:a>o?n+new Array(a-o+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+Gi(e,Math.max(0,t+a-1))[0]}function Xy(e,t){var r=Gi(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const Yy={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:fT,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Xy(e*100,t),r:Xy,s:yT,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Zy(e){return e}var Jy=Array.prototype.map,Qy=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function mT(e){var t=e.grouping===void 0||e.thousands===void 0?Zy:hT(Jy.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?Zy:pT(Jy.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",u=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function s(l){l=Rn(l);var h=l.fill,d=l.align,y=l.sign,v=l.symbol,p=l.zero,g=l.width,x=l.comma,w=l.precision,O=l.trim,m=l.type;m==="n"?(x=!0,m="g"):Yy[m]||(w===void 0&&(w=12),O=!0,m="g"),(p||h==="0"&&d==="=")&&(p=!0,h="0",d="=");var b=v==="$"?r:v==="#"&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",_=v==="$"?n:/[%p]/.test(m)?o:"",A=Yy[m],T=/[defgprs%]/.test(m);w=w===void 0?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function M(P){var E=b,j=_,C,$,k;if(m==="c")j=A(P)+j,P="";else{P=+P;var R=P<0||1/P<0;if(P=isNaN(P)?c:A(Math.abs(P),w),O&&(P=vT(P)),R&&+P==0&&y!=="+"&&(R=!1),E=(R?y==="("?y:u:y==="-"||y==="("?"":y)+E,j=(m==="s"?Qy[8+rx/3]:"")+j+(R&&y==="("?")":""),T){for(C=-1,$=P.length;++C<$;)if(k=P.charCodeAt(C),48>k||k>57){j=(k===46?i+P.slice(C+1):P.slice(C))+j,P=P.slice(0,C);break}}}x&&!p&&(P=t(P,1/0));var L=E.length+P.length+j.length,B=L>1)+E+P+j+B.slice(L);break;default:P=B+E+P+j;break}return a(P)}return M.toString=function(){return l+""},M}function f(l,h){var d=s((l=Rn(l),l.type="f",l)),y=Math.max(-8,Math.min(8,Math.floor(jr(h)/3)))*3,v=Math.pow(10,-y),p=Qy[8+y/3];return function(g){return d(v*g)+p}}return{format:s,formatPrefix:f}}var Oi,dh,nx;gT({thousands:",",grouping:[3],currency:["$",""]});function gT(e){return Oi=mT(e),dh=Oi.format,nx=Oi.formatPrefix,Oi}function bT(e){return Math.max(0,-jr(Math.abs(e)))}function xT(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(jr(t)/3)))*3-jr(Math.abs(e)))}function wT(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,jr(t)-jr(e))+1}function ix(e,t,r,n){var i=ql(e,t,r),a;switch(n=Rn(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(a=xT(i,o))&&(n.precision=a),nx(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=wT(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=bT(i))&&(n.precision=a-(n.type==="%")*2);break}}return dh(n)}function kt(e){var t=e.domain;return e.ticks=function(r){var n=t();return Dl(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return ix(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,a=n.length-1,o=n[i],u=n[a],c,s,f=10;for(u0;){if(s=Nl(o,u,r),s===c)return n[i]=o,n[a]=u,t(n);if(s>0)o=Math.floor(o/s)*s,u=Math.ceil(u/s)*s;else if(s<0)o=Math.ceil(o*s)/s,u=Math.floor(u*s)/s;else break;c=s}return e},e}function Vi(){var e=hh();return e.copy=function(){return li(e,Vi())},Qe.apply(e,arguments),kt(e)}function ax(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,Ki),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return ax(e).unknown(t)},e=arguments.length?Array.from(e,Ki):[0,1],kt(r)}function ox(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],a=e[n],o;return aMath.pow(e,t)}function PT(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function rm(e){return(t,r)=>-e(-t,r)}function vh(e){const t=e(em,tm),r=t.domain;let n=10,i,a;function o(){return i=PT(n),a=ST(n),r()[0]<0?(i=rm(i),a=rm(a),e(OT,_T)):e(em,tm),t}return t.base=function(u){return arguments.length?(n=+u,o()):n},t.domain=function(u){return arguments.length?(r(u),o()):r()},t.ticks=u=>{const c=r();let s=c[0],f=c[c.length-1];const l=f0){for(;h<=d;++h)for(y=1;yf)break;g.push(v)}}else for(;h<=d;++h)for(y=n-1;y>=1;--y)if(v=h>0?y/a(-h):y*a(h),!(vf)break;g.push(v)}g.length*2{if(u==null&&(u=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=Rn(c)).precision==null&&(c.trim=!0),c=dh(c)),u===1/0)return c;const s=Math.max(1,n*u/t.ticks().length);return f=>{let l=f/a(Math.round(i(f)));return l*nr(ox(r(),{floor:u=>a(Math.floor(i(u))),ceil:u=>a(Math.ceil(i(u)))})),t}function ux(){const e=vh(Ba()).domain([1,10]);return e.copy=()=>li(e,ux()).base(e.base()),Qe.apply(e,arguments),e}function nm(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function im(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function yh(e){var t=1,r=e(nm(t),im(t));return r.constant=function(n){return arguments.length?e(nm(t=+n),im(t)):t},kt(r)}function cx(){var e=yh(Ba());return e.copy=function(){return li(e,cx()).constant(e.constant())},Qe.apply(e,arguments)}function am(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function TT(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function ET(e){return e<0?-e*e:e*e}function mh(e){var t=e(ke,ke),r=1;function n(){return r===1?e(ke,ke):r===.5?e(TT,ET):e(am(r),am(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},kt(t)}function gh(){var e=mh(Ba());return e.copy=function(){return li(e,gh()).exponent(e.exponent())},Qe.apply(e,arguments),e}function jT(){return gh.apply(null,arguments).exponent(.5)}function om(e){return Math.sign(e)*e*e}function MT(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function sx(){var e=hh(),t=[0,1],r=!1,n;function i(a){var o=MT(e(a));return isNaN(o)?n:r?Math.round(o):o}return i.invert=function(a){return e.invert(om(a))},i.domain=function(a){return arguments.length?(e.domain(a),i):e.domain()},i.range=function(a){return arguments.length?(e.range((t=Array.from(a,Ki)).map(om)),i):t.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(r=!!a,i):r},i.clamp=function(a){return arguments.length?(e.clamp(a),i):e.clamp()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return sx(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},Qe.apply(i,arguments),kt(i)}function lx(){var e=[],t=[],r=[],n;function i(){var o=0,u=Math.max(1,t.length);for(r=new Array(u-1);++o0?r[u-1]:e[0],u=r?[n[r-1],t]:[n[s-1],n[s]]},o.unknown=function(c){return arguments.length&&(a=c),o},o.thresholds=function(){return n.slice()},o.copy=function(){return fx().domain([e,t]).range(i).unknown(a)},Qe.apply(kt(o),arguments)}function hx(){var e=[.5],t=[0,1],r,n=1;function i(a){return a!=null&&a<=a?t[ci(e,a,0,n)]:r}return i.domain=function(a){return arguments.length?(e=Array.from(a),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(a){return arguments.length?(t=Array.from(a),n=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(a){var o=t.indexOf(a);return[e[o-1],e[o]]},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return hx().domain(e).range(t).unknown(r)},Qe.apply(i,arguments)}const As=new Date,Ss=new Date;function Se(e,t,r,n){function i(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),i.round=a=>{const o=i(a),u=i.ceil(a);return a-o(t(a=new Date(+a),o==null?1:Math.floor(o)),a),i.range=(a,o,u)=>{const c=[];if(a=i.ceil(a),u=u==null?1:Math.floor(u),!(a0))return c;let s;do c.push(s=new Date(+a)),t(a,u),e(a);while(sSe(o=>{if(o>=o)for(;e(o),!a(o);)o.setTime(o-1)},(o,u)=>{if(o>=o)if(u<0)for(;++u<=0;)for(;t(o,-1),!a(o););else for(;--u>=0;)for(;t(o,1),!a(o););}),r&&(i.count=(a,o)=>(As.setTime(+a),Ss.setTime(+o),e(As),e(Ss),Math.floor(r(As,Ss))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(n?o=>n(o)%a===0:o=>i.count(0,o)%a===0):i)),i}const Xi=Se(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Xi.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Se(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):Xi);Xi.range;const yt=1e3,Ze=yt*60,mt=Ze*60,Ot=mt*24,bh=Ot*7,um=Ot*30,Ps=Ot*365,Xt=Se(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*yt)},(e,t)=>(t-e)/yt,e=>e.getUTCSeconds());Xt.range;const xh=Se(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*yt)},(e,t)=>{e.setTime(+e+t*Ze)},(e,t)=>(t-e)/Ze,e=>e.getMinutes());xh.range;const wh=Se(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Ze)},(e,t)=>(t-e)/Ze,e=>e.getUTCMinutes());wh.range;const Oh=Se(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*yt-e.getMinutes()*Ze)},(e,t)=>{e.setTime(+e+t*mt)},(e,t)=>(t-e)/mt,e=>e.getHours());Oh.range;const _h=Se(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*mt)},(e,t)=>(t-e)/mt,e=>e.getUTCHours());_h.range;const fi=Se(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Ze)/Ot,e=>e.getDate()-1);fi.range;const Fa=Se(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ot,e=>e.getUTCDate()-1);Fa.range;const px=Se(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ot,e=>Math.floor(e/Ot));px.range;function ur(e){return Se(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*Ze)/bh)}const Wa=ur(0),Yi=ur(1),$T=ur(2),CT=ur(3),Mr=ur(4),IT=ur(5),kT=ur(6);Wa.range;Yi.range;$T.range;CT.range;Mr.range;IT.range;kT.range;function cr(e){return Se(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/bh)}const za=cr(0),Zi=cr(1),RT=cr(2),DT=cr(3),$r=cr(4),NT=cr(5),qT=cr(6);za.range;Zi.range;RT.range;DT.range;$r.range;NT.range;qT.range;const Ah=Se(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Ah.range;const Sh=Se(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Sh.range;const _t=Se(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());_t.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Se(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});_t.range;const At=Se(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());At.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Se(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});At.range;function dx(e,t,r,n,i,a){const o=[[Xt,1,yt],[Xt,5,5*yt],[Xt,15,15*yt],[Xt,30,30*yt],[a,1,Ze],[a,5,5*Ze],[a,15,15*Ze],[a,30,30*Ze],[i,1,mt],[i,3,3*mt],[i,6,6*mt],[i,12,12*mt],[n,1,Ot],[n,2,2*Ot],[r,1,bh],[t,1,um],[t,3,3*um],[e,1,Ps]];function u(s,f,l){const h=fp).right(o,h);if(d===o.length)return e.every(ql(s/Ps,f/Ps,l));if(d===0)return Xi.every(Math.max(ql(s,f,l),1));const[y,v]=o[h/o[d-1][2]53)return null;"w"in D||(D.w=1),"Z"in D?(ee=Es(un(D.y,0,1)),be=ee.getUTCDay(),ee=be>4||be===0?Zi.ceil(ee):Zi(ee),ee=Fa.offset(ee,(D.V-1)*7),D.y=ee.getUTCFullYear(),D.m=ee.getUTCMonth(),D.d=ee.getUTCDate()+(D.w+6)%7):(ee=Ts(un(D.y,0,1)),be=ee.getDay(),ee=be>4||be===0?Yi.ceil(ee):Yi(ee),ee=fi.offset(ee,(D.V-1)*7),D.y=ee.getFullYear(),D.m=ee.getMonth(),D.d=ee.getDate()+(D.w+6)%7)}else("W"in D||"U"in D)&&("w"in D||(D.w="u"in D?D.u%7:"W"in D?1:0),be="Z"in D?Es(un(D.y,0,1)).getUTCDay():Ts(un(D.y,0,1)).getDay(),D.m=0,D.d="W"in D?(D.w+6)%7+D.W*7-(be+5)%7:D.w+D.U*7-(be+6)%7);return"Z"in D?(D.H+=D.Z/100|0,D.M+=D.Z%100,Es(D)):Ts(D)}}function A(F,Z,Q,D){for(var de=0,ee=Z.length,be=Q.length,xe,De;de=be)return-1;if(xe=Z.charCodeAt(de++),xe===37){if(xe=Z.charAt(de++),De=m[xe in cm?Z.charAt(de++):xe],!De||(D=De(F,Q,D))<0)return-1}else if(xe!=Q.charCodeAt(D++))return-1}return D}function T(F,Z,Q){var D=s.exec(Z.slice(Q));return D?(F.p=f.get(D[0].toLowerCase()),Q+D[0].length):-1}function M(F,Z,Q){var D=d.exec(Z.slice(Q));return D?(F.w=y.get(D[0].toLowerCase()),Q+D[0].length):-1}function P(F,Z,Q){var D=l.exec(Z.slice(Q));return D?(F.w=h.get(D[0].toLowerCase()),Q+D[0].length):-1}function E(F,Z,Q){var D=g.exec(Z.slice(Q));return D?(F.m=x.get(D[0].toLowerCase()),Q+D[0].length):-1}function j(F,Z,Q){var D=v.exec(Z.slice(Q));return D?(F.m=p.get(D[0].toLowerCase()),Q+D[0].length):-1}function C(F,Z,Q){return A(F,t,Z,Q)}function $(F,Z,Q){return A(F,r,Z,Q)}function k(F,Z,Q){return A(F,n,Z,Q)}function R(F){return o[F.getDay()]}function L(F){return a[F.getDay()]}function B(F){return c[F.getMonth()]}function U(F){return u[F.getMonth()]}function G(F){return i[+(F.getHours()>=12)]}function W(F){return 1+~~(F.getMonth()/3)}function V(F){return o[F.getUTCDay()]}function fe(F){return a[F.getUTCDay()]}function ye(F){return c[F.getUTCMonth()]}function Le(F){return u[F.getUTCMonth()]}function qt(F){return i[+(F.getUTCHours()>=12)]}function Re(F){return 1+~~(F.getUTCMonth()/3)}return{format:function(F){var Z=b(F+="",w);return Z.toString=function(){return F},Z},parse:function(F){var Z=_(F+="",!1);return Z.toString=function(){return F},Z},utcFormat:function(F){var Z=b(F+="",O);return Z.toString=function(){return F},Z},utcParse:function(F){var Z=_(F+="",!0);return Z.toString=function(){return F},Z}}}var cm={"-":"",_:" ",0:"0"},Ee=/^\s*\d+/,UT=/^%/,HT=/[\\^$*+?|[\]().{}]/g;function re(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",a=i.length;return n+(a[t.toLowerCase(),r]))}function GT(e,t,r){var n=Ee.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function VT(e,t,r){var n=Ee.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function XT(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function YT(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function ZT(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function sm(e,t,r){var n=Ee.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function lm(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function JT(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function QT(e,t,r){var n=Ee.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function eE(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function fm(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function tE(e,t,r){var n=Ee.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function hm(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function rE(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function nE(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function iE(e,t,r){var n=Ee.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function aE(e,t,r){var n=Ee.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function oE(e,t,r){var n=UT.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function uE(e,t,r){var n=Ee.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function cE(e,t,r){var n=Ee.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function pm(e,t){return re(e.getDate(),t,2)}function sE(e,t){return re(e.getHours(),t,2)}function lE(e,t){return re(e.getHours()%12||12,t,2)}function fE(e,t){return re(1+fi.count(_t(e),e),t,3)}function vx(e,t){return re(e.getMilliseconds(),t,3)}function hE(e,t){return vx(e,t)+"000"}function pE(e,t){return re(e.getMonth()+1,t,2)}function dE(e,t){return re(e.getMinutes(),t,2)}function vE(e,t){return re(e.getSeconds(),t,2)}function yE(e){var t=e.getDay();return t===0?7:t}function mE(e,t){return re(Wa.count(_t(e)-1,e),t,2)}function yx(e){var t=e.getDay();return t>=4||t===0?Mr(e):Mr.ceil(e)}function gE(e,t){return e=yx(e),re(Mr.count(_t(e),e)+(_t(e).getDay()===4),t,2)}function bE(e){return e.getDay()}function xE(e,t){return re(Yi.count(_t(e)-1,e),t,2)}function wE(e,t){return re(e.getFullYear()%100,t,2)}function OE(e,t){return e=yx(e),re(e.getFullYear()%100,t,2)}function _E(e,t){return re(e.getFullYear()%1e4,t,4)}function AE(e,t){var r=e.getDay();return e=r>=4||r===0?Mr(e):Mr.ceil(e),re(e.getFullYear()%1e4,t,4)}function SE(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+re(t/60|0,"0",2)+re(t%60,"0",2)}function dm(e,t){return re(e.getUTCDate(),t,2)}function PE(e,t){return re(e.getUTCHours(),t,2)}function TE(e,t){return re(e.getUTCHours()%12||12,t,2)}function EE(e,t){return re(1+Fa.count(At(e),e),t,3)}function mx(e,t){return re(e.getUTCMilliseconds(),t,3)}function jE(e,t){return mx(e,t)+"000"}function ME(e,t){return re(e.getUTCMonth()+1,t,2)}function $E(e,t){return re(e.getUTCMinutes(),t,2)}function CE(e,t){return re(e.getUTCSeconds(),t,2)}function IE(e){var t=e.getUTCDay();return t===0?7:t}function kE(e,t){return re(za.count(At(e)-1,e),t,2)}function gx(e){var t=e.getUTCDay();return t>=4||t===0?$r(e):$r.ceil(e)}function RE(e,t){return e=gx(e),re($r.count(At(e),e)+(At(e).getUTCDay()===4),t,2)}function DE(e){return e.getUTCDay()}function NE(e,t){return re(Zi.count(At(e)-1,e),t,2)}function qE(e,t){return re(e.getUTCFullYear()%100,t,2)}function LE(e,t){return e=gx(e),re(e.getUTCFullYear()%100,t,2)}function BE(e,t){return re(e.getUTCFullYear()%1e4,t,4)}function FE(e,t){var r=e.getUTCDay();return e=r>=4||r===0?$r(e):$r.ceil(e),re(e.getUTCFullYear()%1e4,t,4)}function WE(){return"+0000"}function vm(){return"%"}function ym(e){return+e}function mm(e){return Math.floor(+e/1e3)}var hr,bx,xx;zE({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function zE(e){return hr=zT(e),bx=hr.format,hr.parse,xx=hr.utcFormat,hr.utcParse,hr}function UE(e){return new Date(e)}function HE(e){return e instanceof Date?+e:+new Date(+e)}function Ph(e,t,r,n,i,a,o,u,c,s){var f=hh(),l=f.invert,h=f.domain,d=s(".%L"),y=s(":%S"),v=s("%I:%M"),p=s("%I %p"),g=s("%a %d"),x=s("%b %d"),w=s("%B"),O=s("%Y");function m(b){return(c(b)t(i/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(i,a)=>kP(e,a/n))},r.copy=function(){return Ax(t).domain(e)},Tt.apply(r,arguments)}function Ha(){var e=0,t=.5,r=1,n=1,i,a,o,u,c,s=ke,f,l=!1,h;function d(v){return isNaN(v=+v)?h:(v=.5+((v=+f(v))-a)*(n*vr}return Ms=e,Ms}var $s,wm;function YE(){if(wm)return $s;wm=1;var e=Ka(),t=Ex(),r=Jr();function n(i){return i&&i.length?e(i,r,t):void 0}return $s=n,$s}var ZE=YE();const Ga=oe(ZE);var Cs,Om;function jx(){if(Om)return Cs;Om=1;function e(t,r){return te.e^a.s<0?1:-1;for(n=a.d.length,i=e.d.length,t=0,r=ne.d[t]^a.s<0?1:-1;return n===i?0:n>i^a.s<0?1:-1};z.decimalPlaces=z.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*he;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};z.dividedBy=z.div=function(e){return xt(this,new this.constructor(e))};z.dividedToIntegerBy=z.idiv=function(e){var t=this,r=t.constructor;return ue(xt(t,new r(e),0,1),r.precision)};z.equals=z.eq=function(e){return!this.cmp(e)};z.exponent=function(){return ge(this)};z.greaterThan=z.gt=function(e){return this.cmp(e)>0};z.greaterThanOrEqualTo=z.gte=function(e){return this.cmp(e)>=0};z.isInteger=z.isint=function(){return this.e>this.d.length-2};z.isNegative=z.isneg=function(){return this.s<0};z.isPositive=z.ispos=function(){return this.s>0};z.isZero=function(){return this.s===0};z.lessThan=z.lt=function(e){return this.cmp(e)<0};z.lessThanOrEqualTo=z.lte=function(e){return this.cmp(e)<1};z.logarithm=z.log=function(e){var t,r=this,n=r.constructor,i=n.precision,a=i+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(Ue))throw Error(Je+"NaN");if(r.s<1)throw Error(Je+(r.s?"NaN":"-Infinity"));return r.eq(Ue)?new n(0):(pe=!1,t=xt(Dn(r,a),Dn(e,a),a),pe=!0,ue(t,i))};z.minus=z.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?Ix(t,e):$x(t,(e.s=-e.s,e))};z.modulo=z.mod=function(e){var t,r=this,n=r.constructor,i=n.precision;if(e=new n(e),!e.s)throw Error(Je+"NaN");return r.s?(pe=!1,t=xt(r,e,0,1).times(e),pe=!0,r.minus(t)):ue(new n(r),i)};z.naturalExponential=z.exp=function(){return Cx(this)};z.naturalLogarithm=z.ln=function(){return Dn(this)};z.negated=z.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};z.plus=z.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?$x(t,e):Ix(t,(e.s=-e.s,e))};z.precision=z.sd=function(e){var t,r,n,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Jt+e);if(t=ge(i)+1,n=i.d.length-1,r=n*he+1,n=i.d[n],n){for(;n%10==0;n/=10)r--;for(n=i.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};z.squareRoot=z.sqrt=function(){var e,t,r,n,i,a,o,u=this,c=u.constructor;if(u.s<1){if(!u.s)return new c(0);throw Error(Je+"NaN")}for(e=ge(u),pe=!1,i=Math.sqrt(+u),i==0||i==1/0?(t=ot(u.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=tn((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new c(t)):n=new c(i.toString()),r=c.precision,i=o=r+3;;)if(a=n,n=a.plus(xt(u,a,o+2)).times(.5),ot(a.d).slice(0,o)===(t=ot(n.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(ue(a,r+1,0),a.times(a).eq(u)){n=a;break}}else if(t!="9999")break;o+=4}return pe=!0,ue(n,r)};z.times=z.mul=function(e){var t,r,n,i,a,o,u,c,s,f=this,l=f.constructor,h=f.d,d=(e=new l(e)).d;if(!f.s||!e.s)return new l(0);for(e.s*=f.s,r=f.e+e.e,c=h.length,s=d.length,c=0;){for(t=0,i=c+n;i>n;)u=a[i]+d[n]*h[i-n-1]+t,a[i--]=u%Pe|0,t=u/Pe|0;a[i]=(a[i]+t)%Pe|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=r,pe?ue(e,l.precision):e};z.toDecimalPlaces=z.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(st(e,0,en),t===void 0?t=n.rounding:st(t,0,8),ue(r,e+ge(r)+1,t))};z.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=nr(n,!0):(st(e,0,en),t===void 0?t=i.rounding:st(t,0,8),n=ue(new i(n),e+1,t),r=nr(n,!0,e+1)),r};z.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return e===void 0?nr(i):(st(e,0,en),t===void 0?t=a.rounding:st(t,0,8),n=ue(new a(i),e+ge(i)+1,t),r=nr(n.abs(),!1,e+ge(n)+1),i.isneg()&&!i.isZero()?"-"+r:r)};z.toInteger=z.toint=function(){var e=this,t=e.constructor;return ue(new t(e),ge(e)+1,t.rounding)};z.toNumber=function(){return+this};z.toPower=z.pow=function(e){var t,r,n,i,a,o,u=this,c=u.constructor,s=12,f=+(e=new c(e));if(!e.s)return new c(Ue);if(u=new c(u),!u.s){if(e.s<1)throw Error(Je+"Infinity");return u}if(u.eq(Ue))return u;if(n=c.precision,e.eq(Ue))return ue(u,n);if(t=e.e,r=e.d.length-1,o=t>=r,a=u.s,o){if((r=f<0?-f:f)<=Mx){for(i=new c(Ue),t=Math.ceil(n/he+4),pe=!1;r%2&&(i=i.times(u),Em(i.d,t)),r=tn(r/2),r!==0;)u=u.times(u),Em(u.d,t);return pe=!0,e.s<0?new c(Ue).div(i):ue(i,n)}}else if(a<0)throw Error(Je+"NaN");return a=a<0&&e.d[Math.max(t,r)]&1?-1:1,u.s=1,pe=!1,i=e.times(Dn(u,n+s)),pe=!0,i=Cx(i),i.s=a,i};z.toPrecision=function(e,t){var r,n,i=this,a=i.constructor;return e===void 0?(r=ge(i),n=nr(i,r<=a.toExpNeg||r>=a.toExpPos)):(st(e,1,en),t===void 0?t=a.rounding:st(t,0,8),i=ue(new a(i),e,t),r=ge(i),n=nr(i,e<=r||r<=a.toExpNeg,e)),n};z.toSignificantDigits=z.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(st(e,1,en),t===void 0?t=n.rounding:st(t,0,8)),ue(new n(r),e,t)};z.toString=z.valueOf=z.val=z.toJSON=z[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=ge(e),r=e.constructor;return nr(e,t<=r.toExpNeg||t>=r.toExpPos)};function $x(e,t){var r,n,i,a,o,u,c,s,f=e.constructor,l=f.precision;if(!e.s||!t.s)return t.s||(t=new f(e)),pe?ue(t,l):t;if(c=e.d,s=t.d,o=e.e,i=t.e,c=c.slice(),a=o-i,a){for(a<0?(n=c,a=-a,u=s.length):(n=s,i=o,u=c.length),o=Math.ceil(l/he),u=o>u?o+1:u+1,a>u&&(a=u,n.length=1),n.reverse();a--;)n.push(0);n.reverse()}for(u=c.length,a=s.length,u-a<0&&(a=u,n=s,s=c,c=n),r=0;a;)r=(c[--a]=c[a]+s[a]+r)/Pe|0,c[a]%=Pe;for(r&&(c.unshift(r),++i),u=c.length;c[--u]==0;)c.pop();return t.d=c,t.e=i,pe?ue(t,l):t}function st(e,t,r){if(e!==~~e||er)throw Error(Jt+e)}function ot(e){var t,r,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;to?1:-1;else for(u=c=0;ui[u]?1:-1;break}return c}function r(n,i,a){for(var o=0;a--;)n[a]-=o,o=n[a]1;)n.shift()}return function(n,i,a,o){var u,c,s,f,l,h,d,y,v,p,g,x,w,O,m,b,_,A,T=n.constructor,M=n.s==i.s?1:-1,P=n.d,E=i.d;if(!n.s)return new T(n);if(!i.s)throw Error(Je+"Division by zero");for(c=n.e-i.e,_=E.length,m=P.length,d=new T(M),y=d.d=[],s=0;E[s]==(P[s]||0);)++s;if(E[s]>(P[s]||0)&&--c,a==null?x=a=T.precision:o?x=a+(ge(n)-ge(i))+1:x=a,x<0)return new T(0);if(x=x/he+2|0,s=0,_==1)for(f=0,E=E[0],x++;(s1&&(E=e(E,f),P=e(P,f),_=E.length,m=P.length),O=_,v=P.slice(0,_),p=v.length;p<_;)v[p++]=0;A=E.slice(),A.unshift(0),b=E[0],E[1]>=Pe/2&&++b;do f=0,u=t(E,v,_,p),u<0?(g=v[0],_!=p&&(g=g*Pe+(v[1]||0)),f=g/b|0,f>1?(f>=Pe&&(f=Pe-1),l=e(E,f),h=l.length,p=v.length,u=t(l,v,h,p),u==1&&(f--,r(l,_16)throw Error(jh+ge(e));if(!e.s)return new f(Ue);for(pe=!1,u=l,o=new f(.03125);e.abs().gte(.1);)e=e.times(o),s+=5;for(n=Math.log(Ht(2,s))/Math.LN10*2+5|0,u+=n,r=i=a=new f(Ue),f.precision=u;;){if(i=ue(i.times(e),u),r=r.times(++c),o=a.plus(xt(i,r,u)),ot(o.d).slice(0,u)===ot(a.d).slice(0,u)){for(;s--;)a=ue(a.times(a),u);return f.precision=l,t==null?(pe=!0,ue(a,l)):a}a=o}}function ge(e){for(var t=e.e*he,r=e.d[0];r>=10;r/=10)t++;return t}function Ns(e,t,r){if(t>e.LN10.sd())throw pe=!0,r&&(e.precision=r),Error(Je+"LN10 precision limit exceeded");return ue(new e(e.LN10),t)}function jt(e){for(var t="";e--;)t+="0";return t}function Dn(e,t){var r,n,i,a,o,u,c,s,f,l=1,h=10,d=e,y=d.d,v=d.constructor,p=v.precision;if(d.s<1)throw Error(Je+(d.s?"NaN":"-Infinity"));if(d.eq(Ue))return new v(0);if(t==null?(pe=!1,s=p):s=t,d.eq(10))return t==null&&(pe=!0),Ns(v,s);if(s+=h,v.precision=s,r=ot(y),n=r.charAt(0),a=ge(d),Math.abs(a)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)d=d.times(e),r=ot(d.d),n=r.charAt(0),l++;a=ge(d),n>1?(d=new v("0."+r),a++):d=new v(n+"."+r.slice(1))}else return c=Ns(v,s+2,p).times(a+""),d=Dn(new v(n+"."+r.slice(1)),s-h).plus(c),v.precision=p,t==null?(pe=!0,ue(d,p)):d;for(u=o=d=xt(d.minus(Ue),d.plus(Ue),s),f=ue(d.times(d),s),i=3;;){if(o=ue(o.times(f),s),c=u.plus(xt(o,new v(i),s)),ot(c.d).slice(0,s)===ot(u.d).slice(0,s))return u=u.times(2),a!==0&&(u=u.plus(Ns(v,s+2,p).times(a+""))),u=xt(u,new v(l),s),v.precision=p,t==null?(pe=!0,ue(u,p)):u;u=c,i+=2}}function Tm(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(n,i),t){if(i-=n,r=r-n-1,e.e=tn(r/he),e.d=[],n=(r+1)%he,r<0&&(n+=he),nJi||e.e<-Ji))throw Error(jh+r)}else e.s=0,e.e=0,e.d=[0];return e}function ue(e,t,r){var n,i,a,o,u,c,s,f,l=e.d;for(o=1,a=l[0];a>=10;a/=10)o++;if(n=t-o,n<0)n+=he,i=t,s=l[f=0];else{if(f=Math.ceil((n+1)/he),a=l.length,f>=a)return e;for(s=a=l[f],o=1;a>=10;a/=10)o++;n%=he,i=n-he+o}if(r!==void 0&&(a=Ht(10,o-i-1),u=s/a%10|0,c=t<0||l[f+1]!==void 0||s%a,c=r<4?(u||c)&&(r==0||r==(e.s<0?3:2)):u>5||u==5&&(r==4||c||r==6&&(n>0?i>0?s/Ht(10,o-i):0:l[f-1])%10&1||r==(e.s<0?8:7))),t<1||!l[0])return c?(a=ge(e),l.length=1,t=t-a-1,l[0]=Ht(10,(he-t%he)%he),e.e=tn(-t/he)||0):(l.length=1,l[0]=e.e=e.s=0),e;if(n==0?(l.length=f,a=1,f--):(l.length=f+1,a=Ht(10,he-n),l[f]=i>0?(s/Ht(10,o-i)%Ht(10,i)|0)*a:0),c)for(;;)if(f==0){(l[0]+=a)==Pe&&(l[0]=1,++e.e);break}else{if(l[f]+=a,l[f]!=Pe)break;l[f--]=0,a=1}for(n=l.length;l[--n]===0;)l.pop();if(pe&&(e.e>Ji||e.e<-Ji))throw Error(jh+ge(e));return e}function Ix(e,t){var r,n,i,a,o,u,c,s,f,l,h=e.constructor,d=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),pe?ue(t,d):t;if(c=e.d,l=t.d,n=t.e,s=e.e,c=c.slice(),o=s-n,o){for(f=o<0,f?(r=c,o=-o,u=l.length):(r=l,n=s,u=c.length),i=Math.max(Math.ceil(d/he),u)+2,o>i&&(o=i,r.length=1),r.reverse(),i=o;i--;)r.push(0);r.reverse()}else{for(i=c.length,u=l.length,f=i0;--i)c[u++]=0;for(i=l.length;i>o;){if(c[--i]0?a=a.charAt(0)+"."+a.slice(1)+jt(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+jt(-i-1)+a,r&&(n=r-o)>0&&(a+=jt(n))):i>=o?(a+=jt(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+jt(n))):((n=i+1)0&&(i+1===o&&(a+="."),a+=jt(n))),e.s<0?"-"+a:a}function Em(e,t){if(e.length>t)return e.length=t,!0}function kx(e){var t,r,n;function i(a){var o=this;if(!(o instanceof i))return new i(a);if(o.constructor=i,a instanceof i){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(Jt+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return Tm(o,a.toString())}else if(typeof a!="string")throw Error(Jt+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,uj.test(a))Tm(o,a);else throw Error(Jt+a)}if(i.prototype=z,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=kx,i.config=i.set=cj,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&n<=i[t+2])this[r]=n;else throw Error(Jt+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(Jt+r+": "+n);return this}var Mh=kx(oj);Ue=new Mh(1);const ae=Mh;function sj(e){return pj(e)||hj(e)||fj(e)||lj()}function lj(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fj(e,t){if(e){if(typeof e=="string")return zl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zl(e,t)}}function hj(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function pj(e){if(Array.isArray(e))return zl(e)}function zl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=t?r.apply(void 0,i):e(t-o,jm(function(){for(var u=arguments.length,c=new Array(u),s=0;se.length)&&(t=e.length);for(var r=0,n=new Array(t);r"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),u;!(n=(u=o.next()).done)&&(r.push(u.value),!(t&&r.length===t));n=!0);}catch(c){i=!0,a=c}finally{try{!n&&o.return!=null&&o.return()}finally{if(i)throw a}}return r}}function Ej(e){if(Array.isArray(e))return e}function Lx(e){var t=Nn(e,2),r=t[0],n=t[1],i=r,a=n;return r>n&&(i=n,a=r),[i,a]}function Bx(e,t,r){if(e.lte(0))return new ae(0);var n=Ya.getDigitCount(e.toNumber()),i=new ae(10).pow(n),a=e.div(i),o=n!==1?.05:.1,u=new ae(Math.ceil(a.div(o).toNumber())).add(r).mul(o),c=u.mul(i);return t?c:new ae(Math.ceil(c))}function jj(e,t,r){var n=1,i=new ae(e);if(!i.isint()&&r){var a=Math.abs(e);a<1?(n=new ae(10).pow(Ya.getDigitCount(e)-1),i=new ae(Math.floor(i.div(n).toNumber())).mul(n)):a>1&&(i=new ae(Math.floor(e)))}else e===0?i=new ae(Math.floor((t-1)/2)):r||(i=new ae(Math.floor(e)));var o=Math.floor((t-1)/2),u=mj(yj(function(c){return i.add(new ae(c-o).mul(n)).toNumber()}),Ul);return u(0,t)}function Fx(e,t,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(r-1)))return{step:new ae(0),tickMin:new ae(0),tickMax:new ae(0)};var a=Bx(new ae(t).sub(e).div(r-1),n,i),o;e<=0&&t>=0?o=new ae(0):(o=new ae(e).add(t).div(2),o=o.sub(new ae(o).mod(a)));var u=Math.ceil(o.sub(e).div(a).toNumber()),c=Math.ceil(new ae(t).sub(o).div(a).toNumber()),s=u+c+1;return s>r?Fx(e,t,r,n,i+1):(s0?c+(r-s):c,u=t>0?u:u+(r-s)),{step:a,tickMin:o.sub(new ae(u).mul(a)),tickMax:o.add(new ae(c).mul(a))})}function Mj(e){var t=Nn(e,2),r=t[0],n=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),u=Lx([r,n]),c=Nn(u,2),s=c[0],f=c[1];if(s===-1/0||f===1/0){var l=f===1/0?[s].concat(Kl(Ul(0,i-1).map(function(){return 1/0}))):[].concat(Kl(Ul(0,i-1).map(function(){return-1/0})),[f]);return r>n?Hl(l):l}if(s===f)return jj(s,i,a);var h=Fx(s,f,o,a),d=h.step,y=h.tickMin,v=h.tickMax,p=Ya.rangeStep(y,v.add(new ae(.1).mul(d)),d);return r>n?Hl(p):p}function $j(e,t){var r=Nn(e,2),n=r[0],i=r[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Lx([n,i]),u=Nn(o,2),c=u[0],s=u[1];if(c===-1/0||s===1/0)return[n,i];if(c===s)return[c];var f=Math.max(t,2),l=Bx(new ae(s).sub(c).div(f-1),a,0),h=[].concat(Kl(Ya.rangeStep(new ae(c),new ae(s).sub(new ae(.99).mul(l)),l)),[s]);return n>i?Hl(h):h}var Cj=Nx(Mj),Ij=Nx($j),kj=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Cr(e){"@babel/helpers - typeof";return Cr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cr(e)}function Qi(){return Qi=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Fj(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Wj(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zj(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,o=-1,u=(r=n?.length)!==null&&r!==void 0?r:0;if(u<=1)return 0;if(a&&a.axisType==="angleAxis"&&Math.abs(Math.abs(a.range[1]-a.range[0])-360)<=1e-6)for(var c=a.range,s=0;s0?i[s-1].coordinate:i[u-1].coordinate,l=i[s].coordinate,h=s>=u-1?i[0].coordinate:i[s+1].coordinate,d=void 0;if(Ce(l-f)!==Ce(h-l)){var y=[];if(Ce(h-l)===Ce(c[1]-c[0])){d=h;var v=l+c[1]-c[0];y[0]=Math.min(v,(v+f)/2),y[1]=Math.max(v,(v+f)/2)}else{d=f;var p=h+c[1]-c[0];y[0]=Math.min(l,(p+l)/2),y[1]=Math.max(l,(p+l)/2)}var g=[Math.min(l,(d+l)/2),Math.max(l,(d+l)/2)];if(t>g[0]&&t<=g[1]||t>=y[0]&&t<=y[1]){o=i[s].index;break}}else{var x=Math.min(f,h),w=Math.max(f,h);if(t>(x+l)/2&&t<=(w+l)/2){o=i[s].index;break}}}else for(var O=0;O0&&O(n[O].coordinate+n[O-1].coordinate)/2&&t<=(n[O].coordinate+n[O+1].coordinate)/2||O===u-1&&t>(n[O].coordinate+n[O-1].coordinate)/2){o=n[O].index;break}return o},$h=function(t){var r,n=t,i=n.type.displayName,a=(r=t.type)!==null&&r!==void 0&&r.defaultProps?ve(ve({},t.type.defaultProps),t.props):t.props,o=a.stroke,u=a.fill,c;switch(i){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:u;break;default:c=u;break}return c},oM=function(t){var r=t.barSize,n=t.totalSize,i=t.stackGroups,a=i===void 0?{}:i;if(!a)return{};for(var o={},u=Object.keys(a),c=0,s=u.length;c=0});if(g&&g.length){var x=g[0].type.defaultProps,w=x!==void 0?ve(ve({},x),g[0].props):g[0].props,O=w.barSize,m=w[p];o[m]||(o[m]=[]);var b=Y(O)?r:O;o[m].push({item:g[0],stackList:g.slice(1),barSize:Y(b)?void 0:Ie(b,n,0)})}}return o},uM=function(t){var r=t.barGap,n=t.barCategoryGap,i=t.bandSize,a=t.sizeList,o=a===void 0?[]:a,u=t.maxBarSize,c=o.length;if(c<1)return null;var s=Ie(r,i,0,!0),f,l=[];if(o[0].barSize===+o[0].barSize){var h=!1,d=i/c,y=o.reduce(function(O,m){return O+m.barSize||0},0);y+=(c-1)*s,y>=i&&(y-=(c-1)*s,s=0),y>=i&&d>0&&(h=!0,d*=.9,y=c*d);var v=(i-y)/2>>0,p={offset:v-s,size:0};f=o.reduce(function(O,m){var b={item:m.item,position:{offset:p.offset+p.size+s,size:h?d:m.barSize}},_=[].concat(Cm(O),[b]);return p=_[_.length-1].position,m.stackList&&m.stackList.length&&m.stackList.forEach(function(A){_.push({item:A,position:p})}),_},l)}else{var g=Ie(n,i,0,!0);i-2*g-(c-1)*s<=0&&(s=0);var x=(i-2*g-(c-1)*s)/c;x>1&&(x>>=0);var w=u===+u?Math.min(x,u):x;f=o.reduce(function(O,m,b){var _=[].concat(Cm(O),[{item:m.item,position:{offset:g+(x+s)*b+(x-w)/2,size:w}}]);return m.stackList&&m.stackList.length&&m.stackList.forEach(function(A){_.push({item:A,position:_[_.length-1].position})}),_},l)}return f},cM=function(t,r,n,i){var a=n.children,o=n.width,u=n.margin,c=o-(u.left||0)-(u.right||0),s=Hx({children:a,legendWidth:c});if(s){var f=i||{},l=f.width,h=f.height,d=s.align,y=s.verticalAlign,v=s.layout;if((v==="vertical"||v==="horizontal"&&y==="middle")&&d!=="center"&&q(t[d]))return ve(ve({},t),{},_r({},d,t[d]+(l||0)));if((v==="horizontal"||v==="vertical"&&d==="center")&&y!=="middle"&&q(t[y]))return ve(ve({},t),{},_r({},y,t[y]+(h||0)))}return t},sM=function(t,r,n){return Y(r)?!0:t==="horizontal"?r==="yAxis":t==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},Kx=function(t,r,n,i,a){var o=r.props.children,u=Ke(o,pi).filter(function(s){return sM(i,a,s.props.direction)});if(u&&u.length){var c=u.map(function(s){return s.props.dataKey});return t.reduce(function(s,f){var l=_e(f,n);if(Y(l))return s;var h=Array.isArray(l)?[Va(l),Ga(l)]:[l,l],d=c.reduce(function(y,v){var p=_e(f,v,0),g=h[0]-Math.abs(Array.isArray(p)?p[0]:p),x=h[1]+Math.abs(Array.isArray(p)?p[1]:p);return[Math.min(g,y[0]),Math.max(x,y[1])]},[1/0,-1/0]);return[Math.min(d[0],s[0]),Math.max(d[1],s[1])]},[1/0,-1/0])}return null},lM=function(t,r,n,i,a){var o=r.map(function(u){return Kx(t,u,n,a,i)}).filter(function(u){return!Y(u)});return o&&o.length?o.reduce(function(u,c){return[Math.min(u[0],c[0]),Math.max(u[1],c[1])]},[1/0,-1/0]):null},Gx=function(t,r,n,i,a){var o=r.map(function(c){var s=c.props.dataKey;return n==="number"&&s&&Kx(t,c,s,i)||bn(t,s,n,a)});if(n==="number")return o.reduce(function(c,s){return[Math.min(c[0],s[0]),Math.max(c[1],s[1])]},[1/0,-1/0]);var u={};return o.reduce(function(c,s){for(var f=0,l=s.length;f=2?Ce(u[0]-u[1])*2*s:s,r&&(t.ticks||t.niceTicks)){var f=(t.ticks||t.niceTicks).map(function(l){var h=a?a.indexOf(l):l;return{coordinate:i(h)+s,value:l,offset:s}});return f.filter(function(l){return!oi(l.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(l,h){return{coordinate:i(l)+s,value:l,index:h,offset:s}}):i.ticks&&!n?i.ticks(t.tickCount).map(function(l){return{coordinate:i(l)+s,value:l,offset:s}}):i.domain().map(function(l,h){return{coordinate:i(l)+s,value:a?a[l]:l,index:h,offset:s}})},qs=new WeakMap,_i=function(t,r){if(typeof r!="function")return t;qs.has(t)||qs.set(t,new WeakMap);var n=qs.get(t);if(n.has(r))return n.get(r);var i=function(){t.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,i),i},Yx=function(t,r,n){var i=t.scale,a=t.type,o=t.layout,u=t.axisType;if(i==="auto")return o==="radial"&&u==="radiusAxis"?{scale:$n(),realScaleType:"band"}:o==="radial"&&u==="angleAxis"?{scale:Vi(),realScaleType:"linear"}:a==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:gn(),realScaleType:"point"}:a==="category"?{scale:$n(),realScaleType:"band"}:{scale:Vi(),realScaleType:"linear"};if(er(i)){var c="scale".concat(Ia(i));return{scale:(gm[c]||gn)(),realScaleType:gm[c]?c:"point"}}return X(i)?{scale:i}:{scale:gn(),realScaleType:"point"}},km=1e-4,Zx=function(t){var r=t.domain();if(!(!r||r.length<=2)){var n=r.length,i=t.range(),a=Math.min(i[0],i[1])-km,o=Math.max(i[0],i[1])+km,u=t(r[0]),c=t(r[n-1]);(uo||co)&&t.domain([r[0],r[n-1]])}},fM=function(t,r){if(!t)return null;for(var n=0,i=t.length;ni)&&(a[1]=i),a[0]>i&&(a[0]=i),a[1]=0?(t[u][n][0]=a,t[u][n][1]=a+c,a=t[u][n][1]):(t[u][n][0]=o,t[u][n][1]=o+c,o=t[u][n][1])}},dM=function(t){var r=t.length;if(!(r<=0))for(var n=0,i=t[0].length;n=0?(t[o][n][0]=a,t[o][n][1]=a+u,a=t[o][n][1]):(t[o][n][0]=0,t[o][n][1]=0)}},vM={sign:pM,expand:n1,none:Ar,silhouette:i1,wiggle:a1,positive:dM},yM=function(t,r,n){var i=r.map(function(u){return u.props.dataKey}),a=vM[n],o=r1().keys(i).value(function(u,c){return+_e(u,c,0)}).order(Sl).offset(a);return o(t)},mM=function(t,r,n,i,a,o){if(!t)return null;var u=o?r.reverse():r,c={},s=u.reduce(function(l,h){var d,y=(d=h.type)!==null&&d!==void 0&&d.defaultProps?ve(ve({},h.type.defaultProps),h.props):h.props,v=y.stackId,p=y.hide;if(p)return l;var g=y[n],x=l[g]||{hasStack:!1,stackGroups:{}};if(Ae(v)){var w=x.stackGroups[v]||{numericAxisId:n,cateAxisId:i,items:[]};w.items.push(h),x.hasStack=!0,x.stackGroups[v]=w}else x.stackGroups[Zr("_stackId_")]={numericAxisId:n,cateAxisId:i,items:[h]};return ve(ve({},l),{},_r({},g,x))},c),f={};return Object.keys(s).reduce(function(l,h){var d=s[h];if(d.hasStack){var y={};d.stackGroups=Object.keys(d.stackGroups).reduce(function(v,p){var g=d.stackGroups[p];return ve(ve({},v),{},_r({},p,{numericAxisId:n,cateAxisId:i,items:g.items,stackedData:yM(t,g.items,a)}))},y)}return ve(ve({},l),{},_r({},h,d))},f)},Jx=function(t,r){var n=r.realScaleType,i=r.type,a=r.tickCount,o=r.originalDomain,u=r.allowDecimals,c=n||r.scale;if(c!=="auto"&&c!=="linear")return null;if(a&&i==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var s=t.domain();if(!s.length)return null;var f=Cj(s,a,u);return t.domain([Va(f),Ga(f)]),{niceTicks:f}}if(a&&i==="number"){var l=t.domain(),h=Ij(l,a,u);return{niceTicks:h}}return null};function Rm(e){var t=e.axis,r=e.ticks,n=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Y(i[t.dataKey])){var u=Mi(r,"value",i[t.dataKey]);if(u)return u.coordinate+n/2}return r[a]?r[a].coordinate+n/2:null}var c=_e(i,Y(o)?t.dataKey:o);return Y(c)?null:t.scale(c)}var Dm=function(t){var r=t.axis,n=t.ticks,i=t.offset,a=t.bandSize,o=t.entry,u=t.index;if(r.type==="category")return n[u]?n[u].coordinate+i:null;var c=_e(o,r.dataKey,r.domain[u]);return Y(c)?null:r.scale(c)-a/2+i},gM=function(t){var r=t.numericAxis,n=r.scale.domain();if(r.type==="number"){var i=Math.min(n[0],n[1]),a=Math.max(n[0],n[1]);return i<=0&&a>=0?0:a<0?a:i}return n[0]},bM=function(t,r){var n,i=(n=t.type)!==null&&n!==void 0&&n.defaultProps?ve(ve({},t.type.defaultProps),t.props):t.props,a=i.stackId;if(Ae(a)){var o=r[a];if(o){var u=o.items.indexOf(t);return u>=0?o.stackedData[u]:null}}return null},xM=function(t){return t.reduce(function(r,n){return[Va(n.concat([r[0]]).filter(q)),Ga(n.concat([r[1]]).filter(q))]},[1/0,-1/0])},Qx=function(t,r,n){return Object.keys(t).reduce(function(i,a){var o=t[a],u=o.stackedData,c=u.reduce(function(s,f){var l=xM(f.slice(r,n+1));return[Math.min(s[0],l[0]),Math.max(s[1],l[1])]},[1/0,-1/0]);return[Math.min(c[0],i[0]),Math.max(c[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},Nm=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,qm=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Yl=function(t,r,n){if(X(t))return t(r,n);if(!Array.isArray(t))return r;var i=[];if(q(t[0]))i[0]=n?t[0]:Math.min(t[0],r[0]);else if(Nm.test(t[0])){var a=+Nm.exec(t[0])[1];i[0]=r[0]-a}else X(t[0])?i[0]=t[0](r[0]):i[0]=r[0];if(q(t[1]))i[1]=n?t[1]:Math.max(t[1],r[1]);else if(qm.test(t[1])){var o=+qm.exec(t[1])[1];i[1]=r[1]+o}else X(t[1])?i[1]=t[1](r[1]):i[1]=r[1];return i},ta=function(t,r,n){if(t&&t.scale&&t.scale.bandwidth){var i=t.scale.bandwidth();if(!n||i>0)return i}if(t&&r&&r.length>=2){for(var a=ih(r,function(l){return l.coordinate}),o=1/0,u=1,c=a.length;ue.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},jM=function(t,r,n,i,a){var o=t.width,u=t.height,c=t.startAngle,s=t.endAngle,f=Ie(t.cx,o,o/2),l=Ie(t.cy,u,u/2),h=rw(o,u,n),d=Ie(t.innerRadius,h,0),y=Ie(t.outerRadius,h,h*.8),v=Object.keys(r);return v.reduce(function(p,g){var x=r[g],w=x.domain,O=x.reversed,m;if(Y(x.range))i==="angleAxis"?m=[c,s]:i==="radiusAxis"&&(m=[d,y]),O&&(m=[m[1],m[0]]);else{m=x.range;var b=m,_=_M(b,2);c=_[0],s=_[1]}var A=Yx(x,a),T=A.realScaleType,M=A.scale;M.domain(w).range(m),Zx(M);var P=Jx(M,vt(vt({},x),{},{realScaleType:T})),E=vt(vt(vt({},x),P),{},{range:m,radius:y,realScaleType:T,scale:M,cx:f,cy:l,innerRadius:d,outerRadius:y,startAngle:c,endAngle:s});return vt(vt({},p),{},tw({},g,E))},{})},MM=function(t,r){var n=t.x,i=t.y,a=r.x,o=r.y;return Math.sqrt(Math.pow(n-a,2)+Math.pow(i-o,2))},$M=function(t,r){var n=t.x,i=t.y,a=r.cx,o=r.cy,u=MM({x:n,y:i},{x:a,y:o});if(u<=0)return{radius:u};var c=(n-a)/u,s=Math.acos(c);return i>o&&(s=2*Math.PI-s),{radius:u,angle:EM(s),angleInRadian:s}},CM=function(t){var r=t.startAngle,n=t.endAngle,i=Math.floor(r/360),a=Math.floor(n/360),o=Math.min(i,a);return{startAngle:r-o*360,endAngle:n-o*360}},IM=function(t,r){var n=r.startAngle,i=r.endAngle,a=Math.floor(n/360),o=Math.floor(i/360),u=Math.min(a,o);return t+u*360},Wm=function(t,r){var n=t.x,i=t.y,a=$M({x:n,y:i},r),o=a.radius,u=a.angle,c=r.innerRadius,s=r.outerRadius;if(os)return!1;if(o===0)return!0;var f=CM(r),l=f.startAngle,h=f.endAngle,d=u,y;if(l<=h){for(;d>h;)d-=360;for(;d=l&&d<=h}else{for(;d>l;)d-=360;for(;d=h&&d<=l}return y?vt(vt({},r),{},{radius:o,angle:IM(d,r)}):null},nw=function(t){return!N.isValidElement(t)&&!X(t)&&typeof t!="boolean"?t.className:""};function Fn(e){"@babel/helpers - typeof";return Fn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fn(e)}var kM=["offset"];function RM(e){return LM(e)||qM(e)||NM(e)||DM()}function DM(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NM(e,t){if(e){if(typeof e=="string")return Zl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Zl(e,t)}}function qM(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function LM(e){if(Array.isArray(e))return Zl(e)}function Zl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function FM(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function zm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Oe(e){for(var t=1;t=0?1:-1,w,O;i==="insideStart"?(w=d+x*o,O=v):i==="insideEnd"?(w=y-x*o,O=!v):i==="end"&&(w=y+x*o,O=v),O=g<=0?O:!O;var m=le(s,f,p,w),b=le(s,f,p,w+(O?1:-1)*359),_="M".concat(m.x,",").concat(m.y,` + A`).concat(p,",").concat(p,",0,1,").concat(O?0:1,`, + `).concat(b.x,",").concat(b.y),A=Y(t.id)?Zr("recharts-radial-line-"):t.id;return S.createElement("text",Wn({},n,{dominantBaseline:"central",className:J("recharts-radial-bar-label",u)}),S.createElement("defs",null,S.createElement("path",{id:A,d:_})),S.createElement("textPath",{xlinkHref:"#".concat(A)},r))},VM=function(t){var r=t.viewBox,n=t.offset,i=t.position,a=r,o=a.cx,u=a.cy,c=a.innerRadius,s=a.outerRadius,f=a.startAngle,l=a.endAngle,h=(f+l)/2;if(i==="outside"){var d=le(o,u,s+n,h),y=d.x,v=d.y;return{x:y,y:v,textAnchor:y>=o?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"end"};var p=(c+s)/2,g=le(o,u,p,h),x=g.x,w=g.y;return{x,y:w,textAnchor:"middle",verticalAnchor:"middle"}},XM=function(t){var r=t.viewBox,n=t.parentViewBox,i=t.offset,a=t.position,o=r,u=o.x,c=o.y,s=o.width,f=o.height,l=f>=0?1:-1,h=l*i,d=l>0?"end":"start",y=l>0?"start":"end",v=s>=0?1:-1,p=v*i,g=v>0?"end":"start",x=v>0?"start":"end";if(a==="top"){var w={x:u+s/2,y:c-l*i,textAnchor:"middle",verticalAnchor:d};return Oe(Oe({},w),n?{height:Math.max(c-n.y,0),width:s}:{})}if(a==="bottom"){var O={x:u+s/2,y:c+f+h,textAnchor:"middle",verticalAnchor:y};return Oe(Oe({},O),n?{height:Math.max(n.y+n.height-(c+f),0),width:s}:{})}if(a==="left"){var m={x:u-p,y:c+f/2,textAnchor:g,verticalAnchor:"middle"};return Oe(Oe({},m),n?{width:Math.max(m.x-n.x,0),height:f}:{})}if(a==="right"){var b={x:u+s+p,y:c+f/2,textAnchor:x,verticalAnchor:"middle"};return Oe(Oe({},b),n?{width:Math.max(n.x+n.width-b.x,0),height:f}:{})}var _=n?{width:s,height:f}:{};return a==="insideLeft"?Oe({x:u+p,y:c+f/2,textAnchor:x,verticalAnchor:"middle"},_):a==="insideRight"?Oe({x:u+s-p,y:c+f/2,textAnchor:g,verticalAnchor:"middle"},_):a==="insideTop"?Oe({x:u+s/2,y:c+h,textAnchor:"middle",verticalAnchor:y},_):a==="insideBottom"?Oe({x:u+s/2,y:c+f-h,textAnchor:"middle",verticalAnchor:d},_):a==="insideTopLeft"?Oe({x:u+p,y:c+h,textAnchor:x,verticalAnchor:y},_):a==="insideTopRight"?Oe({x:u+s-p,y:c+h,textAnchor:g,verticalAnchor:y},_):a==="insideBottomLeft"?Oe({x:u+p,y:c+f-h,textAnchor:x,verticalAnchor:d},_):a==="insideBottomRight"?Oe({x:u+s-p,y:c+f-h,textAnchor:g,verticalAnchor:d},_):Yr(a)&&(q(a.x)||Gt(a.x))&&(q(a.y)||Gt(a.y))?Oe({x:u+Ie(a.x,s),y:c+Ie(a.y,f),textAnchor:"end",verticalAnchor:"end"},_):Oe({x:u+s/2,y:c+f/2,textAnchor:"middle",verticalAnchor:"middle"},_)},YM=function(t){return"cx"in t&&q(t.cx)};function Te(e){var t=e.offset,r=t===void 0?5:t,n=BM(e,kM),i=Oe({offset:r},n),a=i.viewBox,o=i.position,u=i.value,c=i.children,s=i.content,f=i.className,l=f===void 0?"":f,h=i.textBreakAll;if(!a||Y(u)&&Y(c)&&!N.isValidElement(s)&&!X(s))return null;if(N.isValidElement(s))return N.cloneElement(s,i);var d;if(X(s)){if(d=N.createElement(s,i),N.isValidElement(d))return d}else d=HM(i);var y=YM(a),v=H(i,!0);if(y&&(o==="insideStart"||o==="insideEnd"||o==="end"))return GM(i,d,v);var p=y?VM(i):XM(i);return S.createElement(rr,Wn({className:J("recharts-label",l)},v,p,{breakAll:h}),d)}Te.displayName="Label";var iw=function(t){var r=t.cx,n=t.cy,i=t.angle,a=t.startAngle,o=t.endAngle,u=t.r,c=t.radius,s=t.innerRadius,f=t.outerRadius,l=t.x,h=t.y,d=t.top,y=t.left,v=t.width,p=t.height,g=t.clockWise,x=t.labelViewBox;if(x)return x;if(q(v)&&q(p)){if(q(l)&&q(h))return{x:l,y:h,width:v,height:p};if(q(d)&&q(y))return{x:d,y,width:v,height:p}}return q(l)&&q(h)?{x:l,y:h,width:0,height:0}:q(r)&&q(n)?{cx:r,cy:n,startAngle:a||i||0,endAngle:o||i||0,innerRadius:s||0,outerRadius:f||c||u||0,clockWise:g}:t.viewBox?t.viewBox:{}},ZM=function(t,r){return t?t===!0?S.createElement(Te,{key:"label-implicit",viewBox:r}):Ae(t)?S.createElement(Te,{key:"label-implicit",viewBox:r,value:t}):N.isValidElement(t)?t.type===Te?N.cloneElement(t,{key:"label-implicit",viewBox:r}):S.createElement(Te,{key:"label-implicit",content:t,viewBox:r}):X(t)?S.createElement(Te,{key:"label-implicit",content:t,viewBox:r}):Yr(t)?S.createElement(Te,Wn({viewBox:r},t,{key:"label-implicit"})):null:null},JM=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var i=t.children,a=iw(t),o=Ke(i,Te).map(function(c,s){return N.cloneElement(c,{viewBox:r||a,key:"label-".concat(s)})});if(!n)return o;var u=ZM(t.label,r||a);return[u].concat(RM(o))};Te.parseViewBox=iw;Te.renderCallByParent=JM;var Ls,Um;function QM(){if(Um)return Ls;Um=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return Ls=e,Ls}var e$=QM();const t$=oe(e$);function zn(e){"@babel/helpers - typeof";return zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zn(e)}var r$=["valueAccessor"],n$=["data","dataKey","clockWise","id","textBreakAll"];function i$(e){return c$(e)||u$(e)||o$(e)||a$()}function a$(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function o$(e,t){if(e){if(typeof e=="string")return Jl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Jl(e,t)}}function u$(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c$(e){if(Array.isArray(e))return Jl(e)}function Jl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function h$(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var p$=function(t){return Array.isArray(t.value)?t$(t.value):t.value};function wt(e){var t=e.valueAccessor,r=t===void 0?p$:t,n=Gm(e,r$),i=n.data,a=n.dataKey,o=n.clockWise,u=n.id,c=n.textBreakAll,s=Gm(n,n$);return!i||!i.length?null:S.createElement(te,{className:"recharts-label-list"},i.map(function(f,l){var h=Y(a)?r(f,l):_e(f&&f.payload,a),d=Y(u)?{}:{id:"".concat(u,"-").concat(l)};return S.createElement(Te,na({},H(f,!0),s,d,{parentViewBox:f.parentViewBox,value:h,textBreakAll:c,viewBox:Te.parseViewBox(Y(o)?f:Km(Km({},f),{},{clockWise:o})),key:"label-".concat(l),index:l}))}))}wt.displayName="LabelList";function d$(e,t){return e?e===!0?S.createElement(wt,{key:"labelList-implicit",data:t}):S.isValidElement(e)||X(e)?S.createElement(wt,{key:"labelList-implicit",data:t,content:e}):Yr(e)?S.createElement(wt,na({data:t},e,{key:"labelList-implicit"})):null:null}function v$(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var n=e.children,i=Ke(n,wt).map(function(o,u){return N.cloneElement(o,{data:t,key:"labelList-".concat(u)})});if(!r)return i;var a=d$(e.label,t);return[a].concat(i$(i))}wt.renderCallByParent=v$;function Un(e){"@babel/helpers - typeof";return Un=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Un(e)}function Ql(){return Ql=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(o>s),`, + `).concat(l.x,",").concat(l.y,` + `);if(i>0){var d=le(r,n,i,o),y=le(r,n,i,s);h+="L ".concat(y.x,",").concat(y.y,` + A `).concat(i,",").concat(i,`,0, + `).concat(+(Math.abs(c)>180),",").concat(+(o<=s),`, + `).concat(d.x,",").concat(d.y," Z")}else h+="L ".concat(r,",").concat(n," Z");return h},x$=function(t){var r=t.cx,n=t.cy,i=t.innerRadius,a=t.outerRadius,o=t.cornerRadius,u=t.forceCornerRadius,c=t.cornerIsExternal,s=t.startAngle,f=t.endAngle,l=Ce(f-s),h=Ai({cx:r,cy:n,radius:a,angle:s,sign:l,cornerRadius:o,cornerIsExternal:c}),d=h.circleTangency,y=h.lineTangency,v=h.theta,p=Ai({cx:r,cy:n,radius:a,angle:f,sign:-l,cornerRadius:o,cornerIsExternal:c}),g=p.circleTangency,x=p.lineTangency,w=p.theta,O=c?Math.abs(s-f):Math.abs(s-f)-v-w;if(O<0)return u?"M ".concat(y.x,",").concat(y.y,` + a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0 + a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0 + `):aw({cx:r,cy:n,innerRadius:i,outerRadius:a,startAngle:s,endAngle:f});var m="M ".concat(y.x,",").concat(y.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(d.x,",").concat(d.y,` + A`).concat(a,",").concat(a,",0,").concat(+(O>180),",").concat(+(l<0),",").concat(g.x,",").concat(g.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(x.x,",").concat(x.y,` + `);if(i>0){var b=Ai({cx:r,cy:n,radius:i,angle:s,sign:l,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),_=b.circleTangency,A=b.lineTangency,T=b.theta,M=Ai({cx:r,cy:n,radius:i,angle:f,sign:-l,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),P=M.circleTangency,E=M.lineTangency,j=M.theta,C=c?Math.abs(s-f):Math.abs(s-f)-T-j;if(C<0&&o===0)return"".concat(m,"L").concat(r,",").concat(n,"Z");m+="L".concat(E.x,",").concat(E.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(P.x,",").concat(P.y,` + A`).concat(i,",").concat(i,",0,").concat(+(C>180),",").concat(+(l>0),",").concat(_.x,",").concat(_.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(A.x,",").concat(A.y,"Z")}else m+="L".concat(r,",").concat(n,"Z");return m},w$={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},ow=function(t){var r=Xm(Xm({},w$),t),n=r.cx,i=r.cy,a=r.innerRadius,o=r.outerRadius,u=r.cornerRadius,c=r.forceCornerRadius,s=r.cornerIsExternal,f=r.startAngle,l=r.endAngle,h=r.className;if(o0&&Math.abs(f-l)<360?p=x$({cx:n,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(v,y/2),forceCornerRadius:c,cornerIsExternal:s,startAngle:f,endAngle:l}):p=aw({cx:n,cy:i,innerRadius:a,outerRadius:o,startAngle:f,endAngle:l}),S.createElement("path",Ql({},H(r,!0),{className:d,d:p,role:"img"}))};function Hn(e){"@babel/helpers - typeof";return Hn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hn(e)}function ef(){return ef=Object.assign?Object.assign.bind():function(e){for(var t=1;t0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function B$(e,t){return sr(e.getTime(),t.getTime())}function F$(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function W$(e,t){return e===t}function og(e,t,r){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var i=new Array(n),a=e.entries(),o,u,c=0;(o=a.next())&&!o.done;){for(var s=t.entries(),f=!1,l=0;(u=s.next())&&!u.done;){if(i[l]){l++;continue}var h=o.value,d=u.value;if(r.equals(h[0],d[0],c,l,e,t,r)&&r.equals(h[1],d[1],h[0],d[0],e,t,r)){f=i[l]=!0;break}l++}if(!f)return!1;c++}return!0}var z$=sr;function U$(e,t,r){var n=ag(e),i=n.length;if(ag(t).length!==i)return!1;for(;i-- >0;)if(!uw(e,t,r,n[i]))return!1;return!0}function hn(e,t,r){var n=ng(e),i=n.length;if(ng(t).length!==i)return!1;for(var a,o,u;i-- >0;)if(a=n[i],!uw(e,t,r,a)||(o=ig(e,a),u=ig(t,a),(o||u)&&(!o||!u||o.configurable!==u.configurable||o.enumerable!==u.enumerable||o.writable!==u.writable)))return!1;return!0}function H$(e,t){return sr(e.valueOf(),t.valueOf())}function K$(e,t){return e.source===t.source&&e.flags===t.flags}function ug(e,t,r){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var i=new Array(n),a=e.values(),o,u;(o=a.next())&&!o.done;){for(var c=t.values(),s=!1,f=0;(u=c.next())&&!u.done;){if(!i[f]&&r.equals(o.value,u.value,o.value,u.value,e,t,r)){s=i[f]=!0;break}f++}if(!s)return!1}return!0}function G$(e,t){var r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}function V$(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function uw(e,t,r,n){return(n===q$||n===N$||n===D$)&&(e.$$typeof||t.$$typeof)?!0:R$(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var X$="[object Arguments]",Y$="[object Boolean]",Z$="[object Date]",J$="[object Error]",Q$="[object Map]",eC="[object Number]",tC="[object Object]",rC="[object RegExp]",nC="[object Set]",iC="[object String]",aC="[object URL]",oC=Array.isArray,cg=typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView:null,sg=Object.assign,uC=Object.prototype.toString.call.bind(Object.prototype.toString);function cC(e){var t=e.areArraysEqual,r=e.areDatesEqual,n=e.areErrorsEqual,i=e.areFunctionsEqual,a=e.areMapsEqual,o=e.areNumbersEqual,u=e.areObjectsEqual,c=e.arePrimitiveWrappersEqual,s=e.areRegExpsEqual,f=e.areSetsEqual,l=e.areTypedArraysEqual,h=e.areUrlsEqual,d=e.unknownTagComparators;return function(v,p,g){if(v===p)return!0;if(v==null||p==null)return!1;var x=typeof v;if(x!==typeof p)return!1;if(x!=="object")return x==="number"?o(v,p,g):x==="function"?i(v,p,g):!1;var w=v.constructor;if(w!==p.constructor)return!1;if(w===Object)return u(v,p,g);if(oC(v))return t(v,p,g);if(cg!=null&&cg(v))return l(v,p,g);if(w===Date)return r(v,p,g);if(w===RegExp)return s(v,p,g);if(w===Map)return a(v,p,g);if(w===Set)return f(v,p,g);var O=uC(v);if(O===Z$)return r(v,p,g);if(O===rC)return s(v,p,g);if(O===Q$)return a(v,p,g);if(O===nC)return f(v,p,g);if(O===tC)return typeof v.then!="function"&&typeof p.then!="function"&&u(v,p,g);if(O===aC)return h(v,p,g);if(O===J$)return n(v,p,g);if(O===X$)return u(v,p,g);if(O===Y$||O===eC||O===iC)return c(v,p,g);if(d){var m=d[O];if(!m){var b=k$(v);b&&(m=d[b])}if(m)return m(v,p,g)}return!1}}function sC(e){var t=e.circular,r=e.createCustomConfig,n=e.strict,i={areArraysEqual:n?hn:L$,areDatesEqual:B$,areErrorsEqual:F$,areFunctionsEqual:W$,areMapsEqual:n?rg(og,hn):og,areNumbersEqual:z$,areObjectsEqual:n?hn:U$,arePrimitiveWrappersEqual:H$,areRegExpsEqual:K$,areSetsEqual:n?rg(ug,hn):ug,areTypedArraysEqual:n?hn:G$,areUrlsEqual:V$,unknownTagComparators:void 0};if(r&&(i=sg({},i,r(i))),t){var a=Pi(i.areArraysEqual),o=Pi(i.areMapsEqual),u=Pi(i.areObjectsEqual),c=Pi(i.areSetsEqual);i=sg({},i,{areArraysEqual:a,areMapsEqual:o,areObjectsEqual:u,areSetsEqual:c})}return i}function lC(e){return function(t,r,n,i,a,o,u){return e(t,r,u)}}function fC(e){var t=e.circular,r=e.comparator,n=e.createState,i=e.equals,a=e.strict;if(n)return function(c,s){var f=n(),l=f.cache,h=l===void 0?t?new WeakMap:void 0:l,d=f.meta;return r(c,s,{cache:h,equals:i,meta:d,strict:a})};if(t)return function(c,s){return r(c,s,{cache:new WeakMap,equals:i,meta:void 0,strict:a})};var o={cache:void 0,equals:i,meta:void 0,strict:a};return function(c,s){return r(c,s,o)}}var hC=Dt();Dt({strict:!0});Dt({circular:!0});Dt({circular:!0,strict:!0});Dt({createInternalComparator:function(){return sr}});Dt({strict:!0,createInternalComparator:function(){return sr}});Dt({circular:!0,createInternalComparator:function(){return sr}});Dt({circular:!0,createInternalComparator:function(){return sr},strict:!0});function Dt(e){e===void 0&&(e={});var t=e.circular,r=t===void 0?!1:t,n=e.createInternalComparator,i=e.createState,a=e.strict,o=a===void 0?!1:a,u=sC(e),c=cC(u),s=n?n(c):lC(c);return fC({circular:r,comparator:c,createState:i,equals:s,strict:o})}function pC(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function lg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function i(a){r<0&&(r=a),a-r>t?(e(a),r=-1):pC(i)};requestAnimationFrame(n)}function tf(e){"@babel/helpers - typeof";return tf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tf(e)}function dC(e){return gC(e)||mC(e)||yC(e)||vC()}function vC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yC(e,t){if(e){if(typeof e=="string")return fg(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return fg(e,t)}}function fg(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);re.length)&&(t=e.length);for(var r=0,n=new Array(t);r1?1:g<0?0:g},v=function(g){for(var x=g>1?1:g,w=x,O=0;O<8;++O){var m=l(w)-x,b=d(w);if(Math.abs(m-x)0&&arguments[0]!==void 0?arguments[0]:{},r=t.stiff,n=r===void 0?100:r,i=t.damping,a=i===void 0?8:i,o=t.dt,u=o===void 0?17:o,c=function(f,l,h){var d=-(f-l)*n,y=h*a,v=h+(d-y)*u/1e3,p=h*u/1e3+f;return Math.abs(p-l)e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function XC(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,a;for(a=0;a=0)&&(r[i]=e[i]);return r}function zs(e){return QC(e)||JC(e)||ZC(e)||YC()}function YC(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZC(e,t){if(e){if(typeof e=="string")return uf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return uf(e,t)}}function JC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function QC(e){if(Array.isArray(e))return uf(e)}function uf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ua(e){return ua=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ua(e)}var lt=(function(e){iI(r,e);var t=aI(r);function r(n,i){var a;eI(this,r),a=t.call(this,n,i);var o=a.props,u=o.isActive,c=o.attributeName,s=o.from,f=o.to,l=o.steps,h=o.children,d=o.duration;if(a.handleStyleChange=a.handleStyleChange.bind(lf(a)),a.changeStyle=a.changeStyle.bind(lf(a)),!u||d<=0)return a.state={style:{}},typeof h=="function"&&(a.state={style:f}),sf(a);if(l&&l.length)a.state={style:l[0].style};else if(s){if(typeof h=="function")return a.state={style:s},sf(a);a.state={style:c?yn({},c,s):s}}else a.state={style:{}};return a}return rI(r,[{key:"componentDidMount",value:function(){var i=this.props,a=i.isActive,o=i.canBegin;this.mounted=!0,!(!a||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var a=this.props,o=a.isActive,u=a.canBegin,c=a.attributeName,s=a.shouldReAnimate,f=a.to,l=a.from,h=this.state.style;if(u){if(!o){var d={style:c?yn({},c,f):f};this.state&&h&&(c&&h[c]!==f||!c&&h!==f)&&this.setState(d);return}if(!(hC(i.to,f)&&i.canBegin&&i.isActive)){var y=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var v=y||s?l:i.to;if(this.state&&h){var p={style:c?yn({},c,v):v};(c&&h[c]!==v||!c&&h!==v)&&this.setState(p)}this.runAnimation(et(et({},this.props),{},{from:v,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var a=this,o=i.from,u=i.to,c=i.duration,s=i.easing,f=i.begin,l=i.onAnimationEnd,h=i.onAnimationStart,d=KC(o,u,RC(s),c,this.changeStyle),y=function(){a.stopJSAnimation=d()};this.manager.start([h,f,y,c,l])}},{key:"runStepAnimation",value:function(i){var a=this,o=i.steps,u=i.begin,c=i.onAnimationStart,s=o[0],f=s.style,l=s.duration,h=l===void 0?0:l,d=function(v,p,g){if(g===0)return v;var x=p.duration,w=p.easing,O=w===void 0?"ease":w,m=p.style,b=p.properties,_=p.onAnimationEnd,A=g>0?o[g-1]:p,T=b||Object.keys(m);if(typeof O=="function"||O==="spring")return[].concat(zs(v),[a.runJSAnimation.bind(a,{from:A.style,to:m,duration:x,easing:O}),x]);var M=dg(T,x,O),P=et(et(et({},A.style),m),{},{transition:M});return[].concat(zs(v),[P,x,_]).filter(_C)};return this.manager.start([c].concat(zs(o.reduce(d,[f,Math.max(h,u)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=bC());var a=i.begin,o=i.duration,u=i.attributeName,c=i.to,s=i.easing,f=i.onAnimationStart,l=i.onAnimationEnd,h=i.steps,d=i.children,y=this.manager;if(this.unSubscribe=y.subscribe(this.handleStyleChange),typeof s=="function"||typeof d=="function"||s==="spring"){this.runJSAnimation(i);return}if(h.length>1){this.runStepAnimation(i);return}var v=u?yn({},u,c):c,p=dg(Object.keys(v),o,s);y.start([f,a,et(et({},v),{},{transition:p}),o,l])}},{key:"render",value:function(){var i=this.props,a=i.children;i.begin;var o=i.duration;i.attributeName,i.easing;var u=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var c=VC(i,GC),s=N.Children.count(a),f=this.state.style;if(typeof a=="function")return a(f);if(!u||s===0||o<=0)return a;var l=function(d){var y=d.props,v=y.style,p=v===void 0?{}:v,g=y.className,x=N.cloneElement(d,et(et({},c),{},{style:et(et({},p),f),className:g}));return x};return s===1?l(N.Children.only(a)):S.createElement("div",null,N.Children.map(a,function(h){return l(h)}))}}]),r})(N.PureComponent);lt.displayName="Animate";lt.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};lt.propTypes={from:ie.oneOfType([ie.object,ie.string]),to:ie.oneOfType([ie.object,ie.string]),attributeName:ie.string,duration:ie.number,begin:ie.number,easing:ie.oneOfType([ie.string,ie.func]),steps:ie.arrayOf(ie.shape({duration:ie.number.isRequired,style:ie.object.isRequired,easing:ie.oneOfType([ie.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),ie.func]),properties:ie.arrayOf("string"),onAnimationEnd:ie.func})),children:ie.oneOfType([ie.node,ie.func]),isActive:ie.bool,canBegin:ie.bool,onAnimationEnd:ie.func,shouldReAnimate:ie.bool,onAnimationStart:ie.func,onAnimationReStart:ie.func};function xg(){return xg=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0?1:-1,c=n>=0?1:-1,s=i>=0&&n>=0||i<0&&n<0?1:0,f;if(o>0&&a instanceof Array){for(var l=[0,0,0,0],h=0,d=4;ho?o:a[h];f="M".concat(t,",").concat(r+u*l[0]),l[0]>0&&(f+="A ".concat(l[0],",").concat(l[0],",0,0,").concat(s,",").concat(t+c*l[0],",").concat(r)),f+="L ".concat(t+n-c*l[1],",").concat(r),l[1]>0&&(f+="A ".concat(l[1],",").concat(l[1],",0,0,").concat(s,`, + `).concat(t+n,",").concat(r+u*l[1])),f+="L ".concat(t+n,",").concat(r+i-u*l[2]),l[2]>0&&(f+="A ".concat(l[2],",").concat(l[2],",0,0,").concat(s,`, + `).concat(t+n-c*l[2],",").concat(r+i)),f+="L ".concat(t+c*l[3],",").concat(r+i),l[3]>0&&(f+="A ".concat(l[3],",").concat(l[3],",0,0,").concat(s,`, + `).concat(t,",").concat(r+i-u*l[3])),f+="Z"}else if(o>0&&a===+a&&a>0){var y=Math.min(o,a);f="M ".concat(t,",").concat(r+u*y,` + A `).concat(y,",").concat(y,",0,0,").concat(s,",").concat(t+c*y,",").concat(r,` + L `).concat(t+n-c*y,",").concat(r,` + A `).concat(y,",").concat(y,",0,0,").concat(s,",").concat(t+n,",").concat(r+u*y,` + L `).concat(t+n,",").concat(r+i-u*y,` + A `).concat(y,",").concat(y,",0,0,").concat(s,",").concat(t+n-c*y,",").concat(r+i,` + L `).concat(t+c*y,",").concat(r+i,` + A `).concat(y,",").concat(y,",0,0,").concat(s,",").concat(t,",").concat(r+i-u*y," Z")}else f="M ".concat(t,",").concat(r," h ").concat(n," v ").concat(i," h ").concat(-n," Z");return f},vI=function(t,r){if(!t||!r)return!1;var n=t.x,i=t.y,a=r.x,o=r.y,u=r.width,c=r.height;if(Math.abs(u)>0&&Math.abs(c)>0){var s=Math.min(a,a+u),f=Math.max(a,a+u),l=Math.min(o,o+c),h=Math.max(o,o+c);return n>=s&&n<=f&&i>=l&&i<=h}return!1},yI={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Ch=function(t){var r=_g(_g({},yI),t),n=N.useRef(),i=N.useState(-1),a=uI(i,2),o=a[0],u=a[1];N.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var O=n.current.getTotalLength();O&&u(O)}catch{}},[]);var c=r.x,s=r.y,f=r.width,l=r.height,h=r.radius,d=r.className,y=r.animationEasing,v=r.animationDuration,p=r.animationBegin,g=r.isAnimationActive,x=r.isUpdateAnimationActive;if(c!==+c||s!==+s||f!==+f||l!==+l||f===0||l===0)return null;var w=J("recharts-rectangle",d);return x?S.createElement(lt,{canBegin:o>0,from:{width:f,height:l,x:c,y:s},to:{width:f,height:l,x:c,y:s},duration:v,animationEasing:y,isActive:x},function(O){var m=O.width,b=O.height,_=O.x,A=O.y;return S.createElement(lt,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:p,duration:v,isActive:g,easing:y},S.createElement("path",ca({},H(r,!0),{className:w,d:Ag(_,A,m,b,h),ref:n})))}):S.createElement("path",ca({},H(r,!0),{className:w,d:Ag(c,s,f,l,h)}))},mI=["points","className","baseLinePoints","connectNulls"];function yr(){return yr=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function bI(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Sg(e){return _I(e)||OI(e)||wI(e)||xI()}function xI(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wI(e,t){if(e){if(typeof e=="string")return ff(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ff(e,t)}}function OI(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function _I(e){if(Array.isArray(e))return ff(e)}function ff(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return t.forEach(function(n){Pg(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),Pg(t[0])&&r[r.length-1].push(t[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},wn=function(t,r){var n=AI(t);r&&(n=[n.reduce(function(a,o){return[].concat(Sg(a),Sg(o))},[])]);var i=n.map(function(a){return a.reduce(function(o,u,c){return"".concat(o).concat(c===0?"M":"L").concat(u.x,",").concat(u.y)},"")}).join("");return n.length===1?"".concat(i,"Z"):i},SI=function(t,r,n){var i=wn(t,n);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(wn(r.reverse(),n).slice(1))},PI=function(t){var r=t.points,n=t.className,i=t.baseLinePoints,a=t.connectNulls,o=gI(t,mI);if(!r||!r.length)return null;var u=J("recharts-polygon",n);if(i&&i.length){var c=o.stroke&&o.stroke!=="none",s=SI(r,i,a);return S.createElement("g",{className:u},S.createElement("path",yr({},H(o,!0),{fill:s.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:s})),c?S.createElement("path",yr({},H(o,!0),{fill:"none",d:wn(r,a)})):null,c?S.createElement("path",yr({},H(o,!0),{fill:"none",d:wn(i,a)})):null)}var f=wn(r,a);return S.createElement("path",yr({},H(o,!0),{fill:f.slice(-1)==="Z"?o.fill:"none",className:u,d:f}))};function hf(){return hf=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function II(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var kI=function(t,r,n,i,a,o){return"M".concat(t,",").concat(a,"v").concat(i,"M").concat(o,",").concat(r,"h").concat(n)},RI=function(t){var r=t.x,n=r===void 0?0:r,i=t.y,a=i===void 0?0:i,o=t.top,u=o===void 0?0:o,c=t.left,s=c===void 0?0:c,f=t.width,l=f===void 0?0:f,h=t.height,d=h===void 0?0:h,y=t.className,v=CI(t,TI),p=EI({x:n,y:a,top:u,left:s,width:l,height:d},v);return!q(n)||!q(a)||!q(l)||!q(d)||!q(u)||!q(s)?null:S.createElement("path",pf({},H(p,!0),{className:J("recharts-cross",y),d:kI(n,a,l,d,u,s)}))},Us,Eg;function DI(){if(Eg)return Us;Eg=1;var e=Ka(),t=Ex(),r=ht();function n(i,a){return i&&i.length?e(i,r(a,2),t):void 0}return Us=n,Us}var NI=DI();const qI=oe(NI);var Hs,jg;function LI(){if(jg)return Hs;jg=1;var e=Ka(),t=ht(),r=jx();function n(i,a){return i&&i.length?e(i,t(a,2),r):void 0}return Hs=n,Hs}var BI=LI();const FI=oe(BI);var WI=["cx","cy","angle","ticks","axisLine"],zI=["ticks","tick","angle","tickFormatter","stroke"];function kr(e){"@babel/helpers - typeof";return kr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kr(e)}function On(){return On=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function UI(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function HI(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cg(e,t){for(var r=0;rRg?o=i==="outer"?"start":"end":a<-Rg?o=i==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var n=this.props,i=n.cx,a=n.cy,o=n.radius,u=n.axisLine,c=n.axisLineType,s=zt(zt({},H(this.props,!1)),{},{fill:"none"},H(u,!1));if(c==="circle")return S.createElement(Za,Kt({className:"recharts-polar-angle-axis-line"},s,{cx:i,cy:a,r:o}));var f=this.props.ticks,l=f.map(function(h){return le(i,a,o,h.coordinate)});return S.createElement(PI,Kt({className:"recharts-polar-angle-axis-line"},s,{points:l}))}},{key:"renderTicks",value:function(){var n=this,i=this.props,a=i.ticks,o=i.tick,u=i.tickLine,c=i.tickFormatter,s=i.stroke,f=H(this.props,!1),l=H(o,!1),h=zt(zt({},f),{},{fill:"none"},H(u,!1)),d=a.map(function(y,v){var p=n.getTickLineCoord(y),g=n.getTickTextAnchor(y),x=zt(zt(zt({textAnchor:g},f),{},{stroke:"none",fill:s},l),{},{index:v,payload:y,x:p.x2,y:p.y2});return S.createElement(te,Kt({className:J("recharts-polar-angle-axis-tick",nw(o)),key:"tick-".concat(y.coordinate)},tr(n.props,y,v)),u&&S.createElement("line",Kt({className:"recharts-polar-angle-axis-tick-line"},h,p)),o&&t.renderTickItem(o,x,c?c(y.value,v):y.value))});return S.createElement(te,{className:"recharts-polar-angle-axis-ticks"},d)}},{key:"render",value:function(){var n=this.props,i=n.ticks,a=n.radius,o=n.axisLine;return a<=0||!i||!i.length?null:S.createElement(te,{className:J("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,i,a){var o;return S.isValidElement(n)?o=S.cloneElement(n,i):X(n)?o=n(i):o=S.createElement(rr,Kt({},i,{className:"recharts-polar-angle-axis-tick-value"}),a),o}}])})(N.PureComponent);eo(to,"displayName","PolarAngleAxis");eo(to,"axisType","angleAxis");eo(to,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var Ks,Dg;function ok(){if(Dg)return Ks;Dg=1;var e=T0(),t=e(Object.getPrototypeOf,Object);return Ks=t,Ks}var Gs,Ng;function uk(){if(Ng)return Gs;Ng=1;var e=St(),t=ok(),r=Pt(),n="[object Object]",i=Function.prototype,a=Object.prototype,o=i.toString,u=a.hasOwnProperty,c=o.call(Object);function s(f){if(!r(f)||e(f)!=n)return!1;var l=t(f);if(l===null)return!0;var h=u.call(l,"constructor")&&l.constructor;return typeof h=="function"&&h instanceof h&&o.call(h)==c}return Gs=s,Gs}var ck=uk();const sk=oe(ck);var Vs,qg;function lk(){if(qg)return Vs;qg=1;var e=St(),t=Pt(),r="[object Boolean]";function n(i){return i===!0||i===!1||t(i)&&e(i)==r}return Vs=n,Vs}var fk=lk();const hk=oe(fk);function Yn(e){"@babel/helpers - typeof";return Yn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yn(e)}function fa(){return fa=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0,from:{upperWidth:0,lowerWidth:0,height:h,x:c,y:s},to:{upperWidth:f,lowerWidth:l,height:h,x:c,y:s},duration:v,animationEasing:y,isActive:g},function(w){var O=w.upperWidth,m=w.lowerWidth,b=w.height,_=w.x,A=w.y;return S.createElement(lt,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:p,duration:v,easing:y},S.createElement("path",fa({},H(r,!0),{className:x,d:Wg(_,A,O,m,b),ref:n})))}):S.createElement("g",null,S.createElement("path",fa({},H(r,!0),{className:x,d:Wg(c,s,f,l,h)})))},_k=["option","shapeType","propTransformer","activeClassName","isActive"];function Zn(e){"@babel/helpers - typeof";return Zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zn(e)}function Ak(e,t){if(e==null)return{};var r=Sk(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Sk(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function zg(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ha(e){for(var t=1;t0?He(w,"paddingAngle",0):0;if(m){var _=ze(m.endAngle-m.startAngle,w.endAngle-w.startAngle),A=ce(ce({},w),{},{startAngle:x+b,endAngle:x+_(v)+b});p.push(A),x=A.endAngle}else{var T=w.endAngle,M=w.startAngle,P=ze(0,T-M),E=P(v),j=ce(ce({},w),{},{startAngle:x+b,endAngle:x+E+b});p.push(j),x=j.endAngle}}),S.createElement(te,null,n.renderSectorsStatically(p))})}},{key:"attachKeyboardHandlers",value:function(n){var i=this;n.onkeydown=function(a){if(!a.altKey)switch(a.key){case"ArrowLeft":{var o=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[o].focus(),i.setState({sectorToFocus:o});break}case"ArrowRight":{var u=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[u].focus(),i.setState({sectorToFocus:u});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var n=this.props,i=n.sectors,a=n.isAnimationActive,o=this.state.prevSectors;return a&&i&&i.length&&(!o||!hi(o,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var n=this,i=this.props,a=i.hide,o=i.sectors,u=i.className,c=i.label,s=i.cx,f=i.cy,l=i.innerRadius,h=i.outerRadius,d=i.isAnimationActive,y=this.state.isAnimationFinished;if(a||!o||!o.length||!q(s)||!q(f)||!q(l)||!q(h))return null;var v=J("recharts-pie",u);return S.createElement(te,{tabIndex:this.props.rootTabIndex,className:v,ref:function(g){n.pieRef=g}},this.renderSectors(),c&&this.renderLabels(o),Te.renderCallByParent(this.props,null,!1),(!d||y)&&wt.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return i.prevIsAnimationActive!==n.isAnimationActive?{prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:[],isAnimationFinished:!0}:n.isAnimationActive&&n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:n.sectors!==i.curSectors?{curSectors:n.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(n,i){return n>i?"start":n=360?x:x-1)*c,O=p-x*d-w,m=i.reduce(function(A,T){var M=_e(T,g,0);return A+(q(M)?M:0)},0),b;if(m>0){var _;b=i.map(function(A,T){var M=_e(A,g,0),P=_e(A,f,T),E=(q(M)?M:0)/m,j;T?j=_.endAngle+Ce(v)*c*(M!==0?1:0):j=o;var C=j+Ce(v)*((M!==0?d:0)+E*O),$=(j+C)/2,k=(y.innerRadius+y.outerRadius)/2,R=[{name:P,value:M,payload:A,dataKey:g,type:h}],L=le(y.cx,y.cy,k,$);return _=ce(ce(ce({percent:E,cornerRadius:a,name:P,tooltipPayload:R,midAngle:$,middleRadius:k,tooltipPosition:L},A),y),{},{value:_e(A,g),startAngle:j,endAngle:C,payload:A,paddingAngle:Ce(v)*c}),_})}return ce(ce({},y),{},{sectors:b,data:i})});var Xs,Gg;function Kk(){if(Gg)return Xs;Gg=1;var e=Math.ceil,t=Math.max;function r(n,i,a,o){for(var u=-1,c=t(e((i-n)/(a||1)),0),s=Array(c);c--;)s[o?c:++u]=n,n+=a;return s}return Xs=r,Xs}var Ys,Vg;function ww(){if(Vg)return Ys;Vg=1;var e=z0(),t=1/0,r=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var a=i<0?-1:1;return a*r}return i===i?i:0}return Ys=n,Ys}var Zs,Xg;function Gk(){if(Xg)return Zs;Xg=1;var e=Kk(),t=La(),r=ww();function n(i){return function(a,o,u){return u&&typeof u!="number"&&t(a,o,u)&&(o=u=void 0),a=r(a),o===void 0?(o=a,a=0):o=r(o),u=u===void 0?a0&&n.handleDrag(i.changedTouches[0])}),Fe(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=n.props,a=i.endIndex,o=i.onDragEnd,u=i.startIndex;o?.({endIndex:a,startIndex:u})}),n.detachDragEndListener()}),Fe(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),Fe(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),Fe(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),Fe(n,"handleSlideDragStart",function(i){var a=tb(i)?i.changedTouches[0]:i;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:a.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return aR(t,e),tR(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var i=n.startX,a=n.endX,o=this.state.scaleValues,u=this.props,c=u.gap,s=u.data,f=s.length-1,l=Math.min(i,a),h=Math.max(i,a),d=t.getIndexInRange(o,l),y=t.getIndexInRange(o,h);return{startIndex:d-d%c,endIndex:y===f?f:y-y%c}}},{key:"getTextOfTick",value:function(n){var i=this.props,a=i.data,o=i.tickFormatter,u=i.dataKey,c=_e(a[n],u,n);return X(o)?o(c,n):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(n){var i=this.state,a=i.slideMoveStartX,o=i.startX,u=i.endX,c=this.props,s=c.x,f=c.width,l=c.travellerWidth,h=c.startIndex,d=c.endIndex,y=c.onChange,v=n.pageX-a;v>0?v=Math.min(v,s+f-l-u,s+f-l-o):v<0&&(v=Math.max(v,s-o,s-u));var p=this.getIndex({startX:o+v,endX:u+v});(p.startIndex!==h||p.endIndex!==d)&&y&&y(p),this.setState({startX:o+v,endX:u+v,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,i){var a=tb(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:a.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var i=this.state,a=i.brushMoveStartX,o=i.movingTravellerId,u=i.endX,c=i.startX,s=this.state[o],f=this.props,l=f.x,h=f.width,d=f.travellerWidth,y=f.onChange,v=f.gap,p=f.data,g={startX:this.state.startX,endX:this.state.endX},x=n.pageX-a;x>0?x=Math.min(x,l+h-d-s):x<0&&(x=Math.max(x,l-s)),g[o]=s+x;var w=this.getIndex(g),O=w.startIndex,m=w.endIndex,b=function(){var A=p.length-1;return o==="startX"&&(u>c?O%v===0:m%v===0)||uc?m%v===0:O%v===0)||u>c&&m===A};this.setState(Fe(Fe({},o,s+x),"brushMoveStartX",n.pageX),function(){y&&b()&&y(w)})}},{key:"handleTravellerMoveKeyboard",value:function(n,i){var a=this,o=this.state,u=o.scaleValues,c=o.startX,s=o.endX,f=this.state[i],l=u.indexOf(f);if(l!==-1){var h=l+n;if(!(h===-1||h>=u.length)){var d=u[h];i==="startX"&&d>=s||i==="endX"&&d<=c||this.setState(Fe({},i,d),function(){a.props.onChange(a.getIndex({startX:a.state.startX,endX:a.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,u=n.height,c=n.fill,s=n.stroke;return S.createElement("rect",{stroke:s,fill:c,x:i,y:a,width:o,height:u})}},{key:"renderPanorama",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,u=n.height,c=n.data,s=n.children,f=n.padding,l=N.Children.only(s);return l?S.cloneElement(l,{x:i,y:a,width:o,height:u,margin:f,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(n,i){var a,o,u=this,c=this.props,s=c.y,f=c.travellerWidth,l=c.height,h=c.traveller,d=c.ariaLabel,y=c.data,v=c.startIndex,p=c.endIndex,g=Math.max(n,this.props.x),x=Qs(Qs({},H(this.props,!1)),{},{x:g,y:s,width:f,height:l}),w=d||"Min value: ".concat((a=y[v])===null||a===void 0?void 0:a.name,", Max value: ").concat((o=y[p])===null||o===void 0?void 0:o.name);return S.createElement(te,{tabIndex:0,role:"slider","aria-label":w,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(m){["ArrowLeft","ArrowRight"].includes(m.key)&&(m.preventDefault(),m.stopPropagation(),u.handleTravellerMoveKeyboard(m.key==="ArrowRight"?1:-1,i))},onFocus:function(){u.setState({isTravellerFocused:!0})},onBlur:function(){u.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(h,x))}},{key:"renderSlide",value:function(n,i){var a=this.props,o=a.y,u=a.height,c=a.stroke,s=a.travellerWidth,f=Math.min(n,i)+s,l=Math.max(Math.abs(i-n)-s,0);return S.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:f,y:o,width:l,height:u})}},{key:"renderText",value:function(){var n=this.props,i=n.startIndex,a=n.endIndex,o=n.y,u=n.height,c=n.travellerWidth,s=n.stroke,f=this.state,l=f.startX,h=f.endX,d=5,y={pointerEvents:"none",fill:s};return S.createElement(te,{className:"recharts-brush-texts"},S.createElement(rr,va({textAnchor:"end",verticalAnchor:"middle",x:Math.min(l,h)-d,y:o+u/2},y),this.getTextOfTick(i)),S.createElement(rr,va({textAnchor:"start",verticalAnchor:"middle",x:Math.max(l,h)+c+d,y:o+u/2},y),this.getTextOfTick(a)))}},{key:"render",value:function(){var n=this.props,i=n.data,a=n.className,o=n.children,u=n.x,c=n.y,s=n.width,f=n.height,l=n.alwaysShowText,h=this.state,d=h.startX,y=h.endX,v=h.isTextActive,p=h.isSlideMoving,g=h.isTravellerMoving,x=h.isTravellerFocused;if(!i||!i.length||!q(u)||!q(c)||!q(s)||!q(f)||s<=0||f<=0)return null;var w=J("recharts-brush",a),O=S.Children.count(o)===1,m=Qk("userSelect","none");return S.createElement(te,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:m},this.renderBackground(),O&&this.renderPanorama(),this.renderSlide(d,y),this.renderTravellerLayer(d,"startX"),this.renderTravellerLayer(y,"endX"),(v||p||g||x||l)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var i=n.x,a=n.y,o=n.width,u=n.height,c=n.stroke,s=Math.floor(a+u/2)-1;return S.createElement(S.Fragment,null,S.createElement("rect",{x:i,y:a,width:o,height:u,fill:c,stroke:"none"}),S.createElement("line",{x1:i+1,y1:s,x2:i+o-1,y2:s,fill:"none",stroke:"#fff"}),S.createElement("line",{x1:i+1,y1:s+2,x2:i+o-1,y2:s+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,i){var a;return S.isValidElement(n)?a=S.cloneElement(n,i):X(n)?a=n(i):a=t.renderDefaultTraveller(i),a}},{key:"getDerivedStateFromProps",value:function(n,i){var a=n.data,o=n.width,u=n.x,c=n.travellerWidth,s=n.updateId,f=n.startIndex,l=n.endIndex;if(a!==i.prevData||s!==i.prevUpdateId)return Qs({prevData:a,prevTravellerWidth:c,prevUpdateId:s,prevX:u,prevWidth:o},a&&a.length?uR({data:a,width:o,x:u,travellerWidth:c,startIndex:f,endIndex:l}):{scale:null,scaleValues:null});if(i.scale&&(o!==i.prevWidth||u!==i.prevX||c!==i.prevTravellerWidth)){i.scale.range([u,u+o-c]);var h=i.scale.domain().map(function(d){return i.scale(d)});return{prevData:a,prevTravellerWidth:c,prevUpdateId:s,prevX:u,prevWidth:o,startX:i.scale(n.startIndex),endX:i.scale(n.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(n,i){for(var a=n.length,o=0,u=a-1;u-o>1;){var c=Math.floor((o+u)/2);n[c]>i?u=c:o=c}return i>=n[u]?u:o}}])})(N.PureComponent);Fe(qr,"displayName","Brush");Fe(qr,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var el,rb;function cR(){if(rb)return el;rb=1;var e=nh();function t(r,n){var i;return e(r,function(a,o,u){return i=n(a,o,u),!i}),!!i}return el=t,el}var tl,nb;function sR(){if(nb)return tl;nb=1;var e=x0(),t=ht(),r=cR(),n=qe(),i=La();function a(o,u,c){var s=n(o)?e:r;return c&&i(o,u,c)&&(u=void 0),s(o,t(u,3))}return tl=a,tl}var lR=sR();const fR=oe(lR);var ct=function(t,r){var n=t.alwaysShow,i=t.ifOverflow;return n&&(i="extendDomain"),i===r},rl,ib;function hR(){if(ib)return rl;ib=1;var e=q0();function t(r,n,i){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[n]=i}return rl=t,rl}var nl,ab;function pR(){if(ab)return nl;ab=1;var e=hR(),t=D0(),r=ht();function n(i,a){var o={};return a=r(a,3),t(i,function(u,c,s){e(o,c,a(u,c,s))}),o}return nl=n,nl}var dR=pR();const vR=oe(dR);var il,ob;function yR(){if(ob)return il;ob=1;function e(t,r){for(var n=-1,i=t==null?0:t.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function SR(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function PR(e,t){var r=e.x,n=e.y,i=AR(e,xR),a="".concat(r),o=parseInt(a,10),u="".concat(n),c=parseInt(u,10),s="".concat(t.height||i.height),f=parseInt(s,10),l="".concat(t.width||i.width),h=parseInt(l,10);return pn(pn(pn(pn(pn({},t),i),o?{x:o}:{}),c?{y:c}:{}),{},{height:f,width:h,name:t.name,radius:t.radius})}function lb(e){return S.createElement(gw,gf({shapeType:"rectangle",propTransformer:PR,activeClassName:"recharts-active-bar"},e))}var TR=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,i){if(typeof t=="number")return t;var a=q(n)||ZO(n);return a?t(n,i):(a||Qt(!1),r)}},ER=["value","background"],Pw;function Lr(e){"@babel/helpers - typeof";return Lr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lr(e)}function jR(e,t){if(e==null)return{};var r=MR(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function MR(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function ma(){return ma=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs($)0&&Math.abs(C)0&&(j=Math.min((fe||0)-(C[ye-1]||0),j))}),Number.isFinite(j)){var $=j/E,k=v.layout==="vertical"?n.height:n.width;if(v.padding==="gap"&&(_=$*k/2),v.padding==="no-gap"){var R=Ie(t.barCategoryGap,$*k),L=$*k/2;_=L-R-(L-R)/k*R}}}i==="xAxis"?A=[n.left+(w.left||0)+(_||0),n.left+n.width-(w.right||0)-(_||0)]:i==="yAxis"?A=c==="horizontal"?[n.top+n.height-(w.bottom||0),n.top+(w.top||0)]:[n.top+(w.top||0)+(_||0),n.top+n.height-(w.bottom||0)-(_||0)]:A=v.range,m&&(A=[A[1],A[0]]);var B=Yx(v,a,h),U=B.scale,G=B.realScaleType;U.domain(g).range(A),Zx(U);var W=Jx(U,tt(tt({},v),{},{realScaleType:G}));i==="xAxis"?(P=p==="top"&&!O||p==="bottom"&&O,T=n.left,M=l[b]-P*v.height):i==="yAxis"&&(P=p==="left"&&!O||p==="right"&&O,T=l[b]-P*v.width,M=n.top);var V=tt(tt(tt({},v),W),{},{realScaleType:G,x:T,y:M,scale:U,width:i==="xAxis"?n.width:v.width,height:i==="yAxis"?n.height:v.height});return V.bandSize=ta(V,W),!v.hide&&i==="xAxis"?l[b]+=(P?-1:1)*V.height:v.hide||(l[b]+=(P?-1:1)*V.width),tt(tt({},d),{},io({},y,V))},{})},$w=function(t,r){var n=t.x,i=t.y,a=r.x,o=r.y;return{x:Math.min(n,a),y:Math.min(i,o),width:Math.abs(a-n),height:Math.abs(o-i)}},FR=function(t){var r=t.x1,n=t.y1,i=t.x2,a=t.y2;return $w({x:r,y:n},{x:i,y:a})},Cw=(function(){function e(t){qR(this,e),this.scale=t}return LR(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.bandAware,a=n.position;if(r!==void 0){if(a)switch(a){case"start":return this.scale(r);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+o}case"end":{var u=this.bandwidth?this.bandwidth():0;return this.scale(r)+u}default:return this.scale(r)}if(i){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+c}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),i=n[0],a=n[n.length-1];return i<=a?r>=i&&r<=a:r>=a&&r<=i}}],[{key:"create",value:function(r){return new e(r)}}])})();io(Cw,"EPS",1e-4);var Ih=function(t){var r=Object.keys(t).reduce(function(n,i){return tt(tt({},n),{},io({},i,Cw.create(t[i])))},{});return tt(tt({},r),{},{apply:function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=a.bandAware,u=a.position;return vR(i,function(c,s){return r[s].apply(c,{bandAware:o,position:u})})},isInRange:function(i){return Sw(i,function(a,o){return r[o].isInRange(a)})}})};function WR(e){return(e%180+180)%180}var zR=function(t){var r=t.width,n=t.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=WR(i),o=a*Math.PI/180,u=Math.atan(n/r),c=o>u&&o-1?c[s?a[f]:f]:void 0}}return ul=n,ul}var cl,yb;function HR(){if(yb)return cl;yb=1;var e=ww();function t(r){var n=e(r),i=n%1;return n===n?i?n-i:n:0}return cl=t,cl}var sl,mb;function KR(){if(mb)return sl;mb=1;var e=$0(),t=ht(),r=HR(),n=Math.max;function i(a,o,u){var c=a==null?0:a.length;if(!c)return-1;var s=u==null?0:r(u);return s<0&&(s=n(c+s,0)),e(a,t(o,3),s)}return sl=i,sl}var ll,gb;function GR(){if(gb)return ll;gb=1;var e=UR(),t=KR(),r=e(t);return ll=r,ll}var VR=GR();const XR=oe(VR);var YR=Gb();const ZR=oe(YR);var JR=ZR(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),kh=N.createContext(void 0),Rh=N.createContext(void 0),Iw=N.createContext(void 0),kw=N.createContext({}),Rw=N.createContext(void 0),Dw=N.createContext(0),Nw=N.createContext(0),bb=function(t){var r=t.state,n=r.xAxisMap,i=r.yAxisMap,a=r.offset,o=t.clipPathId,u=t.children,c=t.width,s=t.height,f=JR(a);return S.createElement(kh.Provider,{value:n},S.createElement(Rh.Provider,{value:i},S.createElement(kw.Provider,{value:a},S.createElement(Iw.Provider,{value:f},S.createElement(Rw.Provider,{value:o},S.createElement(Dw.Provider,{value:s},S.createElement(Nw.Provider,{value:c},u)))))))},QR=function(){return N.useContext(Rw)},qw=function(t){var r=N.useContext(kh);r==null&&Qt(!1);var n=r[t];return n==null&&Qt(!1),n},eD=function(){var t=N.useContext(kh);return Mt(t)},tD=function(){var t=N.useContext(Rh),r=XR(t,function(n){return Sw(n.domain,Number.isFinite)});return r||Mt(t)},Lw=function(t){var r=N.useContext(Rh);r==null&&Qt(!1);var n=r[t];return n==null&&Qt(!1),n},rD=function(){var t=N.useContext(Iw);return t},nD=function(){return N.useContext(kw)},Dh=function(){return N.useContext(Nw)},Nh=function(){return N.useContext(Dw)};function Br(e){"@babel/helpers - typeof";return Br=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Br(e)}function iD(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function aD(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);re*i)return!1;var a=r();return e*(t-e*a/2-n)>=0&&e*(t+e*a/2-i)<=0}function BD(e,t){return Kw(e,t+1)}function FD(e,t,r,n,i){for(var a=(n||[]).slice(),o=t.start,u=t.end,c=0,s=1,f=o,l=function(){var y=n?.[c];if(y===void 0)return{v:Kw(n,s)};var v=c,p,g=function(){return p===void 0&&(p=r(y,v)),p},x=y.coordinate,w=c===0||Oa(e,x,g,f,u);w||(c=0,f=o,s+=1),w&&(f=x+e*(g()/2+i),c+=s)},h;s<=a.length;)if(h=l(),h)return h.v;return[]}function ri(e){"@babel/helpers - typeof";return ri=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ri(e)}function Tb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Me(e){for(var t=1;t0?d.coordinate-p*e:d.coordinate})}else a[h]=d=Me(Me({},d),{},{tickCoord:d.coordinate});var g=Oa(e,d.tickCoord,v,u,c);g&&(c=d.tickCoord-e*(v()/2+i),a[h]=Me(Me({},d),{},{isShow:!0}))},f=o-1;f>=0;f--)s(f);return a}function KD(e,t,r,n,i,a){var o=(n||[]).slice(),u=o.length,c=t.start,s=t.end;if(a){var f=n[u-1],l=r(f,u-1),h=e*(f.coordinate+e*l/2-s);o[u-1]=f=Me(Me({},f),{},{tickCoord:h>0?f.coordinate-h*e:f.coordinate});var d=Oa(e,f.tickCoord,function(){return l},c,s);d&&(s=f.tickCoord-e*(l/2+i),o[u-1]=Me(Me({},f),{},{isShow:!0}))}for(var y=a?u-1:u,v=function(x){var w=o[x],O,m=function(){return O===void 0&&(O=r(w,x)),O};if(x===0){var b=e*(w.coordinate-e*m()/2-c);o[x]=w=Me(Me({},w),{},{tickCoord:b<0?w.coordinate-b*e:w.coordinate})}else o[x]=w=Me(Me({},w),{},{tickCoord:w.coordinate});var _=Oa(e,w.tickCoord,m,c,s);_&&(c=w.tickCoord+e*(m()/2+i),o[x]=Me(Me({},w),{},{isShow:!0}))},p=0;p=2?Ce(i[1].coordinate-i[0].coordinate):1,g=LD(a,p,d);return c==="equidistantPreserveStart"?FD(p,g,v,i,o):(c==="preserveStart"||c==="preserveStartEnd"?h=KD(p,g,v,i,o,c==="preserveStartEnd"):h=HD(p,g,v,i,o),h.filter(function(x){return x.isShow}))}var GD=["viewBox"],VD=["viewBox"],XD=["ticks"];function zr(e){"@babel/helpers - typeof";return zr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zr(e)}function gr(){return gr=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function YD(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function ZD(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jb(e,t){for(var r=0;r0?c(this.props):c(d)),o<=0||u<=0||!y||!y.length?null:S.createElement(te,{className:J("recharts-cartesian-axis",s),ref:function(p){n.layerReference=p}},a&&this.renderAxisLine(),this.renderTicks(y,this.state.fontSize,this.state.letterSpacing),Te.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,i,a){var o,u=J(i.className,"recharts-cartesian-axis-tick-value");return S.isValidElement(n)?o=S.cloneElement(n,we(we({},i),{},{className:u})):X(n)?o=n(we(we({},i),{},{className:u})):o=S.createElement(rr,gr({},i,{className:"recharts-cartesian-axis-tick-value"}),a),o}}])})(N.Component);Fh(nn,"displayName","CartesianAxis");Fh(nn,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var iN=["x1","y1","x2","y2","key"],aN=["offset"];function ir(e){"@babel/helpers - typeof";return ir=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ir(e)}function Mb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function $e(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function sN(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var lN=function(t){var r=t.fill;if(!r||r==="none")return null;var n=t.fillOpacity,i=t.x,a=t.y,o=t.width,u=t.height,c=t.ry;return S.createElement("rect",{x:i,y:a,ry:c,width:o,height:u,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function Xw(e,t){var r;if(S.isValidElement(e))r=S.cloneElement(e,t);else if(X(e))r=e(t);else{var n=t.x1,i=t.y1,a=t.x2,o=t.y2,u=t.key,c=$b(t,iN),s=H(c,!1);s.offset;var f=$b(s,aN);r=S.createElement("line",Yt({},f,{x1:n,y1:i,x2:a,y2:o,fill:"none",key:u}))}return r}function fN(e){var t=e.x,r=e.width,n=e.horizontal,i=n===void 0?!0:n,a=e.horizontalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(u,c){var s=$e($e({},e),{},{x1:t,y1:u,x2:t+r,y2:u,key:"line-".concat(c),index:c});return Xw(i,s)});return S.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function hN(e){var t=e.y,r=e.height,n=e.vertical,i=n===void 0?!0:n,a=e.verticalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(u,c){var s=$e($e({},e),{},{x1:u,y1:t,x2:u,y2:t+r,key:"line-".concat(c),index:c});return Xw(i,s)});return S.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function pN(e){var t=e.horizontalFill,r=e.fillOpacity,n=e.x,i=e.y,a=e.width,o=e.height,u=e.horizontalPoints,c=e.horizontal,s=c===void 0?!0:c;if(!s||!t||!t.length)return null;var f=u.map(function(h){return Math.round(h+i-i)}).sort(function(h,d){return h-d});i!==f[0]&&f.unshift(0);var l=f.map(function(h,d){var y=!f[d+1],v=y?i+o-h:f[d+1]-h;if(v<=0)return null;var p=d%t.length;return S.createElement("rect",{key:"react-".concat(d),y:h,x:n,height:v,width:a,stroke:"none",fill:t[p],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return S.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},l)}function dN(e){var t=e.vertical,r=t===void 0?!0:t,n=e.verticalFill,i=e.fillOpacity,a=e.x,o=e.y,u=e.width,c=e.height,s=e.verticalPoints;if(!r||!n||!n.length)return null;var f=s.map(function(h){return Math.round(h+a-a)}).sort(function(h,d){return h-d});a!==f[0]&&f.unshift(0);var l=f.map(function(h,d){var y=!f[d+1],v=y?a+u-h:f[d+1]-h;if(v<=0)return null;var p=d%n.length;return S.createElement("rect",{key:"react-".concat(d),x:h,y:o,width:v,height:c,stroke:"none",fill:n[p],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return S.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},l)}var vN=function(t,r){var n=t.xAxis,i=t.width,a=t.height,o=t.offset;return Xx(Bh($e($e($e({},nn.defaultProps),n),{},{ticks:gt(n,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.left,o.left+o.width,r)},yN=function(t,r){var n=t.yAxis,i=t.width,a=t.height,o=t.offset;return Xx(Bh($e($e($e({},nn.defaultProps),n),{},{ticks:gt(n,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.top,o.top+o.height,r)},pr={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function mN(e){var t,r,n,i,a,o,u=Dh(),c=Nh(),s=nD(),f=$e($e({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:pr.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:pr.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:pr.horizontal,horizontalFill:(i=e.horizontalFill)!==null&&i!==void 0?i:pr.horizontalFill,vertical:(a=e.vertical)!==null&&a!==void 0?a:pr.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:pr.verticalFill,x:q(e.x)?e.x:s.left,y:q(e.y)?e.y:s.top,width:q(e.width)?e.width:s.width,height:q(e.height)?e.height:s.height}),l=f.x,h=f.y,d=f.width,y=f.height,v=f.syncWithTicks,p=f.horizontalValues,g=f.verticalValues,x=eD(),w=tD();if(!q(d)||d<=0||!q(y)||y<=0||!q(l)||l!==+l||!q(h)||h!==+h)return null;var O=f.verticalCoordinatesGenerator||vN,m=f.horizontalCoordinatesGenerator||yN,b=f.horizontalPoints,_=f.verticalPoints;if((!b||!b.length)&&X(m)){var A=p&&p.length,T=m({yAxis:w?$e($e({},w),{},{ticks:A?p:w.ticks}):void 0,width:u,height:c,offset:s},A?!0:v);it(Array.isArray(T),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(ir(T),"]")),Array.isArray(T)&&(b=T)}if((!_||!_.length)&&X(O)){var M=g&&g.length,P=O({xAxis:x?$e($e({},x),{},{ticks:M?g:x.ticks}):void 0,width:u,height:c,offset:s},M?!0:v);it(Array.isArray(P),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(ir(P),"]")),Array.isArray(P)&&(_=P)}return S.createElement("g",{className:"recharts-cartesian-grid"},S.createElement(lN,{fill:f.fill,fillOpacity:f.fillOpacity,x:f.x,y:f.y,width:f.width,height:f.height,ry:f.ry}),S.createElement(fN,Yt({},f,{offset:s,horizontalPoints:b,xAxis:x,yAxis:w})),S.createElement(hN,Yt({},f,{offset:s,verticalPoints:_,xAxis:x,yAxis:w})),S.createElement(pN,Yt({},f,{horizontalPoints:b})),S.createElement(dN,Yt({},f,{verticalPoints:_})))}mN.displayName="CartesianGrid";var gN=["type","layout","connectNulls","ref"],bN=["key"];function Ur(e){"@babel/helpers - typeof";return Ur=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ur(e)}function Cb(e,t){if(e==null)return{};var r=xN(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function xN(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function _n(){return _n=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);rl){d=[].concat(dr(c.slice(0,y)),[l-v]);break}var p=d.length%2===0?[0,h]:[h];return[].concat(dr(t.repeat(c,f)),dr(d),p).map(function(g){return"".concat(g,"px")}).join(", ")}),rt(r,"id",Zr("recharts-line-")),rt(r,"pathRef",function(o){r.mainCurve=o}),rt(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),rt(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return MN(t,e),PN(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.points,u=a.xAxis,c=a.yAxis,s=a.layout,f=a.children,l=Ke(f,pi);if(!l)return null;var h=function(v,p){return{x:v.x,y:v.y,value:v.value,errorVal:_e(v.payload,p)}},d={clipPath:n?"url(#clipPath-".concat(i,")"):null};return S.createElement(te,d,l.map(function(y){return S.cloneElement(y,{key:"bar-".concat(y.props.dataKey),data:o,xAxis:u,yAxis:c,layout:s,dataPointFormatter:h})}))}},{key:"renderDots",value:function(n,i,a){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var u=this.props,c=u.dot,s=u.points,f=u.dataKey,l=H(this.props,!1),h=H(c,!0),d=s.map(function(v,p){var g=Be(Be(Be({key:"dot-".concat(p),r:3},l),h),{},{index:p,cx:v.x,cy:v.y,value:v.value,dataKey:f,payload:v.payload,points:s});return t.renderDotItem(c,g)}),y={clipPath:n?"url(#clipPath-".concat(i?"":"dots-").concat(a,")"):null};return S.createElement(te,_n({className:"recharts-line-dots",key:"dots"},y),d)}},{key:"renderCurveStatically",value:function(n,i,a,o){var u=this.props,c=u.type,s=u.layout,f=u.connectNulls;u.ref;var l=Cb(u,gN),h=Be(Be(Be({},H(l,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(a,")"):null,points:n},o),{},{type:c,layout:s,connectNulls:f});return S.createElement(ia,_n({},h,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,i){var a=this,o=this.props,u=o.points,c=o.strokeDasharray,s=o.isAnimationActive,f=o.animationBegin,l=o.animationDuration,h=o.animationEasing,d=o.animationId,y=o.animateNewValues,v=o.width,p=o.height,g=this.state,x=g.prevPoints,w=g.totalLength;return S.createElement(lt,{begin:f,duration:l,isActive:s,easing:h,from:{t:0},to:{t:1},key:"line-".concat(d),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(O){var m=O.t;if(x){var b=x.length/u.length,_=u.map(function(E,j){var C=Math.floor(j*b);if(x[C]){var $=x[C],k=ze($.x,E.x),R=ze($.y,E.y);return Be(Be({},E),{},{x:k(m),y:R(m)})}if(y){var L=ze(v*2,E.x),B=ze(p/2,E.y);return Be(Be({},E),{},{x:L(m),y:B(m)})}return Be(Be({},E),{},{x:E.x,y:E.y})});return a.renderCurveStatically(_,n,i)}var A=ze(0,w),T=A(m),M;if(c){var P="".concat(c).split(/[,\s]+/gim).map(function(E){return parseFloat(E)});M=a.getStrokeDasharray(T,w,P)}else M=a.generateSimpleStrokeDasharray(w,T);return a.renderCurveStatically(u,n,i,{strokeDasharray:M})})}},{key:"renderCurve",value:function(n,i){var a=this.props,o=a.points,u=a.isAnimationActive,c=this.state,s=c.prevPoints,f=c.totalLength;return u&&o&&o.length&&(!s&&f>0||!hi(s,o))?this.renderCurveWithAnimation(n,i):this.renderCurveStatically(o,n,i)}},{key:"render",value:function(){var n,i=this.props,a=i.hide,o=i.dot,u=i.points,c=i.className,s=i.xAxis,f=i.yAxis,l=i.top,h=i.left,d=i.width,y=i.height,v=i.isAnimationActive,p=i.id;if(a||!u||!u.length)return null;var g=this.state.isAnimationFinished,x=u.length===1,w=J("recharts-line",c),O=s&&s.allowDataOverflow,m=f&&f.allowDataOverflow,b=O||m,_=Y(p)?this.id:p,A=(n=H(o,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},T=A.r,M=T===void 0?3:T,P=A.strokeWidth,E=P===void 0?2:P,j=s_(o)?o:{},C=j.clipDot,$=C===void 0?!0:C,k=M*2+E;return S.createElement(te,{className:w},O||m?S.createElement("defs",null,S.createElement("clipPath",{id:"clipPath-".concat(_)},S.createElement("rect",{x:O?h:h-d/2,y:m?l:l-y/2,width:O?d:d*2,height:m?y:y*2})),!$&&S.createElement("clipPath",{id:"clipPath-dots-".concat(_)},S.createElement("rect",{x:h-k/2,y:l-k/2,width:d+k,height:y+k}))):null,!x&&this.renderCurve(b,_),this.renderErrorBar(b,_),(x||o)&&this.renderDots(b,$,_),(!v||g)&&wt.renderCallByParent(this.props,u))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:i.curPoints}:n.points!==i.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,i){for(var a=n.length%2!==0?[].concat(dr(n),[0]):n,o=[],u=0;ue.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function x2(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function w2(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O2(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0?o:t&&t.length&&q(i)&&q(a)?t.slice(i,a+1):[]};function lO(e){return e==="number"?[0,"auto"]:void 0}var Nf=function(t,r,n,i){var a=t.graphicalItems,o=t.tooltipAxis,u=ho(r,t);return n<0||!a||!a.length||n>=u.length?null:a.reduce(function(c,s){var f,l=(f=s.props.data)!==null&&f!==void 0?f:r;l&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(l=l.slice(t.dataStartIndex,t.dataEndIndex+1));var h;if(o.dataKey&&!o.allowDuplicatedCategory){var d=l===void 0?u:l;h=Mi(d,o.dataKey,i)}else h=l&&l[n]||u[n];return h?[].concat(Vr(c),[ew(s,h)]):c},[])},Fb=function(t,r,n,i){var a=i||{x:t.chartX,y:t.chartY},o=k2(a,n),u=t.orderedTooltipTicks,c=t.tooltipAxis,s=t.tooltipTicks,f=aM(o,u,s,c);if(f>=0&&s){var l=s[f]&&s[f].value,h=Nf(t,r,f,l),d=R2(n,u,f,a);return{activeTooltipIndex:f,activeLabel:l,activePayload:h,activeCoordinate:d}}return null},D2=function(t,r){var n=r.axes,i=r.graphicalItems,a=r.axisType,o=r.axisIdKey,u=r.stackGroups,c=r.dataStartIndex,s=r.dataEndIndex,f=t.layout,l=t.children,h=t.stackOffset,d=Vx(f,a);return n.reduce(function(y,v){var p,g=v.type.defaultProps!==void 0?I(I({},v.type.defaultProps),v.props):v.props,x=g.type,w=g.dataKey,O=g.allowDataOverflow,m=g.allowDuplicatedCategory,b=g.scale,_=g.ticks,A=g.includeHidden,T=g[o];if(y[T])return y;var M=ho(t.data,{graphicalItems:i.filter(function(W){var V,fe=o in W.props?W.props[o]:(V=W.type.defaultProps)===null||V===void 0?void 0:V[o];return fe===T}),dataStartIndex:c,dataEndIndex:s}),P=M.length,E,j,C;c2(g.domain,O,x)&&(E=Yl(g.domain,null,O),d&&(x==="number"||b!=="auto")&&(C=bn(M,w,"category")));var $=lO(x);if(!E||E.length===0){var k,R=(k=g.domain)!==null&&k!==void 0?k:$;if(w){if(E=bn(M,w,x),x==="category"&&d){var L=QO(E);m&&L?(j=E,E=da(0,P)):m||(E=Lm(R,E,v).reduce(function(W,V){return W.indexOf(V)>=0?W:[].concat(Vr(W),[V])},[]))}else if(x==="category")m?E=E.filter(function(W){return W!==""&&!Y(W)}):E=Lm(R,E,v).reduce(function(W,V){return W.indexOf(V)>=0||V===""||Y(V)?W:[].concat(Vr(W),[V])},[]);else if(x==="number"){var B=lM(M,i.filter(function(W){var V,fe,ye=o in W.props?W.props[o]:(V=W.type.defaultProps)===null||V===void 0?void 0:V[o],Le="hide"in W.props?W.props.hide:(fe=W.type.defaultProps)===null||fe===void 0?void 0:fe.hide;return ye===T&&(A||!Le)}),w,a,f);B&&(E=B)}d&&(x==="number"||b!=="auto")&&(C=bn(M,w,"category"))}else d?E=da(0,P):u&&u[T]&&u[T].hasStack&&x==="number"?E=h==="expand"?[0,1]:Qx(u[T].stackGroups,c,s):E=Gx(M,i.filter(function(W){var V=o in W.props?W.props[o]:W.type.defaultProps[o],fe="hide"in W.props?W.props.hide:W.type.defaultProps.hide;return V===T&&(A||!fe)}),x,f,!0);if(x==="number")E=kf(l,E,T,a,_),R&&(E=Yl(R,E,O));else if(x==="category"&&R){var U=R,G=E.every(function(W){return U.indexOf(W)>=0});G&&(E=U)}}return I(I({},y),{},K({},T,I(I({},g),{},{axisType:a,domain:E,categoricalDomain:C,duplicateDomain:j,originalDomain:(p=g.domain)!==null&&p!==void 0?p:$,isCategorical:d,layout:f})))},{})},N2=function(t,r){var n=r.graphicalItems,i=r.Axis,a=r.axisType,o=r.axisIdKey,u=r.stackGroups,c=r.dataStartIndex,s=r.dataEndIndex,f=t.layout,l=t.children,h=ho(t.data,{graphicalItems:n,dataStartIndex:c,dataEndIndex:s}),d=h.length,y=Vx(f,a),v=-1;return n.reduce(function(p,g){var x=g.type.defaultProps!==void 0?I(I({},g.type.defaultProps),g.props):g.props,w=x[o],O=lO("number");if(!p[w]){v++;var m;return y?m=da(0,d):u&&u[w]&&u[w].hasStack?(m=Qx(u[w].stackGroups,c,s),m=kf(l,m,w,a)):(m=Yl(O,Gx(h,n.filter(function(b){var _,A,T=o in b.props?b.props[o]:(_=b.type.defaultProps)===null||_===void 0?void 0:_[o],M="hide"in b.props?b.props.hide:(A=b.type.defaultProps)===null||A===void 0?void 0:A.hide;return T===w&&!M}),"number",f),i.defaultProps.allowDataOverflow),m=kf(l,m,w,a)),I(I({},p),{},K({},w,I(I({axisType:a},i.defaultProps),{},{hide:!0,orientation:He(C2,"".concat(a,".").concat(v%2),null),domain:m,originalDomain:O,isCategorical:y,layout:f})))}return p},{})},q2=function(t,r){var n=r.axisType,i=n===void 0?"xAxis":n,a=r.AxisComp,o=r.graphicalItems,u=r.stackGroups,c=r.dataStartIndex,s=r.dataEndIndex,f=t.children,l="".concat(i,"Id"),h=Ke(f,a),d={};return h&&h.length?d=D2(t,{axes:h,graphicalItems:o,axisType:i,axisIdKey:l,stackGroups:u,dataStartIndex:c,dataEndIndex:s}):o&&o.length&&(d=N2(t,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:l,stackGroups:u,dataStartIndex:c,dataEndIndex:s})),d},L2=function(t){var r=Mt(t),n=gt(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:ih(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:ta(r,n)}},Wb=function(t){var r=t.children,n=t.defaultShowTooltip,i=We(r,qr),a=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},B2=function(t){return!t||!t.length?!1:t.some(function(r){var n=bt(r&&r.type);return n&&n.indexOf("Bar")>=0})},zb=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},F2=function(t,r){var n=t.props,i=t.graphicalItems,a=t.xAxisMap,o=a===void 0?{}:a,u=t.yAxisMap,c=u===void 0?{}:u,s=n.width,f=n.height,l=n.children,h=n.margin||{},d=We(l,qr),y=We(l,wr),v=Object.keys(c).reduce(function(m,b){var _=c[b],A=_.orientation;return!_.mirror&&!_.hide?I(I({},m),{},K({},A,m[A]+_.width)):m},{left:h.left||0,right:h.right||0}),p=Object.keys(o).reduce(function(m,b){var _=o[b],A=_.orientation;return!_.mirror&&!_.hide?I(I({},m),{},K({},A,He(m,"".concat(A))+_.height)):m},{top:h.top||0,bottom:h.bottom||0}),g=I(I({},p),v),x=g.bottom;d&&(g.bottom+=d.props.height||qr.defaultProps.height),y&&r&&(g=cM(g,i,n,r));var w=s-g.left-g.right,O=f-g.top-g.bottom;return I(I({brushBottom:x},g),{},{width:Math.max(w,0),height:Math.max(O,0)})},W2=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},Wh=function(t){var r=t.chartName,n=t.GraphicalChild,i=t.defaultTooltipEventType,a=i===void 0?"axis":i,o=t.validateTooltipEventTypes,u=o===void 0?["axis"]:o,c=t.axisComponents,s=t.legendContent,f=t.formatAxisMap,l=t.defaultProps,h=function(g,x){var w=x.graphicalItems,O=x.stackGroups,m=x.offset,b=x.updateId,_=x.dataStartIndex,A=x.dataEndIndex,T=g.barSize,M=g.layout,P=g.barGap,E=g.barCategoryGap,j=g.maxBarSize,C=zb(M),$=C.numericAxisName,k=C.cateAxisName,R=B2(w),L=[];return w.forEach(function(B,U){var G=ho(g.data,{graphicalItems:[B],dataStartIndex:_,dataEndIndex:A}),W=B.type.defaultProps!==void 0?I(I({},B.type.defaultProps),B.props):B.props,V=W.dataKey,fe=W.maxBarSize,ye=W["".concat($,"Id")],Le=W["".concat(k,"Id")],qt={},Re=c.reduce(function(Lt,Bt){var po=x["".concat(Bt.axisType,"Map")],zh=W["".concat(Bt.axisType,"Id")];po&&po[zh]||Bt.axisType==="zAxis"||Qt(!1);var Uh=po[zh];return I(I({},Lt),{},K(K({},Bt.axisType,Uh),"".concat(Bt.axisType,"Ticks"),gt(Uh)))},qt),F=Re[k],Z=Re["".concat(k,"Ticks")],Q=O&&O[ye]&&O[ye].hasStack&&bM(B,O[ye].stackGroups),D=bt(B.type).indexOf("Bar")>=0,de=ta(F,Z),ee=[],be=R&&oM({barSize:T,stackGroups:O,totalSize:W2(Re,k)});if(D){var xe,De,Et=Y(fe)?j:fe,lr=(xe=(De=ta(F,Z,!0))!==null&&De!==void 0?De:Et)!==null&&xe!==void 0?xe:0;ee=uM({barGap:P,barCategoryGap:E,bandSize:lr!==de?lr:de,sizeList:be[Le],maxBarSize:Et}),lr!==de&&(ee=ee.map(function(Lt){return I(I({},Lt),{},{position:I(I({},Lt.position),{},{offset:Lt.position.offset-lr/2})})}))}var di=B&&B.type&&B.type.getComposedData;di&&L.push({props:I(I({},di(I(I({},Re),{},{displayedData:G,props:g,dataKey:V,item:B,bandSize:de,barPosition:ee,offset:m,stackedData:Q,layout:M,dataStartIndex:_,dataEndIndex:A}))),{},K(K(K({key:B.key||"item-".concat(U)},$,Re[$]),k,Re[k]),"animationId",b)),childIndex:h_(B,g.children),item:B})}),L},d=function(g,x){var w=g.props,O=g.dataStartIndex,m=g.dataEndIndex,b=g.updateId;if(!Qp({props:w}))return null;var _=w.children,A=w.layout,T=w.stackOffset,M=w.data,P=w.reverseStackOrder,E=zb(A),j=E.numericAxisName,C=E.cateAxisName,$=Ke(_,n),k=mM(M,$,"".concat(j,"Id"),"".concat(C,"Id"),T,P),R=c.reduce(function(W,V){var fe="".concat(V.axisType,"Map");return I(I({},W),{},K({},fe,q2(w,I(I({},V),{},{graphicalItems:$,stackGroups:V.axisType===j&&k,dataStartIndex:O,dataEndIndex:m}))))},{}),L=F2(I(I({},R),{},{props:w,graphicalItems:$}),x?.legendBBox);Object.keys(R).forEach(function(W){R[W]=f(w,R[W],L,W.replace("Map",""),r)});var B=R["".concat(C,"Map")],U=L2(B),G=h(w,I(I({},R),{},{dataStartIndex:O,dataEndIndex:m,updateId:b,graphicalItems:$,stackGroups:k,offset:L}));return I(I({formattedGraphicalItems:G,graphicalItems:$,offset:L,stackGroups:k},U),R)},y=(function(p){function g(x){var w,O,m;return w2(this,g),m=A2(this,g,[x]),K(m,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),K(m,"accessibilityManager",new u2),K(m,"handleLegendBBoxUpdate",function(b){if(b){var _=m.state,A=_.dataStartIndex,T=_.dataEndIndex,M=_.updateId;m.setState(I({legendBBox:b},d({props:m.props,dataStartIndex:A,dataEndIndex:T,updateId:M},I(I({},m.state),{},{legendBBox:b}))))}}),K(m,"handleReceiveSyncEvent",function(b,_,A){if(m.props.syncId===b){if(A===m.eventEmitterSymbol&&typeof m.props.syncMethod!="function")return;m.applySyncEvent(_)}}),K(m,"handleBrushChange",function(b){var _=b.startIndex,A=b.endIndex;if(_!==m.state.dataStartIndex||A!==m.state.dataEndIndex){var T=m.state.updateId;m.setState(function(){return I({dataStartIndex:_,dataEndIndex:A},d({props:m.props,dataStartIndex:_,dataEndIndex:A,updateId:T},m.state))}),m.triggerSyncEvent({dataStartIndex:_,dataEndIndex:A})}}),K(m,"handleMouseEnter",function(b){var _=m.getMouseInfo(b);if(_){var A=I(I({},_),{},{isTooltipActive:!0});m.setState(A),m.triggerSyncEvent(A);var T=m.props.onMouseEnter;X(T)&&T(A,b)}}),K(m,"triggeredAfterMouseMove",function(b){var _=m.getMouseInfo(b),A=_?I(I({},_),{},{isTooltipActive:!0}):{isTooltipActive:!1};m.setState(A),m.triggerSyncEvent(A);var T=m.props.onMouseMove;X(T)&&T(A,b)}),K(m,"handleItemMouseEnter",function(b){m.setState(function(){return{isTooltipActive:!0,activeItem:b,activePayload:b.tooltipPayload,activeCoordinate:b.tooltipPosition||{x:b.cx,y:b.cy}}})}),K(m,"handleItemMouseLeave",function(){m.setState(function(){return{isTooltipActive:!1}})}),K(m,"handleMouseMove",function(b){b.persist(),m.throttleTriggeredAfterMouseMove(b)}),K(m,"handleMouseLeave",function(b){m.throttleTriggeredAfterMouseMove.cancel();var _={isTooltipActive:!1};m.setState(_),m.triggerSyncEvent(_);var A=m.props.onMouseLeave;X(A)&&A(_,b)}),K(m,"handleOuterEvent",function(b){var _=f_(b),A=He(m.props,"".concat(_));if(_&&X(A)){var T,M;/.*touch.*/i.test(_)?M=m.getMouseInfo(b.changedTouches[0]):M=m.getMouseInfo(b),A((T=M)!==null&&T!==void 0?T:{},b)}}),K(m,"handleClick",function(b){var _=m.getMouseInfo(b);if(_){var A=I(I({},_),{},{isTooltipActive:!0});m.setState(A),m.triggerSyncEvent(A);var T=m.props.onClick;X(T)&&T(A,b)}}),K(m,"handleMouseDown",function(b){var _=m.props.onMouseDown;if(X(_)){var A=m.getMouseInfo(b);_(A,b)}}),K(m,"handleMouseUp",function(b){var _=m.props.onMouseUp;if(X(_)){var A=m.getMouseInfo(b);_(A,b)}}),K(m,"handleTouchMove",function(b){b.changedTouches!=null&&b.changedTouches.length>0&&m.throttleTriggeredAfterMouseMove(b.changedTouches[0])}),K(m,"handleTouchStart",function(b){b.changedTouches!=null&&b.changedTouches.length>0&&m.handleMouseDown(b.changedTouches[0])}),K(m,"handleTouchEnd",function(b){b.changedTouches!=null&&b.changedTouches.length>0&&m.handleMouseUp(b.changedTouches[0])}),K(m,"handleDoubleClick",function(b){var _=m.props.onDoubleClick;if(X(_)){var A=m.getMouseInfo(b);_(A,b)}}),K(m,"handleContextMenu",function(b){var _=m.props.onContextMenu;if(X(_)){var A=m.getMouseInfo(b);_(A,b)}}),K(m,"triggerSyncEvent",function(b){m.props.syncId!==void 0&&pl.emit(dl,m.props.syncId,b,m.eventEmitterSymbol)}),K(m,"applySyncEvent",function(b){var _=m.props,A=_.layout,T=_.syncMethod,M=m.state.updateId,P=b.dataStartIndex,E=b.dataEndIndex;if(b.dataStartIndex!==void 0||b.dataEndIndex!==void 0)m.setState(I({dataStartIndex:P,dataEndIndex:E},d({props:m.props,dataStartIndex:P,dataEndIndex:E,updateId:M},m.state)));else if(b.activeTooltipIndex!==void 0){var j=b.chartX,C=b.chartY,$=b.activeTooltipIndex,k=m.state,R=k.offset,L=k.tooltipTicks;if(!R)return;if(typeof T=="function")$=T(L,b);else if(T==="value"){$=-1;for(var B=0;B=0){var Q,D;if(j.dataKey&&!j.allowDuplicatedCategory){var de=typeof j.dataKey=="function"?Z:"payload.".concat(j.dataKey.toString());Q=Mi(B,de,$),D=U&&G&&Mi(G,de,$)}else Q=B?.[C],D=U&&G&&G[C];if(Le||ye){var ee=b.props.activeIndex!==void 0?b.props.activeIndex:C;return[N.cloneElement(b,I(I(I({},T.props),Re),{},{activeIndex:ee})),null,null]}if(!Y(Q))return[F].concat(Vr(m.renderActivePoints({item:T,activePoint:Q,basePoint:D,childIndex:C,isRange:U})))}else{var be,xe=(be=m.getItemByXY(m.state.activeCoordinate))!==null&&be!==void 0?be:{graphicalItem:F},De=xe.graphicalItem,Et=De.item,lr=Et===void 0?b:Et,di=De.childIndex,Lt=I(I(I({},T.props),Re),{},{activeIndex:di});return[N.cloneElement(lr,Lt),null,null]}return U?[F,null,null]:[F,null]}),K(m,"renderCustomized",function(b,_,A){return N.cloneElement(b,I(I({key:"recharts-customized-".concat(A)},m.props),m.state))}),K(m,"renderMap",{CartesianGrid:{handler:Ei,once:!0},ReferenceArea:{handler:m.renderReferenceElement},ReferenceLine:{handler:Ei},ReferenceDot:{handler:m.renderReferenceElement},XAxis:{handler:Ei},YAxis:{handler:Ei},Brush:{handler:m.renderBrush,once:!0},Bar:{handler:m.renderGraphicChild},Line:{handler:m.renderGraphicChild},Area:{handler:m.renderGraphicChild},Radar:{handler:m.renderGraphicChild},RadialBar:{handler:m.renderGraphicChild},Scatter:{handler:m.renderGraphicChild},Pie:{handler:m.renderGraphicChild},Funnel:{handler:m.renderGraphicChild},Tooltip:{handler:m.renderCursor,once:!0},PolarGrid:{handler:m.renderPolarGrid,once:!0},PolarAngleAxis:{handler:m.renderPolarAxis},PolarRadiusAxis:{handler:m.renderPolarAxis},Customized:{handler:m.renderCustomized}}),m.clipPathId="".concat((w=x.id)!==null&&w!==void 0?w:Zr("recharts"),"-clip"),m.throttleTriggeredAfterMouseMove=U0(m.triggeredAfterMouseMove,(O=x.throttleDelay)!==null&&O!==void 0?O:1e3/60),m.state={},m}return T2(g,p),_2(g,[{key:"componentDidMount",value:function(){var w,O;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(w=this.props.margin.left)!==null&&w!==void 0?w:0,top:(O=this.props.margin.top)!==null&&O!==void 0?O:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var w=this.props,O=w.children,m=w.data,b=w.height,_=w.layout,A=We(O,dt);if(A){var T=A.props.defaultIndex;if(!(typeof T!="number"||T<0||T>this.state.tooltipTicks.length-1)){var M=this.state.tooltipTicks[T]&&this.state.tooltipTicks[T].value,P=Nf(this.state,m,T,M),E=this.state.tooltipTicks[T].coordinate,j=(this.state.offset.top+b)/2,C=_==="horizontal",$=C?{x:E,y:j}:{y:E,x:j},k=this.state.formattedGraphicalItems.find(function(L){var B=L.item;return B.type.name==="Scatter"});k&&($=I(I({},$),k.props.points[T].tooltipPosition),P=k.props.points[T].tooltipPayload);var R={activeTooltipIndex:T,isTooltipActive:!0,activeLabel:M,activePayload:P,activeCoordinate:$};this.setState(R),this.renderCursor(A),this.accessibilityManager.setIndex(T)}}}},{key:"getSnapshotBeforeUpdate",value:function(w,O){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==O.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==w.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==w.margin){var m,b;this.accessibilityManager.setDetails({offset:{left:(m=this.props.margin.left)!==null&&m!==void 0?m:0,top:(b=this.props.margin.top)!==null&&b!==void 0?b:0}})}return null}},{key:"componentDidUpdate",value:function(w){gl([We(w.children,dt)],[We(this.props.children,dt)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var w=We(this.props.children,dt);if(w&&typeof w.props.shared=="boolean"){var O=w.props.shared?"axis":"item";return u.indexOf(O)>=0?O:a}return a}},{key:"getMouseInfo",value:function(w){if(!this.container)return null;var O=this.container,m=O.getBoundingClientRect(),b=JS(m),_={chartX:Math.round(w.pageX-b.left),chartY:Math.round(w.pageY-b.top)},A=m.width/O.offsetWidth||1,T=this.inRange(_.chartX,_.chartY,A);if(!T)return null;var M=this.state,P=M.xAxisMap,E=M.yAxisMap,j=this.getTooltipEventType(),C=Fb(this.state,this.props.data,this.props.layout,T);if(j!=="axis"&&P&&E){var $=Mt(P).scale,k=Mt(E).scale,R=$&&$.invert?$.invert(_.chartX):null,L=k&&k.invert?k.invert(_.chartY):null;return I(I({},_),{},{xValue:R,yValue:L},C)}return C?I(I({},_),C):null}},{key:"inRange",value:function(w,O){var m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,b=this.props.layout,_=w/m,A=O/m;if(b==="horizontal"||b==="vertical"){var T=this.state.offset,M=_>=T.left&&_<=T.left+T.width&&A>=T.top&&A<=T.top+T.height;return M?{x:_,y:A}:null}var P=this.state,E=P.angleAxisMap,j=P.radiusAxisMap;if(E&&j){var C=Mt(E);return Wm({x:_,y:A},C)}return null}},{key:"parseEventsOfWrapper",value:function(){var w=this.props.children,O=this.getTooltipEventType(),m=We(w,dt),b={};m&&O==="axis"&&(m.props.trigger==="click"?b={onClick:this.handleClick}:b={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var _=$i(this.props,this.handleOuterEvent);return I(I({},_),b)}},{key:"addListener",value:function(){pl.on(dl,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){pl.removeListener(dl,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(w,O,m){for(var b=this.state.formattedGraphicalItems,_=0,A=b.length;_t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,o,c)=>c?c.toUpperCase():o.toLowerCase()),d=t=>{const a=M(t);return a.charAt(0).toUpperCase()+a.slice(1)},r=(...t)=>t.filter((a,o,c)=>!!a&&a.trim()!==""&&c.indexOf(a)===o).join(" ").trim(),m=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var v={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"};const x=s.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:y="",children:n,iconNode:k,...h},i)=>s.createElement("svg",{ref:i,...v,width:a,height:a,stroke:t,strokeWidth:c?Number(o)*24/Number(a):o,className:r("lucide",y),...!n&&!m(h)&&{"aria-hidden":"true"},...h},[...k.map(([p,l])=>s.createElement(p,l)),...Array.isArray(n)?n:[n]]));const e=(t,a)=>{const o=s.forwardRef(({className:c,...y},n)=>s.createElement(x,{ref:n,iconNode:a,className:r(`lucide-${_(d(t))}`,`lucide-${t}`,c),...y}));return o.displayName=d(t),o};const u=[["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"}]],W1=e("activity",u);const g=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],X1=e("arrow-left",g);const $=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Q1=e("arrow-right",$);const N=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],G1=e("ban",N);const f=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],J1=e("book-open",f);const w=[["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"}]],Y1=e("bot",w);const z=[["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"}]],e2=e("boxes",z);const C=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],a2=e("calendar",C);const b=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],t2=e("chart-column",b);const q=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],o2=e("check",q);const A=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],c2=e("chevron-down",A);const j=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],n2=e("chevron-left",j);const H=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],s2=e("chevron-right",H);const V=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],y2=e("chevron-up",V);const L=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],h2=e("chevrons-left",L);const S=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],d2=e("chevrons-right",S);const P=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],r2=e("chevrons-up-down",P);const U=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],k2=e("circle-alert",U);const R=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],i2=e("circle-check",R);const T=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],p2=e("circle-question-mark",T);const Z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],l2=e("circle-user",Z);const E=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],_2=e("circle-x",E);const B=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],M2=e("circle",B);const D=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],m2=e("clock",D);const F=[["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"}]],v2=e("code-xml",F);const O=[["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"}]],x2=e("copy",O);const I=[["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"}]],u2=e("database",I);const K=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],g2=e("dollar-sign",K);const W=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],$2=e("download",W);const X=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],N2=e("external-link",X);const Q=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],f2=e("eye-off",Q);const G=[["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"}]],w2=e("eye",G);const J=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],z2=e("file-search",J);const Y=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],C2=e("file-text",Y);const e1=[["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"}]],b2=e("folder-open",e1);const a1=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],q2=e("funnel",a1);const t1=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],A2=e("hash",t1);const o1=[["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-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],j2=e("house",o1);const c1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],H2=e("info",c1);const n1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],V2=e("key",n1);const s1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],L2=e("loader-circle",s1);const y1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],S2=e("lock",y1);const h1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],P2=e("log-out",h1);const d1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],U2=e("menu",d1);const r1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],R2=e("message-square",r1);const k1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],T2=e("moon",k1);const i1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Z2=e("package",i1);const p1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["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:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],E2=e("palette",p1);const l1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],B2=e("panels-top-left",l1);const _1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],D2=e("pause",_1);const M1=[["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"}]],F2=e("pencil",M1);const m1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],O2=e("play",m1);const v1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],I2=e("plus",v1);const x1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],K2=e("power",x1);const u1=[["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"}]],W2=e("refresh-cw",u1);const g1=[["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"}]],X2=e("rotate-ccw",g1);const $1=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Q2=e("rotate-cw",$1);const N1=[["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"}]],G2=e("save",N1);const f1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],J2=e("search",f1);const w1=[["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"}]],Y2=e("server",w1);const z1=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],e0=e("settings-2",z1);const C1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],a0=e("settings",C1);const b1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],t0=e("shield",b1);const q1=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],o0=e("skip-forward",q1);const A1=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],c0=e("sliders-vertical",A1);const j1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],n0=e("smile",j1);const H1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],s0=e("sparkles",H1);const V1=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],y0=e("square-pen",V1);const L1=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],h0=e("star",L1);const S1=[["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"}]],d0=e("sun",S1);const P1=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],r0=e("terminal",P1);const U1=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],k0=e("thumbs-up",U1);const R1=[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]],i0=e("thumbs-down",R1);const T1=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],p0=e("trash-2",T1);const Z1=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],l0=e("trending-up",Z1);const E1=[["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"}]],_0=e("triangle-alert",E1);const B1=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],M0=e("upload",B1);const D1=[["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"}]],m0=e("user",D1);const F1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],v0=e("users",F1);const O1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],x0=e("x",O1);const I1=[["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"}]],u0=e("zap",I1);export{r2 as $,W1 as A,Y1 as B,m2 as C,g2 as D,f2 as E,C2 as F,K2 as G,j2 as H,H2 as I,I2 as J,V2 as K,S2 as L,R2 as M,p0 as N,z2 as O,E2 as P,F2 as Q,W2 as R,t0 as S,l0 as T,m0 as U,h2 as V,n2 as W,x0 as X,s2 as Y,u0 as Z,d2 as _,u2 as a,M0 as a0,b2 as a1,$2 as a2,q2 as a3,y0 as a4,G1 as a5,A2 as a6,v0 as a7,a2 as a8,D2 as a9,O2 as aa,h0 as ab,k0 as ac,i0 as ad,e0 as ae,N2 as af,Z2 as ag,Y2 as ah,e2 as ai,l2 as aj,t2 as ak,M2 as al,c0 as am,U2 as an,J1 as ao,P2 as ap,Q2 as aq,a0 as b,_0 as c,o2 as d,x2 as e,w2 as f,i2 as g,_2 as h,X2 as i,d0 as j,T2 as k,k2 as l,p2 as m,r0 as n,s0 as o,n0 as p,o0 as q,Q1 as r,J2 as s,X1 as t,c2 as u,y2 as v,L2 as w,B2 as x,v2 as y,G2 as z}; diff --git a/webui/dist/assets/index-BjjI9czp.css b/webui/dist/assets/index-BjjI9czp.css deleted file mode 100644 index f7652efa..00000000 --- a/webui/dist/assets/index-BjjI9czp.css +++ /dev/null @@ -1 +0,0 @@ -*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem;--chart-1: 221.2 83.2% 53.3%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 217.2 91.2% 59.8%;--primary-foreground: 222.2 47.4% 11.2%;--primary-gradient: none;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 224.3 76.3% 48%;--chart-1: 217.2 91.2% 59.8%;--chart-2: 160 60% 50%;--chart-3: 30 80% 60%;--chart-4: 280 65% 65%;--chart-5: 340 75% 60%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-4{bottom:1rem}.left-0{left:0}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-60{height:15rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[250px\]{height:250px}.h-\[300px\]{height:300px}.h-\[400px\]{height:400px}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.h-\[calc\(100vh-500px\)\]{height:calc(100vh - 500px)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[300px\]{max-height:300px}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-screen{max-height:100vh}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[60px\]{min-height:60px}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[70px\]{width:70px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-2xl{max-width:42rem}.max-w-\[200px\]{max-width:200px}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize{resize:both}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-600\/20{background-color:#dc262633}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/50{background-color:hsl(var(--secondary) / .5)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-yellow-400{fill:#facc15}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-700:hover{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.hover\:text-orange-700:hover{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-gray-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:top-auto{top:auto}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mr-2{margin-right:.5rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-24{height:6rem}.sm\:h-3{height:.75rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[calc\(100vh-320px\)\]{height:calc(100vh - 320px)}.sm\:w-24{width:6rem}.sm\:w-3{width:.75rem}.sm\:w-\[140px\]{width:140px}.sm\:w-\[160px\]{width:160px}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:flex-wrap{flex-wrap:wrap}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media(min-width:768px){.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:max-w-\[420px\]{max-width:420px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:text-sm{font-size:.875rem;line-height:1.25rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:mb-1{margin-bottom:.25rem}.lg\:block{display:block}.lg\:hidden{display:none}.lg\:h-\[calc\(100vh-400px\)\]{height:calc(100vh - 400px)}.lg\:w-16{width:4rem}.lg\:w-64{width:16rem}.lg\:w-8{width:2rem}.lg\:w-\[150px\]{width:150px}.lg\:w-\[180px\]{width:180px}.lg\:w-\[200px\]{width:200px}.lg\:w-\[240px\]{width:240px}.lg\:w-\[80px\]{width:80px}.lg\:w-auto{width:auto}.lg\:max-w-0{max-width:0px}.lg\:flex-1{flex:1 1 0%}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-4{padding:1rem}.lg\:p-6{padding:1.5rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:text-3xl{font-size:1.875rem;line-height:2.25rem}.lg\:text-sm{font-size:.875rem;line-height:1.25rem}.lg\:opacity-0{opacity:0}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-layer\]\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-sector\]\:outline-none .recharts-sector,.\[\&_\.recharts-surface\]\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:invisible svg{visibility:hidden}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent} diff --git a/webui/dist/assets/index-BmybQ2BG.css b/webui/dist/assets/index-BmybQ2BG.css new file mode 100644 index 00000000..bb6e4a9a --- /dev/null +++ b/webui/dist/assets/index-BmybQ2BG.css @@ -0,0 +1 @@ +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem;--chart-1: 221.2 83.2% 53.3%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 217.2 91.2% 59.8%;--primary-foreground: 222.2 47.4% 11.2%;--primary-gradient: none;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 224.3 76.3% 48%;--chart-1: 217.2 91.2% 59.8%;--chart-2: 160 60% 50%;--chart-3: 30 80% 60%;--chart-4: 280 65% 65%;--chart-5: 340 75% 60%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-1\/4{bottom:25%}.bottom-4{bottom:1rem}.left-0{left:0}.left-1\/2{left:50%}.left-1\/4{left:25%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-1\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-60{height:15rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[1px\]{height:1px}.h-\[250px\]{height:250px}.h-\[300px\]{height:300px}.h-\[400px\]{height:400px}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-240px\)\]{height:calc(100vh - 240px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[300px\]{max-height:300px}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-screen{max-height:100vh}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[300px\]{min-height:300px}.min-h-\[60px\]{min-height:60px}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-1\/4{width:25%}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[1px\]{width:1px}.w-\[70px\]{width:70px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/30{border-color:hsl(var(--primary) / .3)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-900\/20{background-color:#713f1233}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-primary\/10{--tw-gradient-to: hsl(var(--primary) / .1) var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-yellow-400{fill:#facc15}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-yellow-300:hover{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-blue-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 58 138 / var(--tw-border-opacity, 1))}.dark\:border-gray-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:top-auto{top:auto}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mr-2{margin-right:.5rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-24{height:6rem}.sm\:h-3{height:.75rem}.sm\:h-4{height:1rem}.sm\:h-8{height:2rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:h-\[calc\(100vh-320px\)\]{height:calc(100vh - 320px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-24{width:6rem}.sm\:w-3{width:.75rem}.sm\:w-4{width:1rem}.sm\:w-8{width:2rem}.sm\:w-\[140px\]{width:140px}.sm\:w-\[160px\]{width:160px}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:flex-wrap{flex-wrap:wrap}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.sm\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.sm\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:mb-4{margin-bottom:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-5{height:1.25rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-5{width:1.25rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-\[420px\]{max-width:420px}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:gap-3{gap:.75rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.md\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.md\:whitespace-normal{white-space:normal}.md\:p-12{padding:3rem}.md\:p-4{padding:1rem}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:mb-1{margin-bottom:.25rem}.lg\:block{display:block}.lg\:hidden{display:none}.lg\:h-\[calc\(100vh-400px\)\]{height:calc(100vh - 400px)}.lg\:w-16{width:4rem}.lg\:w-64{width:16rem}.lg\:w-8{width:2rem}.lg\:w-\[150px\]{width:150px}.lg\:w-\[180px\]{width:180px}.lg\:w-\[200px\]{width:200px}.lg\:w-\[240px\]{width:240px}.lg\:w-\[80px\]{width:80px}.lg\:w-auto{width:auto}.lg\:max-w-0{max-width:0px}.lg\:flex-1{flex:1 1 0%}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-4{padding:1rem}.lg\:p-6{padding:1.5rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:text-3xl{font-size:1.875rem;line-height:2.25rem}.lg\:text-sm{font-size:.875rem;line-height:1.25rem}.lg\:opacity-0{opacity:0}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-layer\]\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-sector\]\:outline-none .recharts-sector,.\[\&_\.recharts-surface\]\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:invisible svg{visibility:hidden}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.16.25"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.1666666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.6666666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.4566666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.1466666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.7142857143em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.8571428571em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.1428571429em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.2857142857em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.4285714286em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.7142857143em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.0571428571em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.4685714286em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.9628571429em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.5542857143em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.7777777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.8888888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.1111111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.3044444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.7644444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.5833333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.7283333333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.0733333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.4861111111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.4402777778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.7277777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.2893518519em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.4050925926em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462962963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.5208333333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.2002314815em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.4398148148em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.2410800386em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2892960463em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512054em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.3857280617em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.4339440694em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.4821600771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.5785920926em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.6943105111em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8331726133em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.1996142719em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.2009646302em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.2411575563em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.2813504823em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.3215434084em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.3617363344em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.4019292605em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.4823151125em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778135em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.6945337621em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.8336012862em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo} diff --git a/webui/dist/assets/index-Cga6iLH3.js b/webui/dist/assets/index-Cga6iLH3.js new file mode 100644 index 00000000..85f669a3 --- /dev/null +++ b/webui/dist/assets/index-Cga6iLH3.js @@ -0,0 +1,359 @@ +import{r as S,j as a,u as ba,R as Ue,d as MI,L as AI,e as EI,f as Xr,g as _I,h as DI,O as c9,b as RI,k as zI}from"./router-BWgTyY51.js";import{a as PI,b as LI,g as u9}from"./react-vendor-Dtc2IqVY.js";import{c as d9,R as BI,T as II,L as qI,a as FI,C as Vm,X as Wm,Y as Ch,b as QI,B as fy,d as Gm,P as $I,e as HI,f as UI,_ as VI,g as WI}from"./charts-B1JvyJzO.js";import{c as Hi,a as tx,u as Oi,P as Yt,b as $e,d as Cn,e as Vf,f as So,g as es,h as Ls,i as h9,j as F4,k as Q4,S as GI,l as f9,m as m9,R as p9,O as nx,n as $4,C as rx,o as H4,T as U4,D as V4,p as W4,q as g9,r as x9,W as XI,s as v9,I as YI,t as y9,v as b9,w as KI,x as w9,V as ZI,L as S9,y as k9,z as JI,A as eq,B as O9,E as tq,F as nq,G as lo,H as sx,J as wd,K as j9,M as N9,N as C9,Q as T9,U as G4,X as X4,Y as ix,Z as ax,_ as Y4,$ as M9,a0 as rq,a1 as A9,a2 as sq,a3 as iq,a4 as E9,a5 as aq}from"./ui-vendor-nTGLnMlb.js";import{R as Ii,A as lq,D as oq,a as cq,Z as uf,C as uc,M as Wf,T as uq,X as Gf,P as _9,S as dq,b as dc,I as oo,c as Hu,d as hc,e as Xb,E as Yb,f as Fi,g as ua,h as Kb,i as hq,j as Zb,k as Jb,L as lO,K as fq,l as xc,m as mq,n as pq,F as io,o as gq,B as xq,U as D9,p as K4,q as vq,r as yq,s as Ps,H as hg,t as R9,u as df,v as e2,w as hf,x as bq,y as wq,z as lx,G as Z4,J as Wr,N as Ht,O as fg,Q as nd,V as Xf,W as Tc,Y as Mc,_ as Yf,$ as Sq,a0 as oO,a1 as kq,a2 as fc,a3 as t2,a4 as rd,a5 as cO,a6 as mg,a7 as Oq,a8 as uO,a9 as jq,aa as Nq,ab as Zl,ac as my,ad as dO,ae as Cq,af as Yh,ag as pg,ah as z9,ai as P9,aj as L9,ak as Tq,al as Mq,am as hO,an as Aq,ao as Eq,ap as fO,aq as _q}from"./icons-D6w7t-x9.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var py={exports:{}},Th={},gy={exports:{}},xy={};var mO;function Dq(){return mO||(mO=1,(function(t){function e(H,ae){var ne=H.length;H.push(ae);e:for(;0>>1,R=H[ue];if(0>>1;ues(P,ne))Ks($,P)?(H[ue]=$,H[K]=ne,ue=K):(H[ue]=P,H[Y]=ne,ue=Y);else if(Ks($,ne))H[ue]=$,H[K]=ne,ue=K;else break e}}return ae}function s(H,ae){var ne=H.sortIndex-ae.sortIndex;return ne!==0?ne:H.id-ae.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var l=Date,c=l.now();t.unstable_now=function(){return l.now()-c}}var d=[],h=[],m=1,p=null,x=3,v=!1,b=!1,k=!1,O=!1,j=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function _(H){for(var ae=n(h);ae!==null;){if(ae.callback===null)r(h);else if(ae.startTime<=H)r(h),ae.sortIndex=ae.expirationTime,e(d,ae);else break;ae=n(h)}}function D(H){if(k=!1,_(H),!b)if(n(d)!==null)b=!0,E||(E=!0,V());else{var ae=n(h);ae!==null&&J(D,ae.startTime-H)}}var E=!1,z=-1,Q=5,F=-1;function B(){return O?!0:!(t.unstable_now()-FH&&B());){var ue=p.callback;if(typeof ue=="function"){p.callback=null,x=p.priorityLevel;var R=ue(p.expirationTime<=H);if(H=t.unstable_now(),typeof R=="function"){p.callback=R,_(H),ae=!0;break t}p===n(d)&&r(d),_(H)}else r(d);p=n(d)}if(p!==null)ae=!0;else{var me=n(h);me!==null&&J(D,me.startTime-H),ae=!1}}break e}finally{p=null,x=ne,v=!1}ae=void 0}}finally{ae?V():E=!1}}}var V;if(typeof M=="function")V=function(){M(U)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,W=ce.port2;ce.port1.onmessage=U,V=function(){W.postMessage(null)}}else V=function(){j(U,0)};function J(H,ae){z=j(function(){H(t.unstable_now())},ae)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(H){H.callback=null},t.unstable_forceFrameRate=function(H){0>H||125ue?(H.sortIndex=ne,e(h,H),n(d)===null&&H===n(h)&&(k?(T(z),z=-1):k=!0,J(D,ne-ue))):(H.sortIndex=R,e(d,H),b||v||(b=!0,E||(E=!0,V()))),H},t.unstable_shouldYield=B,t.unstable_wrapCallback=function(H){var ae=x;return function(){var ne=x;x=ae;try{return H.apply(this,arguments)}finally{x=ne}}}})(xy)),xy}var pO;function Rq(){return pO||(pO=1,gy.exports=Dq()),gy.exports}var gO;function zq(){if(gO)return Th;gO=1;var t=Rq(),e=PI(),n=LI();function r(o){var u="https://react.dev/errors/"+o;if(1R||(o.current=ue[R],ue[R]=null,R--)}function P(o,u){R++,ue[R]=o.current,o.current=u}var K=me(null),$=me(null),fe=me(null),ve=me(null);function Re(o,u){switch(P(fe,u),P($,o),P(K,null),u.nodeType){case 9:case 11:o=(o=u.documentElement)&&(o=o.namespaceURI)?Ak(o):0;break;default:if(o=u.tagName,u=u.namespaceURI)u=Ak(u),o=Ek(u,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}Y(K),P(K,o)}function de(){Y(K),Y($),Y(fe)}function We(o){o.memoizedState!==null&&P(ve,o);var u=K.current,f=Ek(u,o.type);u!==f&&(P($,o),P(K,f))}function ct(o){$.current===o&&(Y(K),Y($)),ve.current===o&&(Y(ve),kh._currentValue=ne)}var Oe,nt;function ut(o){if(Oe===void 0)try{throw Error()}catch(f){var u=f.stack.trim().match(/\n( *(at )?)/);Oe=u&&u[1]||"",nt=-1)":-1y||Z[g]!==xe[y]){var je=` +`+Z[g].replace(" at new "," at ");return o.displayName&&je.includes("")&&(je=je.replace("",o.displayName)),je}while(1<=g&&0<=y);break}}}finally{Ct=!1,Error.prepareStackTrace=f}return(f=o?o.displayName||o.name:"")?ut(f):""}function Tn(o,u){switch(o.tag){case 26:case 27:case 5:return ut(o.type);case 16:return ut("Lazy");case 13:return o.child!==u&&u!==null?ut("Suspense Fallback"):ut("Suspense");case 19:return ut("SuspenseList");case 0:case 15:return Bn(o.type,!1);case 11:return Bn(o.type.render,!1);case 1:return Bn(o.type,!0);case 31:return ut("Activity");default:return""}}function Jn(o){try{var u="",f=null;do u+=Tn(o,f),f=o,o=o.return;while(o);return u}catch(g){return` +Error generating stack: `+g.message+` +`+g.stack}}var nn=Object.prototype.hasOwnProperty,_t=t.unstable_scheduleCallback,Yr=t.unstable_cancelCallback,In=t.unstable_shouldYield,or=t.unstable_requestPaint,yn=t.unstable_now,ft=t.unstable_getCurrentPriorityLevel,ee=t.unstable_ImmediatePriority,Se=t.unstable_UserBlockingPriority,Le=t.unstable_NormalPriority,rt=t.unstable_LowPriority,Tt=t.unstable_IdlePriority,cr=t.log,Kr=t.unstable_setDisableYieldValue,re=null,Me=null;function pt(o){if(typeof cr=="function"&&Kr(o),Me&&typeof Me.setStrictMode=="function")try{Me.setStrictMode(re,o)}catch{}}var vt=Math.clz32?Math.clz32:zn,vs=Math.log,dt=Math.LN2;function zn(o){return o>>>=0,o===0?32:31-(vs(o)/dt|0)|0}var mt=256,rn=262144,Ar=4194304;function Mt(o){var u=o&42;if(u!==0)return u;switch(o&-o){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 o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Ic(o,u,f){var g=o.pendingLanes;if(g===0)return 0;var y=0,w=o.suspendedLanes,A=o.pingedLanes;o=o.warmLanes;var I=g&134217727;return I!==0?(g=I&~w,g!==0?y=Mt(g):(A&=I,A!==0?y=Mt(A):f||(f=I&~o,f!==0&&(y=Mt(f))))):(I=g&~w,I!==0?y=Mt(I):A!==0?y=Mt(A):f||(f=g&~o,f!==0&&(y=Mt(f)))),y===0?0:u!==0&&u!==y&&(u&w)===0&&(w=y&-y,f=u&-u,w>=f||w===32&&(f&4194048)!==0)?u:y}function Eo(o,u){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&u)===0}function t1(o,u){switch(o){case 1:case 2:case 4:case 8:case 64:return u+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 u+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 qc(){var o=Ar;return Ar<<=1,(Ar&62914560)===0&&(Ar=4194304),o}function _o(o){for(var u=[],f=0;31>f;f++)u.push(o);return u}function Ld(o,u){o.pendingLanes|=u,u!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function xL(o,u,f,g,y,w){var A=o.pendingLanes;o.pendingLanes=f,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=f,o.entangledLanes&=f,o.errorRecoveryDisabledLanes&=f,o.shellSuspendCounter=0;var I=o.entanglements,Z=o.expirationTimes,xe=o.hiddenUpdates;for(f=A&~f;0"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var kL=/[\n"\\]/g;function oi(o){return o.replace(kL,function(u){return"\\"+u.charCodeAt(0).toString(16)+" "})}function l1(o,u,f,g,y,w,A,I){o.name="",A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?o.type=A:o.removeAttribute("type"),u!=null?A==="number"?(u===0&&o.value===""||o.value!=u)&&(o.value=""+li(u)):o.value!==""+li(u)&&(o.value=""+li(u)):A!=="submit"&&A!=="reset"||o.removeAttribute("value"),u!=null?o1(o,A,li(u)):f!=null?o1(o,A,li(f)):g!=null&&o.removeAttribute("value"),y==null&&w!=null&&(o.defaultChecked=!!w),y!=null&&(o.checked=y&&typeof y!="function"&&typeof y!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?o.name=""+li(I):o.removeAttribute("name")}function O3(o,u,f,g,y,w,A,I){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(o.type=w),u!=null||f!=null){if(!(w!=="submit"&&w!=="reset"||u!=null)){a1(o);return}f=f!=null?""+li(f):"",u=u!=null?""+li(u):f,I||u===o.value||(o.value=u),o.defaultValue=u}g=g??y,g=typeof g!="function"&&typeof g!="symbol"&&!!g,o.checked=I?o.checked:!!g,o.defaultChecked=!!g,A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(o.name=A),a1(o)}function o1(o,u,f){u==="number"&&P0(o.ownerDocument)===o||o.defaultValue===""+f||(o.defaultValue=""+f)}function Vc(o,u,f,g){if(o=o.options,u){u={};for(var y=0;y"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f1=!1;if(_a)try{var Fd={};Object.defineProperty(Fd,"passive",{get:function(){f1=!0}}),window.addEventListener("test",Fd,Fd),window.removeEventListener("test",Fd,Fd)}catch{f1=!1}var Ol=null,m1=null,B0=null;function E3(){if(B0)return B0;var o,u=m1,f=u.length,g,y="value"in Ol?Ol.value:Ol.textContent,w=y.length;for(o=0;o=Hd),L3=" ",B3=!1;function I3(o,u){switch(o){case"keyup":return KL.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function q3(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Yc=!1;function JL(o,u){switch(o){case"compositionend":return q3(u);case"keypress":return u.which!==32?null:(B3=!0,L3);case"textInput":return o=u.data,o===L3&&B3?null:o;default:return null}}function eB(o,u){if(Yc)return o==="compositionend"||!y1&&I3(o,u)?(o=E3(),B0=m1=Ol=null,Yc=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1=u)return{node:f,offset:u-o};o=g}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=G3(f)}}function Y3(o,u){return o&&u?o===u?!0:o&&o.nodeType===3?!1:u&&u.nodeType===3?Y3(o,u.parentNode):"contains"in o?o.contains(u):o.compareDocumentPosition?!!(o.compareDocumentPosition(u)&16):!1:!1}function K3(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var u=P0(o.document);u instanceof o.HTMLIFrameElement;){try{var f=typeof u.contentWindow.location.href=="string"}catch{f=!1}if(f)o=u.contentWindow;else break;u=P0(o.document)}return u}function S1(o){var u=o&&o.nodeName&&o.nodeName.toLowerCase();return u&&(u==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||u==="textarea"||o.contentEditable==="true")}var oB=_a&&"documentMode"in document&&11>=document.documentMode,Kc=null,k1=null,Gd=null,O1=!1;function Z3(o,u,f){var g=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;O1||Kc==null||Kc!==P0(g)||(g=Kc,"selectionStart"in g&&S1(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Gd&&Wd(Gd,g)||(Gd=g,g=Em(k1,"onSelect"),0>=A,y-=A,Gi=1<<32-vt(u)+y|f<kt?(Qt=Ke,Ke=null):Qt=Ke.sibling;var Zt=be(oe,Ke,pe[kt],Ne);if(Zt===null){Ke===null&&(Ke=Qt);break}o&&Ke&&Zt.alternate===null&&u(oe,Ke),se=w(Zt,se,kt),Kt===null?tt=Zt:Kt.sibling=Zt,Kt=Zt,Ke=Qt}if(kt===pe.length)return f(oe,Ke),Ut&&Ra(oe,kt),tt;if(Ke===null){for(;ktkt?(Qt=Ke,Ke=null):Qt=Ke.sibling;var Vl=be(oe,Ke,Zt.value,Ne);if(Vl===null){Ke===null&&(Ke=Qt);break}o&&Ke&&Vl.alternate===null&&u(oe,Ke),se=w(Vl,se,kt),Kt===null?tt=Vl:Kt.sibling=Vl,Kt=Vl,Ke=Qt}if(Zt.done)return f(oe,Ke),Ut&&Ra(oe,kt),tt;if(Ke===null){for(;!Zt.done;kt++,Zt=pe.next())Zt=Te(oe,Zt.value,Ne),Zt!==null&&(se=w(Zt,se,kt),Kt===null?tt=Zt:Kt.sibling=Zt,Kt=Zt);return Ut&&Ra(oe,kt),tt}for(Ke=g(Ke);!Zt.done;kt++,Zt=pe.next())Zt=ke(Ke,oe,kt,Zt.value,Ne),Zt!==null&&(o&&Zt.alternate!==null&&Ke.delete(Zt.key===null?kt:Zt.key),se=w(Zt,se,kt),Kt===null?tt=Zt:Kt.sibling=Zt,Kt=Zt);return o&&Ke.forEach(function(TI){return u(oe,TI)}),Ut&&Ra(oe,kt),tt}function Sn(oe,se,pe,Ne){if(typeof pe=="object"&&pe!==null&&pe.type===k&&pe.key===null&&(pe=pe.props.children),typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case v:e:{for(var tt=pe.key;se!==null;){if(se.key===tt){if(tt=pe.type,tt===k){if(se.tag===7){f(oe,se.sibling),Ne=y(se,pe.props.children),Ne.return=oe,oe=Ne;break e}}else if(se.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===Q&&$o(tt)===se.type){f(oe,se.sibling),Ne=y(se,pe.props),eh(Ne,pe),Ne.return=oe,oe=Ne;break e}f(oe,se);break}else u(oe,se);se=se.sibling}pe.type===k?(Ne=Bo(pe.props.children,oe.mode,Ne,pe.key),Ne.return=oe,oe=Ne):(Ne=G0(pe.type,pe.key,pe.props,null,oe.mode,Ne),eh(Ne,pe),Ne.return=oe,oe=Ne)}return A(oe);case b:e:{for(tt=pe.key;se!==null;){if(se.key===tt)if(se.tag===4&&se.stateNode.containerInfo===pe.containerInfo&&se.stateNode.implementation===pe.implementation){f(oe,se.sibling),Ne=y(se,pe.children||[]),Ne.return=oe,oe=Ne;break e}else{f(oe,se);break}else u(oe,se);se=se.sibling}Ne=E1(pe,oe.mode,Ne),Ne.return=oe,oe=Ne}return A(oe);case Q:return pe=$o(pe),Sn(oe,se,pe,Ne)}if(J(pe))return Ge(oe,se,pe,Ne);if(V(pe)){if(tt=V(pe),typeof tt!="function")throw Error(r(150));return pe=tt.call(pe),lt(oe,se,pe,Ne)}if(typeof pe.then=="function")return Sn(oe,se,tm(pe),Ne);if(pe.$$typeof===M)return Sn(oe,se,K0(oe,pe),Ne);nm(oe,pe)}return typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint"?(pe=""+pe,se!==null&&se.tag===6?(f(oe,se.sibling),Ne=y(se,pe),Ne.return=oe,oe=Ne):(f(oe,se),Ne=A1(pe,oe.mode,Ne),Ne.return=oe,oe=Ne),A(oe)):f(oe,se)}return function(oe,se,pe,Ne){try{Jd=0;var tt=Sn(oe,se,pe,Ne);return ou=null,tt}catch(Ke){if(Ke===lu||Ke===J0)throw Ke;var Kt=$s(29,Ke,null,oe.mode);return Kt.lanes=Ne,Kt.return=oe,Kt}finally{}}}var Uo=w6(!0),S6=w6(!1),Ml=!1;function $1(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function H1(o,u){o=o.updateQueue,u.updateQueue===o&&(u.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Al(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function El(o,u,f){var g=o.updateQueue;if(g===null)return null;if(g=g.shared,(sn&2)!==0){var y=g.pending;return y===null?u.next=u:(u.next=y.next,y.next=u),g.pending=u,u=W0(o),i6(o,null,f),u}return V0(o,g,u,f),W0(o)}function th(o,u,f){if(u=u.updateQueue,u!==null&&(u=u.shared,(f&4194048)!==0)){var g=u.lanes;g&=o.pendingLanes,f|=g,u.lanes=f,f3(o,f)}}function U1(o,u){var f=o.updateQueue,g=o.alternate;if(g!==null&&(g=g.updateQueue,f===g)){var y=null,w=null;if(f=f.firstBaseUpdate,f!==null){do{var A={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};w===null?y=w=A:w=w.next=A,f=f.next}while(f!==null);w===null?y=w=u:w=w.next=u}else y=w=u;f={baseState:g.baseState,firstBaseUpdate:y,lastBaseUpdate:w,shared:g.shared,callbacks:g.callbacks},o.updateQueue=f;return}o=f.lastBaseUpdate,o===null?f.firstBaseUpdate=u:o.next=u,f.lastBaseUpdate=u}var V1=!1;function nh(){if(V1){var o=au;if(o!==null)throw o}}function rh(o,u,f,g){V1=!1;var y=o.updateQueue;Ml=!1;var w=y.firstBaseUpdate,A=y.lastBaseUpdate,I=y.shared.pending;if(I!==null){y.shared.pending=null;var Z=I,xe=Z.next;Z.next=null,A===null?w=xe:A.next=xe,A=Z;var je=o.alternate;je!==null&&(je=je.updateQueue,I=je.lastBaseUpdate,I!==A&&(I===null?je.firstBaseUpdate=xe:I.next=xe,je.lastBaseUpdate=Z))}if(w!==null){var Te=y.baseState;A=0,je=xe=Z=null,I=w;do{var be=I.lane&-536870913,ke=be!==I.lane;if(ke?(Ft&be)===be:(g&be)===be){be!==0&&be===iu&&(V1=!0),je!==null&&(je=je.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});e:{var Ge=o,lt=I;be=u;var Sn=f;switch(lt.tag){case 1:if(Ge=lt.payload,typeof Ge=="function"){Te=Ge.call(Sn,Te,be);break e}Te=Ge;break e;case 3:Ge.flags=Ge.flags&-65537|128;case 0:if(Ge=lt.payload,be=typeof Ge=="function"?Ge.call(Sn,Te,be):Ge,be==null)break e;Te=p({},Te,be);break e;case 2:Ml=!0}}be=I.callback,be!==null&&(o.flags|=64,ke&&(o.flags|=8192),ke=y.callbacks,ke===null?y.callbacks=[be]:ke.push(be))}else ke={lane:be,tag:I.tag,payload:I.payload,callback:I.callback,next:null},je===null?(xe=je=ke,Z=Te):je=je.next=ke,A|=be;if(I=I.next,I===null){if(I=y.shared.pending,I===null)break;ke=I,I=ke.next,ke.next=null,y.lastBaseUpdate=ke,y.shared.pending=null}}while(!0);je===null&&(Z=Te),y.baseState=Z,y.firstBaseUpdate=xe,y.lastBaseUpdate=je,w===null&&(y.shared.lanes=0),Pl|=A,o.lanes=A,o.memoizedState=Te}}function k6(o,u){if(typeof o!="function")throw Error(r(191,o));o.call(u)}function O6(o,u){var f=o.callbacks;if(f!==null)for(o.callbacks=null,o=0;ow?w:8;var A=H.T,I={};H.T=I,dv(o,!1,u,f);try{var Z=y(),xe=H.S;if(xe!==null&&xe(I,Z),Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var je=xB(Z,g);ah(o,u,je,Gs(o))}else ah(o,u,g,Gs(o))}catch(Te){ah(o,u,{then:function(){},status:"rejected",reason:Te},Gs())}finally{ae.p=w,A!==null&&I.types!==null&&(A.types=I.types),H.T=A}}function kB(){}function cv(o,u,f,g){if(o.tag!==5)throw Error(r(476));var y=nS(o).queue;tS(o,y,u,ne,f===null?kB:function(){return rS(o),f(g)})}function nS(o){var u=o.memoizedState;if(u!==null)return u;u={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ba,lastRenderedState:ne},next:null};var f={};return u.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ba,lastRenderedState:f},next:null},o.memoizedState=u,o=o.alternate,o!==null&&(o.memoizedState=u),u}function rS(o){var u=nS(o);u.next===null&&(u=o.alternate.memoizedState),ah(o,u.next.queue,{},Gs())}function uv(){return qr(kh)}function sS(){return sr().memoizedState}function iS(){return sr().memoizedState}function OB(o){for(var u=o.return;u!==null;){switch(u.tag){case 24:case 3:var f=Gs();o=Al(f);var g=El(u,o,f);g!==null&&(js(g,u,f),th(g,u,f)),u={cache:I1()},o.payload=u;return}u=u.return}}function jB(o,u,f){var g=Gs();f={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},hm(o)?lS(u,f):(f=T1(o,u,f,g),f!==null&&(js(f,o,g),oS(f,u,g)))}function aS(o,u,f){var g=Gs();ah(o,u,f,g)}function ah(o,u,f,g){var y={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(hm(o))lS(u,y);else{var w=o.alternate;if(o.lanes===0&&(w===null||w.lanes===0)&&(w=u.lastRenderedReducer,w!==null))try{var A=u.lastRenderedState,I=w(A,f);if(y.hasEagerState=!0,y.eagerState=I,Qs(I,A))return V0(o,u,y,0),Mn===null&&U0(),!1}catch{}finally{}if(f=T1(o,u,y,g),f!==null)return js(f,o,g),oS(f,u,g),!0}return!1}function dv(o,u,f,g){if(g={lane:2,revertLane:$v(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},hm(o)){if(u)throw Error(r(479))}else u=T1(o,f,g,2),u!==null&&js(u,o,2)}function hm(o){var u=o.alternate;return o===wt||u!==null&&u===wt}function lS(o,u){uu=im=!0;var f=o.pending;f===null?u.next=u:(u.next=f.next,f.next=u),o.pending=u}function oS(o,u,f){if((f&4194048)!==0){var g=u.lanes;g&=o.pendingLanes,f|=g,u.lanes=f,f3(o,f)}}var lh={readContext:qr,use:om,useCallback:er,useContext:er,useEffect:er,useImperativeHandle:er,useLayoutEffect:er,useInsertionEffect:er,useMemo:er,useReducer:er,useRef:er,useState:er,useDebugValue:er,useDeferredValue:er,useTransition:er,useSyncExternalStore:er,useId:er,useHostTransitionStatus:er,useFormState:er,useActionState:er,useOptimistic:er,useMemoCache:er,useCacheRefresh:er};lh.useEffectEvent=er;var cS={readContext:qr,use:om,useCallback:function(o,u){return os().memoizedState=[o,u===void 0?null:u],o},useContext:qr,useEffect:V6,useImperativeHandle:function(o,u,f){f=f!=null?f.concat([o]):null,um(4194308,4,Y6.bind(null,u,o),f)},useLayoutEffect:function(o,u){return um(4194308,4,o,u)},useInsertionEffect:function(o,u){um(4,2,o,u)},useMemo:function(o,u){var f=os();u=u===void 0?null:u;var g=o();if(Vo){pt(!0);try{o()}finally{pt(!1)}}return f.memoizedState=[g,u],g},useReducer:function(o,u,f){var g=os();if(f!==void 0){var y=f(u);if(Vo){pt(!0);try{f(u)}finally{pt(!1)}}}else y=u;return g.memoizedState=g.baseState=y,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:y},g.queue=o,o=o.dispatch=jB.bind(null,wt,o),[g.memoizedState,o]},useRef:function(o){var u=os();return o={current:o},u.memoizedState=o},useState:function(o){o=sv(o);var u=o.queue,f=aS.bind(null,wt,u);return u.dispatch=f,[o.memoizedState,f]},useDebugValue:lv,useDeferredValue:function(o,u){var f=os();return ov(f,o,u)},useTransition:function(){var o=sv(!1);return o=tS.bind(null,wt,o.queue,!0,!1),os().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,u,f){var g=wt,y=os();if(Ut){if(f===void 0)throw Error(r(407));f=f()}else{if(f=u(),Mn===null)throw Error(r(349));(Ft&127)!==0||A6(g,u,f)}y.memoizedState=f;var w={value:f,getSnapshot:u};return y.queue=w,V6(_6.bind(null,g,w,o),[o]),g.flags|=2048,hu(9,{destroy:void 0},E6.bind(null,g,w,f,u),null),f},useId:function(){var o=os(),u=Mn.identifierPrefix;if(Ut){var f=Xi,g=Gi;f=(g&~(1<<32-vt(g)-1)).toString(32)+f,u="_"+u+"R_"+f,f=am++,0<\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof g.is=="string"?A.createElement("select",{is:g.is}):A.createElement("select"),g.multiple?w.multiple=!0:g.size&&(w.size=g.size);break;default:w=typeof g.is=="string"?A.createElement(y,{is:g.is}):A.createElement(y)}}w[Br]=u,w[ys]=g;e:for(A=u.child;A!==null;){if(A.tag===5||A.tag===6)w.appendChild(A.stateNode);else if(A.tag!==4&&A.tag!==27&&A.child!==null){A.child.return=A,A=A.child;continue}if(A===u)break e;for(;A.sibling===null;){if(A.return===null||A.return===u)break e;A=A.return}A.sibling.return=A.return,A=A.sibling}u.stateNode=w;e:switch(Qr(w,y,g),y){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&qa(u)}}return Fn(u),jv(u,u.type,o===null?null:o.memoizedProps,u.pendingProps,f),null;case 6:if(o&&u.stateNode!=null)o.memoizedProps!==g&&qa(u);else{if(typeof g!="string"&&u.stateNode===null)throw Error(r(166));if(o=fe.current,ru(u)){if(o=u.stateNode,f=u.memoizedProps,g=null,y=Ir,y!==null)switch(y.tag){case 27:case 5:g=y.memoizedProps}o[Br]=u,o=!!(o.nodeValue===f||g!==null&&g.suppressHydrationWarning===!0||Tk(o.nodeValue,f)),o||Cl(u,!0)}else o=_m(o).createTextNode(g),o[Br]=u,u.stateNode=o}return Fn(u),null;case 31:if(f=u.memoizedState,o===null||o.memoizedState!==null){if(g=ru(u),f!==null){if(o===null){if(!g)throw Error(r(318));if(o=u.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[Br]=u}else Io(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Fn(u),o=!1}else f=z1(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=f),o=!0;if(!o)return u.flags&256?(Us(u),u):(Us(u),null);if((u.flags&128)!==0)throw Error(r(558))}return Fn(u),null;case 13:if(g=u.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(y=ru(u),g!==null&&g.dehydrated!==null){if(o===null){if(!y)throw Error(r(318));if(y=u.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(r(317));y[Br]=u}else Io(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Fn(u),y=!1}else y=z1(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=y),y=!0;if(!y)return u.flags&256?(Us(u),u):(Us(u),null)}return Us(u),(u.flags&128)!==0?(u.lanes=f,u):(f=g!==null,o=o!==null&&o.memoizedState!==null,f&&(g=u.child,y=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(y=g.alternate.memoizedState.cachePool.pool),w=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(w=g.memoizedState.cachePool.pool),w!==y&&(g.flags|=2048)),f!==o&&f&&(u.child.flags|=8192),xm(u,u.updateQueue),Fn(u),null);case 4:return de(),o===null&&Wv(u.stateNode.containerInfo),Fn(u),null;case 10:return Pa(u.type),Fn(u),null;case 19:if(Y(rr),g=u.memoizedState,g===null)return Fn(u),null;if(y=(u.flags&128)!==0,w=g.rendering,w===null)if(y)ch(g,!1);else{if(tr!==0||o!==null&&(o.flags&128)!==0)for(o=u.child;o!==null;){if(w=sm(o),w!==null){for(u.flags|=128,ch(g,!1),o=w.updateQueue,u.updateQueue=o,xm(u,o),u.subtreeFlags=0,o=f,f=u.child;f!==null;)a6(f,o),f=f.sibling;return P(rr,rr.current&1|2),Ut&&Ra(u,g.treeForkCount),u.child}o=o.sibling}g.tail!==null&&yn()>Sm&&(u.flags|=128,y=!0,ch(g,!1),u.lanes=4194304)}else{if(!y)if(o=sm(w),o!==null){if(u.flags|=128,y=!0,o=o.updateQueue,u.updateQueue=o,xm(u,o),ch(g,!0),g.tail===null&&g.tailMode==="hidden"&&!w.alternate&&!Ut)return Fn(u),null}else 2*yn()-g.renderingStartTime>Sm&&f!==536870912&&(u.flags|=128,y=!0,ch(g,!1),u.lanes=4194304);g.isBackwards?(w.sibling=u.child,u.child=w):(o=g.last,o!==null?o.sibling=w:u.child=w,g.last=w)}return g.tail!==null?(o=g.tail,g.rendering=o,g.tail=o.sibling,g.renderingStartTime=yn(),o.sibling=null,f=rr.current,P(rr,y?f&1|2:f&1),Ut&&Ra(u,g.treeForkCount),o):(Fn(u),null);case 22:case 23:return Us(u),G1(),g=u.memoizedState!==null,o!==null?o.memoizedState!==null!==g&&(u.flags|=8192):g&&(u.flags|=8192),g?(f&536870912)!==0&&(u.flags&128)===0&&(Fn(u),u.subtreeFlags&6&&(u.flags|=8192)):Fn(u),f=u.updateQueue,f!==null&&xm(u,f.retryQueue),f=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==f&&(u.flags|=2048),o!==null&&Y(Qo),null;case 24:return f=null,o!==null&&(f=o.memoizedState.cache),u.memoizedState.cache!==f&&(u.flags|=2048),Pa(ur),Fn(u),null;case 25:return null;case 30:return null}throw Error(r(156,u.tag))}function AB(o,u){switch(D1(u),u.tag){case 1:return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 3:return Pa(ur),de(),o=u.flags,(o&65536)!==0&&(o&128)===0?(u.flags=o&-65537|128,u):null;case 26:case 27:case 5:return ct(u),null;case 31:if(u.memoizedState!==null){if(Us(u),u.alternate===null)throw Error(r(340));Io()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 13:if(Us(u),o=u.memoizedState,o!==null&&o.dehydrated!==null){if(u.alternate===null)throw Error(r(340));Io()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 19:return Y(rr),null;case 4:return de(),null;case 10:return Pa(u.type),null;case 22:case 23:return Us(u),G1(),o!==null&&Y(Qo),o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 24:return Pa(ur),null;case 25:return null;default:return null}}function DS(o,u){switch(D1(u),u.tag){case 3:Pa(ur),de();break;case 26:case 27:case 5:ct(u);break;case 4:de();break;case 31:u.memoizedState!==null&&Us(u);break;case 13:Us(u);break;case 19:Y(rr);break;case 10:Pa(u.type);break;case 22:case 23:Us(u),G1(),o!==null&&Y(Qo);break;case 24:Pa(ur)}}function uh(o,u){try{var f=u.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var y=g.next;f=y;do{if((f.tag&o)===o){g=void 0;var w=f.create,A=f.inst;g=w(),A.destroy=g}f=f.next}while(f!==y)}}catch(I){gn(u,u.return,I)}}function Rl(o,u,f){try{var g=u.updateQueue,y=g!==null?g.lastEffect:null;if(y!==null){var w=y.next;g=w;do{if((g.tag&o)===o){var A=g.inst,I=A.destroy;if(I!==void 0){A.destroy=void 0,y=u;var Z=f,xe=I;try{xe()}catch(je){gn(y,Z,je)}}}g=g.next}while(g!==w)}}catch(je){gn(u,u.return,je)}}function RS(o){var u=o.updateQueue;if(u!==null){var f=o.stateNode;try{O6(u,f)}catch(g){gn(o,o.return,g)}}}function zS(o,u,f){f.props=Wo(o.type,o.memoizedProps),f.state=o.memoizedState;try{f.componentWillUnmount()}catch(g){gn(o,u,g)}}function dh(o,u){try{var f=o.ref;if(f!==null){switch(o.tag){case 26:case 27:case 5:var g=o.stateNode;break;case 30:g=o.stateNode;break;default:g=o.stateNode}typeof f=="function"?o.refCleanup=f(g):f.current=g}}catch(y){gn(o,u,y)}}function Yi(o,u){var f=o.ref,g=o.refCleanup;if(f!==null)if(typeof g=="function")try{g()}catch(y){gn(o,u,y)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(y){gn(o,u,y)}else f.current=null}function PS(o){var u=o.type,f=o.memoizedProps,g=o.stateNode;try{e:switch(u){case"button":case"input":case"select":case"textarea":f.autoFocus&&g.focus();break e;case"img":f.src?g.src=f.src:f.srcSet&&(g.srcset=f.srcSet)}}catch(y){gn(o,o.return,y)}}function Nv(o,u,f){try{var g=o.stateNode;ZB(g,o.type,f,u),g[ys]=u}catch(y){gn(o,o.return,y)}}function LS(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Fl(o.type)||o.tag===4}function Cv(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||LS(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Fl(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Tv(o,u,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,u?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(o,u):(u=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,u.appendChild(o),f=f._reactRootContainer,f!=null||u.onclick!==null||(u.onclick=Ea));else if(g!==4&&(g===27&&Fl(o.type)&&(f=o.stateNode,u=null),o=o.child,o!==null))for(Tv(o,u,f),o=o.sibling;o!==null;)Tv(o,u,f),o=o.sibling}function vm(o,u,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,u?f.insertBefore(o,u):f.appendChild(o);else if(g!==4&&(g===27&&Fl(o.type)&&(f=o.stateNode),o=o.child,o!==null))for(vm(o,u,f),o=o.sibling;o!==null;)vm(o,u,f),o=o.sibling}function BS(o){var u=o.stateNode,f=o.memoizedProps;try{for(var g=o.type,y=u.attributes;y.length;)u.removeAttributeNode(y[0]);Qr(u,g,f),u[Br]=o,u[ys]=f}catch(w){gn(o,o.return,w)}}var Fa=!1,fr=!1,Mv=!1,IS=typeof WeakSet=="function"?WeakSet:Set,_r=null;function EB(o,u){if(o=o.containerInfo,Yv=Im,o=K3(o),S1(o)){if("selectionStart"in o)var f={start:o.selectionStart,end:o.selectionEnd};else e:{f=(f=o.ownerDocument)&&f.defaultView||window;var g=f.getSelection&&f.getSelection();if(g&&g.rangeCount!==0){f=g.anchorNode;var y=g.anchorOffset,w=g.focusNode;g=g.focusOffset;try{f.nodeType,w.nodeType}catch{f=null;break e}var A=0,I=-1,Z=-1,xe=0,je=0,Te=o,be=null;t:for(;;){for(var ke;Te!==f||y!==0&&Te.nodeType!==3||(I=A+y),Te!==w||g!==0&&Te.nodeType!==3||(Z=A+g),Te.nodeType===3&&(A+=Te.nodeValue.length),(ke=Te.firstChild)!==null;)be=Te,Te=ke;for(;;){if(Te===o)break t;if(be===f&&++xe===y&&(I=A),be===w&&++je===g&&(Z=A),(ke=Te.nextSibling)!==null)break;Te=be,be=Te.parentNode}Te=ke}f=I===-1||Z===-1?null:{start:I,end:Z}}else f=null}f=f||{start:0,end:0}}else f=null;for(Kv={focusedElem:o,selectionRange:f},Im=!1,_r=u;_r!==null;)if(u=_r,o=u.child,(u.subtreeFlags&1028)!==0&&o!==null)o.return=u,_r=o;else for(;_r!==null;){switch(u=_r,w=u.alternate,o=u.flags,u.tag){case 0:if((o&4)!==0&&(o=u.updateQueue,o=o!==null?o.events:null,o!==null))for(f=0;f title"))),Qr(w,g,f),w[Br]=o,Er(w),g=w;break e;case"link":var A=Uk("link","href",y).get(g+(f.href||""));if(A){for(var I=0;ISn&&(A=Sn,Sn=lt,lt=A);var oe=X3(I,lt),se=X3(I,Sn);if(oe&&se&&(ke.rangeCount!==1||ke.anchorNode!==oe.node||ke.anchorOffset!==oe.offset||ke.focusNode!==se.node||ke.focusOffset!==se.offset)){var pe=Te.createRange();pe.setStart(oe.node,oe.offset),ke.removeAllRanges(),lt>Sn?(ke.addRange(pe),ke.extend(se.node,se.offset)):(pe.setEnd(se.node,se.offset),ke.addRange(pe))}}}}for(Te=[],ke=I;ke=ke.parentNode;)ke.nodeType===1&&Te.push({element:ke,left:ke.scrollLeft,top:ke.scrollTop});for(typeof I.focus=="function"&&I.focus(),I=0;If?32:f,H.T=null,f=Pv,Pv=null;var w=Bl,A=Va;if(br=0,xu=Bl=null,Va=0,(sn&6)!==0)throw Error(r(331));var I=sn;if(sn|=4,YS(w.current),WS(w,w.current,A,f),sn=I,xh(0,!1),Me&&typeof Me.onPostCommitFiberRoot=="function")try{Me.onPostCommitFiberRoot(re,w)}catch{}return!0}finally{ae.p=y,H.T=g,mk(o,u)}}function gk(o,u,f){u=ui(f,u),u=pv(o.stateNode,u,2),o=El(o,u,2),o!==null&&(Ld(o,2),Ki(o))}function gn(o,u,f){if(o.tag===3)gk(o,o,f);else for(;u!==null;){if(u.tag===3){gk(u,o,f);break}else if(u.tag===1){var g=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Ll===null||!Ll.has(g))){o=ui(f,o),f=xS(2),g=El(u,f,2),g!==null&&(vS(f,g,u,o),Ld(g,2),Ki(g));break}}u=u.return}}function qv(o,u,f){var g=o.pingCache;if(g===null){g=o.pingCache=new RB;var y=new Set;g.set(u,y)}else y=g.get(u),y===void 0&&(y=new Set,g.set(u,y));y.has(f)||(_v=!0,y.add(f),o=IB.bind(null,o,u,f),u.then(o,o))}function IB(o,u,f){var g=o.pingCache;g!==null&&g.delete(u),o.pingedLanes|=o.suspendedLanes&f,o.warmLanes&=~f,Mn===o&&(Ft&f)===f&&(tr===4||tr===3&&(Ft&62914560)===Ft&&300>yn()-wm?(sn&2)===0&&vu(o,0):Dv|=f,gu===Ft&&(gu=0)),Ki(o)}function xk(o,u){u===0&&(u=qc()),o=Lo(o,u),o!==null&&(Ld(o,u),Ki(o))}function qB(o){var u=o.memoizedState,f=0;u!==null&&(f=u.retryLane),xk(o,f)}function FB(o,u){var f=0;switch(o.tag){case 31:case 13:var g=o.stateNode,y=o.memoizedState;y!==null&&(f=y.retryLane);break;case 19:g=o.stateNode;break;case 22:g=o.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(u),xk(o,f)}function QB(o,u){return _t(o,u)}var Tm=null,bu=null,Fv=!1,Mm=!1,Qv=!1,ql=0;function Ki(o){o!==bu&&o.next===null&&(bu===null?Tm=bu=o:bu=bu.next=o),Mm=!0,Fv||(Fv=!0,HB())}function xh(o,u){if(!Qv&&Mm){Qv=!0;do for(var f=!1,g=Tm;g!==null;){if(o!==0){var y=g.pendingLanes;if(y===0)var w=0;else{var A=g.suspendedLanes,I=g.pingedLanes;w=(1<<31-vt(42|o)+1)-1,w&=y&~(A&~I),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(f=!0,wk(g,w))}else w=Ft,w=Ic(g,g===Mn?w:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(w&3)===0||Eo(g,w)||(f=!0,wk(g,w));g=g.next}while(f);Qv=!1}}function $B(){vk()}function vk(){Mm=Fv=!1;var o=0;ql!==0&&eI()&&(o=ql);for(var u=yn(),f=null,g=Tm;g!==null;){var y=g.next,w=yk(g,u);w===0?(g.next=null,f===null?Tm=y:f.next=y,y===null&&(bu=f)):(f=g,(o!==0||(w&3)!==0)&&(Mm=!0)),g=y}br!==0&&br!==5||xh(o),ql!==0&&(ql=0)}function yk(o,u){for(var f=o.suspendedLanes,g=o.pingedLanes,y=o.expirationTimes,w=o.pendingLanes&-62914561;0I)break;var je=Z.transferSize,Te=Z.initiatorType;je&&Mk(Te)&&(Z=Z.responseEnd,A+=je*(Z"u"?null:document;function Fk(o,u,f){var g=wu;if(g&&typeof u=="string"&&u){var y=oi(u);y='link[rel="'+o+'"][href="'+y+'"]',typeof f=="string"&&(y+='[crossorigin="'+f+'"]'),qk.has(y)||(qk.add(y),o={rel:o,crossOrigin:f,href:u},g.querySelector(y)===null&&(u=g.createElement("link"),Qr(u,"link",o),Er(u),g.head.appendChild(u)))}}function cI(o){Wa.D(o),Fk("dns-prefetch",o,null)}function uI(o,u){Wa.C(o,u),Fk("preconnect",o,u)}function dI(o,u,f){Wa.L(o,u,f);var g=wu;if(g&&o&&u){var y='link[rel="preload"][as="'+oi(u)+'"]';u==="image"&&f&&f.imageSrcSet?(y+='[imagesrcset="'+oi(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(y+='[imagesizes="'+oi(f.imageSizes)+'"]')):y+='[href="'+oi(o)+'"]';var w=y;switch(u){case"style":w=Su(o);break;case"script":w=ku(o)}gi.has(w)||(o=p({rel:"preload",href:u==="image"&&f&&f.imageSrcSet?void 0:o,as:u},f),gi.set(w,o),g.querySelector(y)!==null||u==="style"&&g.querySelector(wh(w))||u==="script"&&g.querySelector(Sh(w))||(u=g.createElement("link"),Qr(u,"link",o),Er(u),g.head.appendChild(u)))}}function hI(o,u){Wa.m(o,u);var f=wu;if(f&&o){var g=u&&typeof u.as=="string"?u.as:"script",y='link[rel="modulepreload"][as="'+oi(g)+'"][href="'+oi(o)+'"]',w=y;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=ku(o)}if(!gi.has(w)&&(o=p({rel:"modulepreload",href:o},u),gi.set(w,o),f.querySelector(y)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(Sh(w)))return}g=f.createElement("link"),Qr(g,"link",o),Er(g),f.head.appendChild(g)}}}function fI(o,u,f){Wa.S(o,u,f);var g=wu;if(g&&o){var y=Hc(g).hoistableStyles,w=Su(o);u=u||"default";var A=y.get(w);if(!A){var I={loading:0,preload:null};if(A=g.querySelector(wh(w)))I.loading=5;else{o=p({rel:"stylesheet",href:o,"data-precedence":u},f),(f=gi.get(w))&&sy(o,f);var Z=A=g.createElement("link");Er(Z),Qr(Z,"link",o),Z._p=new Promise(function(xe,je){Z.onload=xe,Z.onerror=je}),Z.addEventListener("load",function(){I.loading|=1}),Z.addEventListener("error",function(){I.loading|=2}),I.loading|=4,Rm(A,u,g)}A={type:"stylesheet",instance:A,count:1,state:I},y.set(w,A)}}}function mI(o,u){Wa.X(o,u);var f=wu;if(f&&o){var g=Hc(f).hoistableScripts,y=ku(o),w=g.get(y);w||(w=f.querySelector(Sh(y)),w||(o=p({src:o,async:!0},u),(u=gi.get(y))&&iy(o,u),w=f.createElement("script"),Er(w),Qr(w,"link",o),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(y,w))}}function pI(o,u){Wa.M(o,u);var f=wu;if(f&&o){var g=Hc(f).hoistableScripts,y=ku(o),w=g.get(y);w||(w=f.querySelector(Sh(y)),w||(o=p({src:o,async:!0,type:"module"},u),(u=gi.get(y))&&iy(o,u),w=f.createElement("script"),Er(w),Qr(w,"link",o),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(y,w))}}function Qk(o,u,f,g){var y=(y=fe.current)?Dm(y):null;if(!y)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(u=Su(f.href),f=Hc(y).hoistableStyles,g=f.get(u),g||(g={type:"style",instance:null,count:0,state:null},f.set(u,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){o=Su(f.href);var w=Hc(y).hoistableStyles,A=w.get(o);if(A||(y=y.ownerDocument||y,A={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(o,A),(w=y.querySelector(wh(o)))&&!w._p&&(A.instance=w,A.state.loading=5),gi.has(o)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},gi.set(o,f),w||gI(y,o,f,A.state))),u&&g===null)throw Error(r(528,""));return A}if(u&&g!==null)throw Error(r(529,""));return null;case"script":return u=f.async,f=f.src,typeof f=="string"&&u&&typeof u!="function"&&typeof u!="symbol"?(u=ku(f),f=Hc(y).hoistableScripts,g=f.get(u),g||(g={type:"script",instance:null,count:0,state:null},f.set(u,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function Su(o){return'href="'+oi(o)+'"'}function wh(o){return'link[rel="stylesheet"]['+o+"]"}function $k(o){return p({},o,{"data-precedence":o.precedence,precedence:null})}function gI(o,u,f,g){o.querySelector('link[rel="preload"][as="style"]['+u+"]")?g.loading=1:(u=o.createElement("link"),g.preload=u,u.addEventListener("load",function(){return g.loading|=1}),u.addEventListener("error",function(){return g.loading|=2}),Qr(u,"link",f),Er(u),o.head.appendChild(u))}function ku(o){return'[src="'+oi(o)+'"]'}function Sh(o){return"script[async]"+o}function Hk(o,u,f){if(u.count++,u.instance===null)switch(u.type){case"style":var g=o.querySelector('style[data-href~="'+oi(f.href)+'"]');if(g)return u.instance=g,Er(g),g;var y=p({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return g=(o.ownerDocument||o).createElement("style"),Er(g),Qr(g,"style",y),Rm(g,f.precedence,o),u.instance=g;case"stylesheet":y=Su(f.href);var w=o.querySelector(wh(y));if(w)return u.state.loading|=4,u.instance=w,Er(w),w;g=$k(f),(y=gi.get(y))&&sy(g,y),w=(o.ownerDocument||o).createElement("link"),Er(w);var A=w;return A._p=new Promise(function(I,Z){A.onload=I,A.onerror=Z}),Qr(w,"link",g),u.state.loading|=4,Rm(w,f.precedence,o),u.instance=w;case"script":return w=ku(f.src),(y=o.querySelector(Sh(w)))?(u.instance=y,Er(y),y):(g=f,(y=gi.get(w))&&(g=p({},f),iy(g,y)),o=o.ownerDocument||o,y=o.createElement("script"),Er(y),Qr(y,"link",g),o.head.appendChild(y),u.instance=y);case"void":return null;default:throw Error(r(443,u.type))}else u.type==="stylesheet"&&(u.state.loading&4)===0&&(g=u.instance,u.state.loading|=4,Rm(g,f.precedence,o));return u.instance}function Rm(o,u,f){for(var g=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=g.length?g[g.length-1]:null,w=y,A=0;A title"):null)}function xI(o,u,f){if(f===1||u.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof u.precedence!="string"||typeof u.href!="string"||u.href==="")break;return!0;case"link":if(typeof u.rel!="string"||typeof u.href!="string"||u.href===""||u.onLoad||u.onError)break;switch(u.rel){case"stylesheet":return o=u.disabled,typeof u.precedence=="string"&&o==null;default:return!0}case"script":if(u.async&&typeof u.async!="function"&&typeof u.async!="symbol"&&!u.onLoad&&!u.onError&&u.src&&typeof u.src=="string")return!0}return!1}function Wk(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function vI(o,u,f,g){if(f.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var y=Su(g.href),w=u.querySelector(wh(y));if(w){u=w._p,u!==null&&typeof u=="object"&&typeof u.then=="function"&&(o.count++,o=Pm.bind(o),u.then(o,o)),f.state.loading|=4,f.instance=w,Er(w);return}w=u.ownerDocument||u,g=$k(g),(y=gi.get(y))&&sy(g,y),w=w.createElement("link"),Er(w);var A=w;A._p=new Promise(function(I,Z){A.onload=I,A.onerror=Z}),Qr(w,"link",g),f.instance=w}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(f,u),(u=f.state.preload)&&(f.state.loading&3)===0&&(o.count++,f=Pm.bind(o),u.addEventListener("load",f),u.addEventListener("error",f))}}var ay=0;function yI(o,u){return o.stylesheets&&o.count===0&&Bm(o,o.stylesheets),0ay?50:800)+u);return o.unsuspend=f,function(){o.unsuspend=null,clearTimeout(g),clearTimeout(y)}}:null}function Pm(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bm(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Lm=null;function Bm(o,u){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Lm=new Map,u.forEach(bI,o),Lm=null,Pm.call(o))}function bI(o,u){if(!(u.state.loading&4)){var f=Lm.get(o);if(f)var g=f.get(null);else{f=new Map,Lm.set(o,f);for(var y=o.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),py.exports=zq(),py.exports}var Lq=Pq();function B9(t,e){return function(){return t.apply(e,arguments)}}const{toString:Bq}=Object.prototype,{getPrototypeOf:J4}=Object,{iterator:ox,toStringTag:I9}=Symbol,cx=(t=>e=>{const n=Bq.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ui=t=>(t=t.toLowerCase(),e=>cx(e)===t),ux=t=>e=>typeof e===t,{isArray:Sd}=Array,sd=ux("undefined");function Kf(t){return t!==null&&!sd(t)&&t.constructor!==null&&!sd(t.constructor)&&Ds(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const q9=Ui("ArrayBuffer");function Iq(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&q9(t.buffer),e}const qq=ux("string"),Ds=ux("function"),F9=ux("number"),Zf=t=>t!==null&&typeof t=="object",Fq=t=>t===!0||t===!1,$p=t=>{if(cx(t)!=="object")return!1;const e=J4(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(I9 in t)&&!(ox in t)},Qq=t=>{if(!Zf(t)||Kf(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},$q=Ui("Date"),Hq=Ui("File"),Uq=Ui("Blob"),Vq=Ui("FileList"),Wq=t=>Zf(t)&&Ds(t.pipe),Gq=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Ds(t.append)&&((e=cx(t))==="formdata"||e==="object"&&Ds(t.toString)&&t.toString()==="[object FormData]"))},Xq=Ui("URLSearchParams"),[Yq,Kq,Zq,Jq]=["ReadableStream","Request","Response","Headers"].map(Ui),eF=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Jf(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),Sd(t))for(r=0,s=t.length;r0;)if(s=n[r],e===s.toLowerCase())return s;return null}const ic=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,$9=t=>!sd(t)&&t!==ic;function n2(){const{caseless:t,skipUndefined:e}=$9(this)&&this||{},n={},r=(s,i)=>{const l=t&&Q9(n,i)||i;$p(n[l])&&$p(s)?n[l]=n2(n[l],s):$p(s)?n[l]=n2({},s):Sd(s)?n[l]=s.slice():(!e||!sd(s))&&(n[l]=s)};for(let s=0,i=arguments.length;s(Jf(e,(s,i)=>{n&&Ds(s)?t[i]=B9(s,n):t[i]=s},{allOwnKeys:r}),t),nF=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),rF=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},sF=(t,e,n,r)=>{let s,i,l;const c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)l=s[i],(!r||r(l,t,e))&&!c[l]&&(e[l]=t[l],c[l]=!0);t=n!==!1&&J4(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},iF=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},aF=t=>{if(!t)return null;if(Sd(t))return t;let e=t.length;if(!F9(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},lF=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&J4(Uint8Array)),oF=(t,e)=>{const r=(t&&t[ox]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},cF=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},uF=Ui("HTMLFormElement"),dF=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),vO=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),hF=Ui("RegExp"),H9=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Jf(n,(s,i)=>{let l;(l=e(s,i,t))!==!1&&(r[i]=l||s)}),Object.defineProperties(t,r)},fF=t=>{H9(t,(e,n)=>{if(Ds(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Ds(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},mF=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Sd(t)?r(t):r(String(t).split(e)),n},pF=()=>{},gF=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function xF(t){return!!(t&&Ds(t.append)&&t[I9]==="FormData"&&t[ox])}const vF=t=>{const e=new Array(10),n=(r,s)=>{if(Zf(r)){if(e.indexOf(r)>=0)return;if(Kf(r))return r;if(!("toJSON"in r)){e[s]=r;const i=Sd(r)?[]:{};return Jf(r,(l,c)=>{const d=n(l,s+1);!sd(d)&&(i[c]=d)}),e[s]=void 0,i}}return r};return n(t,0)},yF=Ui("AsyncFunction"),bF=t=>t&&(Zf(t)||Ds(t))&&Ds(t.then)&&Ds(t.catch),U9=((t,e)=>t?setImmediate:e?((n,r)=>(ic.addEventListener("message",({source:s,data:i})=>{s===ic&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),ic.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Ds(ic.postMessage)),wF=typeof queueMicrotask<"u"?queueMicrotask.bind(ic):typeof process<"u"&&process.nextTick||U9,SF=t=>t!=null&&Ds(t[ox]),we={isArray:Sd,isArrayBuffer:q9,isBuffer:Kf,isFormData:Gq,isArrayBufferView:Iq,isString:qq,isNumber:F9,isBoolean:Fq,isObject:Zf,isPlainObject:$p,isEmptyObject:Qq,isReadableStream:Yq,isRequest:Kq,isResponse:Zq,isHeaders:Jq,isUndefined:sd,isDate:$q,isFile:Hq,isBlob:Uq,isRegExp:hF,isFunction:Ds,isStream:Wq,isURLSearchParams:Xq,isTypedArray:lF,isFileList:Vq,forEach:Jf,merge:n2,extend:tF,trim:eF,stripBOM:nF,inherits:rF,toFlatObject:sF,kindOf:cx,kindOfTest:Ui,endsWith:iF,toArray:aF,forEachEntry:oF,matchAll:cF,isHTMLForm:uF,hasOwnProperty:vO,hasOwnProp:vO,reduceDescriptors:H9,freezeMethods:fF,toObjectSet:mF,toCamelCase:dF,noop:pF,toFiniteNumber:gF,findKey:Q9,global:ic,isContextDefined:$9,isSpecCompliantForm:xF,toJSONObject:vF,isAsyncFn:yF,isThenable:bF,setImmediate:U9,asap:wF,isIterable:SF};function St(t,e,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}we.inherits(St,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:we.toJSONObject(this.config),code:this.code,status:this.status}}});const V9=St.prototype,W9={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{W9[t]={value:t}});Object.defineProperties(St,W9);Object.defineProperty(V9,"isAxiosError",{value:!0});St.from=(t,e,n,r,s,i)=>{const l=Object.create(V9);we.toFlatObject(t,l,function(m){return m!==Error.prototype},h=>h!=="isAxiosError");const c=t&&t.message?t.message:"Error",d=e==null&&t?t.code:e;return St.call(l,c,d,n,r,s),t&&l.cause==null&&Object.defineProperty(l,"cause",{value:t,configurable:!0}),l.name=t&&t.name||"Error",i&&Object.assign(l,i),l};const kF=null;function r2(t){return we.isPlainObject(t)||we.isArray(t)}function G9(t){return we.endsWith(t,"[]")?t.slice(0,-2):t}function yO(t,e,n){return t?t.concat(e).map(function(s,i){return s=G9(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function OF(t){return we.isArray(t)&&!t.some(r2)}const jF=we.toFlatObject(we,{},null,function(e){return/^is[A-Z]/.test(e)});function dx(t,e,n){if(!we.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=we.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(k,O){return!we.isUndefined(O[k])});const r=n.metaTokens,s=n.visitor||m,i=n.dots,l=n.indexes,d=(n.Blob||typeof Blob<"u"&&Blob)&&we.isSpecCompliantForm(e);if(!we.isFunction(s))throw new TypeError("visitor must be a function");function h(b){if(b===null)return"";if(we.isDate(b))return b.toISOString();if(we.isBoolean(b))return b.toString();if(!d&&we.isBlob(b))throw new St("Blob is not supported. Use a Buffer instead.");return we.isArrayBuffer(b)||we.isTypedArray(b)?d&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function m(b,k,O){let j=b;if(b&&!O&&typeof b=="object"){if(we.endsWith(k,"{}"))k=r?k:k.slice(0,-2),b=JSON.stringify(b);else if(we.isArray(b)&&OF(b)||(we.isFileList(b)||we.endsWith(k,"[]"))&&(j=we.toArray(b)))return k=G9(k),j.forEach(function(M,_){!(we.isUndefined(M)||M===null)&&e.append(l===!0?yO([k],_,i):l===null?k:k+"[]",h(M))}),!1}return r2(b)?!0:(e.append(yO(O,k,i),h(b)),!1)}const p=[],x=Object.assign(jF,{defaultVisitor:m,convertValue:h,isVisitable:r2});function v(b,k){if(!we.isUndefined(b)){if(p.indexOf(b)!==-1)throw Error("Circular reference detected in "+k.join("."));p.push(b),we.forEach(b,function(j,T){(!(we.isUndefined(j)||j===null)&&s.call(e,j,we.isString(T)?T.trim():T,k,x))===!0&&v(j,k?k.concat(T):[T])}),p.pop()}}if(!we.isObject(t))throw new TypeError("data must be an object");return v(t),e}function bO(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function ew(t,e){this._pairs=[],t&&dx(t,this,e)}const X9=ew.prototype;X9.append=function(e,n){this._pairs.push([e,n])};X9.toString=function(e){const n=e?function(r){return e.call(this,r,bO)}:bO;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function NF(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Y9(t,e,n){if(!e)return t;const r=n&&n.encode||NF;we.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=we.isURLSearchParams(e)?e.toString():new ew(e,n).toString(r),i){const l=t.indexOf("#");l!==-1&&(t=t.slice(0,l)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class wO{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){we.forEach(this.handlers,function(r){r!==null&&e(r)})}}const K9={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},CF=typeof URLSearchParams<"u"?URLSearchParams:ew,TF=typeof FormData<"u"?FormData:null,MF=typeof Blob<"u"?Blob:null,AF={isBrowser:!0,classes:{URLSearchParams:CF,FormData:TF,Blob:MF},protocols:["http","https","file","blob","url","data"]},tw=typeof window<"u"&&typeof document<"u",s2=typeof navigator=="object"&&navigator||void 0,EF=tw&&(!s2||["ReactNative","NativeScript","NS"].indexOf(s2.product)<0),_F=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",DF=tw&&window.location.href||"http://localhost",RF=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:tw,hasStandardBrowserEnv:EF,hasStandardBrowserWebWorkerEnv:_F,navigator:s2,origin:DF},Symbol.toStringTag,{value:"Module"})),ts={...RF,...AF};function zF(t,e){return dx(t,new ts.classes.URLSearchParams,{visitor:function(n,r,s,i){return ts.isNode&&we.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function PF(t){return we.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function LF(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r=n.length;return l=!l&&we.isArray(s)?s.length:l,d?(we.hasOwnProp(s,l)?s[l]=[s[l],r]:s[l]=r,!c):((!s[l]||!we.isObject(s[l]))&&(s[l]=[]),e(n,r,s[l],i)&&we.isArray(s[l])&&(s[l]=LF(s[l])),!c)}if(we.isFormData(t)&&we.isFunction(t.entries)){const n={};return we.forEachEntry(t,(r,s)=>{e(PF(r),s,n,0)}),n}return null}function BF(t,e,n){if(we.isString(t))try{return(e||JSON.parse)(t),we.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const e0={transitional:K9,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=we.isObject(e);if(i&&we.isHTMLForm(e)&&(e=new FormData(e)),we.isFormData(e))return s?JSON.stringify(Z9(e)):e;if(we.isArrayBuffer(e)||we.isBuffer(e)||we.isStream(e)||we.isFile(e)||we.isBlob(e)||we.isReadableStream(e))return e;if(we.isArrayBufferView(e))return e.buffer;if(we.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return zF(e,this.formSerializer).toString();if((c=we.isFileList(e))||r.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return dx(c?{"files[]":e}:e,d&&new d,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),BF(e)):e}],transformResponse:[function(e){const n=this.transitional||e0.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(we.isResponse(e)||we.isReadableStream(e))return e;if(e&&we.isString(e)&&(r&&!this.responseType||s)){const l=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(l)throw c.name==="SyntaxError"?St.from(c,St.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ts.classes.FormData,Blob:ts.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};we.forEach(["delete","get","head","post","put","patch"],t=>{e0.headers[t]={}});const IF=we.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),qF=t=>{const e={};let n,r,s;return t&&t.split(` +`).forEach(function(l){s=l.indexOf(":"),n=l.substring(0,s).trim().toLowerCase(),r=l.substring(s+1).trim(),!(!n||e[n]&&IF[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},SO=Symbol("internals");function Mh(t){return t&&String(t).trim().toLowerCase()}function Hp(t){return t===!1||t==null?t:we.isArray(t)?t.map(Hp):String(t)}function FF(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const QF=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function vy(t,e,n,r,s){if(we.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!we.isString(e)){if(we.isString(r))return e.indexOf(r)!==-1;if(we.isRegExp(r))return r.test(e)}}function $F(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function HF(t,e){const n=we.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,l){return this[r].call(this,e,s,i,l)},configurable:!0})})}let Rs=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(c,d,h){const m=Mh(d);if(!m)throw new Error("header name must be a non-empty string");const p=we.findKey(s,m);(!p||s[p]===void 0||h===!0||h===void 0&&s[p]!==!1)&&(s[p||d]=Hp(c))}const l=(c,d)=>we.forEach(c,(h,m)=>i(h,m,d));if(we.isPlainObject(e)||e instanceof this.constructor)l(e,n);else if(we.isString(e)&&(e=e.trim())&&!QF(e))l(qF(e),n);else if(we.isObject(e)&&we.isIterable(e)){let c={},d,h;for(const m of e){if(!we.isArray(m))throw TypeError("Object iterator must return a key-value pair");c[h=m[0]]=(d=c[h])?we.isArray(d)?[...d,m[1]]:[d,m[1]]:m[1]}l(c,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=Mh(e),e){const r=we.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return FF(s);if(we.isFunction(n))return n.call(this,s,r);if(we.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Mh(e),e){const r=we.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||vy(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(l){if(l=Mh(l),l){const c=we.findKey(r,l);c&&(!n||vy(r,r[c],c,n))&&(delete r[c],s=!0)}}return we.isArray(e)?e.forEach(i):i(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!e||vy(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const n=this,r={};return we.forEach(this,(s,i)=>{const l=we.findKey(r,i);if(l){n[l]=Hp(s),delete n[i];return}const c=e?$F(i):String(i).trim();c!==i&&delete n[i],n[c]=Hp(s),r[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return we.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&we.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[SO]=this[SO]={accessors:{}}).accessors,s=this.prototype;function i(l){const c=Mh(l);r[c]||(HF(s,l),r[c]=!0)}return we.isArray(e)?e.forEach(i):i(e),this}};Rs.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);we.reduceDescriptors(Rs.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});we.freezeMethods(Rs);function yy(t,e){const n=this||e0,r=e||n,s=Rs.from(r.headers);let i=r.data;return we.forEach(t,function(c){i=c.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function J9(t){return!!(t&&t.__CANCEL__)}function kd(t,e,n){St.call(this,t??"canceled",St.ERR_CANCELED,e,n),this.name="CanceledError"}we.inherits(kd,St,{__CANCEL__:!0});function eC(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new St("Request failed with status code "+n.status,[St.ERR_BAD_REQUEST,St.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function UF(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function VF(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,l;return e=e!==void 0?e:1e3,function(d){const h=Date.now(),m=r[i];l||(l=h),n[s]=d,r[s]=h;let p=i,x=0;for(;p!==s;)x+=n[p++],p=p%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),h-l{n=m,s=null,i&&(clearTimeout(i),i=null),t(...h)};return[(...h)=>{const m=Date.now(),p=m-n;p>=r?l(h,m):(s=h,i||(i=setTimeout(()=>{i=null,l(s)},r-p)))},()=>s&&l(s)]}const gg=(t,e,n=3)=>{let r=0;const s=VF(50,250);return WF(i=>{const l=i.loaded,c=i.lengthComputable?i.total:void 0,d=l-r,h=s(d),m=l<=c;r=l;const p={loaded:l,total:c,progress:c?l/c:void 0,bytes:d,rate:h||void 0,estimated:h&&c&&m?(c-l)/h:void 0,event:i,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(p)},n)},kO=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},OO=t=>(...e)=>we.asap(()=>t(...e)),GF=ts.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,ts.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(ts.origin),ts.navigator&&/(msie|trident)/i.test(ts.navigator.userAgent)):()=>!0,XF=ts.hasStandardBrowserEnv?{write(t,e,n,r,s,i,l){if(typeof document>"u")return;const c=[`${t}=${encodeURIComponent(e)}`];we.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),we.isString(r)&&c.push(`path=${r}`),we.isString(s)&&c.push(`domain=${s}`),i===!0&&c.push("secure"),we.isString(l)&&c.push(`SameSite=${l}`),document.cookie=c.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function YF(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function KF(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function tC(t,e,n){let r=!YF(e);return t&&(r||n==!1)?KF(t,e):e}const jO=t=>t instanceof Rs?{...t}:t;function vc(t,e){e=e||{};const n={};function r(h,m,p,x){return we.isPlainObject(h)&&we.isPlainObject(m)?we.merge.call({caseless:x},h,m):we.isPlainObject(m)?we.merge({},m):we.isArray(m)?m.slice():m}function s(h,m,p,x){if(we.isUndefined(m)){if(!we.isUndefined(h))return r(void 0,h,p,x)}else return r(h,m,p,x)}function i(h,m){if(!we.isUndefined(m))return r(void 0,m)}function l(h,m){if(we.isUndefined(m)){if(!we.isUndefined(h))return r(void 0,h)}else return r(void 0,m)}function c(h,m,p){if(p in e)return r(h,m);if(p in t)return r(void 0,h)}const d={url:i,method:i,data:i,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:c,headers:(h,m,p)=>s(jO(h),jO(m),p,!0)};return we.forEach(Object.keys({...t,...e}),function(m){const p=d[m]||s,x=p(t[m],e[m],m);we.isUndefined(x)&&p!==c||(n[m]=x)}),n}const nC=t=>{const e=vc({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:l,auth:c}=e;if(e.headers=l=Rs.from(l),e.url=Y9(tC(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&l.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),we.isFormData(n)){if(ts.hasStandardBrowserEnv||ts.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if(we.isFunction(n.getHeaders)){const d=n.getHeaders(),h=["content-type","content-length"];Object.entries(d).forEach(([m,p])=>{h.includes(m.toLowerCase())&&l.set(m,p)})}}if(ts.hasStandardBrowserEnv&&(r&&we.isFunction(r)&&(r=r(e)),r||r!==!1&&GF(e.url))){const d=s&&i&&XF.read(i);d&&l.set(s,d)}return e},ZF=typeof XMLHttpRequest<"u",JF=ZF&&function(t){return new Promise(function(n,r){const s=nC(t);let i=s.data;const l=Rs.from(s.headers).normalize();let{responseType:c,onUploadProgress:d,onDownloadProgress:h}=s,m,p,x,v,b;function k(){v&&v(),b&&b(),s.cancelToken&&s.cancelToken.unsubscribe(m),s.signal&&s.signal.removeEventListener("abort",m)}let O=new XMLHttpRequest;O.open(s.method.toUpperCase(),s.url,!0),O.timeout=s.timeout;function j(){if(!O)return;const M=Rs.from("getAllResponseHeaders"in O&&O.getAllResponseHeaders()),D={data:!c||c==="text"||c==="json"?O.responseText:O.response,status:O.status,statusText:O.statusText,headers:M,config:t,request:O};eC(function(z){n(z),k()},function(z){r(z),k()},D),O=null}"onloadend"in O?O.onloadend=j:O.onreadystatechange=function(){!O||O.readyState!==4||O.status===0&&!(O.responseURL&&O.responseURL.indexOf("file:")===0)||setTimeout(j)},O.onabort=function(){O&&(r(new St("Request aborted",St.ECONNABORTED,t,O)),O=null)},O.onerror=function(_){const D=_&&_.message?_.message:"Network Error",E=new St(D,St.ERR_NETWORK,t,O);E.event=_||null,r(E),O=null},O.ontimeout=function(){let _=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const D=s.transitional||K9;s.timeoutErrorMessage&&(_=s.timeoutErrorMessage),r(new St(_,D.clarifyTimeoutError?St.ETIMEDOUT:St.ECONNABORTED,t,O)),O=null},i===void 0&&l.setContentType(null),"setRequestHeader"in O&&we.forEach(l.toJSON(),function(_,D){O.setRequestHeader(D,_)}),we.isUndefined(s.withCredentials)||(O.withCredentials=!!s.withCredentials),c&&c!=="json"&&(O.responseType=s.responseType),h&&([x,b]=gg(h,!0),O.addEventListener("progress",x)),d&&O.upload&&([p,v]=gg(d),O.upload.addEventListener("progress",p),O.upload.addEventListener("loadend",v)),(s.cancelToken||s.signal)&&(m=M=>{O&&(r(!M||M.type?new kd(null,t,O):M),O.abort(),O=null)},s.cancelToken&&s.cancelToken.subscribe(m),s.signal&&(s.signal.aborted?m():s.signal.addEventListener("abort",m)));const T=UF(s.url);if(T&&ts.protocols.indexOf(T)===-1){r(new St("Unsupported protocol "+T+":",St.ERR_BAD_REQUEST,t));return}O.send(i||null)})},eQ=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(h){if(!s){s=!0,c();const m=h instanceof Error?h:this.reason;r.abort(m instanceof St?m:new kd(m instanceof Error?m.message:m))}};let l=e&&setTimeout(()=>{l=null,i(new St(`timeout ${e} of ms exceeded`,St.ETIMEDOUT))},e);const c=()=>{t&&(l&&clearTimeout(l),l=null,t.forEach(h=>{h.unsubscribe?h.unsubscribe(i):h.removeEventListener("abort",i)}),t=null)};t.forEach(h=>h.addEventListener("abort",i));const{signal:d}=r;return d.unsubscribe=()=>we.asap(c),d}},tQ=function*(t,e){let n=t.byteLength;if(n{const s=nQ(t,e);let i=0,l,c=d=>{l||(l=!0,r&&r(d))};return new ReadableStream({async pull(d){try{const{done:h,value:m}=await s.next();if(h){c(),d.close();return}let p=m.byteLength;if(n){let x=i+=p;n(x)}d.enqueue(new Uint8Array(m))}catch(h){throw c(h),h}},cancel(d){return c(d),s.return()}},{highWaterMark:2})},CO=64*1024,{isFunction:Xm}=we,sQ=(({Request:t,Response:e})=>({Request:t,Response:e}))(we.global),{ReadableStream:TO,TextEncoder:MO}=we.global,AO=(t,...e)=>{try{return!!t(...e)}catch{return!1}},iQ=t=>{t=we.merge.call({skipUndefined:!0},sQ,t);const{fetch:e,Request:n,Response:r}=t,s=e?Xm(e):typeof fetch=="function",i=Xm(n),l=Xm(r);if(!s)return!1;const c=s&&Xm(TO),d=s&&(typeof MO=="function"?(b=>k=>b.encode(k))(new MO):async b=>new Uint8Array(await new n(b).arrayBuffer())),h=i&&c&&AO(()=>{let b=!1;const k=new n(ts.origin,{body:new TO,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!k}),m=l&&c&&AO(()=>we.isReadableStream(new r("").body)),p={stream:m&&(b=>b.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!p[b]&&(p[b]=(k,O)=>{let j=k&&k[b];if(j)return j.call(k);throw new St(`Response type '${b}' is not supported`,St.ERR_NOT_SUPPORT,O)})});const x=async b=>{if(b==null)return 0;if(we.isBlob(b))return b.size;if(we.isSpecCompliantForm(b))return(await new n(ts.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(we.isArrayBufferView(b)||we.isArrayBuffer(b))return b.byteLength;if(we.isURLSearchParams(b)&&(b=b+""),we.isString(b))return(await d(b)).byteLength},v=async(b,k)=>{const O=we.toFiniteNumber(b.getContentLength());return O??x(k)};return async b=>{let{url:k,method:O,data:j,signal:T,cancelToken:M,timeout:_,onDownloadProgress:D,onUploadProgress:E,responseType:z,headers:Q,withCredentials:F="same-origin",fetchOptions:B}=nC(b),U=e||fetch;z=z?(z+"").toLowerCase():"text";let V=eQ([T,M&&M.toAbortSignal()],_),ce=null;const W=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let J;try{if(E&&h&&O!=="get"&&O!=="head"&&(J=await v(Q,j))!==0){let me=new n(k,{method:"POST",body:j,duplex:"half"}),Y;if(we.isFormData(j)&&(Y=me.headers.get("content-type"))&&Q.setContentType(Y),me.body){const[P,K]=kO(J,gg(OO(E)));j=NO(me.body,CO,P,K)}}we.isString(F)||(F=F?"include":"omit");const H=i&&"credentials"in n.prototype,ae={...B,signal:V,method:O.toUpperCase(),headers:Q.normalize().toJSON(),body:j,duplex:"half",credentials:H?F:void 0};ce=i&&new n(k,ae);let ne=await(i?U(ce,B):U(k,ae));const ue=m&&(z==="stream"||z==="response");if(m&&(D||ue&&W)){const me={};["status","statusText","headers"].forEach($=>{me[$]=ne[$]});const Y=we.toFiniteNumber(ne.headers.get("content-length")),[P,K]=D&&kO(Y,gg(OO(D),!0))||[];ne=new r(NO(ne.body,CO,P,()=>{K&&K(),W&&W()}),me)}z=z||"text";let R=await p[we.findKey(p,z)||"text"](ne,b);return!ue&&W&&W(),await new Promise((me,Y)=>{eC(me,Y,{data:R,headers:Rs.from(ne.headers),status:ne.status,statusText:ne.statusText,config:b,request:ce})})}catch(H){throw W&&W(),H&&H.name==="TypeError"&&/Load failed|fetch/i.test(H.message)?Object.assign(new St("Network Error",St.ERR_NETWORK,b,ce),{cause:H.cause||H}):St.from(H,H&&H.code,b,ce)}}},aQ=new Map,rC=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,i=[r,s,n];let l=i.length,c=l,d,h,m=aQ;for(;c--;)d=i[c],h=m.get(d),h===void 0&&m.set(d,h=c?new Map:iQ(e)),m=h;return h};rC();const nw={http:kF,xhr:JF,fetch:{get:rC}};we.forEach(nw,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const EO=t=>`- ${t}`,lQ=t=>we.isFunction(t)||t===null||t===!1;function oQ(t,e){t=we.isArray(t)?t:[t];const{length:n}=t;let r,s;const i={};for(let l=0;l`adapter ${d} `+(h===!1?"is not supported by the environment":"is not available in the build"));let c=n?l.length>1?`since : +`+l.map(EO).join(` +`):" "+EO(l[0]):"as no adapter specified";throw new St("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const sC={getAdapter:oQ,adapters:nw};function by(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new kd(null,t)}function _O(t){return by(t),t.headers=Rs.from(t.headers),t.data=yy.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),sC.getAdapter(t.adapter||e0.adapter,t)(t).then(function(r){return by(t),r.data=yy.call(t,t.transformResponse,r),r.headers=Rs.from(r.headers),r},function(r){return J9(r)||(by(t),r&&r.response&&(r.response.data=yy.call(t,t.transformResponse,r.response),r.response.headers=Rs.from(r.response.headers))),Promise.reject(r)})}const iC="1.13.2",hx={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{hx[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const DO={};hx.transitional=function(e,n,r){function s(i,l){return"[Axios v"+iC+"] Transitional option '"+i+"'"+l+(r?". "+r:"")}return(i,l,c)=>{if(e===!1)throw new St(s(l," has been removed"+(n?" in "+n:"")),St.ERR_DEPRECATED);return n&&!DO[l]&&(DO[l]=!0,console.warn(s(l," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,l,c):!0}};hx.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function cQ(t,e,n){if(typeof t!="object")throw new St("options must be an object",St.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const i=r[s],l=e[i];if(l){const c=t[i],d=c===void 0||l(c,i,t);if(d!==!0)throw new St("option "+i+" must be "+d,St.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new St("Unknown option "+i,St.ERR_BAD_OPTION)}}const Up={assertOptions:cQ,validators:hx},Zi=Up.validators;let mc=class{constructor(e){this.defaults=e||{},this.interceptors={request:new wO,response:new wO}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=vc(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Up.assertOptions(r,{silentJSONParsing:Zi.transitional(Zi.boolean),forcedJSONParsing:Zi.transitional(Zi.boolean),clarifyTimeoutError:Zi.transitional(Zi.boolean)},!1),s!=null&&(we.isFunction(s)?n.paramsSerializer={serialize:s}:Up.assertOptions(s,{encode:Zi.function,serialize:Zi.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Up.assertOptions(n,{baseUrl:Zi.spelling("baseURL"),withXsrfToken:Zi.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=i&&we.merge(i.common,i[n.method]);i&&we.forEach(["delete","get","head","post","put","patch","common"],b=>{delete i[b]}),n.headers=Rs.concat(l,i);const c=[];let d=!0;this.interceptors.request.forEach(function(k){typeof k.runWhen=="function"&&k.runWhen(n)===!1||(d=d&&k.synchronous,c.unshift(k.fulfilled,k.rejected))});const h=[];this.interceptors.response.forEach(function(k){h.push(k.fulfilled,k.rejected)});let m,p=0,x;if(!d){const b=[_O.bind(this),void 0];for(b.unshift(...c),b.push(...h),x=b.length,m=Promise.resolve(n);p{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const l=new Promise(c=>{r.subscribe(c),i=c}).then(s);return l.cancel=function(){r.unsubscribe(i)},l},e(function(i,l,c){r.reason||(r.reason=new kd(i,l,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new aC(function(s){e=s}),cancel:e}}};function dQ(t){return function(n){return t.apply(null,n)}}function hQ(t){return we.isObject(t)&&t.isAxiosError===!0}const i2={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(i2).forEach(([t,e])=>{i2[e]=t});function lC(t){const e=new mc(t),n=B9(mc.prototype.request,e);return we.extend(n,mc.prototype,e,{allOwnKeys:!0}),we.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return lC(vc(t,s))},n}const Zn=lC(e0);Zn.Axios=mc;Zn.CanceledError=kd;Zn.CancelToken=uQ;Zn.isCancel=J9;Zn.VERSION=iC;Zn.toFormData=dx;Zn.AxiosError=St;Zn.Cancel=Zn.CanceledError;Zn.all=function(e){return Promise.all(e)};Zn.spread=dQ;Zn.isAxiosError=hQ;Zn.mergeConfig=vc;Zn.AxiosHeaders=Rs;Zn.formToJSON=t=>Z9(we.isHTMLForm(t)?new FormData(t):t);Zn.getAdapter=sC.getAdapter;Zn.HttpStatusCode=i2;Zn.default=Zn;const{Axios:Nxe,AxiosError:Cxe,CanceledError:Txe,isCancel:Mxe,CancelToken:Axe,VERSION:Exe,all:_xe,Cancel:Dxe,isAxiosError:Rxe,spread:zxe,toFormData:Pxe,AxiosHeaders:Lxe,HttpStatusCode:Bxe,formToJSON:Ixe,getAdapter:qxe,mergeConfig:Fxe}=Zn,fQ=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),oC=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),xg="-",RO=[],pQ="arbitrary..",gQ=t=>{const e=vQ(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return xQ(l);const c=l.split(xg),d=c[0]===""&&c.length>1?1:0;return cC(c,d,e)},getConflictingClassGroupIds:(l,c)=>{if(c){const d=r[l],h=n[l];return d?h?fQ(h,d):d:h||RO}return n[l]||RO}}},cC=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const h=cC(t,e+1,i);if(h)return h}const l=n.validators;if(l===null)return;const c=e===0?t.join(xg):t.slice(e).join(xg),d=l.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?pQ+r:void 0})(),vQ=t=>{const{theme:e,classGroups:n}=t;return yQ(n,e)},yQ=(t,e)=>{const n=oC();for(const r in t){const s=t[r];rw(s,n,r,e)}return n},rw=(t,e,n,r)=>{const s=t.length;for(let i=0;i{if(typeof t=="string"){wQ(t,e,n);return}if(typeof t=="function"){SQ(t,e,n,r);return}kQ(t,e,n,r)},wQ=(t,e,n)=>{const r=t===""?e:uC(e,t);r.classGroupId=n},SQ=(t,e,n,r)=>{if(OQ(t)){rw(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(mQ(n,t))},kQ=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let l=0;l{let n=t;const r=e.split(xg),s=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,jQ=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,l)=>{n[i]=l,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let l=n[i];if(l!==void 0)return l;if((l=r[i])!==void 0)return s(i,l),l},set(i,l){i in n?n[i]=l:s(i,l)}}},a2="!",zO=":",NQ=[],PO=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),CQ=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let l=0,c=0,d=0,h;const m=s.length;for(let k=0;kd?h-d:void 0;return PO(i,v,x,b)};if(e){const s=e+zO,i=r;r=l=>l.startsWith(s)?i(l.slice(s.length)):PO(NQ,!1,l,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},TQ=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i0&&(s.sort(),r.push(...s),s=[]),r.push(l)):s.push(l)}return s.length>0&&(s.sort(),r.push(...s)),r}},MQ=t=>({cache:jQ(t.cacheSize),parseClassName:CQ(t),sortModifiers:TQ(t),...gQ(t)}),AQ=/\s+/,EQ=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,l=[],c=t.trim().split(AQ);let d="";for(let h=c.length-1;h>=0;h-=1){const m=c[h],{isExternal:p,modifiers:x,hasImportantModifier:v,baseClassName:b,maybePostfixModifierPosition:k}=n(m);if(p){d=m+(d.length>0?" "+d:d);continue}let O=!!k,j=r(O?b.substring(0,k):b);if(!j){if(!O){d=m+(d.length>0?" "+d:d);continue}if(j=r(b),!j){d=m+(d.length>0?" "+d:d);continue}O=!1}const T=x.length===0?"":x.length===1?x[0]:i(x).join(":"),M=v?T+a2:T,_=M+j;if(l.indexOf(_)>-1)continue;l.push(_);const D=s(j,O);for(let E=0;E0?" "+d:d)}return d},_Q=(...t)=>{let e=0,n,r,s="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,s,i;const l=d=>{const h=e.reduce((m,p)=>p(m),t());return n=MQ(h),r=n.cache.get,s=n.cache.set,i=c,c(d)},c=d=>{const h=r(d);if(h)return h;const m=EQ(d,n);return s(d,m),m};return i=l,(...d)=>i(_Q(...d))},RQ=[],wr=t=>{const e=n=>n[t]||RQ;return e.isThemeGetter=!0,e},hC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zQ=/^\d+\/\d+$/,PQ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,LQ=/\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$/,BQ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,IQ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qQ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ju=t=>zQ.test(t),At=t=>!!t&&!Number.isNaN(Number(t)),Wl=t=>!!t&&Number.isInteger(Number(t)),wy=t=>t.endsWith("%")&&At(t.slice(0,-1)),Ga=t=>PQ.test(t),FQ=()=>!0,QQ=t=>LQ.test(t)&&!BQ.test(t),mC=()=>!1,$Q=t=>IQ.test(t),HQ=t=>qQ.test(t),UQ=t=>!Xe(t)&&!Ye(t),VQ=t=>Od(t,xC,mC),Xe=t=>hC.test(t),Yo=t=>Od(t,vC,QQ),Sy=t=>Od(t,KQ,At),LO=t=>Od(t,pC,mC),WQ=t=>Od(t,gC,HQ),Ym=t=>Od(t,yC,$Q),Ye=t=>fC.test(t),Ah=t=>jd(t,vC),GQ=t=>jd(t,ZQ),BO=t=>jd(t,pC),XQ=t=>jd(t,xC),YQ=t=>jd(t,gC),Km=t=>jd(t,yC,!0),Od=(t,e,n)=>{const r=hC.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},jd=(t,e,n=!1)=>{const r=fC.exec(t);return r?r[1]?e(r[1]):n:!1},pC=t=>t==="position"||t==="percentage",gC=t=>t==="image"||t==="url",xC=t=>t==="length"||t==="size"||t==="bg-size",vC=t=>t==="length",KQ=t=>t==="number",ZQ=t=>t==="family-name",yC=t=>t==="shadow",JQ=()=>{const t=wr("color"),e=wr("font"),n=wr("text"),r=wr("font-weight"),s=wr("tracking"),i=wr("leading"),l=wr("breakpoint"),c=wr("container"),d=wr("spacing"),h=wr("radius"),m=wr("shadow"),p=wr("inset-shadow"),x=wr("text-shadow"),v=wr("drop-shadow"),b=wr("blur"),k=wr("perspective"),O=wr("aspect"),j=wr("ease"),T=wr("animate"),M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[..._(),Ye,Xe],E=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],Q=()=>[Ye,Xe,d],F=()=>[ju,"full","auto",...Q()],B=()=>[Wl,"none","subgrid",Ye,Xe],U=()=>["auto",{span:["full",Wl,Ye,Xe]},Wl,Ye,Xe],V=()=>[Wl,"auto",Ye,Xe],ce=()=>["auto","min","max","fr",Ye,Xe],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...Q()],ae=()=>[ju,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...Q()],ne=()=>[t,Ye,Xe],ue=()=>[..._(),BO,LO,{position:[Ye,Xe]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],me=()=>["auto","cover","contain",XQ,VQ,{size:[Ye,Xe]}],Y=()=>[wy,Ah,Yo],P=()=>["","none","full",h,Ye,Xe],K=()=>["",At,Ah,Yo],$=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ve=()=>[At,wy,BO,LO],Re=()=>["","none",b,Ye,Xe],de=()=>["none",At,Ye,Xe],We=()=>["none",At,Ye,Xe],ct=()=>[At,Ye,Xe],Oe=()=>[ju,"full",...Q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ga],breakpoint:[Ga],color:[FQ],container:[Ga],"drop-shadow":[Ga],ease:["in","out","in-out"],font:[UQ],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ga],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ga],shadow:[Ga],spacing:["px",At],text:[Ga],"text-shadow":[Ga],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ju,Xe,Ye,O]}],container:["container"],columns:[{columns:[At,Xe,Ye,c]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"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"],sr:["sr-only","not-sr-only"],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:D()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:F()}],"inset-x":[{"inset-x":F()}],"inset-y":[{"inset-y":F()}],start:[{start:F()}],end:[{end:F()}],top:[{top:F()}],right:[{right:F()}],bottom:[{bottom:F()}],left:[{left:F()}],visibility:["visible","invisible","collapse"],z:[{z:[Wl,"auto",Ye,Xe]}],basis:[{basis:[ju,"full","auto",c,...Q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[At,ju,"auto","initial","none",Xe]}],grow:[{grow:["",At,Ye,Xe]}],shrink:[{shrink:["",At,Ye,Xe]}],order:[{order:[Wl,"first","last","none",Ye,Xe]}],"grid-cols":[{"grid-cols":B()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":B()}],"row-start-end":[{row:U()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ce()}],"auto-rows":[{"auto-rows":ce()}],gap:[{gap:Q()}],"gap-x":[{"gap-x":Q()}],"gap-y":[{"gap-y":Q()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...J(),"baseline"]}],"place-self":[{"place-self":["auto",...J()]}],p:[{p:Q()}],px:[{px:Q()}],py:[{py:Q()}],ps:[{ps:Q()}],pe:[{pe:Q()}],pt:[{pt:Q()}],pr:[{pr:Q()}],pb:[{pb:Q()}],pl:[{pl:Q()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":Q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":Q()}],"space-y-reverse":["space-y-reverse"],size:[{size:ae()}],w:[{w:[c,"screen",...ae()]}],"min-w":[{"min-w":[c,"screen","none",...ae()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...ae()]}],h:[{h:["screen","lh",...ae()]}],"min-h":[{"min-h":["screen","lh","none",...ae()]}],"max-h":[{"max-h":["screen","lh",...ae()]}],"font-size":[{text:["base",n,Ah,Yo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Ye,Sy]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",wy,Xe]}],"font-family":[{font:[GQ,Xe,e]}],"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:[s,Ye,Xe]}],"line-clamp":[{"line-clamp":[At,"none",Ye,Sy]}],leading:[{leading:[i,...Q()]}],"list-image":[{"list-image":["none",Ye,Xe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ye,Xe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:ne()}],"text-color":[{text:ne()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:[At,"from-font","auto",Ye,Yo]}],"text-decoration-color":[{decoration:ne()}],"underline-offset":[{"underline-offset":[At,"auto",Ye,Xe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Q()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ye,Xe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ye,Xe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ue()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:me()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Wl,Ye,Xe],radial:["",Ye,Xe],conic:[Wl,Ye,Xe]},YQ,WQ]}],"bg-color":[{bg:ne()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:ne()}],"gradient-via":[{via:ne()}],"gradient-to":[{to:ne()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...$(),"hidden","none"]}],"divide-style":[{divide:[...$(),"hidden","none"]}],"border-color":[{border:ne()}],"border-color-x":[{"border-x":ne()}],"border-color-y":[{"border-y":ne()}],"border-color-s":[{"border-s":ne()}],"border-color-e":[{"border-e":ne()}],"border-color-t":[{"border-t":ne()}],"border-color-r":[{"border-r":ne()}],"border-color-b":[{"border-b":ne()}],"border-color-l":[{"border-l":ne()}],"divide-color":[{divide:ne()}],"outline-style":[{outline:[...$(),"none","hidden"]}],"outline-offset":[{"outline-offset":[At,Ye,Xe]}],"outline-w":[{outline:["",At,Ah,Yo]}],"outline-color":[{outline:ne()}],shadow:[{shadow:["","none",m,Km,Ym]}],"shadow-color":[{shadow:ne()}],"inset-shadow":[{"inset-shadow":["none",p,Km,Ym]}],"inset-shadow-color":[{"inset-shadow":ne()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:ne()}],"ring-offset-w":[{"ring-offset":[At,Yo]}],"ring-offset-color":[{"ring-offset":ne()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":ne()}],"text-shadow":[{"text-shadow":["none",x,Km,Ym]}],"text-shadow-color":[{"text-shadow":ne()}],opacity:[{opacity:[At,Ye,Xe]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[At]}],"mask-image-linear-from-pos":[{"mask-linear-from":ve()}],"mask-image-linear-to-pos":[{"mask-linear-to":ve()}],"mask-image-linear-from-color":[{"mask-linear-from":ne()}],"mask-image-linear-to-color":[{"mask-linear-to":ne()}],"mask-image-t-from-pos":[{"mask-t-from":ve()}],"mask-image-t-to-pos":[{"mask-t-to":ve()}],"mask-image-t-from-color":[{"mask-t-from":ne()}],"mask-image-t-to-color":[{"mask-t-to":ne()}],"mask-image-r-from-pos":[{"mask-r-from":ve()}],"mask-image-r-to-pos":[{"mask-r-to":ve()}],"mask-image-r-from-color":[{"mask-r-from":ne()}],"mask-image-r-to-color":[{"mask-r-to":ne()}],"mask-image-b-from-pos":[{"mask-b-from":ve()}],"mask-image-b-to-pos":[{"mask-b-to":ve()}],"mask-image-b-from-color":[{"mask-b-from":ne()}],"mask-image-b-to-color":[{"mask-b-to":ne()}],"mask-image-l-from-pos":[{"mask-l-from":ve()}],"mask-image-l-to-pos":[{"mask-l-to":ve()}],"mask-image-l-from-color":[{"mask-l-from":ne()}],"mask-image-l-to-color":[{"mask-l-to":ne()}],"mask-image-x-from-pos":[{"mask-x-from":ve()}],"mask-image-x-to-pos":[{"mask-x-to":ve()}],"mask-image-x-from-color":[{"mask-x-from":ne()}],"mask-image-x-to-color":[{"mask-x-to":ne()}],"mask-image-y-from-pos":[{"mask-y-from":ve()}],"mask-image-y-to-pos":[{"mask-y-to":ve()}],"mask-image-y-from-color":[{"mask-y-from":ne()}],"mask-image-y-to-color":[{"mask-y-to":ne()}],"mask-image-radial":[{"mask-radial":[Ye,Xe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ve()}],"mask-image-radial-to-pos":[{"mask-radial-to":ve()}],"mask-image-radial-from-color":[{"mask-radial-from":ne()}],"mask-image-radial-to-color":[{"mask-radial-to":ne()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[At]}],"mask-image-conic-from-pos":[{"mask-conic-from":ve()}],"mask-image-conic-to-pos":[{"mask-conic-to":ve()}],"mask-image-conic-from-color":[{"mask-conic-from":ne()}],"mask-image-conic-to-color":[{"mask-conic-to":ne()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ue()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:me()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ye,Xe]}],filter:[{filter:["","none",Ye,Xe]}],blur:[{blur:Re()}],brightness:[{brightness:[At,Ye,Xe]}],contrast:[{contrast:[At,Ye,Xe]}],"drop-shadow":[{"drop-shadow":["","none",v,Km,Ym]}],"drop-shadow-color":[{"drop-shadow":ne()}],grayscale:[{grayscale:["",At,Ye,Xe]}],"hue-rotate":[{"hue-rotate":[At,Ye,Xe]}],invert:[{invert:["",At,Ye,Xe]}],saturate:[{saturate:[At,Ye,Xe]}],sepia:[{sepia:["",At,Ye,Xe]}],"backdrop-filter":[{"backdrop-filter":["","none",Ye,Xe]}],"backdrop-blur":[{"backdrop-blur":Re()}],"backdrop-brightness":[{"backdrop-brightness":[At,Ye,Xe]}],"backdrop-contrast":[{"backdrop-contrast":[At,Ye,Xe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",At,Ye,Xe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[At,Ye,Xe]}],"backdrop-invert":[{"backdrop-invert":["",At,Ye,Xe]}],"backdrop-opacity":[{"backdrop-opacity":[At,Ye,Xe]}],"backdrop-saturate":[{"backdrop-saturate":[At,Ye,Xe]}],"backdrop-sepia":[{"backdrop-sepia":["",At,Ye,Xe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":Q()}],"border-spacing-x":[{"border-spacing-x":Q()}],"border-spacing-y":[{"border-spacing-y":Q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ye,Xe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[At,"initial",Ye,Xe]}],ease:[{ease:["linear","initial",j,Ye,Xe]}],delay:[{delay:[At,Ye,Xe]}],animate:[{animate:["none",T,Ye,Xe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,Ye,Xe]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:We()}],"scale-x":[{"scale-x":We()}],"scale-y":[{"scale-y":We()}],"scale-z":[{"scale-z":We()}],"scale-3d":["scale-3d"],skew:[{skew:ct()}],"skew-x":[{"skew-x":ct()}],"skew-y":[{"skew-y":ct()}],transform:[{transform:[Ye,Xe,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Oe()}],"translate-x":[{"translate-x":Oe()}],"translate-y":[{"translate-y":Oe()}],"translate-z":[{"translate-z":Oe()}],"translate-none":["translate-none"],accent:[{accent:ne()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:ne()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",Ye,Xe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":Q()}],"scroll-mx":[{"scroll-mx":Q()}],"scroll-my":[{"scroll-my":Q()}],"scroll-ms":[{"scroll-ms":Q()}],"scroll-me":[{"scroll-me":Q()}],"scroll-mt":[{"scroll-mt":Q()}],"scroll-mr":[{"scroll-mr":Q()}],"scroll-mb":[{"scroll-mb":Q()}],"scroll-ml":[{"scroll-ml":Q()}],"scroll-p":[{"scroll-p":Q()}],"scroll-px":[{"scroll-px":Q()}],"scroll-py":[{"scroll-py":Q()}],"scroll-ps":[{"scroll-ps":Q()}],"scroll-pe":[{"scroll-pe":Q()}],"scroll-pt":[{"scroll-pt":Q()}],"scroll-pr":[{"scroll-pr":Q()}],"scroll-pb":[{"scroll-pb":Q()}],"scroll-pl":[{"scroll-pl":Q()}],"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",Ye,Xe]}],fill:[{fill:["none",...ne()]}],"stroke-w":[{stroke:[At,Ah,Yo,Sy]}],stroke:[{stroke:["none",...ne()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},e$=DQ(JQ);function ye(...t){return e$(d9(t))}const yt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("rounded-xl border bg-card text-card-foreground shadow",t),...e}));yt.displayName="Card";const Jt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("flex flex-col space-y-1.5 p-6",t),...e}));Jt.displayName="CardHeader";const en=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("font-semibold leading-none tracking-tight",t),...e}));en.displayName="CardTitle";const Sr=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Sr.displayName="CardDescription";const vn=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("p-6 pt-0",t),...e}));vn.displayName="CardContent";const bC=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("flex items-center p-6 pt-0",t),...e}));bC.displayName="CardFooter";var ky="rovingFocusGroup.onEntryFocus",t$={bubbles:!1,cancelable:!0},t0="RovingFocusGroup",[l2,wC,n$]=tx(t0),[r$,fx]=Hi(t0,[n$]),[s$,i$]=r$(t0),SC=S.forwardRef((t,e)=>a.jsx(l2.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(l2.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(a$,{...t,ref:e})})}));SC.displayName=t0;var a$=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:h,preventScrollOnEntryFocus:m=!1,...p}=t,x=S.useRef(null),v=Cn(e,x),b=Vf(i),[k,O]=So({prop:l,defaultProp:c??null,onChange:d,caller:t0}),[j,T]=S.useState(!1),M=es(h),_=wC(n),D=S.useRef(!1),[E,z]=S.useState(0);return S.useEffect(()=>{const Q=x.current;if(Q)return Q.addEventListener(ky,M),()=>Q.removeEventListener(ky,M)},[M]),a.jsx(s$,{scope:n,orientation:r,dir:b,loop:s,currentTabStopId:k,onItemFocus:S.useCallback(Q=>O(Q),[O]),onItemShiftTab:S.useCallback(()=>T(!0),[]),onFocusableItemAdd:S.useCallback(()=>z(Q=>Q+1),[]),onFocusableItemRemove:S.useCallback(()=>z(Q=>Q-1),[]),children:a.jsx(Yt.div,{tabIndex:j||E===0?-1:0,"data-orientation":r,...p,ref:v,style:{outline:"none",...t.style},onMouseDown:$e(t.onMouseDown,()=>{D.current=!0}),onFocus:$e(t.onFocus,Q=>{const F=!D.current;if(Q.target===Q.currentTarget&&F&&!j){const B=new CustomEvent(ky,t$);if(Q.currentTarget.dispatchEvent(B),!B.defaultPrevented){const U=_().filter(H=>H.focusable),V=U.find(H=>H.active),ce=U.find(H=>H.id===k),J=[V,ce,...U].filter(Boolean).map(H=>H.ref.current);jC(J,m)}}D.current=!1}),onBlur:$e(t.onBlur,()=>T(!1))})})}),kC="RovingFocusGroupItem",OC=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:l,...c}=t,d=Oi(),h=i||d,m=i$(kC,n),p=m.currentTabStopId===h,x=wC(n),{onFocusableItemAdd:v,onFocusableItemRemove:b,currentTabStopId:k}=m;return S.useEffect(()=>{if(r)return v(),()=>b()},[r,v,b]),a.jsx(l2.ItemSlot,{scope:n,id:h,focusable:r,active:s,children:a.jsx(Yt.span,{tabIndex:p?0:-1,"data-orientation":m.orientation,...c,ref:e,onMouseDown:$e(t.onMouseDown,O=>{r?m.onItemFocus(h):O.preventDefault()}),onFocus:$e(t.onFocus,()=>m.onItemFocus(h)),onKeyDown:$e(t.onKeyDown,O=>{if(O.key==="Tab"&&O.shiftKey){m.onItemShiftTab();return}if(O.target!==O.currentTarget)return;const j=c$(O,m.orientation,m.dir);if(j!==void 0){if(O.metaKey||O.ctrlKey||O.altKey||O.shiftKey)return;O.preventDefault();let M=x().filter(_=>_.focusable).map(_=>_.ref.current);if(j==="last")M.reverse();else if(j==="prev"||j==="next"){j==="prev"&&M.reverse();const _=M.indexOf(O.currentTarget);M=m.loop?u$(M,_+1):M.slice(_+1)}setTimeout(()=>jC(M))}}),children:typeof l=="function"?l({isCurrentTabStop:p,hasTabStop:k!=null}):l})})});OC.displayName=kC;var l$={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function o$(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function c$(t,e,n){const r=o$(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return l$[r]}function jC(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function u$(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var NC=SC,CC=OC,mx="Tabs",[d$]=Hi(mx,[fx]),TC=fx(),[h$,sw]=d$(mx),MC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:l="horizontal",dir:c,activationMode:d="automatic",...h}=t,m=Vf(c),[p,x]=So({prop:r,onChange:s,defaultProp:i??"",caller:mx});return a.jsx(h$,{scope:n,baseId:Oi(),value:p,onValueChange:x,orientation:l,dir:m,activationMode:d,children:a.jsx(Yt.div,{dir:m,"data-orientation":l,...h,ref:e})})});MC.displayName=mx;var AC="TabsList",EC=S.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=sw(AC,n),l=TC(n);return a.jsx(NC,{asChild:!0,...l,orientation:i.orientation,dir:i.dir,loop:r,children:a.jsx(Yt.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});EC.displayName=AC;var _C="TabsTrigger",DC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,l=sw(_C,n),c=TC(n),d=PC(l.baseId,r),h=LC(l.baseId,r),m=r===l.value;return a.jsx(CC,{asChild:!0,...c,focusable:!s,active:m,children:a.jsx(Yt.button,{type:"button",role:"tab","aria-selected":m,"aria-controls":h,"data-state":m?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:d,...i,ref:e,onMouseDown:$e(t.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?l.onValueChange(r):p.preventDefault()}),onKeyDown:$e(t.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&l.onValueChange(r)}),onFocus:$e(t.onFocus,()=>{const p=l.activationMode!=="manual";!m&&!s&&p&&l.onValueChange(r)})})})});DC.displayName=_C;var RC="TabsContent",zC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...l}=t,c=sw(RC,n),d=PC(c.baseId,r),h=LC(c.baseId,r),m=r===c.value,p=S.useRef(m);return S.useEffect(()=>{const x=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(x)},[]),a.jsx(Ls,{present:s||m,children:({present:x})=>a.jsx(Yt.div,{"data-state":m?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":d,hidden:!x,id:h,tabIndex:0,...l,ref:e,style:{...t.style,animationDuration:p.current?"0s":void 0},children:x&&i})})});zC.displayName=RC;function PC(t,e){return`${t}-trigger-${e}`}function LC(t,e){return`${t}-content-${e}`}var f$=MC,BC=EC,IC=DC,qC=zC;const dl=f$,va=S.forwardRef(({className:t,...e},n)=>a.jsx(BC,{ref:n,className:ye("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));va.displayName=BC.displayName;const $t=S.forwardRef(({className:t,...e},n)=>a.jsx(IC,{ref:n,className:ye("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));$t.displayName=IC.displayName;const kn=S.forwardRef(({className:t,...e},n)=>a.jsx(qC,{ref:n,className:ye("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",t),...e}));kn.displayName=qC.displayName;function m$(t,e){return S.useReducer((n,r)=>e[n][r]??n,t)}var iw="ScrollArea",[FC]=Hi(iw),[p$,Ai]=FC(iw),QC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...l}=t,[c,d]=S.useState(null),[h,m]=S.useState(null),[p,x]=S.useState(null),[v,b]=S.useState(null),[k,O]=S.useState(null),[j,T]=S.useState(0),[M,_]=S.useState(0),[D,E]=S.useState(!1),[z,Q]=S.useState(!1),F=Cn(e,U=>d(U)),B=Vf(s);return a.jsx(p$,{scope:n,type:r,dir:B,scrollHideDelay:i,scrollArea:c,viewport:h,onViewportChange:m,content:p,onContentChange:x,scrollbarX:v,onScrollbarXChange:b,scrollbarXEnabled:D,onScrollbarXEnabledChange:E,scrollbarY:k,onScrollbarYChange:O,scrollbarYEnabled:z,onScrollbarYEnabledChange:Q,onCornerWidthChange:T,onCornerHeightChange:_,children:a.jsx(Yt.div,{dir:B,...l,ref:F,style:{position:"relative","--radix-scroll-area-corner-width":j+"px","--radix-scroll-area-corner-height":M+"px",...t.style}})})});QC.displayName=iw;var $C="ScrollAreaViewport",HC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,l=Ai($C,n),c=S.useRef(null),d=Cn(e,c,l.onViewportChange);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),a.jsx(Yt.div,{"data-radix-scroll-area-viewport":"",...i,ref:d,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:a.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});HC.displayName=$C;var wa="ScrollAreaScrollbar",aw=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ai(wa,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:l}=s,c=t.orientation==="horizontal";return S.useEffect(()=>(c?i(!0):l(!0),()=>{c?i(!1):l(!1)}),[c,i,l]),s.type==="hover"?a.jsx(g$,{...r,ref:e,forceMount:n}):s.type==="scroll"?a.jsx(x$,{...r,ref:e,forceMount:n}):s.type==="auto"?a.jsx(UC,{...r,ref:e,forceMount:n}):s.type==="always"?a.jsx(lw,{...r,ref:e}):null});aw.displayName=wa;var g$=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ai(wa,t.__scopeScrollArea),[i,l]=S.useState(!1);return S.useEffect(()=>{const c=s.scrollArea;let d=0;if(c){const h=()=>{window.clearTimeout(d),l(!0)},m=()=>{d=window.setTimeout(()=>l(!1),s.scrollHideDelay)};return c.addEventListener("pointerenter",h),c.addEventListener("pointerleave",m),()=>{window.clearTimeout(d),c.removeEventListener("pointerenter",h),c.removeEventListener("pointerleave",m)}}},[s.scrollArea,s.scrollHideDelay]),a.jsx(Ls,{present:n||i,children:a.jsx(UC,{"data-state":i?"visible":"hidden",...r,ref:e})})}),x$=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ai(wa,t.__scopeScrollArea),i=t.orientation==="horizontal",l=gx(()=>d("SCROLL_END"),100),[c,d]=m$("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return S.useEffect(()=>{if(c==="idle"){const h=window.setTimeout(()=>d("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(h)}},[c,s.scrollHideDelay,d]),S.useEffect(()=>{const h=s.viewport,m=i?"scrollLeft":"scrollTop";if(h){let p=h[m];const x=()=>{const v=h[m];p!==v&&(d("SCROLL"),l()),p=v};return h.addEventListener("scroll",x),()=>h.removeEventListener("scroll",x)}},[s.viewport,i,d,l]),a.jsx(Ls,{present:n||c!=="hidden",children:a.jsx(lw,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:$e(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:$e(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),UC=S.forwardRef((t,e)=>{const n=Ai(wa,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,l]=S.useState(!1),c=t.orientation==="horizontal",d=gx(()=>{if(n.viewport){const h=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,s=Ai(wa,t.__scopeScrollArea),i=S.useRef(null),l=S.useRef(0),[c,d]=S.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=YC(c.viewport,c.content),m={...r,sizes:c,onSizesChange:d,hasThumb:h>0&&h<1,onThumbChange:x=>i.current=x,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:x=>l.current=x};function p(x,v){return k$(x,l.current,c,v)}return n==="horizontal"?a.jsx(v$,{...m,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const x=s.viewport.scrollLeft,v=IO(x,c,s.dir);i.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollLeft=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollLeft=p(x,s.dir))}}):n==="vertical"?a.jsx(y$,{...m,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const x=s.viewport.scrollTop,v=IO(x,c);i.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollTop=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollTop=p(x))}}):null}),v$=S.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Ai(wa,t.__scopeScrollArea),[l,c]=S.useState(),d=S.useRef(null),h=Cn(e,d,i.onScrollbarXChange);return S.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(WC,{"data-orientation":"horizontal",...s,ref:h,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":px(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.x),onDragScroll:m=>t.onDragScroll(m.x),onWheelScroll:(m,p)=>{if(i.viewport){const x=i.viewport.scrollLeft+m.deltaX;t.onWheelScroll(x),ZC(x,p)&&m.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:yg(l.paddingLeft),paddingEnd:yg(l.paddingRight)}})}})}),y$=S.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Ai(wa,t.__scopeScrollArea),[l,c]=S.useState(),d=S.useRef(null),h=Cn(e,d,i.onScrollbarYChange);return S.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(WC,{"data-orientation":"vertical",...s,ref:h,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":px(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.y),onDragScroll:m=>t.onDragScroll(m.y),onWheelScroll:(m,p)=>{if(i.viewport){const x=i.viewport.scrollTop+m.deltaY;t.onWheelScroll(x),ZC(x,p)&&m.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:yg(l.paddingTop),paddingEnd:yg(l.paddingBottom)}})}})}),[b$,VC]=FC(wa),WC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:l,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:h,onWheelScroll:m,onResize:p,...x}=t,v=Ai(wa,n),[b,k]=S.useState(null),O=Cn(e,F=>k(F)),j=S.useRef(null),T=S.useRef(""),M=v.viewport,_=r.content-r.viewport,D=es(m),E=es(d),z=gx(p,10);function Q(F){if(j.current){const B=F.clientX-j.current.left,U=F.clientY-j.current.top;h({x:B,y:U})}}return S.useEffect(()=>{const F=B=>{const U=B.target;b?.contains(U)&&D(B,_)};return document.addEventListener("wheel",F,{passive:!1}),()=>document.removeEventListener("wheel",F,{passive:!1})},[M,b,_,D]),S.useEffect(E,[r,E]),id(b,z),id(v.content,z),a.jsx(b$,{scope:n,scrollbar:b,hasThumb:s,onThumbChange:es(i),onThumbPointerUp:es(l),onThumbPositionChange:E,onThumbPointerDown:es(c),children:a.jsx(Yt.div,{...x,ref:O,style:{position:"absolute",...x.style},onPointerDown:$e(t.onPointerDown,F=>{F.button===0&&(F.target.setPointerCapture(F.pointerId),j.current=b.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),Q(F))}),onPointerMove:$e(t.onPointerMove,Q),onPointerUp:$e(t.onPointerUp,F=>{const B=F.target;B.hasPointerCapture(F.pointerId)&&B.releasePointerCapture(F.pointerId),document.body.style.webkitUserSelect=T.current,v.viewport&&(v.viewport.style.scrollBehavior=""),j.current=null})})})}),vg="ScrollAreaThumb",GC=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=VC(vg,t.__scopeScrollArea);return a.jsx(Ls,{present:n||s.hasThumb,children:a.jsx(w$,{ref:e,...r})})}),w$=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=Ai(vg,n),l=VC(vg,n),{onThumbPositionChange:c}=l,d=Cn(e,p=>l.onThumbChange(p)),h=S.useRef(void 0),m=gx(()=>{h.current&&(h.current(),h.current=void 0)},100);return S.useEffect(()=>{const p=i.viewport;if(p){const x=()=>{if(m(),!h.current){const v=O$(p,c);h.current=v,c()}};return c(),p.addEventListener("scroll",x),()=>p.removeEventListener("scroll",x)}},[i.viewport,m,c]),a.jsx(Yt.div,{"data-state":l.hasThumb?"visible":"hidden",...s,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:$e(t.onPointerDownCapture,p=>{const v=p.target.getBoundingClientRect(),b=p.clientX-v.left,k=p.clientY-v.top;l.onThumbPointerDown({x:b,y:k})}),onPointerUp:$e(t.onPointerUp,l.onThumbPointerUp)})});GC.displayName=vg;var ow="ScrollAreaCorner",XC=S.forwardRef((t,e)=>{const n=Ai(ow,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(S$,{...t,ref:e}):null});XC.displayName=ow;var S$=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=Ai(ow,n),[i,l]=S.useState(0),[c,d]=S.useState(0),h=!!(i&&c);return id(s.scrollbarX,()=>{const m=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(m),d(m)}),id(s.scrollbarY,()=>{const m=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(m),l(m)}),h?a.jsx(Yt.div,{...r,ref:e,style:{width:i,height:c,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function yg(t){return t?parseInt(t,10):0}function YC(t,e){const n=t/e;return isNaN(n)?0:n}function px(t){const e=YC(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function k$(t,e,n,r="ltr"){const s=px(n),i=s/2,l=e||i,c=s-l,d=n.scrollbar.paddingStart+l,h=n.scrollbar.size-n.scrollbar.paddingEnd-c,m=n.content-n.viewport,p=r==="ltr"?[0,m]:[m*-1,0];return KC([d,h],p)(t)}function IO(t,e,n="ltr"){const r=px(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,l=e.content-e.viewport,c=i-r,d=n==="ltr"?[0,l]:[l*-1,0],h=F4(t,d);return KC([0,l],[0,c])(h)}function KC(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function ZC(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function s(){const i={left:t.scrollLeft,top:t.scrollTop},l=n.left!==i.left,c=n.top!==i.top;(l||c)&&e(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function gx(t,e){const n=es(t),r=S.useRef(0);return S.useEffect(()=>()=>window.clearTimeout(r.current),[]),S.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function id(t,e){const n=es(e);h9(()=>{let r=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(t),()=>{window.cancelAnimationFrame(r),s.unobserve(t)}}},[t,n])}var JC=QC,j$=HC,N$=XC;const fn=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(JC,{ref:r,className:ye("relative overflow-hidden",t),...n,children:[a.jsx(j$,{className:"h-full w-full rounded-[inherit]",children:e}),a.jsx(eT,{}),a.jsx(N$,{})]}));fn.displayName=JC.displayName;const eT=S.forwardRef(({className:t,orientation:e="vertical",...n},r)=>a.jsx(aw,{ref:r,orientation:e,className:ye("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:a.jsx(GC,{className:"relative flex-1 rounded-full bg-border"})}));eT.displayName=aw.displayName;function qO({className:t,...e}){return a.jsx("div",{className:ye("animate-pulse rounded-md bg-primary/10",t),...e})}function C$(t,e=[]){let n=[];function r(i,l){const c=S.createContext(l);c.displayName=i+"Context";const d=n.length;n=[...n,l];const h=p=>{const{scope:x,children:v,...b}=p,k=x?.[t]?.[d]||c,O=S.useMemo(()=>b,Object.values(b));return a.jsx(k.Provider,{value:O,children:v})};h.displayName=i+"Provider";function m(p,x){const v=x?.[t]?.[d]||c,b=S.useContext(v);if(b)return b;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[h,m]}const s=()=>{const i=n.map(l=>S.createContext(l));return function(c){const d=c?.[t]||i;return S.useMemo(()=>({[`__scope${t}`]:{...c,[t]:d}}),[c,d])}};return s.scopeName=t,[r,T$(s,...e)]}function T$(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const l=r.reduce((c,{useScope:d,scopeName:h})=>{const p=d(i)[`__scope${h}`];return{...c,...p}},{});return S.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return n.scopeName=e.scopeName,n}var M$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],tT=M$.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),cw="Progress",uw=100,[A$]=C$(cw),[E$,_$]=A$(cw),nT=S.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=D$,...l}=t;(s||s===0)&&!FO(s)&&console.error(R$(`${s}`,"Progress"));const c=FO(s)?s:uw;r!==null&&!QO(r,c)&&console.error(z$(`${r}`,"Progress"));const d=QO(r,c)?r:null,h=bg(d)?i(d,c):void 0;return a.jsx(E$,{scope:n,value:d,max:c,children:a.jsx(tT.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":bg(d)?d:void 0,"aria-valuetext":h,role:"progressbar","data-state":iT(d,c),"data-value":d??void 0,"data-max":c,...l,ref:e})})});nT.displayName=cw;var rT="ProgressIndicator",sT=S.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=_$(rT,n);return a.jsx(tT.div,{"data-state":iT(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});sT.displayName=rT;function D$(t,e){return`${Math.round(t/e*100)}%`}function iT(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function bg(t){return typeof t=="number"}function FO(t){return bg(t)&&!isNaN(t)&&t>0}function QO(t,e){return bg(t)&&!isNaN(t)&&t<=e&&t>=0}function R$(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${uw}\`.`}function z$(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: + - a positive number + - less than the value passed to \`max\` (or ${uw} if no \`max\` prop is set) + - \`null\` or \`undefined\` if the progress is indeterminate. + +Defaulting to \`null\`.`}var aT=nT,P$=sT;const n0=S.forwardRef(({className:t,value:e,...n},r)=>a.jsx(aT,{ref:r,className:ye("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:a.jsx(P$,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));n0.displayName=aT.displayName;const L$={light:"",dark:".dark"},lT=S.createContext(null);function oT(){const t=S.useContext(lT);if(!t)throw new Error("useChart must be used within a ");return t}const Eu=S.forwardRef(({id:t,className:e,children:n,config:r,...s},i)=>{const l=S.useId(),c=`chart-${t||l.replace(/:/g,"")}`;return a.jsx(lT.Provider,{value:{config:r},children:a.jsxs("div",{"data-chart":c,ref:i,className:ye("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",e),...s,children:[a.jsx(B$,{id:c,config:r}),a.jsx(BI,{children:n})]})})});Eu.displayName="Chart";const B$=({id:t,config:e})=>{const n=Object.entries(e).filter(([,r])=>r.theme||r.color);return n.length?a.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(L$).map(([r,s])=>` +${s} [data-chart=${t}] { +${n.map(([i,l])=>{const c=l.theme?.[r]||l.color;return c?` --color-${i}: ${c};`:null}).join(` +`)} +} +`).join(` +`)}}):null},Eh=II,_u=S.forwardRef(({active:t,payload:e,className:n,indicator:r="dot",hideLabel:s=!1,hideIndicator:i=!1,label:l,labelFormatter:c,labelClassName:d,formatter:h,color:m,nameKey:p,labelKey:x},v)=>{const{config:b}=oT(),k=S.useMemo(()=>{if(s||!e?.length)return null;const[j]=e,T=`${x||j?.dataKey||j?.name||"value"}`,M=o2(b,j,T),_=!x&&typeof l=="string"?b[l]?.label||l:M?.label;return c?a.jsx("div",{className:ye("font-medium",d),children:c(_,e)}):_?a.jsx("div",{className:ye("font-medium",d),children:_}):null},[l,c,e,s,d,b,x]);if(!t||!e?.length)return null;const O=e.length===1&&r!=="dot";return a.jsxs("div",{ref:v,className:ye("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[O?null:k,a.jsx("div",{className:"grid gap-1.5",children:e.filter(j=>j.type!=="none").map((j,T)=>{const M=`${p||j.name||j.dataKey||"value"}`,_=o2(b,j,M),D=m||j.payload.fill||j.color;return a.jsx("div",{className:ye("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",r==="dot"&&"items-center"),children:h&&j?.value!==void 0&&j.name?h(j.value,j.name,j,T,j.payload):a.jsxs(a.Fragment,{children:[_?.icon?a.jsx(_.icon,{}):!i&&a.jsx("div",{className:ye("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":O&&r==="dashed"}),style:{"--color-bg":D,"--color-border":D}}),a.jsxs("div",{className:ye("flex flex-1 justify-between leading-none",O?"items-end":"items-center"),children:[a.jsxs("div",{className:"grid gap-1.5",children:[O?k:null,a.jsx("span",{className:"text-muted-foreground",children:_?.label||j.name})]}),j.value&&a.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:j.value.toLocaleString()})]})]})},j.dataKey)})})]})});_u.displayName="ChartTooltip";const I$=qI,cT=S.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:s},i)=>{const{config:l}=oT();return n?.length?a.jsx("div",{ref:i,className:ye("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.filter(c=>c.type!=="none").map(c=>{const d=`${s||c.dataKey||"value"}`,h=o2(l,c,d);return a.jsxs("div",{className:ye("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[h?.icon&&!e?a.jsx(h.icon,{}):a.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:c.color}}),h?.label]},c.value)})}):null});cT.displayName="ChartLegend";function o2(t,e,n){if(typeof e!="object"||e===null)return;const r="payload"in e&&typeof e.payload=="object"&&e.payload!==null?e.payload:void 0;let s=n;return n in e&&typeof e[n]=="string"?s=e[n]:r&&n in r&&typeof r[n]=="string"&&(s=r[n]),s in t?t[s]:t[n]}const $O=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,HO=d9,Nd=(t,e)=>n=>{var r;if(e?.variants==null)return HO(t,n?.class,n?.className);const{variants:s,defaultVariants:i}=e,l=Object.keys(s).map(h=>{const m=n?.[h],p=i?.[h];if(m===null)return null;const x=$O(m)||$O(p);return s[h][x]}),c=n&&Object.entries(n).reduce((h,m)=>{let[p,x]=m;return x===void 0||(h[p]=x),h},{}),d=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,m)=>{let{class:p,className:x,...v}=m;return Object.entries(v).every(b=>{let[k,O]=b;return Array.isArray(O)?O.includes({...i,...c}[k]):{...i,...c}[k]===O})?[...h,p,x]:h},[]);return HO(t,l,d,n?.class,n?.className)},ff=Nd("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ie=S.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const l=r?GI:"button";return a.jsx(l,{className:ye(ff({variant:e,size:n,className:t})),ref:i,...s})});ie.displayName="Button";function q$(){const[t,e]=S.useState(null),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(24),[d,h]=S.useState(!0),[m,p]=S.useState(null),[x,v]=S.useState(!0),b=S.useCallback(async()=>{try{v(!0);const F=await Zn.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");p({hitokoto:F.data.hitokoto,from:F.data.from||F.data.from_who||"未知"})}catch(F){console.error("获取一言失败:",F),p({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{v(!1)}},[]),k=S.useCallback(async()=>{try{const F=localStorage.getItem("access-token"),B=await Zn.get(`/api/webui/statistics/dashboard?hours=${l}`,{headers:{Authorization:`Bearer ${F}`}});e(B.data),r(!1),i(100)}catch(F){console.error("Failed to fetch dashboard data:",F),r(!1),i(100)}},[l]);if(S.useEffect(()=>{if(!n)return;i(0);const F=setTimeout(()=>i(15),200),B=setTimeout(()=>i(30),800),U=setTimeout(()=>i(45),2e3),V=setTimeout(()=>i(60),4e3),ce=setTimeout(()=>i(75),6500),W=setTimeout(()=>i(85),9e3),J=setTimeout(()=>i(92),11e3);return()=>{clearTimeout(F),clearTimeout(B),clearTimeout(U),clearTimeout(V),clearTimeout(ce),clearTimeout(W),clearTimeout(J)}},[n]),S.useEffect(()=>{k(),b()},[k,b]),S.useEffect(()=>{if(!d)return;const F=setInterval(()=>{k()},3e4);return()=>clearInterval(F)},[d,k]),n||!t)return a.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:a.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[a.jsx(Ii,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(n0,{value:s,className:"h-2"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[s,"%"]})]})]})});const{summary:O,model_stats:j,hourly_data:T,daily_data:M,recent_activity:_}=t,D=F=>{const B=Math.floor(F/3600),U=Math.floor(F%3600/60);return`${B}小时${U}分钟`},E=F=>new Date(F).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),z=j.slice(0,6).map(F=>({name:F.model_name,value:F.request_count,fill:`hsl(var(--chart-${j.indexOf(F)%5+1}))`})),Q={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return a.jsx(fn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(dl,{value:l.toString(),onValueChange:F=>c(Number(F)),children:a.jsxs(va,{className:"grid grid-cols-3 w-full sm:w-auto",children:[a.jsx($t,{value:"24",children:"24小时"}),a.jsx($t,{value:"168",children:"7天"}),a.jsx($t,{value:"720",children:"30天"})]})}),a.jsxs(ie,{variant:d?"default":"outline",size:"sm",onClick:()=>h(!d),className:"gap-2",children:[a.jsx(Ii,{className:`h-4 w-4 ${d?"animate-spin":""}`}),a.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:k,children:a.jsx(Ii,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"总请求数"}),a.jsx(lq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(vn,{children:[a.jsx("div",{className:"text-2xl font-bold",children:O.total_requests.toLocaleString()}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",l<48?l+"小时":Math.floor(l/24)+"天"]})]})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"总花费"}),a.jsx(oq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(vn,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:["¥",O.total_cost.toFixed(2)]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:O.cost_per_hour>0?`¥${O.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"Token消耗"}),a.jsx(cq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(vn,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:[(O.total_tokens/1e3).toFixed(1),"K"]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:O.tokens_per_hour>0?`${(O.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"平均响应"}),a.jsx(uf,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(vn,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:[O.avg_response_time.toFixed(2),"s"]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"在线时长"}),a.jsx(uc,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsx(vn,{children:a.jsx("div",{className:"text-xl font-bold",children:D(O.online_time)})})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"消息处理"}),a.jsx(Wf,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(vn,{children:[a.jsx("div",{className:"text-xl font-bold",children:O.total_messages.toLocaleString()}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",O.total_replies.toLocaleString()," 条"]})]})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"成本效率"}),a.jsx(uq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(vn,{children:[a.jsx("div",{className:"text-xl font-bold",children:O.total_messages>0?`¥${(O.total_cost/O.total_messages*100).toFixed(2)}`:"¥0.00"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),a.jsxs(dl,{defaultValue:"trends",className:"space-y-4",children:[a.jsxs(va,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[a.jsx($t,{value:"trends",children:"趋势"}),a.jsx($t,{value:"models",children:"模型"}),a.jsx($t,{value:"activity",children:"活动"}),a.jsx($t,{value:"daily",children:"日统计"})]}),a.jsxs(kn,{value:"trends",className:"space-y-4",children:[a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"请求趋势"}),a.jsxs(Sr,{children:["最近",l,"小时的请求量变化"]})]}),a.jsx(vn,{children:a.jsx(Eu,{config:Q,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:a.jsxs(FI,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(QI,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"花费趋势"}),a.jsx(Sr,{children:"API调用成本变化"})]}),a.jsx(vn,{children:a.jsx(Eu,{config:Q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:a.jsxs(fy,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(Gm,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"Token消耗"}),a.jsx(Sr,{children:"Token使用量变化"})]}),a.jsx(vn,{children:a.jsx(Eu,{config:Q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:a.jsxs(fy,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(Gm,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),a.jsx(kn,{value:"models",className:"space-y-4",children:a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"模型请求分布"}),a.jsx(Sr,{children:"各模型使用占比"})]}),a.jsx(vn,{children:a.jsx(Eu,{config:Object.fromEntries(j.slice(0,6).map((F,B)=>[F.model_name,{label:F.model_name,color:`hsl(var(--chart-${B%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:a.jsxs($I,{children:[a.jsx(Eh,{content:a.jsx(_u,{})}),a.jsx(HI,{data:z,cx:"50%",cy:"50%",labelLine:!1,label:({name:F,percent:B})=>`${F} ${B?(B*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:z.map((F,B)=>a.jsx(UI,{fill:F.fill},`cell-${B}`))})]})})})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"模型详细统计"}),a.jsx(Sr,{children:"请求数、花费和性能"})]}),a.jsx(vn,{children:a.jsx(fn,{className:"h-[300px] sm:h-[400px]",children:a.jsx("div",{className:"space-y-3",children:j.map((F,B)=>a.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:F.model_name}),a.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${B%5+1}))`}})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),a.jsx("span",{className:"ml-1 font-medium",children:F.request_count.toLocaleString()})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"花费:"}),a.jsxs("span",{className:"ml-1 font-medium",children:["¥",F.total_cost.toFixed(2)]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),a.jsxs("span",{className:"ml-1 font-medium",children:[(F.total_tokens/1e3).toFixed(1),"K"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),a.jsxs("span",{className:"ml-1 font-medium",children:[F.avg_response_time.toFixed(2),"s"]})]})]})]},B))})})})]})]})}),a.jsx(kn,{value:"activity",children:a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"最近活动"}),a.jsx(Sr,{children:"最新的API调用记录"})]}),a.jsx(vn,{children:a.jsx(fn,{className:"h-[400px] sm:h-[500px]",children:a.jsx("div",{className:"space-y-2",children:_.map((F,B)=>a.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium text-sm truncate",children:F.model}),a.jsx("div",{className:"text-xs text-muted-foreground",children:F.request_type})]}),a.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:E(F.timestamp)})]}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),a.jsx("span",{className:"ml-1",children:F.tokens})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"花费:"}),a.jsxs("span",{className:"ml-1",children:["¥",F.cost.toFixed(4)]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),a.jsxs("span",{className:"ml-1",children:[F.time_cost.toFixed(2),"s"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"状态:"}),a.jsx("span",{className:`ml-1 ${F.status==="success"?"text-green-600":"text-red-600"}`,children:F.status})]})]})]},B))})})})]})}),a.jsx(kn,{value:"daily",children:a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"每日统计"}),a.jsx(Sr,{children:"最近7天的数据汇总"})]}),a.jsx(vn,{children:a.jsx(Eu,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:a.jsxs(fy,{data:M,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>{const B=new Date(F);return`${B.getMonth()+1}/${B.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>new Date(F).toLocaleDateString("zh-CN")})}),a.jsx(I$,{content:a.jsx(cT,{})}),a.jsx(Gm,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),a.jsx(Gm,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),a.jsxs(yt,{className:"border-2 border-primary/20",children:[a.jsx(Jt,{className:"pb-3",children:a.jsx(en,{className:"text-lg",children:"每日一言"})}),a.jsx(vn,{children:x?a.jsxs("div",{className:"space-y-2",children:[a.jsx(qO,{className:"h-6 w-3/4"}),a.jsx(qO,{className:"h-4 w-1/4"})]}):m?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("p",{className:"text-lg font-medium leading-relaxed italic",children:['"',m.hitokoto,'"']}),a.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["—— ",m.from]})]}):null})]})]})})}const F$={theme:"system",setTheme:()=>null},uT=S.createContext(F$),dw=()=>{const t=S.useContext(uT);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},Q$=(t,e,n)=>{const r=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||r){e(t);return}const s=n.clientX,i=n.clientY,l=Math.hypot(Math.max(s,innerWidth-s),Math.max(i,innerHeight-i));document.startViewTransition(()=>{e(t)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${s}px ${i}px)`,`circle(${l}px at ${s}px ${i}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},dT=S.createContext(void 0),hT=()=>{const t=S.useContext(dT);if(t===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return t};var xx="Switch",[$$]=Hi(xx),[H$,U$]=$$(xx),fT=S.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:l,disabled:c,value:d="on",onCheckedChange:h,form:m,...p}=t,[x,v]=S.useState(null),b=Cn(e,M=>v(M)),k=S.useRef(!1),O=x?m||!!x.closest("form"):!0,[j,T]=So({prop:s,defaultProp:i??!1,onChange:h,caller:xx});return a.jsxs(H$,{scope:n,checked:j,disabled:c,children:[a.jsx(Yt.button,{type:"button",role:"switch","aria-checked":j,"aria-required":l,"data-state":xT(j),"data-disabled":c?"":void 0,disabled:c,value:d,...p,ref:b,onClick:$e(t.onClick,M=>{T(_=>!_),O&&(k.current=M.isPropagationStopped(),k.current||M.stopPropagation())})}),O&&a.jsx(gT,{control:x,bubbles:!k.current,name:r,value:d,checked:j,required:l,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});fT.displayName=xx;var mT="SwitchThumb",pT=S.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=U$(mT,n);return a.jsx(Yt.span,{"data-state":xT(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});pT.displayName=mT;var V$="SwitchBubbleInput",gT=S.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const l=S.useRef(null),c=Cn(l,i),d=f9(n),h=m9(e);return S.useEffect(()=>{const m=l.current;if(!m)return;const p=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(p,"checked").set;if(d!==n&&v){const b=new Event("click",{bubbles:r});v.call(m,n),m.dispatchEvent(b)}},[d,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:c,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});gT.displayName=V$;function xT(t){return t?"checked":"unchecked"}var vT=fT,W$=pT;const jt=S.forwardRef(({className:t,...e},n)=>a.jsx(vT,{className:ye("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:a.jsx(W$,{className:ye("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));jt.displayName=vT.displayName;const G$=Nd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),te=S.forwardRef(({className:t,...e},n)=>a.jsx(p9,{ref:n,className:ye(G$(),t),...e}));te.displayName=p9.displayName;const Ae=S.forwardRef(({className:t,type:e,...n},r)=>a.jsx("input",{type:e,className:ye("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Ae.displayName="Input";const X$=1,Y$=1e6;let Oy=0;function K$(){return Oy=(Oy+1)%Number.MAX_SAFE_INTEGER,Oy.toString()}const jy=new Map,UO=t=>{if(jy.has(t))return;const e=setTimeout(()=>{jy.delete(t),Kh({type:"REMOVE_TOAST",toastId:t})},Y$);jy.set(t,e)},Z$=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,X$)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?UO(n):t.toasts.forEach(r=>{UO(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},Vp=[];let Wp={toasts:[]};function Kh(t){Wp=Z$(Wp,t),Vp.forEach(e=>{e(Wp)})}function J$({...t}){const e=K$(),n=s=>Kh({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>Kh({type:"DISMISS_TOAST",toastId:e});return Kh({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function Pr(){const[t,e]=S.useState(Wp);return S.useEffect(()=>(Vp.push(e),()=>{const n=Vp.indexOf(e);n>-1&&Vp.splice(n,1)}),[t]),{...t,toast:J$,dismiss:n=>Kh({type:"DISMISS_TOAST",toastId:n})}}const eH=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:t=>t.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:t=>/[A-Z]/.test(t)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:t=>/[a-z]/.test(t)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:t=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(t)}];function tH(t){const e=eH.map(r=>({id:r.id,label:r.label,description:r.description,passed:r.validate(t)}));return{isValid:e.every(r=>r.passed),rules:e}}const hw="0.11.5",fw="MaiBot Dashboard",nH=`${fw} v${hw}`,rH=(t="v")=>`${t}${hw}`,Rr=W4,mw=g9,sH=$4,yT=S.forwardRef(({className:t,...e},n)=>a.jsx(nx,{ref:n,className:ye("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));yT.displayName=nx.displayName;const Nr=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(sH,{children:[a.jsx(yT,{}),a.jsxs(rx,{ref:r,className:ye("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[e,a.jsxs(H4,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(Gf,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Nr.displayName=rx.displayName;const Cr=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Cr.displayName="DialogHeader";const ps=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ps.displayName="DialogFooter";const Tr=S.forwardRef(({className:t,...e},n)=>a.jsx(U4,{ref:n,className:ye("text-lg font-semibold leading-none tracking-tight",t),...e}));Tr.displayName=U4.displayName;const Gr=S.forwardRef(({className:t,...e},n)=>a.jsx(V4,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Gr.displayName=V4.displayName;var iH=Symbol("radix.slottable");function aH(t){const e=({children:n})=>a.jsx(a.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=iH,e}var bT="AlertDialog",[lH]=Hi(bT,[x9]),yl=x9(),wT=t=>{const{__scopeAlertDialog:e,...n}=t,r=yl(e);return a.jsx(W4,{...r,...n,modal:!0})};wT.displayName=bT;var oH="AlertDialogTrigger",ST=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return a.jsx(g9,{...s,...r,ref:e})});ST.displayName=oH;var cH="AlertDialogPortal",kT=t=>{const{__scopeAlertDialog:e,...n}=t,r=yl(e);return a.jsx($4,{...r,...n})};kT.displayName=cH;var uH="AlertDialogOverlay",OT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return a.jsx(nx,{...s,...r,ref:e})});OT.displayName=uH;var Uu="AlertDialogContent",[dH,hH]=lH(Uu),fH=aH("AlertDialogContent"),jT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=yl(n),l=S.useRef(null),c=Cn(e,l),d=S.useRef(null);return a.jsx(XI,{contentName:Uu,titleName:NT,docsSlug:"alert-dialog",children:a.jsx(dH,{scope:n,cancelRef:d,children:a.jsxs(rx,{role:"alertdialog",...i,...s,ref:c,onOpenAutoFocus:$e(s.onOpenAutoFocus,h=>{h.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:[a.jsx(fH,{children:r}),a.jsx(pH,{contentRef:l})]})})})});jT.displayName=Uu;var NT="AlertDialogTitle",CT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return a.jsx(U4,{...s,...r,ref:e})});CT.displayName=NT;var TT="AlertDialogDescription",MT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return a.jsx(V4,{...s,...r,ref:e})});MT.displayName=TT;var mH="AlertDialogAction",AT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return a.jsx(H4,{...s,...r,ref:e})});AT.displayName=mH;var ET="AlertDialogCancel",_T=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=hH(ET,n),i=yl(n),l=Cn(e,s);return a.jsx(H4,{...i,...r,ref:l})});_T.displayName=ET;var pH=({contentRef:t})=>{const e=`\`${Uu}\` requires a description for the component to be accessible for screen reader users. + +You can add a description to the \`${Uu}\` by passing a \`${TT}\` component as a child, which also benefits sighted users by adding visible context to the dialog. + +Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Uu}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. + +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return S.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},gH=wT,xH=ST,vH=kT,DT=OT,RT=jT,zT=AT,PT=_T,LT=CT,BT=MT;const mn=gH,jr=xH,yH=vH,IT=S.forwardRef(({className:t,...e},n)=>a.jsx(DT,{className:ye("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));IT.displayName=DT.displayName;const an=S.forwardRef(({className:t,...e},n)=>a.jsxs(yH,{children:[a.jsx(IT,{}),a.jsx(RT,{ref:n,className:ye("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));an.displayName=RT.displayName;const ln=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col space-y-2 text-center sm:text-left",t),...e});ln.displayName="AlertDialogHeader";const on=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});on.displayName="AlertDialogFooter";const cn=S.forwardRef(({className:t,...e},n)=>a.jsx(LT,{ref:n,className:ye("text-lg font-semibold",t),...e}));cn.displayName=LT.displayName;const un=S.forwardRef(({className:t,...e},n)=>a.jsx(BT,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));un.displayName=BT.displayName;const dn=S.forwardRef(({className:t,...e},n)=>a.jsx(zT,{ref:n,className:ye(ff(),t),...e}));dn.displayName=zT.displayName;const hn=S.forwardRef(({className:t,...e},n)=>a.jsx(PT,{ref:n,className:ye(ff({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));hn.displayName=PT.displayName;function bH(){return a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),a.jsxs(dl,{defaultValue:"appearance",className:"w-full",children:[a.jsxs(va,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[a.jsxs($t,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(_9,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"外观"})]}),a.jsxs($t,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(dq,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"安全"})]}),a.jsxs($t,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(dc,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"其他"})]}),a.jsxs($t,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(oo,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"关于"})]})]}),a.jsxs(fn,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[a.jsx(kn,{value:"appearance",className:"mt-0",children:a.jsx(wH,{})}),a.jsx(kn,{value:"security",className:"mt-0",children:a.jsx(SH,{})}),a.jsx(kn,{value:"other",className:"mt-0",children:a.jsx(kH,{})}),a.jsx(kn,{value:"about",className:"mt-0",children:a.jsx(OH,{})})]})]})]})}function VO(t){const e=document.documentElement,r={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[t];if(r)e.style.setProperty("--primary",r.hsl),r.gradient?(e.style.setProperty("--primary-gradient",r.gradient),e.classList.add("has-gradient")):(e.style.removeProperty("--primary-gradient"),e.classList.remove("has-gradient"));else if(t.startsWith("#")){const s=i=>{i=i.replace("#","");const l=parseInt(i.substring(0,2),16)/255,c=parseInt(i.substring(2,4),16)/255,d=parseInt(i.substring(4,6),16)/255,h=Math.max(l,c,d),m=Math.min(l,c,d);let p=0,x=0;const v=(h+m)/2;if(h!==m){const b=h-m;switch(x=v>.5?b/(2-h-m):b/(h+m),h){case l:p=((c-d)/b+(clocalStorage.getItem("accent-color")||"blue");S.useEffect(()=>{const h=localStorage.getItem("accent-color")||"blue";VO(h)},[]);const d=h=>{c(h),localStorage.setItem("accent-color",h),VO(h)};return a.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[a.jsx(Ny,{value:"light",current:t,onChange:e,label:"浅色",description:"始终使用浅色主题"}),a.jsx(Ny,{value:"dark",current:t,onChange:e,label:"深色",description:"始终使用深色主题"}),a.jsx(Ny,{value:"system",current:t,onChange:e,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),a.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[a.jsx(xi,{value:"blue",current:l,onChange:d,label:"蓝色",colorClass:"bg-blue-500"}),a.jsx(xi,{value:"purple",current:l,onChange:d,label:"紫色",colorClass:"bg-purple-500"}),a.jsx(xi,{value:"green",current:l,onChange:d,label:"绿色",colorClass:"bg-green-500"}),a.jsx(xi,{value:"orange",current:l,onChange:d,label:"橙色",colorClass:"bg-orange-500"}),a.jsx(xi,{value:"pink",current:l,onChange:d,label:"粉色",colorClass:"bg-pink-500"}),a.jsx(xi,{value:"red",current:l,onChange:d,label:"红色",colorClass:"bg-red-500"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),a.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[a.jsx(xi,{value:"gradient-sunset",current:l,onChange:d,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),a.jsx(xi,{value:"gradient-ocean",current:l,onChange:d,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),a.jsx(xi,{value:"gradient-forest",current:l,onChange:d,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),a.jsx(xi,{value:"gradient-aurora",current:l,onChange:d,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),a.jsx(xi,{value:"gradient-fire",current:l,onChange:d,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),a.jsx(xi,{value:"gradient-twilight",current:l,onChange:d,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[a.jsx("div",{className:"flex-1",children:a.jsx("input",{type:"color",value:l.startsWith("#")?l:"#3b82f6",onChange:h=>d(h.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),a.jsx("div",{className:"flex-1",children:a.jsx(Ae,{type:"text",value:l,onChange:h=>d(h.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),a.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),a.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[a.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5 flex-1",children:[a.jsx(te,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),a.jsx(jt,{id:"animations",checked:n,onCheckedChange:r})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5 flex-1",children:[a.jsx(te,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),a.jsx(jt,{id:"waves-background",checked:s,onCheckedChange:i})]})})]})]})]})}function SH(){const t=ba(),[e,n]=S.useState(""),[r,s]=S.useState(""),[i,l]=S.useState(!1),[c,d]=S.useState(!1),[h,m]=S.useState(!1),[p,x]=S.useState(!1),[v,b]=S.useState(!1),[k,O]=S.useState(!1),[j,T]=S.useState(""),[M,_]=S.useState(!1),{toast:D}=Pr(),E=S.useMemo(()=>tH(r),[r]),z=()=>localStorage.getItem("access-token")||"",Q=async W=>{try{await navigator.clipboard.writeText(W),b(!0),D({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>b(!1),2e3)}catch{D({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},F=async()=>{if(!r.trim()){D({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!E.isValid){const W=E.rules.filter(J=>!J.passed).map(J=>J.label).join(", ");D({title:"格式错误",description:`Token 不符合要求: ${W}`,variant:"destructive"});return}m(!0);try{const W=z(),J=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${W}`},body:JSON.stringify({new_token:r.trim()})}),H=await J.json();J.ok&&H.success?(localStorage.setItem("access-token",r.trim()),s(""),e&&n(r.trim()),D({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},1500)):D({title:"更新失败",description:H.message||"无法更新 Token",variant:"destructive"})}catch(W){console.error("更新 Token 错误:",W),D({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{m(!1)}},B=async()=>{x(!0);try{const W=z(),J=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${W}`}}),H=await J.json();J.ok&&H.success?(localStorage.setItem("access-token",H.token),n(H.token),T(H.token),O(!0),_(!1),D({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):D({title:"生成失败",description:H.message||"无法生成新 Token",variant:"destructive"})}catch(W){console.error("生成 Token 错误:",W),D({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{x(!1)}},U=async()=>{try{await navigator.clipboard.writeText(j),_(!0),D({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{D({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},V=()=>{O(!1),setTimeout(()=>{T(""),_(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},500)},ce=W=>{W||V()};return a.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[a.jsx(Rr,{open:k,onOpenChange:ce,children:a.jsxs(Nr,{className:"sm:max-w-md",children:[a.jsxs(Cr,{children:[a.jsxs(Tr,{className:"flex items-center gap-2",children:[a.jsx(Hu,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),a.jsx(Gr,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[a.jsx(te,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),a.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:j})]}),a.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Hu,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),a.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[a.jsx("p",{className:"font-semibold",children:"重要提示"}),a.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[a.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),a.jsx("li",{children:"请立即复制并保存到安全的位置"}),a.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),a.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),a.jsxs(ps,{className:"gap-2 sm:gap-0",children:[a.jsx(ie,{variant:"outline",onClick:U,className:"gap-2",children:M?a.jsxs(a.Fragment,{children:[a.jsx(hc,{className:"h-4 w-4 text-green-500"}),"已复制"]}):a.jsxs(a.Fragment,{children:[a.jsx(Xb,{className:"h-4 w-4"}),"复制 Token"]})}),a.jsx(ie,{onClick:V,children:"我已保存,关闭"})]})]})}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),a.jsx("div",{className:"space-y-3 sm:space-y-4",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(Ae,{id:"current-token",type:i?"text":"password",value:e||z(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),a.jsx("button",{onClick:()=>{e||n(z()),l(!i)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:i?"隐藏":"显示",children:i?a.jsx(Yb,{className:"h-4 w-4 text-muted-foreground"}):a.jsx(Fi,{className:"h-4 w-4 text-muted-foreground"})})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[a.jsx(ie,{variant:"outline",size:"icon",onClick:()=>Q(z()),title:"复制到剪贴板",className:"flex-shrink-0",children:v?a.jsx(hc,{className:"h-4 w-4 text-green-500"}):a.jsx(Xb,{className:"h-4 w-4"})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{variant:"outline",disabled:p,className:"gap-2 flex-1 sm:flex-none",children:[a.jsx(Ii,{className:ye("h-4 w-4",p&&"animate-spin")}),a.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),a.jsx("span",{className:"sm:hidden",children:"生成"})]})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认重新生成 Token"}),a.jsx(un,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:B,children:"确认生成"})]})]})]})]})]}),a.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),a.jsxs("div",{className:"relative",children:[a.jsx(Ae,{id:"new-token",type:c?"text":"password",value:r,onChange:W=>s(W.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),a.jsx("button",{onClick:()=>d(!c),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:c?"隐藏":"显示",children:c?a.jsx(Yb,{className:"h-4 w-4 text-muted-foreground"}):a.jsx(Fi,{className:"h-4 w-4 text-muted-foreground"})})]}),r&&a.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),a.jsx("div",{className:"space-y-1.5",children:E.rules.map(W=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[W.passed?a.jsx(ua,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):a.jsx(Kb,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),a.jsx("span",{className:ye(W.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:W.label})]},W.id))}),E.isValid&&a.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:a.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[a.jsx(hc,{className:"h-4 w-4"}),a.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),a.jsx(ie,{onClick:F,disabled:h||!E.isValid||!r,className:"w-full sm:w-auto",children:h?"更新中...":"更新自定义 Token"})]})]}),a.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[a.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),a.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),a.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),a.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),a.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),a.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),a.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function kH(){const t=ba(),{toast:e}=Pr(),[n,r]=S.useState(!1),s=async()=>{r(!0);try{const i=localStorage.getItem("access-token"),l=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${i}`}}),c=await l.json();l.ok&&c.success?(e({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{t({to:"/setup"})},1e3)):e({title:"重置失败",description:c.message||"无法重置配置状态",variant:"destructive"})}catch(i){console.error("重置配置状态错误:",i),e({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{r(!1)}};return a.jsx("div",{className:"space-y-4 sm:space-y-6",children:a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsx("div",{className:"space-y-2",children:a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{variant:"outline",disabled:n,className:"gap-2",children:[a.jsx(hq,{className:ye("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认重新配置"}),a.jsx(un,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:s,children:"确认重置"})]})]})]})]})]})})}function OH(){return a.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[a.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10 p-4 sm:p-6",children:a.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[a.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:a.jsx("svg",{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"开源项目"}),a.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"本项目在 GitHub 开源,欢迎 Star ⭐ 支持!"}),a.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:ye("inline-flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[a.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),"前往 GitHub",a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",fw]}),a.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[a.jsxs("p",{children:["版本: ",hw]}),a.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),a.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",a.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"React 19.2.0"}),a.jsx("li",{children:"TypeScript 5.7.2"}),a.jsx("li",{children:"Vite 6.0.7"}),a.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"shadcn/ui"}),a.jsx("li",{children:"Radix UI"}),a.jsx("li",{children:"Tailwind CSS 3.4.17"}),a.jsx("li",{children:"Lucide Icons"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"后端"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"Python 3.12+"}),a.jsx("li",{children:"FastAPI"}),a.jsx("li",{children:"Uvicorn"}),a.jsx("li",{children:"WebSocket"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"Bun / npm"}),a.jsx("li",{children:"ESLint 9.17.0"}),a.jsx("li",{children:"PostCSS"})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),a.jsx(fn,{className:"h-[300px] sm:h-[400px]",children:a.jsxs("div",{className:"space-y-4 pr-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"React",description:"用户界面构建库",license:"MIT"}),a.jsx(Gn,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),a.jsx(Gn,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),a.jsx(Gn,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),a.jsx(Gn,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),a.jsx(Gn,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),a.jsx(Gn,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),a.jsx(Gn,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),a.jsx(Gn,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),a.jsx(Gn,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),a.jsx(Gn,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),a.jsx(Gn,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),a.jsx(Gn,{name:"Pydantic",description:"数据验证库",license:"MIT"}),a.jsx(Gn,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),a.jsx(Gn,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),a.jsx(Gn,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),a.jsx(Gn,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:a.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:a.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Gn({name:t,description:e,license:n}){return a.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium text-foreground truncate",children:t}),a.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:e})]}),a.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:n})]})}function Ny({value:t,current:e,onChange:n,label:r,description:s}){const i=e===t;return a.jsxs("button",{onClick:()=>n(t),className:ye("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&a.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-sm sm:text-base font-medium",children:r}),a.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:s})]}),a.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[t==="light"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),t==="dark"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),t==="system"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function xi({value:t,current:e,onChange:n,label:r,colorClass:s}){const i=e===t;return a.jsxs("button",{onClick:()=>n(t),className:ye("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&a.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),a.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[a.jsx("div",{className:ye("h-8 w-8 sm:h-10 sm:w-10 rounded-full",s)}),a.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:r})]})]})}class jH{grad3;p;perm;constructor(e=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let n=0;n<256;n++)this.p[n]=Math.floor(Math.random()*256);this.perm=[];for(let n=0;n<512;n++)this.perm[n]=this.p[n&255]}dot(e,n,r){return e[0]*n+e[1]*r}mix(e,n,r){return(1-r)*e+r*n}fade(e){return e*e*e*(e*(e*6-15)+10)}perlin2(e,n){const r=Math.floor(e)&255,s=Math.floor(n)&255;e-=Math.floor(e),n-=Math.floor(n);const i=this.fade(e),l=this.fade(n),c=this.perm[r]+s,d=this.perm[c],h=this.perm[c+1],m=this.perm[r+1]+s,p=this.perm[m],x=this.perm[m+1];return this.mix(this.mix(this.dot(this.grad3[d%12],e,n),this.dot(this.grad3[p%12],e-1,n),i),this.mix(this.dot(this.grad3[h%12],e,n-1),this.dot(this.grad3[x%12],e-1,n-1),i),l)}}function NH(){const t=S.useRef(null),e=S.useRef(null),n=S.useRef(void 0),r=S.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new jH(Math.random()),bounding:null});return S.useEffect(()=>{const s=e.current,i=t.current;if(!s||!i)return;const l=r.current,c=()=>{const k=s.getBoundingClientRect();l.bounding=k,i.style.width=`${k.width}px`,i.style.height=`${k.height}px`},d=()=>{if(!l.bounding)return;const{width:k,height:O}=l.bounding;l.lines=[],l.paths.forEach(F=>F.remove()),l.paths=[];const j=10,T=32,M=k+200,_=O+30,D=Math.ceil(M/j),E=Math.ceil(_/T),z=(k-j*D)/2,Q=(O-T*E)/2;for(let F=0;F<=D;F++){const B=[];for(let V=0;V<=E;V++){const ce={x:z+j*F,y:Q+T*V,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};B.push(ce)}const U=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild(U),l.paths.push(U),l.lines.push(B)}},h=k=>{const{lines:O,mouse:j,noise:T}=l;O.forEach(M=>{M.forEach(_=>{const D=T.perlin2((_.x+k*.0125)*.002,(_.y+k*.005)*.0015)*12;_.wave.x=Math.cos(D)*32,_.wave.y=Math.sin(D)*16;const E=_.x-j.sx,z=_.y-j.sy,Q=Math.hypot(E,z),F=Math.max(175,j.vs);if(Q{const j={x:k.x+k.wave.x+(O?k.cursor.x:0),y:k.y+k.wave.y+(O?k.cursor.y:0)};return j.x=Math.round(j.x*10)/10,j.y=Math.round(j.y*10)/10,j},p=()=>{const{lines:k,paths:O}=l;k.forEach((j,T)=>{let M=m(j[0],!1),_=`M ${M.x} ${M.y}`;j.forEach((D,E)=>{const z=E===j.length-1;M=m(D,!z),_+=`L ${M.x} ${M.y}`}),O[T].setAttribute("d",_)})},x=k=>{const{mouse:O}=l;O.sx+=(O.x-O.sx)*.1,O.sy+=(O.y-O.sy)*.1;const j=O.x-O.lx,T=O.y-O.ly,M=Math.hypot(j,T);O.v=M,O.vs+=(M-O.vs)*.1,O.vs=Math.min(100,O.vs),O.lx=O.x,O.ly=O.y,O.a=Math.atan2(T,j),s&&(s.style.setProperty("--x",`${O.sx}px`),s.style.setProperty("--y",`${O.sy}px`)),h(k),p(),n.current=requestAnimationFrame(x)},v=k=>{if(!l.bounding)return;const{mouse:O}=l;O.x=k.pageX-l.bounding.left,O.y=k.pageY-l.bounding.top+window.scrollY,O.set||(O.sx=O.x,O.sy=O.y,O.lx=O.x,O.ly=O.y,O.set=!0)},b=()=>{c(),d()};return c(),d(),window.addEventListener("resize",b),window.addEventListener("mousemove",v),n.current=requestAnimationFrame(x),()=>{window.removeEventListener("resize",b),window.removeEventListener("mousemove",v),n.current&&cancelAnimationFrame(n.current)}},[]),a.jsxs("div",{ref:e,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[a.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),a.jsx("svg",{ref:t,style:{display:"block",width:"100%",height:"100%"},children:a.jsx("style",{children:` + path { + fill: none; + stroke: hsl(var(--primary) / 0.20); + stroke-width: 1px; + } + `})})]})}function CH(){const t=ba();S.useEffect(()=>{localStorage.getItem("access-token")||t({to:"/auth"})},[t])}function qT(){return!!localStorage.getItem("access-token")}function TH(){const[t,e]=S.useState(""),[n,r]=S.useState(!1),[s,i]=S.useState(""),l=ba(),{enableWavesBackground:c,setEnableWavesBackground:d}=hT(),{theme:h,setTheme:m}=dw();S.useEffect(()=>{qT()&&l({to:"/"})},[l]);const x=h==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":h,v=()=>{m(x==="dark"?"light":"dark")},b=async k=>{if(k.preventDefault(),i(""),!t.trim()){i("请输入 Access Token");return}r(!0);try{const O=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t.trim()})}),j=await O.json();if(O.ok&&j.valid){localStorage.setItem("access-token",t.trim());const T=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${t.trim()}`}}),M=await T.json();T.ok&&M.is_first_setup?l({to:"/setup"}):l({to:"/"})}else i(j.message||"Token 验证失败,请检查后重试")}catch(O){console.error("Token 验证错误:",O),i("连接服务器失败,请检查网络连接")}finally{r(!1)}};return a.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[c&&a.jsx(NH,{}),a.jsxs(yt,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[a.jsx("button",{onClick:v,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:x==="dark"?"切换到浅色模式":"切换到深色模式",children:x==="dark"?a.jsx(Zb,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):a.jsx(Jb,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),a.jsxs(Jt,{className:"space-y-4 text-center",children:[a.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:a.jsx(lO,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(en,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),a.jsx(Sr,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),a.jsx(vn,{children:a.jsxs("form",{onSubmit:b,className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),a.jsxs("div",{className:"relative",children:[a.jsx(fq,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),a.jsx(Ae,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:t,onChange:k=>e(k.target.value),className:ye("pl-10",s&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),s&&a.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[a.jsx(xc,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),a.jsx("span",{children:s})]}),a.jsx(ie,{type:"submit",className:"w-full",disabled:n,children:n?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),a.jsxs(Rr,{children:[a.jsx(mw,{asChild:!0,children:a.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[a.jsx(mq,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),a.jsxs(Nr,{className:"sm:max-w-md",children:[a.jsxs(Cr,{children:[a.jsxs(Tr,{className:"flex items-center gap-2",children:[a.jsx(lO,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),a.jsx(Gr,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(pq,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),a.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[a.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),a.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(io,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),a.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:a.jsx("code",{className:"text-primary",children:"data/webui.json"})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",a.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),a.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(xc,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[a.jsx("p",{className:"font-semibold",children:"安全提示"}),a.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[a.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),a.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[a.jsx(uf,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsxs(cn,{className:"flex items-center gap-2",children:[a.jsx(uf,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),a.jsx(un,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>d(!1),children:"关闭动画"})]})]})]})]})})]}),a.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:a.jsx("p",{children:nH})})]})}const On=S.forwardRef(({className:t,...e},n)=>a.jsx("textarea",{className:ye("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...e}));On.displayName="Textarea";var MH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],AH=MH.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),EH="Separator",WO="horizontal",_H=["horizontal","vertical"],FT=S.forwardRef((t,e)=>{const{decorative:n,orientation:r=WO,...s}=t,i=DH(r)?r:WO,c=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return a.jsx(AH.div,{"data-orientation":i,...c,...s,ref:e})});FT.displayName=EH;function DH(t){return _H.includes(t)}var QT=FT;const mf=S.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},s)=>a.jsx(QT,{ref:s,decorative:n,orientation:e,className:ye("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));mf.displayName=QT.displayName;const RH=Nd("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function $n({className:t,variant:e,...n}){return a.jsx("div",{className:ye(RH({variant:e}),t),...n})}function zH({config:t,onChange:e}){const n=s=>{s.trim()&&!t.alias_names.includes(s.trim())&&e({...t,alias_names:[...t.alias_names,s.trim()]})},r=s=>{e({...t,alias_names:t.alias_names.filter((i,l)=>l!==s)})};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"qq_account",children:"QQ账号 *"}),a.jsx(Ae,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:t.qq_account||"",onChange:s=>e({...t,qq_account:Number(s.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称 *"}),a.jsx(Ae,{id:"nickname",placeholder:"请输入机器人的昵称",value:t.nickname,onChange:s=>e({...t,nickname:s.target.value})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{children:"别名"}),a.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.alias_names.map((s,i)=>a.jsxs($n,{variant:"secondary",className:"gap-1",children:[s,a.jsx("button",{type:"button",onClick:()=>r(i),className:"ml-1 hover:text-destructive",children:a.jsx(Gf,{className:"h-3 w-3"})})]},i))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ae,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:s=>{s.key==="Enter"&&(n(s.target.value),s.target.value="")}}),a.jsx(ie,{type:"button",variant:"outline",onClick:()=>{const s=document.getElementById("alias_input");s&&(n(s.value),s.value="")},children:"添加"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function PH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"personality",children:"人格特征 *"}),a.jsx(On,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:t.personality,onChange:n=>e({...t,personality:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"reply_style",children:"表达风格 *"}),a.jsx(On,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:t.reply_style,onChange:n=>e({...t,reply_style:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"interest",children:"兴趣 *"}),a.jsx(On,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:t.interest,onChange:n=>e({...t,interest:n.target.value}),rows:2}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),a.jsx(mf,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"plan_style",children:"群聊说话规则 *"}),a.jsx(On,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:t.plan_style,onChange:n=>e({...t,plan_style:n.target.value}),rows:4}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),a.jsx(On,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:t.private_plan_style,onChange:n=>e({...t,private_plan_style:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function LH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{htmlFor:"emoji_chance",children:"表情包激活概率"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[(t.emoji_chance*100).toFixed(0),"%"]})]}),a.jsx(Ae,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:t.emoji_chance,onChange:n=>e({...t,emoji_chance:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"max_reg_num",children:"最大表情包数量"}),a.jsx(Ae,{id:"max_reg_num",type:"number",min:"1",max:"200",value:t.max_reg_num,onChange:n=>e({...t,max_reg_num:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"do_replace",children:"达到最大数量时替换"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),a.jsx(jt,{id:"do_replace",checked:t.do_replace,onCheckedChange:n=>e({...t,do_replace:n})})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),a.jsx(Ae,{id:"check_interval",type:"number",min:"1",max:"120",value:t.check_interval,onChange:n=>e({...t,check_interval:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"steal_emoji",children:"偷取表情包"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),a.jsx(jt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:n=>e({...t,steal_emoji:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"content_filtration",children:"启用表情包过滤"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),a.jsx(jt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:n=>e({...t,content_filtration:n})})]}),t.content_filtration&&a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"filtration_prompt",children:"过滤要求"}),a.jsx(Ae,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:t.filtration_prompt,onChange:n=>e({...t,filtration_prompt:n.target.value})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function BH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"enable_tool",children:"启用工具系统"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),a.jsx(jt,{id:"enable_tool",checked:t.enable_tool,onCheckedChange:n=>e({...t,enable_tool:n})})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"enable_mood",children:"启用情绪系统"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),a.jsx(jt,{id:"enable_mood",checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})})]}),t.enable_mood&&a.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),a.jsx(Ae,{id:"mood_update_threshold",type:"number",min:"0.1",max:"10",step:"0.1",value:t.mood_update_threshold||1,onChange:n=>e({...t,mood_update_threshold:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"emotion_style",children:"情感特征"}),a.jsx(On,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:t.emotion_style||"",onChange:n=>e({...t,emotion_style:n.target.value}),rows:2}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"all_global",children:"启用全局黑话模式"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),a.jsx(jt,{id:"all_global",checked:t.all_global,onCheckedChange:n=>e({...t,all_global:n})})]})]})}async function ot(t,e){const n=await fetch(t,e);if(n.status===401)throw localStorage.removeItem("access-token"),window.location.href="/auth",new Error("认证失败,请重新登录");return n}function bt(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function IH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取Bot配置失败");const n=(await t.json()).config.bot||{};return{qq_account:n.qq_account||0,nickname:n.nickname||"",alias_names:n.alias_names||[]}}async function qH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取人格配置失败");const n=(await t.json()).config.personality||{};return{personality:n.personality||"",reply_style:n.reply_style||"",interest:n.interest||"",plan_style:n.plan_style||"",private_plan_style:n.private_plan_style||""}}async function FH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取表情包配置失败");const n=(await t.json()).config.emoji||{};return{emoji_chance:n.emoji_chance??.4,max_reg_num:n.max_reg_num??40,do_replace:n.do_replace??!0,check_interval:n.check_interval??10,steal_emoji:n.steal_emoji??!0,content_filtration:n.content_filtration??!1,filtration_prompt:n.filtration_prompt||""}}async function QH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取其他配置失败");const n=(await t.json()).config,r=n.tool||{},s=n.mood||{},i=n.jargon||{};return{enable_tool:r.enable_tool??!0,enable_mood:s.enable_mood??!1,mood_update_threshold:s.mood_update_threshold,emotion_style:s.emotion_style,all_global:i.all_global??!0}}async function $H(t){const e=await ot("/api/webui/config/bot/section/bot",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await e.json()}async function HH(t){const e=await ot("/api/webui/config/bot/section/personality",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存人格配置失败")}return await e.json()}async function UH(t){const e=await ot("/api/webui/config/bot/section/emoji",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存表情包配置失败")}return await e.json()}async function VH(t){const e=[];e.push(ot("/api/webui/config/bot/section/tool",{method:"POST",headers:bt(),body:JSON.stringify({enable_tool:t.enable_tool})})),e.push(ot("/api/webui/config/bot/section/jargon",{method:"POST",headers:bt(),body:JSON.stringify({all_global:t.all_global})}));const n={enable_mood:t.enable_mood};t.enable_mood&&(n.mood_update_threshold=t.mood_update_threshold||1,n.emotion_style=t.emotion_style||""),e.push(ot("/api/webui/config/bot/section/mood",{method:"POST",headers:bt(),body:JSON.stringify(n)}));const r=await Promise.all(e);for(const s of r)if(!s.ok){const i=await s.json();throw new Error(i.detail||"保存其他配置失败")}return{success:!0}}async function GO(){const t=localStorage.getItem("access-token"),e=await ot("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!e.ok){const n=await e.json();throw new Error(n.message||"标记配置完成失败")}return await e.json()}function WH(){const t=ba(),{toast:e}=Pr(),[n,r]=S.useState(0),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!0),[m,p]=S.useState({qq_account:0,nickname:"",alias_names:[]}),[x,v]=S.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 +2.如果相同的内容已经被执行,请不要重复执行 +3.请控制你的发言频率,不要太过频繁的发言 +4.如果有人对你感到厌烦,请减少回复 +5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 +2.如果相同的内容已经被执行,请不要重复执行 +3.某句话如果已经被回复过,不要重复回复`}),[b,k]=S.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[O,j]=S.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遭遇特定事件的时候起伏较大",all_global:!0}),T=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:xq},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:D9},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:K4},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:dc},{id:"complete",title:"完成设置",description:"后续配置提示",icon:uf}],M=(n+1)/T.length*100;S.useEffect(()=>{(async()=>{try{h(!0);const[U,V,ce,W]=await Promise.all([IH(),qH(),FH(),QH()]);p(U),v(V),k(ce),j(W)}catch(U){e({title:"加载配置失败",description:U instanceof Error?U.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{h(!1)}})()},[e]);const _=async()=>{c(!0);try{switch(n){case 0:await $H(m);break;case 1:await HH(x);break;case 2:await UH(b);break;case 3:await VH(O);break}return e({title:"保存成功",description:`${T[n].title}配置已保存`}),!0}catch(B){return e({title:"保存失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"}),!1}finally{c(!1)}},D=async()=>{await _()&&n{n>0&&r(n-1)},z=async()=>{i(!0);try{if(!await _()){i(!1);return}await GO(),e({title:"配置完成",description:"所有配置已保存,正在跳转..."}),setTimeout(()=>{t({to:"/"})},500)}catch(B){e({title:"完成失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}finally{i(!1)}},Q=async()=>{try{await GO(),t({to:"/"})}catch(B){e({title:"跳过失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}},F=()=>{switch(n){case 0:return a.jsx(zH,{config:m,onChange:p});case 1:return a.jsx(PH,{config:x,onChange:v});case 2:return a.jsx(LH,{config:b,onChange:k});case 3:return a.jsx(BH,{config:O,onChange:j});case 4:return a.jsxs("div",{className:"space-y-6 text-center py-8",children:[a.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:a.jsx(uf,{className:"h-8 w-8 text-primary",strokeWidth:2})}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h3",{className:"text-xl font-semibold",children:"模型配置"}),a.jsx("p",{className:"text-muted-foreground max-w-md mx-auto",children:"为了让机器人正常工作,您需要配置 AI 模型提供商和模型。"})]}),a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-6 max-w-md mx-auto text-left space-y-4",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"1"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"配置 API 提供商"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → API 提供商"中添加您的 API 提供商信息'})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"2"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"添加模型"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型列表"中添加需要使用的模型'})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"3"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"配置模型任务"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型任务配置"中为不同任务分配模型'})]})]})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"💡 提示:完成向导后,您可以在系统设置中进行详细的模型配置"})]});default:return null}};return a.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[a.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[a.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),a.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),d?a.jsxs("div",{className:"relative z-10 text-center",children:[a.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:a.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),a.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),a.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[a.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[a.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:a.jsx(gq,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),a.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),a.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",fw," 的初始配置"]})]}),a.jsxs("div",{className:"mb-6 md:mb-8",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[a.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",T.length]}),a.jsxs("span",{className:"font-medium text-primary",children:[Math.round(M),"%"]})]}),a.jsx(n0,{value:M,className:"h-2"})]}),a.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:T.map((B,U)=>{const V=B.icon;return a.jsxs("div",{className:ye("flex flex-1 flex-col items-center gap-1 md:gap-2",Ut({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[a.jsx(hg,{className:"h-4 w-4"}),"返回首页"]}),a.jsxs(ie,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[a.jsx(R9,{className:"h-4 w-4"}),"返回上一页"]})]}),a.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var HT=["PageUp","PageDown"],UT=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],VT={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Cd="Slider",[c2,GH,XH]=tx(Cd),[WT]=Hi(Cd,[XH]),[YH,vx]=WT(Cd),GT=S.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:l="horizontal",disabled:c=!1,minStepsBetweenThumbs:d=0,defaultValue:h=[r],value:m,onValueChange:p=()=>{},onValueCommit:x=()=>{},inverted:v=!1,form:b,...k}=t,O=S.useRef(new Set),j=S.useRef(0),M=l==="horizontal"?KH:ZH,[_=[],D]=So({prop:m,defaultProp:h,onChange:U=>{[...O.current][j.current]?.focus(),p(U)}}),E=S.useRef(_);function z(U){const V=rU(_,U);B(U,V)}function Q(U){B(U,j.current)}function F(){const U=E.current[j.current];_[j.current]!==U&&x(_)}function B(U,V,{commit:ce}={commit:!1}){const W=lU(i),J=oU(Math.round((U-r)/i)*i+r,W),H=F4(J,[r,s]);D((ae=[])=>{const ne=tU(ae,H,V);if(aU(ne,d*i)){j.current=ne.indexOf(H);const ue=String(ne)!==String(ae);return ue&&ce&&x(ne),ue?ne:ae}else return ae})}return a.jsx(YH,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:s,valueIndexToChangeRef:j,thumbs:O.current,values:_,orientation:l,form:b,children:a.jsx(c2.Provider,{scope:t.__scopeSlider,children:a.jsx(c2.Slot,{scope:t.__scopeSlider,children:a.jsx(M,{"aria-disabled":c,"data-disabled":c?"":void 0,...k,ref:e,onPointerDown:$e(k.onPointerDown,()=>{c||(E.current=_)}),min:r,max:s,inverted:v,onSlideStart:c?void 0:z,onSlideMove:c?void 0:Q,onSlideEnd:c?void 0:F,onHomeKeyDown:()=>!c&&B(r,0,{commit:!0}),onEndKeyDown:()=>!c&&B(s,_.length-1,{commit:!0}),onStepKeyDown:({event:U,direction:V})=>{if(!c){const J=HT.includes(U.key)||U.shiftKey&&UT.includes(U.key)?10:1,H=j.current,ae=_[H],ne=i*J*V;B(ae+ne,H,{commit:!0})}}})})})})});GT.displayName=Cd;var[XT,YT]=WT(Cd,{startEdge:"left",endEdge:"right",size:"width",direction:1}),KH=S.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:l,onSlideMove:c,onSlideEnd:d,onStepKeyDown:h,...m}=t,[p,x]=S.useState(null),v=Cn(e,M=>x(M)),b=S.useRef(void 0),k=Vf(s),O=k==="ltr",j=O&&!i||!O&&i;function T(M){const _=b.current||p.getBoundingClientRect(),D=[0,_.width],z=pw(D,j?[n,r]:[r,n]);return b.current=_,z(M-_.left)}return a.jsx(XT,{scope:t.__scopeSlider,startEdge:j?"left":"right",endEdge:j?"right":"left",direction:j?1:-1,size:"width",children:a.jsx(KT,{dir:k,"data-orientation":"horizontal",...m,ref:v,style:{...m.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:M=>{const _=T(M.clientX);l?.(_)},onSlideMove:M=>{const _=T(M.clientX);c?.(_)},onSlideEnd:()=>{b.current=void 0,d?.()},onStepKeyDown:M=>{const D=VT[j?"from-left":"from-right"].includes(M.key);h?.({event:M,direction:D?-1:1})}})})}),ZH=S.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...h}=t,m=S.useRef(null),p=Cn(e,m),x=S.useRef(void 0),v=!s;function b(k){const O=x.current||m.current.getBoundingClientRect(),j=[0,O.height],M=pw(j,v?[r,n]:[n,r]);return x.current=O,M(k-O.top)}return a.jsx(XT,{scope:t.__scopeSlider,startEdge:v?"bottom":"top",endEdge:v?"top":"bottom",size:"height",direction:v?1:-1,children:a.jsx(KT,{"data-orientation":"vertical",...h,ref:p,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:k=>{const O=b(k.clientY);i?.(O)},onSlideMove:k=>{const O=b(k.clientY);l?.(O)},onSlideEnd:()=>{x.current=void 0,c?.()},onStepKeyDown:k=>{const j=VT[v?"from-bottom":"from-top"].includes(k.key);d?.({event:k,direction:j?-1:1})}})})}),KT=S.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:l,onEndKeyDown:c,onStepKeyDown:d,...h}=t,m=vx(Cd,n);return a.jsx(Yt.span,{...h,ref:e,onKeyDown:$e(t.onKeyDown,p=>{p.key==="Home"?(l(p),p.preventDefault()):p.key==="End"?(c(p),p.preventDefault()):HT.concat(UT).includes(p.key)&&(d(p),p.preventDefault())}),onPointerDown:$e(t.onPointerDown,p=>{const x=p.target;x.setPointerCapture(p.pointerId),p.preventDefault(),m.thumbs.has(x)?x.focus():r(p)}),onPointerMove:$e(t.onPointerMove,p=>{p.target.hasPointerCapture(p.pointerId)&&s(p)}),onPointerUp:$e(t.onPointerUp,p=>{const x=p.target;x.hasPointerCapture(p.pointerId)&&(x.releasePointerCapture(p.pointerId),i(p))})})}),ZT="SliderTrack",JT=S.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=vx(ZT,n);return a.jsx(Yt.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});JT.displayName=ZT;var u2="SliderRange",eM=S.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=vx(u2,n),i=YT(u2,n),l=S.useRef(null),c=Cn(e,l),d=s.values.length,h=s.values.map(x=>rM(x,s.min,s.max)),m=d>1?Math.min(...h):0,p=100-Math.max(...h);return a.jsx(Yt.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:m+"%",[i.endEdge]:p+"%"}})});eM.displayName=u2;var d2="SliderThumb",tM=S.forwardRef((t,e)=>{const n=GH(t.__scopeSlider),[r,s]=S.useState(null),i=Cn(e,c=>s(c)),l=S.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return a.jsx(JH,{...t,ref:i,index:l})}),JH=S.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...i}=t,l=vx(d2,n),c=YT(d2,n),[d,h]=S.useState(null),m=Cn(e,T=>h(T)),p=d?l.form||!!d.closest("form"):!0,x=m9(d),v=l.values[r],b=v===void 0?0:rM(v,l.min,l.max),k=nU(r,l.values.length),O=x?.[c.size],j=O?sU(O,b,c.direction):0;return S.useEffect(()=>{if(d)return l.thumbs.add(d),()=>{l.thumbs.delete(d)}},[d,l.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${b}% + ${j}px)`},children:[a.jsx(c2.ItemSlot,{scope:t.__scopeSlider,children:a.jsx(Yt.span,{role:"slider","aria-label":t["aria-label"]||k,"aria-valuemin":l.min,"aria-valuenow":v,"aria-valuemax":l.max,"aria-orientation":l.orientation,"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,tabIndex:l.disabled?void 0:0,...i,ref:m,style:v===void 0?{display:"none"}:t.style,onFocus:$e(t.onFocus,()=>{l.valueIndexToChangeRef.current=r})})}),p&&a.jsx(nM,{name:s??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:v},r)]})});tM.displayName=d2;var eU="RadioBubbleInput",nM=S.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=S.useRef(null),i=Cn(s,r),l=f9(e);return S.useEffect(()=>{const c=s.current;if(!c)return;const d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==e&&m){const p=new Event("input",{bubbles:!0});m.call(c,e),c.dispatchEvent(p)}},[l,e]),a.jsx(Yt.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});nM.displayName=eU;function tU(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,i)=>s-i)}function rM(t,e,n){const i=100/(n-e)*(t-e);return F4(i,[0,100])}function nU(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function rU(t,e){if(t.length===1)return 0;const n=t.map(s=>Math.abs(s-e)),r=Math.min(...n);return n.indexOf(r)}function sU(t,e,n){const r=t/2,i=pw([0,50],[0,r]);return(r-i(e)*n)*n}function iU(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function aU(t,e){if(e>0){const n=iU(t);return Math.min(...n)>=e}return!0}function pw(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function lU(t){return(String(t).split(".")[1]||"").length}function oU(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var sM=GT,cU=JT,uU=eM,dU=tM;const yx=S.forwardRef(({className:t,...e},n)=>a.jsxs(sM,{ref:n,className:ye("relative flex w-full touch-none select-none items-center",t),...e,children:[a.jsx(cU,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:a.jsx(uU,{className:"absolute h-full bg-primary"})}),a.jsx(dU,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));yx.displayName=sM.displayName;const Bt=tq,It=nq,Dt=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(v9,{ref:r,className:ye("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,a.jsx(YI,{asChild:!0,children:a.jsx(df,{className:"h-4 w-4 opacity-50"})})]}));Dt.displayName=v9.displayName;const iM=S.forwardRef(({className:t,...e},n)=>a.jsx(y9,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(e2,{className:"h-4 w-4"})}));iM.displayName=y9.displayName;const aM=S.forwardRef(({className:t,...e},n)=>a.jsx(b9,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(df,{className:"h-4 w-4"})}));aM.displayName=b9.displayName;const Rt=S.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>a.jsx(KI,{children:a.jsxs(w9,{ref:s,className:ye("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[a.jsx(iM,{}),a.jsx(ZI,{className:ye("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(aM,{})]})}));Rt.displayName=w9.displayName;const hU=S.forwardRef(({className:t,...e},n)=>a.jsx(S9,{ref:n,className:ye("px-2 py-1.5 text-sm font-semibold",t),...e}));hU.displayName=S9.displayName;const Pe=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(k9,{ref:r,className:ye("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[a.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(JI,{children:a.jsx(hc,{className:"h-4 w-4"})})}),a.jsx(eq,{children:e})]}));Pe.displayName=k9.displayName;const fU=S.forwardRef(({className:t,...e},n)=>a.jsx(O9,{ref:n,className:ye("-mx-1 my-1 h-px bg-muted",t),...e}));fU.displayName=O9.displayName;function mU(t){const e=pU(t),n=S.forwardRef((r,s)=>{const{children:i,...l}=r,c=S.Children.toArray(i),d=c.find(xU);if(d){const h=d.props.children,m=c.map(p=>p===d?S.Children.count(h)>1?S.Children.only(null):S.isValidElement(h)?h.props.children:null:p);return a.jsx(e,{...l,ref:s,children:S.isValidElement(h)?S.cloneElement(h,void 0,m):null})}return a.jsx(e,{...l,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function pU(t){const e=S.forwardRef((n,r)=>{const{children:s,...i}=n;if(S.isValidElement(s)){const l=yU(s),c=vU(i,s.props);return s.type!==S.Fragment&&(c.ref=r?lo(r,l):l),S.cloneElement(s,c)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var gU=Symbol("radix.slottable");function xU(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===gU}function vU(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...c)=>{const d=i(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function yU(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var bx="Popover",[lM]=Hi(bx,[wd]),r0=wd(),[bU,ko]=lM(bx),oM=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:l=!1}=t,c=r0(e),d=S.useRef(null),[h,m]=S.useState(!1),[p,x]=So({prop:r,defaultProp:s??!1,onChange:i,caller:bx});return a.jsx(ix,{...c,children:a.jsx(bU,{scope:e,contentId:Oi(),triggerRef:d,open:p,onOpenChange:x,onOpenToggle:S.useCallback(()=>x(v=>!v),[x]),hasCustomAnchor:h,onCustomAnchorAdd:S.useCallback(()=>m(!0),[]),onCustomAnchorRemove:S.useCallback(()=>m(!1),[]),modal:l,children:n})})};oM.displayName=bx;var cM="PopoverAnchor",wU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=ko(cM,n),i=r0(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=s;return S.useEffect(()=>(l(),()=>c()),[l,c]),a.jsx(ax,{...i,...r,ref:e})});wU.displayName=cM;var uM="PopoverTrigger",dM=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=ko(uM,n),i=r0(n),l=Cn(e,s.triggerRef),c=a.jsx(Yt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":gM(s.open),...r,ref:l,onClick:$e(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:a.jsx(ax,{asChild:!0,...i,children:c})});dM.displayName=uM;var gw="PopoverPortal",[SU,kU]=lM(gw,{forceMount:void 0}),hM=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=ko(gw,e);return a.jsx(SU,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};hM.displayName=gw;var ad="PopoverContent",fM=S.forwardRef((t,e)=>{const n=kU(ad,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=ko(ad,t.__scopePopover);return a.jsx(Ls,{present:r||i.open,children:i.modal?a.jsx(jU,{...s,ref:e}):a.jsx(NU,{...s,ref:e})})});fM.displayName=ad;var OU=mU("PopoverContent.RemoveScroll"),jU=S.forwardRef((t,e)=>{const n=ko(ad,t.__scopePopover),r=S.useRef(null),s=Cn(e,r),i=S.useRef(!1);return S.useEffect(()=>{const l=r.current;if(l)return j9(l)},[]),a.jsx(N9,{as:OU,allowPinchZoom:!0,children:a.jsx(mM,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:$e(t.onCloseAutoFocus,l=>{l.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:$e(t.onPointerDownOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,h=c.button===2||d;i.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:$e(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),NU=S.forwardRef((t,e)=>{const n=ko(ad,t.__scopePopover),r=S.useRef(!1),s=S.useRef(!1);return a.jsx(mM,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=i.target;n.triggerRef.current?.contains(l)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),mM=S.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:m,...p}=t,x=ko(ad,n),v=r0(n);return C9(),a.jsx(T9,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:m,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onDismiss:()=>x.onOpenChange(!1),children:a.jsx(X4,{"data-state":gM(x.open),role:"dialog",id:x.contentId,...v,...p,ref:e,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),pM="PopoverClose",CU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=ko(pM,n);return a.jsx(Yt.button,{type:"button",...r,ref:e,onClick:$e(t.onClick,()=>s.onOpenChange(!1))})});CU.displayName=pM;var TU="PopoverArrow",MU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=r0(n);return a.jsx(Y4,{...s,...r,ref:e})});MU.displayName=TU;function gM(t){return t?"open":"closed"}var AU=oM,EU=dM,_U=hM,xM=fM;const co=AU,uo=EU,hl=S.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>a.jsx(_U,{children:a.jsx(xM,{ref:s,align:e,sideOffset:n,className:ye("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",t),...r})}));hl.displayName=xM.displayName;const Oo="/api/webui/config";async function DU(){const e=await(await ot(`${Oo}/bot`)).json();if(!e.success)throw new Error("获取配置数据失败");return e.config}async function Vu(){const e=await(await ot(`${Oo}/model`)).json();if(!e.success)throw new Error("获取模型配置数据失败");return e.config}async function XO(t){const n=await(await ot(`${Oo}/bot`,{method:"POST",headers:bt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function RU(){const e=await(await ot(`${Oo}/bot/raw`)).json();if(!e.success)throw new Error("获取配置源代码失败");return e.content}async function zU(t){const n=await(await ot(`${Oo}/bot/raw`,{method:"POST",headers:bt(),body:JSON.stringify({raw_content:t})})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function wg(t){const n=await(await ot(`${Oo}/model`,{method:"POST",headers:bt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function PU(t,e){const r=await(await ot(`${Oo}/bot/section/${t}`,{method:"POST",headers:bt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function h2(t,e){const r=await(await ot(`${Oo}/model/section/${t}`,{method:"POST",headers:bt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}const LU=Zn.create({baseURL:"",timeout:1e4});async function xw(){try{return(await LU.post("/api/webui/system/restart")).data}catch(t){throw console.error("重启麦麦失败:",t),t}}const BU=Nd("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),ld=S.forwardRef(({className:t,variant:e,...n},r)=>a.jsx("div",{ref:r,role:"alert",className:ye(BU({variant:e}),t),...n}));ld.displayName="Alert";const IU=S.forwardRef(({className:t,...e},n)=>a.jsx("h5",{ref:n,className:ye("mb-1 font-medium leading-none tracking-tight",t),...e}));IU.displayName="AlertTitle";const od=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("text-sm [&_p]:leading-relaxed",t),...e}));od.displayName="AlertDescription";function vw({onRestartComplete:t,onRestartFailed:e}){const[n,r]=S.useState(0),[s,i]=S.useState("restarting"),[l,c]=S.useState(0),[d,h]=S.useState(0);S.useEffect(()=>{const x=setInterval(()=>{r(k=>k>=90?k:k+1)},200),v=setInterval(()=>{c(k=>k+1)},1e3),b=setTimeout(()=>{i("checking"),m()},3e3);return()=>{clearInterval(x),clearInterval(v),clearTimeout(b)}},[]);const m=()=>{const v=async()=>{try{if(h(k=>k+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)r(100),i("success"),setTimeout(()=>{t?.()},1500);else throw new Error("Status check failed")}catch{d<60?setTimeout(v,2e3):(i("failed"),e?.())}};v()},p=x=>{const v=Math.floor(x/60),b=x%60;return`${v}:${b.toString().padStart(2,"0")}`};return a.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:a.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[a.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s==="restarting"&&a.jsxs(a.Fragment,{children:[a.jsx(hf,{className:"h-16 w-16 text-primary animate-spin"}),a.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),s==="checking"&&a.jsxs(a.Fragment,{children:[a.jsx(hf,{className:"h-16 w-16 text-primary animate-spin"}),a.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),a.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",d,"/60)"]})]}),s==="success"&&a.jsxs(a.Fragment,{children:[a.jsx(ua,{className:"h-16 w-16 text-green-500"}),a.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),s==="failed"&&a.jsxs(a.Fragment,{children:[a.jsx(xc,{className:"h-16 w-16 text-destructive"}),a.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),s!=="failed"&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(n0,{value:n,className:"h-2"}),a.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[a.jsxs("span",{children:[n,"%"]}),a.jsxs("span",{children:["已用时: ",p(l)]})]})]}),a.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="restarting"&&"🔄 配置已保存,正在重启主程序...",s==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",s==="success"&&"✅ 配置已生效,服务运行正常",s==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),s==="failed"&&a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),a.jsx("button",{onClick:()=>{i("checking"),h(0),m()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}let f2=[],vM=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e>1;if(t=vM[r])e=r+1;else return!0;if(e==n)return!1}}function YO(t){return t>=127462&&t<=127487}const KO=8205;function FU(t,e,n=!0,r=!0){return(n?yM:QU)(t,e,r)}function yM(t,e,n){if(e==t.length)return e;e&&bM(t.charCodeAt(e))&&wM(t.charCodeAt(e-1))&&e--;let r=Cy(t,e);for(e+=ZO(r);e=0&&YO(Cy(t,l));)i++,l-=2;if(i%2==0)break;e+=2}else break}return e}function QU(t,e,n){for(;e>0;){let r=yM(t,e-2,n);if(r=56320&&t<57344}function wM(t){return t>=55296&&t<56320}function ZO(t){return t<65536?1:2}class Wt{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=cd(this,e,n);let s=[];return this.decompose(0,e,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(n,this.length,s,1),Gp.from(s,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=cd(this,e,n);let r=[];return this.decompose(e,n,r,0),Gp.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),s=new Zh(this),i=new Zh(e);for(let l=n,c=n;;){if(s.next(l),i.next(l),l=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(c+=s.value.length,s.done||c>=r)return!0}}iter(e=1){return new Zh(this,e)}iterRange(e,n=this.length){return new SM(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let s=this.line(e).from;r=this.iterRange(s,Math.max(s,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new kM(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Wt.empty:e.length<=32?new ir(e):Gp.from(ir.split(e,[]))}}class ir extends Wt{constructor(e,n=$U(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,s){for(let i=0;;i++){let l=this.text[i],c=s+l.length;if((n?r:c)>=e)return new HU(s,c,r,l);s=c+1,r++}}decompose(e,n,r,s){let i=e<=0&&n>=this.length?this:new ir(JO(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let l=r.pop(),c=Xp(i.text,l.text.slice(),0,i.length);if(c.length<=32)r.push(new ir(c,l.length+i.length));else{let d=c.length>>1;r.push(new ir(c.slice(0,d)),new ir(c.slice(d)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof ir))return super.replace(e,n,r);[e,n]=cd(this,e,n);let s=Xp(this.text,Xp(r.text,JO(this.text,0,e)),n),i=this.length+r.length-(n-e);return s.length<=32?new ir(s,i):Gp.from(ir.split(s,[]),i)}sliceString(e,n=this.length,r=` +`){[e,n]=cd(this,e,n);let s="";for(let i=0,l=0;i<=n&&le&&l&&(s+=r),ei&&(s+=c.slice(Math.max(0,e-i),n-i)),i=d+1}return s}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],s=-1;for(let i of e)r.push(i),s+=i.length+1,r.length==32&&(n.push(new ir(r,s)),r=[],s=-1);return s>-1&&n.push(new ir(r,s)),n}}let Gp=class Du extends Wt{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,s){for(let i=0;;i++){let l=this.children[i],c=s+l.length,d=r+l.lines-1;if((n?d:c)>=e)return l.lineInner(e,n,r,s);s=c+1,r=d+1}}decompose(e,n,r,s){for(let i=0,l=0;l<=n&&i=l){let h=s&((l<=e?1:0)|(d>=n?2:0));l>=e&&d<=n&&!h?r.push(c):c.decompose(e-l,n-l,r,h)}l=d+1}}replace(e,n,r){if([e,n]=cd(this,e,n),r.lines=i&&n<=c){let d=l.replace(e-i,n-i,r),h=this.lines-l.lines+d.lines;if(d.lines>4&&d.lines>h>>6){let m=this.children.slice();return m[s]=d,new Du(m,this.length-(n-e)+r.length)}return super.replace(i,c,d)}i=c+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` +`){[e,n]=cd(this,e,n);let s="";for(let i=0,l=0;ie&&i&&(s+=r),el&&(s+=c.sliceString(e-l,n-l,r)),l=d+1}return s}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Du))return 0;let r=0,[s,i,l,c]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=n,i+=n){if(s==l||i==c)return r;let d=this.children[s],h=e.children[i];if(d!=h)return r+d.scanIdentical(h,n);r+=d.length+1}}static from(e,n=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let v of e)r+=v.lines;if(r<32){let v=[];for(let b of e)b.flatten(v);return new ir(v,n)}let s=Math.max(32,r>>5),i=s<<1,l=s>>1,c=[],d=0,h=-1,m=[];function p(v){let b;if(v.lines>i&&v instanceof Du)for(let k of v.children)p(k);else v.lines>l&&(d>l||!d)?(x(),c.push(v)):v instanceof ir&&d&&(b=m[m.length-1])instanceof ir&&v.lines+b.lines<=32?(d+=v.lines,h+=v.length+1,m[m.length-1]=new ir(b.text.concat(v.text),b.length+1+v.length)):(d+v.lines>s&&x(),d+=v.lines,h+=v.length+1,m.push(v))}function x(){d!=0&&(c.push(m.length==1?m[0]:Du.from(m,h)),h=-1,d=m.length=0)}for(let v of e)p(v);return x(),c.length==1?c[0]:new Du(c,n)}};Wt.empty=new ir([""],0);function $U(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Xp(t,e,n=0,r=1e9){for(let s=0,i=0,l=!0;i=n&&(d>r&&(c=c.slice(0,r-s)),s0?1:(e instanceof ir?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],i=this.offsets[r],l=i>>1,c=s instanceof ir?s.text.length:s.children.length;if(l==(n>0?c:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(s instanceof ir){let d=s.text[l+(n<0?-1:0)];if(this.offsets[r]+=n,d.length>Math.max(0,e))return this.value=e==0?d:n>0?d.slice(e):d.slice(0,d.length-e),this;e-=d.length}else{let d=s.children[l+(n<0?-1:0)];e>d.length?(e-=d.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(d),this.offsets.push(n>0?1:(d instanceof ir?d.text.length:d.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class SM{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new Zh(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*n,this.value=s.length<=r?s:n<0?s.slice(s.length-r):s.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class kM{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:s}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Wt.prototype[Symbol.iterator]=function(){return this.iter()},Zh.prototype[Symbol.iterator]=SM.prototype[Symbol.iterator]=kM.prototype[Symbol.iterator]=function(){return this});class HU{constructor(e,n,r,s){this.from=e,this.to=n,this.number=r,this.text=s}get length(){return this.to-this.from}}function cd(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function Vr(t,e,n=!0,r=!0){return FU(t,e,n,r)}function UU(t){return t>=56320&&t<57344}function VU(t){return t>=55296&&t<56320}function Ms(t,e){let n=t.charCodeAt(e);if(!VU(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return UU(r)?(n-55296<<10)+(r-56320)+65536:n}function yw(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function aa(t){return t<65536?1:2}const m2=/\r\n?|\n/;var Ur=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(Ur||(Ur={}));class xa{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return i+(e-s);i+=c}else{if(r!=Ur.Simple&&h>=e&&(r==Ur.TrackDel&&se||r==Ur.TrackBefore&&se))return null;if(h>e||h==e&&n<0&&!c)return e==s||n<0?i:i+d;i+=d}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return i}touchesRange(e,n=e){for(let r=0,s=0;r=0&&s<=n&&c>=e)return sn?"cover":!0;s=c}return!1}toString(){let e="";for(let n=0;n=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new xa(e)}static create(e){return new xa(e)}}class kr extends xa{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return p2(this,(n,r,s,i,l)=>e=e.replace(s,s+(r-n),l),!1),e}mapDesc(e,n=!1){return g2(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let s=0,i=0;s=0){n[s]=c,n[s+1]=l;let d=s>>1;for(;r.length0&&no(r,n,i.text),i.forward(m),c+=m}let h=e[l++];for(;c>1].toJSON()))}return e}static of(e,n,r){let s=[],i=[],l=0,c=null;function d(m=!1){if(!m&&!s.length)return;lx||p<0||x>n)throw new RangeError(`Invalid change range ${p} to ${x} (in doc of length ${n})`);let b=v?typeof v=="string"?Wt.of(v.split(r||m2)):v:Wt.empty,k=b.length;if(p==x&&k==0)return;pl&&Jr(s,p-l,-1),Jr(s,x-p,k),no(i,s,b),l=x}}return h(e),d(!c),c}static empty(e){return new kr(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let s=0;sc&&typeof l!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length=0&&n<=0&&n==t[s+1]?t[s]+=e:s>=0&&e==0&&t[s]==0?t[s+1]+=n:r?(t[s]+=e,t[s+1]+=n):t.push(e,n)}function no(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r>1])),!(n||l==t.sections.length||t.sections[l+1]<0);)c=t.sections[l++],d=t.sections[l++];e(s,h,i,m,p),s=h,i=m}}}function g2(t,e,n,r=!1){let s=[],i=r?[]:null,l=new pf(t),c=new pf(e);for(let d=-1;;){if(l.done&&c.len||c.done&&l.len)throw new Error("Mismatched change set lengths");if(l.ins==-1&&c.ins==-1){let h=Math.min(l.len,c.len);Jr(s,h,-1),l.forward(h),c.forward(h)}else if(c.ins>=0&&(l.ins<0||d==l.i||l.off==0&&(c.len=0&&d=0){let h=0,m=l.len;for(;m;)if(c.ins==-1){let p=Math.min(m,c.len);h+=p,m-=p,c.forward(p)}else if(c.ins==0&&c.lend||l.ins>=0&&l.len>d)&&(c||r.length>h),i.forward2(d),l.forward(d)}}}}class pf{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?Wt.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?Wt.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class ac{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,s;return this.empty?r=s=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new ac(r,s,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return Ce.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return Ce.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Ce.range(e.anchor,e.head)}static create(e,n,r){return new ac(e,n,r)}}class Ce{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:Ce.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Ce(e.ranges.map(n=>ac.fromJSON(n)),e.main)}static single(e,n=e){return new Ce([Ce.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;se?8:0)|i)}static normalized(e,n=0){let r=e[n];e.sort((s,i)=>s.from-i.from),n=e.indexOf(r);for(let s=1;si.head?Ce.range(d,c):Ce.range(c,d))}}return new Ce(e,n)}}function jM(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let bw=0;class He{constructor(e,n,r,s,i){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=bw++,this.default=e([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(e={}){return new He(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:ww),!!e.static,e.enables)}of(e){return new Yp([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yp(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yp(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function ww(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Yp{constructor(e,n,r,s){this.dependencies=e,this.facet=n,this.type=r,this.value=s,this.id=bw++}dynamicSlot(e){var n;let r=this.value,s=this.facet.compareInput,i=this.id,l=e[i]>>1,c=this.type==2,d=!1,h=!1,m=[];for(let p of this.dependencies)p=="doc"?d=!0:p=="selection"?h=!0:(((n=e[p.id])!==null&&n!==void 0?n:1)&1)==0&&m.push(e[p.id]);return{create(p){return p.values[l]=r(p),1},update(p,x){if(d&&x.docChanged||h&&(x.docChanged||x.selection)||x2(p,m)){let v=r(p);if(c?!ej(v,p.values[l],s):!s(v,p.values[l]))return p.values[l]=v,1}return 0},reconfigure:(p,x)=>{let v,b=x.config.address[i];if(b!=null){let k=kg(x,b);if(this.dependencies.every(O=>O instanceof He?x.facet(O)===p.facet(O):O instanceof Lr?x.field(O,!1)==p.field(O,!1):!0)||(c?ej(v=r(p),k,s):s(v=r(p),k)))return p.values[l]=k,0}else v=r(p);return p.values[l]=v,1}}}}function ej(t,e,n){if(t.length!=e.length)return!1;for(let r=0;rt[d.id]),s=n.map(d=>d.type),i=r.filter(d=>!(d&1)),l=t[e.id]>>1;function c(d){let h=[];for(let m=0;mr===s),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Zm).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let i=r.values[n],l=this.updateF(i,s);return this.compareF(i,l)?0:(r.values[n]=l,1)},reconfigure:(r,s)=>{let i=r.facet(Zm),l=s.facet(Zm),c;return(c=i.find(d=>d.field==this))&&c!=l.find(d=>d.field==this)?(r.values[n]=c.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Zm.of({field:this,create:e})]}get extension(){return this}}const rc={lowest:4,low:3,default:2,high:1,highest:0};function _h(t){return e=>new NM(e,t)}const jo={highest:_h(rc.highest),high:_h(rc.high),default:_h(rc.default),low:_h(rc.low),lowest:_h(rc.lowest)};class NM{constructor(e,n){this.inner=e,this.prec=n}}class wx{of(e){return new v2(this,e)}reconfigure(e){return wx.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class v2{constructor(e,n){this.compartment=e,this.inner=n}}class Sg{constructor(e,n,r,s,i,l){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=l,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,r){let s=[],i=Object.create(null),l=new Map;for(let x of GU(e,n,l))x instanceof Lr?s.push(x):(i[x.facet.id]||(i[x.facet.id]=[])).push(x);let c=Object.create(null),d=[],h=[];for(let x of s)c[x.id]=h.length<<1,h.push(v=>x.slot(v));let m=r?.config.facets;for(let x in i){let v=i[x],b=v[0].facet,k=m&&m[x]||[];if(v.every(O=>O.type==0))if(c[b.id]=d.length<<1|1,ww(k,v))d.push(r.facet(b));else{let O=b.combine(v.map(j=>j.value));d.push(r&&b.compare(O,r.facet(b))?r.facet(b):O)}else{for(let O of v)O.type==0?(c[O.id]=d.length<<1|1,d.push(O.value)):(c[O.id]=h.length<<1,h.push(j=>O.dynamicSlot(j)));c[b.id]=h.length<<1,h.push(O=>WU(O,b,v))}}let p=h.map(x=>x(c));return new Sg(e,l,p,c,d,i)}}function GU(t,e,n){let r=[[],[],[],[],[]],s=new Map;function i(l,c){let d=s.get(l);if(d!=null){if(d<=c)return;let h=r[d].indexOf(l);h>-1&&r[d].splice(h,1),l instanceof v2&&n.delete(l.compartment)}if(s.set(l,c),Array.isArray(l))for(let h of l)i(h,c);else if(l instanceof v2){if(n.has(l.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(l.compartment)||l.inner;n.set(l.compartment,h),i(h,c)}else if(l instanceof NM)i(l.inner,l.prec);else if(l instanceof Lr)r[c].push(l),l.provides&&i(l.provides,c);else if(l instanceof Yp)r[c].push(l),l.facet.extensions&&i(l.facet.extensions,rc.default);else{let h=l.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${l}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(h,c)}}return i(t,rc.default),r.reduce((l,c)=>l.concat(c))}function Jh(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let s=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|s}function kg(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const CM=He.define(),y2=He.define({combine:t=>t.some(e=>e),static:!0}),TM=He.define({combine:t=>t.length?t[0]:void 0,static:!0}),MM=He.define(),AM=He.define(),EM=He.define(),_M=He.define({combine:t=>t.length?t[0]:!1});class Sa{constructor(e,n){this.type=e,this.value=n}static define(){return new XU}}class XU{of(e){return new Sa(this,e)}}class YU{constructor(e){this.map=e}of(e){return new xt(this,e)}}class xt{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new xt(this.type,n)}is(e){return this.type==e}static define(e={}){return new YU(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let s of e){let i=s.map(n);i&&r.push(i)}return r}}xt.reconfigure=xt.define();xt.appendConfig=xt.define();class gr{constructor(e,n,r,s,i,l){this.startState=e,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=l,this._doc=null,this._state=null,r&&jM(r,n.newLength),i.some(c=>c.type==gr.time)||(this.annotations=i.concat(gr.time.of(Date.now())))}static create(e,n,r,s,i,l){return new gr(e,n,r,s,i,l)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(gr.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}gr.time=Sa.define();gr.userEvent=Sa.define();gr.addToHistory=Sa.define();gr.remote=Sa.define();function KU(t,e){let n=[];for(let r=0,s=0;;){let i,l;if(r=t[r]))i=t[r++],l=t[r++];else if(s=0;s--){let i=r[s](t);i instanceof gr?t=i:Array.isArray(i)&&i.length==1&&i[0]instanceof gr?t=i[0]:t=RM(e,Wu(i),!1)}return t}function JU(t){let e=t.startState,n=e.facet(EM),r=t;for(let s=n.length-1;s>=0;s--){let i=n[s](t);i&&Object.keys(i).length&&(r=DM(r,b2(e,i,t.changes.newLength),!0))}return r==t?t:gr.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const eV=[];function Wu(t){return t==null?eV:Array.isArray(t)?t:[t]}var Vn=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(Vn||(Vn={}));const tV=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let w2;try{w2=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function nV(t){if(w2)return w2.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||tV.test(n)))return!0}return!1}function rV(t){return e=>{if(!/\S/.test(e))return Vn.Space;if(nV(e))return Vn.Word;for(let n=0;n-1)return Vn.Word;return Vn.Other}}class Vt{constructor(e,n,r,s,i,l){this.config=e,this.doc=n,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=i,l&&(l._state=this);for(let c=0;cs.set(h,d)),n=null),s.set(c.value.compartment,c.value.extension)):c.is(xt.reconfigure)?(n=null,r=c.value):c.is(xt.appendConfig)&&(n=null,r=Wu(r).concat(c.value));let i;n?i=e.startState.values.slice():(n=Sg.resolve(r,s,this),i=new Vt(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(d,h)=>h.reconfigure(d,this),null).values);let l=e.startState.facet(y2)?e.newSelection:e.newSelection.asSingle();new Vt(n,e.newDoc,l,i,(c,d)=>d.update(c,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:Ce.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),s=this.changes(r.changes),i=[r.range],l=Wu(r.effects);for(let c=1;cl.spec.fromJSON(c,d)))}}return Vt.create({doc:e.doc,selection:Ce.fromJSON(e.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(e={}){let n=Sg.resolve(e.extensions||[],new Map),r=e.doc instanceof Wt?e.doc:Wt.of((e.doc||"").split(n.staticFacet(Vt.lineSeparator)||m2)),s=e.selection?e.selection instanceof Ce?e.selection:Ce.single(e.selection.anchor,e.selection.head):Ce.single(0);return jM(s,r.length),n.staticFacet(y2)||(s=s.asSingle()),new Vt(n,r,s,n.dynamicSlots.map(()=>null),(i,l)=>l.create(i),null)}get tabSize(){return this.facet(Vt.tabSize)}get lineBreak(){return this.facet(Vt.lineSeparator)||` +`}get readOnly(){return this.facet(_M)}phrase(e,...n){for(let r of this.facet(Vt.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let i=+(s||1);return!i||i>n.length?r:n[i-1]})),e}languageDataAt(e,n,r=-1){let s=[];for(let i of this.facet(CM))for(let l of i(this,n,r))Object.prototype.hasOwnProperty.call(l,e)&&s.push(l[e]);return s}charCategorizer(e){return rV(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:r,length:s}=this.doc.lineAt(e),i=this.charCategorizer(e),l=e-r,c=e-r;for(;l>0;){let d=Vr(n,l,!1);if(i(n.slice(d,l))!=Vn.Word)break;l=d}for(;ct.length?t[0]:4});Vt.lineSeparator=TM;Vt.readOnly=_M;Vt.phrases=He.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(s=>t[s]==e[s])}});Vt.languageData=CM;Vt.changeFilter=MM;Vt.transactionFilter=AM;Vt.transactionExtender=EM;wx.reconfigure=xt.define();function ka(t,e,n={}){let r={};for(let s of t)for(let i of Object.keys(s)){let l=s[i],c=r[i];if(c===void 0)r[i]=l;else if(!(c===l||l===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](c,l);else throw new Error("Config merge conflict for field "+i)}for(let s in e)r[s]===void 0&&(r[s]=e[s]);return r}class yc{eq(e){return this==e}range(e,n=e){return S2.create(e,n,this)}}yc.prototype.startSide=yc.prototype.endSide=0;yc.prototype.point=!1;yc.prototype.mapMode=Ur.TrackDel;let S2=class zM{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new zM(e,n,r)}};function k2(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Sw{constructor(e,n,r,s){this.from=e,this.to=n,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,s=0){let i=r?this.to:this.from;for(let l=s,c=i.length;;){if(l==c)return l;let d=l+c>>1,h=i[d]-e||(r?this.value[d].endSide:this.value[d].startSide)-n;if(d==l)return h>=0?l:c;h>=0?c=d:l=d+1}}between(e,n,r,s){for(let i=this.findIndex(n,-1e9,!0),l=this.findIndex(r,1e9,!1,i);iv||x==v&&h.startSide>0&&h.endSide<=0)continue;(v-x||h.endSide-h.startSide)<0||(l<0&&(l=x),h.point&&(c=Math.max(c,v-x)),r.push(h),s.push(x-l),i.push(v-l))}return{mapped:r.length?new Sw(s,i,r,c):null,pos:l}}}class Gt{constructor(e,n,r,s){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=s}static create(e,n,r,s){return new Gt(e,n,r,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:s=0,filterTo:i=this.length}=e,l=e.filter;if(n.length==0&&!l)return this;if(r&&(n=n.slice().sort(k2)),this.isEmpty)return n.length?Gt.of(n):this;let c=new PM(this,null,-1).goto(0),d=0,h=[],m=new fl;for(;c.value||d=0){let p=n[d++];m.addInner(p.from,p.to,p.value)||h.push(p)}else c.rangeIndex==1&&c.chunkIndexthis.chunkEnd(c.chunkIndex)||ic.to||i=i&&e<=i+l.length&&l.between(i,e-i,n-i,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return gf.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return gf.from(e).goto(n)}static compare(e,n,r,s,i=-1){let l=e.filter(p=>p.maxPoint>0||!p.isEmpty&&p.maxPoint>=i),c=n.filter(p=>p.maxPoint>0||!p.isEmpty&&p.maxPoint>=i),d=tj(l,c,r),h=new Dh(l,d,i),m=new Dh(c,d,i);r.iterGaps((p,x,v)=>nj(h,p,m,x,v,s)),r.empty&&r.length==0&&nj(h,0,m,0,0,s)}static eq(e,n,r=0,s){s==null&&(s=999999999);let i=e.filter(m=>!m.isEmpty&&n.indexOf(m)<0),l=n.filter(m=>!m.isEmpty&&e.indexOf(m)<0);if(i.length!=l.length)return!1;if(!i.length)return!0;let c=tj(i,l),d=new Dh(i,c,0).goto(r),h=new Dh(l,c,0).goto(r);for(;;){if(d.to!=h.to||!O2(d.active,h.active)||d.point&&(!h.point||!d.point.eq(h.point)))return!1;if(d.to>s)return!0;d.next(),h.next()}}static spans(e,n,r,s,i=-1){let l=new Dh(e,null,i).goto(n),c=n,d=l.openStart;for(;;){let h=Math.min(l.to,r);if(l.point){let m=l.activeForPoint(l.to),p=l.pointFromc&&(s.span(c,h,l.active,d),d=l.openEnd(h));if(l.to>r)return d+(l.point&&l.to>r?1:0);c=l.to,l.next()}}static of(e,n=!1){let r=new fl;for(let s of e instanceof S2?[e]:n?sV(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return Gt.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=Gt.empty;s=s.nextLayer)n=new Gt(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}Gt.empty=new Gt([],[],null,-1);function sV(t){if(t.length>1)for(let e=t[0],n=1;n0)return t.slice().sort(k2);e=r}return t}Gt.empty.nextLayer=Gt.empty;class fl{finishChunk(e){this.chunks.push(new Sw(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new fl)).add(e,n,r)}addInner(e,n,r){let s=e-this.lastTo||r.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(Gt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=Gt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function tj(t,e,n){let r=new Map;for(let i of t)for(let l=0;l=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&s.push(new PM(l,n,r,i));return s.length==1?s[0]:new gf(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)Ty(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)Ty(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Ty(this.heap,0)}}}function Ty(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let s=t[r];if(r+1=0&&(s=t[r+1],r++),n.compare(s)<0)break;t[r]=n,t[e]=s,e=r}}class Dh{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=gf.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){Jm(this.active,e),Jm(this.activeTo,e),Jm(this.activeRank,e),this.minActive=rj(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:s,rank:i}=this.cursor;for(;n0;)n++;ep(this.active,n,r),ep(this.activeTo,n,s),ep(this.activeRank,n,i),e&&ep(e,n,this.cursor.from),this.minActive=rj(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&Jm(r,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&r[s]=0&&!(this.activeRank[r]e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function nj(t,e,n,r,s,i){t.goto(e),n.goto(r);let l=r+s,c=r,d=r-e;for(;;){let h=t.to+d-n.to,m=h||t.endSide-n.endSide,p=m<0?t.to+d:n.to,x=Math.min(p,l);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&O2(t.activeForPoint(t.to),n.activeForPoint(n.to))||i.comparePoint(c,x,t.point,n.point):x>c&&!O2(t.active,n.active)&&i.compareRange(c,x,t.active,n.active),p>l)break;(h||t.openEnd!=n.openEnd)&&i.boundChange&&i.boundChange(p),c=p,m<=0&&t.next(),m>=0&&n.next()}}function O2(t,e){if(t.length!=e.length)return!1;for(let n=0;n=e;r--)t[r+1]=t[r];t[e]=n}function rj(t,e){let n=-1,r=1e9;for(let s=0;s=e)return s;if(s==t.length)break;i+=t.charCodeAt(s)==9?n-i%n:1,s=Vr(t,s)}return r===!0?-1:t.length}const N2="ͼ",sj=typeof Symbol>"u"?"__"+N2:Symbol.for(N2),C2=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),ij=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ho{constructor(e,n){this.rules=[];let{finish:r}=n||{};function s(l){return/^@/.test(l)?[l]:l.split(/,\s*/)}function i(l,c,d,h){let m=[],p=/^@(\w+)\b/.exec(l[0]),x=p&&p[1]=="keyframes";if(p&&c==null)return d.push(l[0]+";");for(let v in c){let b=c[v];if(/&/.test(v))i(v.split(/,\s*/).map(k=>l.map(O=>k.replace(/&/,O))).reduce((k,O)=>k.concat(O)),b,d);else if(b&&typeof b=="object"){if(!p)throw new RangeError("The value of a property ("+v+") should be a primitive value.");i(s(v),b,m,x)}else b!=null&&m.push(v.replace(/_.*/,"").replace(/[A-Z]/g,k=>"-"+k.toLowerCase())+": "+b+";")}(m.length||x)&&d.push((r&&!p&&!h?l.map(r):l).join(", ")+" {"+m.join(" ")+"}")}for(let l in e)i(s(l),e[l],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=ij[sj]||1;return ij[sj]=e+1,N2+e.toString(36)}static mount(e,n,r){let s=e[C2],i=r&&r.nonce;s?i&&s.setNonce(i):s=new iV(e,i),s.mount(Array.isArray(n)?n:[n],e)}}let aj=new Map;class iV{constructor(e,n){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let i=aj.get(r);if(i)return e[C2]=i;this.sheet=new s.CSSStyleSheet,aj.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[C2]=this}mount(e,n){let r=this.sheet,s=0,i=0;for(let l=0;l-1&&(this.modules.splice(d,1),i--,d=-1),d==-1){if(this.modules.splice(i++,0,c),r)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},aV=typeof navigator<"u"&&/Mac/.test(navigator.platform),lV=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Hr=0;Hr<10;Hr++)fo[48+Hr]=fo[96+Hr]=String(Hr);for(var Hr=1;Hr<=24;Hr++)fo[Hr+111]="F"+Hr;for(var Hr=65;Hr<=90;Hr++)fo[Hr]=String.fromCharCode(Hr+32),xf[Hr]=String.fromCharCode(Hr);for(var My in fo)xf.hasOwnProperty(My)||(xf[My]=fo[My]);function oV(t){var e=aV&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||lV&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?xf:fo)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function An(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var s=n[r];typeof s=="string"?t.setAttribute(r,s):s!=null&&(t[r]=s)}e++}for(;e2);var Fe={mac:oj||/Mac/.test(us.platform),windows:/Win/.test(us.platform),linux:/Linux|X11/.test(us.platform),ie:Sx,ie_version:BM?T2.documentMode||6:A2?+A2[1]:M2?+M2[1]:0,gecko:lj,gecko_version:lj?+(/Firefox\/(\d+)/.exec(us.userAgent)||[0,0])[1]:0,chrome:!!Ay,chrome_version:Ay?+Ay[1]:0,ios:oj,android:/Android\b/.test(us.userAgent),webkit_version:cV?+(/\bAppleWebKit\/(\d+)/.exec(us.userAgent)||[0,0])[1]:0,safari:E2,safari_version:E2?+(/\bVersion\/(\d+(\.\d+)?)/.exec(us.userAgent)||[0,0])[1]:0,tabSize:T2.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function vf(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function _2(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Kp(t,e){if(!e.anchorNode)return!1;try{return _2(t,e.anchorNode)}catch{return!1}}function ud(t){return t.nodeType==3?wc(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function ef(t,e,n,r){return n?cj(t,e,n,r,-1)||cj(t,e,n,r,1):!1}function bc(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Og(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function cj(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:ya(t))){if(t.nodeName=="DIV")return!1;let i=t.parentNode;if(!i||i.nodeType!=1)return!1;e=bc(t)+(s<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=s<0?ya(t):0}else return!1}}function ya(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function s0(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function uV(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function IM(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function dV(t,e,n,r,s,i,l,c){let d=t.ownerDocument,h=d.defaultView||window;for(let m=t,p=!1;m&&!p;)if(m.nodeType==1){let x,v=m==d.body,b=1,k=1;if(v)x=uV(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(m).position)&&(p=!0),m.scrollHeight<=m.clientHeight&&m.scrollWidth<=m.clientWidth){m=m.assignedSlot||m.parentNode;continue}let T=m.getBoundingClientRect();({scaleX:b,scaleY:k}=IM(m,T)),x={left:T.left,right:T.left+m.clientWidth*b,top:T.top,bottom:T.top+m.clientHeight*k}}let O=0,j=0;if(s=="nearest")e.top0&&e.bottom>x.bottom+j&&(j=e.bottom-x.bottom+l)):e.bottom>x.bottom&&(j=e.bottom-x.bottom+l,n<0&&e.top-j0&&e.right>x.right+O&&(O=e.right-x.right+i)):e.right>x.right&&(O=e.right-x.right+i,n<0&&e.leftx.bottom||e.leftx.right)&&(e={left:Math.max(e.left,x.left),right:Math.min(e.right,x.right),top:Math.max(e.top,x.top),bottom:Math.min(e.bottom,x.bottom)}),m=m.assignedSlot||m.parentNode}else if(m.nodeType==11)m=m.host;else break}function hV(t){let e=t.ownerDocument,n,r;for(let s=t.parentNode;s&&!(s==e.body||n&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),!n&&s.scrollWidth>s.clientWidth&&(n=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:n,y:r}}class fV{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?ya(n):0),r,Math.min(e.focusOffset,r?ya(r):0))}set(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let tc=null;Fe.safari&&Fe.safari_version>=26&&(tc=!1);function qM(t){if(t.setActive)return t.setActive();if(tc)return t.focus(tc);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(tc==null?{get preventScroll(){return tc={preventScroll:!0},!0}}:void 0),!tc){tc=!1;for(let n=0;nMath.max(1,t.scrollHeight-t.clientHeight-4)}function $M(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=ya(n)}else if(n.parentNode&&!Og(n))r=bc(n),n=n.parentNode;else return null}}function HM(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&rn)return p.domBoundsAround(e,n,h);if(x>=e&&s==-1&&(s=d,i=h),h>n&&p.dom.parentNode==this.dom){l=d,c=m;break}m=x,h=x+p.breakAfter}return{from:i,to:c<0?r+this.length:c,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:l=0?this.children[l].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,r=kw){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}}function VM(t,e,n,r,s,i,l,c,d){let{children:h}=t,m=h.length?h[e]:null,p=i.length?i[i.length-1]:null,x=p?p.breakAfter:l;if(!(e==r&&m&&!l&&!x&&i.length<2&&m.merge(n,s,i.length?p:null,n==0,c,d))){if(r0&&(!l&&i.length&&m.merge(n,m.length,i[0],!1,c,0)?m.breakAfter=i.shift().breakAfter:(ngV||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new Qi(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new ns(this.dom,e)}domBoundsAround(e,n,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return xV(this.dom,e,n)}}class ml extends jn{constructor(e,n=[],r=0){super(),this.mark=e,this.children=n,this.length=r;for(let s of n)s.setParent(this)}setAttrs(e){if(FM(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,r,s,i,l){return r&&(!(r instanceof ml&&r.mark.eq(this.mark))||e&&i<=0||ne&&n.push(r=e&&(s=i),r=d,i++}let l=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new ml(this.mark,n,l)}domAtPos(e){return GM(this,e)}coordsAt(e,n){return YM(this,e,n)}}function xV(t,e,n){let r=t.nodeValue.length;e>r&&(e=r);let s=e,i=e,l=0;e==0&&n<0||e==r&&n>=0?Fe.chrome||Fe.gecko||(e?(s--,l=1):i=0)?0:c.length-1];return Fe.safari&&!l&&d.width==0&&(d=Array.prototype.find.call(c,h=>h.width)||d),l?s0(d,l<0):d||null}class il extends jn{static create(e,n,r){return new il(e,n,r)}constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}split(e){let n=il.create(this.widget,this.length-e,this.side);return this.length-=e,n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,n,r,s,i,l){return r&&(!(r instanceof il)||!this.widget.compare(r.widget)||e>0&&i<=0||n0)?ns.before(this.dom):ns.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);if(r)return r;let s=this.dom.getClientRects(),i=null;if(!s.length)return null;let l=this.side?this.side<0:e>0;for(let c=l?s.length-1:0;i=s[c],!(e>0?c==0:c==s.length-1||i.top0?ns.before(this.dom):ns.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Wt.empty}get isHidden(){return!0}}Qi.prototype.children=il.prototype.children=dd.prototype.children=kw;function GM(t,e){let n=t.dom,{children:r}=t,s=0;for(let i=0;si&&e0;i--){let l=r[i-1];if(l.dom.parentNode==n)return l.domAtPos(l.length)}for(let i=s;i0&&e instanceof ml&&s.length&&(r=s[s.length-1])instanceof ml&&r.mark.eq(e.mark)?XM(r,e.children[0],n-1):(s.push(e),e.setParent(t)),t.length+=e.length}function YM(t,e,n){let r=null,s=-1,i=null,l=-1;function c(h,m){for(let p=0,x=0;p=m&&(v.children.length?c(v,m-x):(!i||i.isHidden&&(n>0||yV(i,v)))&&(b>m||x==b&&v.getSide()>0)?(i=v,l=m-x):(x-1?1:0)!=s.length-(n&&s.indexOf(n)>-1?1:0))return!1;for(let i of r)if(i!=n&&(s.indexOf(i)==-1||t[i]!==e[i]))return!1;return!0}function R2(t,e,n){let r=!1;if(e)for(let s in e)n&&s in n||(r=!0,s=="style"?t.style.cssText="":t.removeAttribute(s));if(n)for(let s in n)e&&e[s]==n[s]||(r=!0,s=="style"?t.style.cssText=n[s]:t.setAttribute(s,n[s]));return r}function bV(t){let e=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new mo(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,s;if(e.isBlockGap)r=-5e8,s=4e8;else{let{start:i,end:l}=KM(e,n);r=(i?n?-3e8:-1:5e8)-1,s=(l?n?2e8:1:-6e8)+1}return new mo(e,r,s,n,e.widget||null,!0)}static line(e){return new a0(e)}static set(e,n=!1){return Gt.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Je.none=Gt.empty;class i0 extends Je{constructor(e){let{start:n,end:r}=KM(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var n,r;return this==e||e instanceof i0&&this.tagName==e.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&jg(this.attrs,e.attrs,"class")}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}i0.prototype.point=!1;class a0 extends Je{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof a0&&this.spec.class==e.spec.class&&jg(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}a0.prototype.mapMode=Ur.TrackBefore;a0.prototype.point=!0;class mo extends Je{constructor(e,n,r,s,i,l){super(n,r,i,e),this.block=s,this.isReplace=l,this.mapMode=s?n<=0?Ur.TrackBefore:Ur.TrackAfter:Ur.TrackDel}get type(){return this.startSide!=this.endSide?fs.WidgetRange:this.startSide<=0?fs.WidgetBefore:fs.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof mo&&wV(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}mo.prototype.point=!0;function KM(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function wV(t,e){return t==e||!!(t&&e&&t.compare(e))}function Zp(t,e,n,r=0){let s=n.length-1;s>=0&&n[s]+r>=t?n[s]=Math.max(n[s],e):n.push(t,e)}class pr extends jn{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,r,s,i,l){if(r){if(!(r instanceof pr))return!1;this.dom||r.transferDOM(this)}return s&&this.setDeco(r?r.attrs:null),WM(this,e,n,r?r.children.slice():[],i,l),!0}split(e){let n=new pr;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i:r,off:s}=this.childPos(e);s&&(n.append(this.children[r].split(s),0),this.children[r].merge(s,this.children[r].length,null,!1,0,0),r++);for(let i=r;i0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,n}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){jg(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){XM(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=D2(n,this.attrs||{})),r&&(this.attrs=D2({class:r},this.attrs||{}))}domAtPos(e){return GM(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(FM(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(R2(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,n);let s=this.dom.lastChild;for(;s&&jn.get(s)instanceof ml;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((r=jn.get(s))===null||r===void 0?void 0:r.isEditable)==!1&&(!Fe.ios||!this.children.some(i=>i instanceof Qi))){let i=document.createElement("BR");i.cmIgnore=!0,this.dom.appendChild(i)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,n;for(let r of this.children){if(!(r instanceof Qi)||/[^ -~]/.test(r.text))return null;let s=ud(r.dom);if(s.length!=1)return null;e+=s[0].width,n=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:n}:null}coordsAt(e,n){let r=YM(this,e,n);if(!this.children.length&&r&&this.parent){let{heightOracle:s}=this.parent.view.viewState,i=r.bottom-r.top;if(Math.abs(i-s.lineHeight)<2&&s.textHeight=n){if(i instanceof pr)return i;if(l>n)break}s=l+i.breakAfter}return null}}class ol extends jn{constructor(e,n,r){super(),this.widget=e,this.length=n,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,n,r,s,i,l){return r&&(!(r instanceof ol)||!this.widget.compare(r.widget)||e>0&&i<=0||n0}}class z2 extends Oa{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class tf{constructor(e,n,r,s){this.doc=e,this.pos=n,this.end=r,this.disallowBlockEffectsFor=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=n}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof ol&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new pr),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(tp(new dd(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof ol)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:l,lineBreak:c,done:d}=this.cursor.next(this.skip);if(this.skip=0,d)throw new Error("Ran out of text content when drawing inline views");if(c){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=l,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e),i=Math.min(s,512);this.flushBuffer(n.slice(n.length-r)),this.getLine().append(tp(new Qi(this.text.slice(this.textOff,this.textOff+i)),n),r),this.atCursorPos=!0,this.textOff+=i,e-=i,r=s<=i?0:n.length}}span(e,n,r,s){this.buildText(n-e,r,s),this.pos=n,this.openStart<0&&(this.openStart=s)}point(e,n,r,s,i,l){if(this.disallowBlockEffectsFor[l]&&r instanceof mo){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let c=n-e;if(r instanceof mo)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ol(r.widget||hd.block,c,r));else{let d=il.create(r.widget||hd.inline,c,c?0:r.startSide),h=this.atCursorPos&&!d.isEditable&&i<=s.length&&(e0),m=!d.isEditable&&(es.length||r.startSide<=0),p=this.getLine();this.pendingBuffer==2&&!h&&!d.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),h&&(p.append(tp(new dd(1),s),i),i=s.length+Math.max(0,i-s.length)),p.append(tp(d,s),i),this.atCursorPos=m,this.pendingBuffer=m?es.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);c&&(this.textOff+c<=this.text.length?this.textOff+=c:(this.skip+=c-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=i)}static build(e,n,r,s,i){let l=new tf(e,n,r,i);return l.openEnd=Gt.spans(s,n,r,l),l.openStart<0&&(l.openStart=l.openEnd),l.finish(l.openEnd),l}}function tp(t,e){for(let n of e)t=new ml(n,[t],t.length);return t}class hd extends Oa{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}hd.inline=new hd("span");hd.block=new hd("div");var Hn=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(Hn||(Hn={}));const Sc=Hn.LTR,Ow=Hn.RTL;function ZM(t){let e=[];for(let n=0;n=n){if(c.level==r)return l;(i<0||(s!=0?s<0?c.fromn:e[i].level>c.level))&&(i=l)}}if(i<0)throw new RangeError("Index out of range");return i}}function eA(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;k-=3)if(Ji[k+1]==-v){let O=Ji[k+2],j=O&2?s:O&4?O&1?i:s:0;j&&(En[p]=En[Ji[k]]=j),c=k;break}}else{if(Ji.length==189)break;Ji[c++]=p,Ji[c++]=x,Ji[c++]=d}else if((b=En[p])==2||b==1){let k=b==s;d=k?0:1;for(let O=c-3;O>=0;O-=3){let j=Ji[O+2];if(j&2)break;if(k)Ji[O+2]|=2;else{if(j&4)break;Ji[O+2]|=4}}}}}function CV(t,e,n,r){for(let s=0,i=r;s<=n.length;s++){let l=s?n[s-1].to:t,c=sd;)b==O&&(b=n[--k].from,O=k?n[k-1].to:t),En[--b]=v;d=m}else i=h,d++}}}function L2(t,e,n,r,s,i,l){let c=r%2?2:1;if(r%2==s%2)for(let d=e,h=0;dd&&l.push(new ro(d,k.from,v));let O=k.direction==Sc!=!(v%2);B2(t,O?r+1:r,s,k.inner,k.from,k.to,l),d=k.to}b=k.to}else{if(b==n||(m?En[b]!=c:En[b]==c))break;b++}x?L2(t,d,b,r+1,s,x,l):de;){let m=!0,p=!1;if(!h||d>i[h-1].to){let k=En[d-1];k!=c&&(m=!1,p=k==16)}let x=!m&&c==1?[]:null,v=m?r:r+1,b=d;e:for(;;)if(h&&b==i[h-1].to){if(p)break e;let k=i[--h];if(!m)for(let O=k.from,j=h;;){if(O==e)break e;if(j&&i[j-1].to==O)O=i[--j].from;else{if(En[O-1]==c)break e;break}}if(x)x.push(k);else{k.toEn.length;)En[En.length]=256;let r=[],s=e==Sc?0:1;return B2(t,s,s,n,0,t.length,r),r}function tA(t){return[new ro(0,t,0)]}let nA="";function MV(t,e,n,r,s){var i;let l=r.head-t.from,c=ro.find(e,l,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),d=e[c],h=d.side(s,n);if(l==h){let x=c+=s?1:-1;if(x<0||x>=e.length)return null;d=e[c=x],l=d.side(!s,n),h=d.side(s,n)}let m=Vr(t.text,l,d.forward(s,n));(md.to)&&(m=h),nA=t.text.slice(Math.min(l,m),Math.max(l,m));let p=c==(s?e.length-1:0)?null:e[c+(s?1:-1)];return p&&m==h&&p.level+(s?0:1)t.some(e=>e)}),uA=He.define({combine:t=>t.some(e=>e)}),dA=He.define();class Xu{constructor(e,n="nearest",r="nearest",s=5,i=5,l=!1){this.range=e,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=l}map(e){return e.empty?this:new Xu(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Xu(Ce.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const np=xt.define({map:(t,e)=>t.map(e)}),hA=xt.define();function Es(t,e,n){let r=t.facet(aA);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const sl=He.define({combine:t=>t.length?t[0]:!0});let EV=0;const Fu=He.define({combine(t){return t.filter((e,n)=>{for(let r=0;r{let d=[];return l&&d.push(yf.of(h=>{let m=h.plugin(c);return m?l(m):Je.none})),i&&d.push(i(c)),d})}static fromClass(e,n){return lr.define((r,s)=>new e(r,s),n)}}class Ey{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(Es(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(n){Es(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){Es(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const fA=He.define(),Cw=He.define(),yf=He.define(),mA=He.define(),l0=He.define(),pA=He.define();function fj(t,e){let n=t.state.facet(pA);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(t):i),s=[];return Gt.spans(r,e.from,e.to,{point(){},span(i,l,c,d){let h=i-e.from,m=l-e.from,p=s;for(let x=c.length-1;x>=0;x--,d--){let v=c[x].spec.bidiIsolate,b;if(v==null&&(v=AV(e.text,h,m)),d>0&&p.length&&(b=p[p.length-1]).to==h&&b.direction==v)b.to=m,p=b.inner;else{let k={from:h,to:m,direction:v,inner:[]};p.push(k),p=k.inner}}}}),s}const gA=He.define();function Tw(t){let e=0,n=0,r=0,s=0;for(let i of t.state.facet(gA)){let l=i(t);l&&(l.left!=null&&(e=Math.max(e,l.left)),l.right!=null&&(n=Math.max(n,l.right)),l.top!=null&&(r=Math.max(r,l.top)),l.bottom!=null&&(s=Math.max(s,l.bottom)))}return{left:e,right:n,top:r,bottom:s}}const Qh=He.define();class ji{constructor(e,n,r,s){this.fromA=e,this.toA=n,this.fromB=r,this.toB=s}join(e){return new ji(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let s=e[n-1];if(!(s.fromA>r.toA)){if(s.toAm)break;i+=2}if(!d)return r;new ji(d.fromA,d.toA,d.fromB,d.toB).addToSet(r),l=d.toA,c=d.toB}}}class Ng{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=kr.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,l,c,d)=>s.push(new ji(i,l,c,d))),this.changedRanges=s}static create(e,n,r){return new Ng(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class mj extends jn{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=Je.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new pr],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new ji(0,0,0,e.state.doc.length)],0,null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:h,toA:m})=>mthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?s=this.domChanged.newSel.head:!BV(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let i=s>-1?DV(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:m}=this.hasComposition;r=new ji(h,m,e.changes.mapPos(h,-1),e.changes.mapPos(m,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(Fe.ie||Fe.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let l=this.decorations,c=this.updateDeco(),d=PV(l,c,e.changes);return r=ji.extendWithRanges(r,d),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,r);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let l=Fe.chrome||Fe.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,l),this.flags&=-8,l&&(l.written||s.selectionRange.focusNode!=l.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(l=>l.flags&=-9);let i=[];if(this.view.viewport.from||this.view.viewport.to=0?s[l]:null;if(!c)break;let{fromA:d,toA:h,fromB:m,toB:p}=c,x,v,b,k;if(r&&r.range.fromBm){let _=tf.build(this.view.state.doc,m,r.range.fromB,this.decorations,this.dynamicDecorationMap),D=tf.build(this.view.state.doc,r.range.toB,p,this.decorations,this.dynamicDecorationMap);v=_.breakAtStart,b=_.openStart,k=D.openEnd;let E=this.compositionView(r);D.breakAtStart?E.breakAfter=1:D.content.length&&E.merge(E.length,E.length,D.content[0],!1,D.openStart,0)&&(E.breakAfter=D.content[0].breakAfter,D.content.shift()),_.content.length&&E.merge(0,0,_.content[_.content.length-1],!0,0,_.openEnd)&&_.content.pop(),x=_.content.concat(E).concat(D.content)}else({content:x,breakAtStart:v,openStart:b,openEnd:k}=tf.build(this.view.state.doc,m,p,this.decorations,this.dynamicDecorationMap));let{i:O,off:j}=i.findPos(h,1),{i:T,off:M}=i.findPos(d,-1);VM(this,T,M,O,j,x,v,b,k)}r&&this.fixCompositionDOM(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(hA)&&(this.editContextFormatting=r.value)}compositionView(e){let n=new Qi(e.text.nodeValue);n.flags|=8;for(let{deco:s}of e.marks)n=new ml(s,[n],n.length);let r=new pr;return r.append(n,0),r}fixCompositionDOM(e){let n=(i,l)=>{l.flags|=8|(l.children.some(d=>d.flags&7)?1:0),this.markedForComposition.add(l);let c=jn.get(i);c&&c!=l&&(c.dom=null),l.setDOM(i)},r=this.childPos(e.range.fromB,1),s=this.children[r.i];n(e.line,s);for(let i=e.marks.length-1;i>=-1;i--)r=s.childPos(r.off,1),s=s.children[r.i],n(i>=0?e.marks[i].node:e.text,s)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,s=r==this.dom,i=!s&&!(this.view.state.facet(sl)||this.dom.tabIndex>-1)&&Kp(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(s||n||i))return;let l=this.forceSelection;this.forceSelection=!1;let c=this.view.state.selection.main,d=this.moveToLine(this.domAtPos(c.anchor)),h=c.empty?d:this.moveToLine(this.domAtPos(c.head));if(Fe.gecko&&c.empty&&!this.hasComposition&&_V(d)){let p=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(p,d.node.childNodes[d.offset]||null)),d=h=new ns(p,0),l=!0}let m=this.view.observer.selectionRange;(l||!m.focusNode||(!ef(d.node,d.offset,m.anchorNode,m.anchorOffset)||!ef(h.node,h.offset,m.focusNode,m.focusOffset))&&!this.suppressWidgetCursorChange(m,c))&&(this.view.observer.ignore(()=>{Fe.android&&Fe.chrome&&this.dom.contains(m.focusNode)&&LV(m.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let p=vf(this.view.root);if(p)if(c.empty){if(Fe.gecko){let x=RV(d.node,d.offset);if(x&&x!=3){let v=(x==1?$M:HM)(d.node,d.offset);v&&(d=new ns(v.node,v.offset))}}p.collapse(d.node,d.offset),c.bidiLevel!=null&&p.caretBidiLevel!==void 0&&(p.caretBidiLevel=c.bidiLevel)}else if(p.extend){p.collapse(d.node,d.offset);try{p.extend(h.node,h.offset)}catch{}}else{let x=document.createRange();c.anchor>c.head&&([d,h]=[h,d]),x.setEnd(h.node,h.offset),x.setStart(d.node,d.offset),p.removeAllRanges(),p.addRange(x)}i&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(d,h)),this.impreciseAnchor=d.precise?null:new ns(m.anchorNode,m.anchorOffset),this.impreciseHead=h.precise?null:new ns(m.focusNode,m.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&ef(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=vf(e.root),{anchorNode:s,anchorOffset:i}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let l=pr.find(this,n.head);if(!l)return;let c=l.posAtStart;if(n.head==c||n.head==c+l.length)return;let d=this.coordsAt(n.head,-1),h=this.coordsAt(n.head,1);if(!d||!h||d.bottom>h.top)return;let m=this.domAtPos(n.head+n.assoc);r.collapse(m.node,m.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let p=e.observer.selectionRange;e.docView.posFromDOM(p.anchorNode,p.anchorOffset)!=n.from&&r.collapse(s,i)}moveToLine(e){let n=this.dom,r;if(e.node!=n)return e;for(let s=e.offset;!r&&s=0;s--){let i=jn.get(n.childNodes[s]);i instanceof pr&&(r=i.domAtPos(i.length))}return r?new ns(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=jn.get(n);if(r&&r.rootView==this)return r;n=n.parentNode}return null}posFromDOM(e,n){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,n)+r.posAtStart}domAtPos(e){let{i:n,off:r}=this.childCursor().findPos(e,-1);for(;n=0;l--){let c=this.children[l],d=i-c.breakAfter,h=d-c.length;if(de||c.covers(1))&&(!r||c instanceof pr&&!(r instanceof pr&&n>=0)))r=c,s=h;else if(r&&h==e&&d==e&&c instanceof ol&&Math.abs(n)<2){if(c.deco.startSide<0)break;l&&(r=null)}i=h}return r?r.coordsAt(e-s,n):null}coordsForChar(e){let{i:n,off:r}=this.childPos(e,1),s=this.children[n];if(!(s instanceof pr))return null;for(;s.children.length;){let{i:c,off:d}=s.childPos(r,1);for(;;c++){if(c==s.children.length)return null;if((s=s.children[c]).length)break}r=d}if(!(s instanceof Qi))return null;let i=Vr(s.text,r);if(i==r)return null;let l=wc(s.dom,r,i).getClientRects();for(let c=0;cMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,c=-1,d=this.view.textDirection==Hn.LTR;for(let h=0,m=0;ms)break;if(h>=r){let v=p.dom.getBoundingClientRect();if(n.push(v.height),l){let b=p.dom.lastChild,k=b?ud(b):[];if(k.length){let O=k[k.length-1],j=d?O.right-v.left:v.right-O.left;j>c&&(c=j,this.minWidth=i,this.minWidthFrom=h,this.minWidthTo=x)}}}h=x+p.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?Hn.RTL:Hn.LTR}measureTextSize(){for(let i of this.children)if(i instanceof pr){let l=i.measureTextSize();if(l)return l}let e=document.createElement("div"),n,r,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let i=ud(e.firstChild)[0];n=e.getBoundingClientRect().height,r=i?i.width/27:7,s=i?i.height:n,e.remove()}),{lineHeight:n,charWidth:r,textHeight:s}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new UM(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,s=0;;s++){let i=s==n.viewports.length?null:n.viewports[s],l=i?i.from-1:this.length;if(l>r){let c=(n.lineBlockAt(l).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(Je.replace({widget:new z2(c),block:!0,inclusive:!0,isBlockGap:!0}).range(r,l))}if(!i)break;r=i.to+1}return Je.set(e)}updateDeco(){let e=1,n=this.view.state.facet(yf).map(i=>(this.dynamicDecorationMap[e++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(mA).map((i,l)=>{let c=typeof i=="function";return c&&(r=!0),c?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[e++]=r,n.push(Gt.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];en.anchor?-1:1),s;if(!r)return;!n.empty&&(s=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let i=Tw(this.view),l={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:c,offsetHeight:d}=this.view.scrollDOM;dV(this.view.scrollDOM,l,n.heads instanceof il||s.children.some(r);return r(this.children[n])}}function _V(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function xA(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=$M(n.focusNode,n.focusOffset),s=HM(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let c=jn.get(s.node);if(!c||c instanceof Qi&&c.text!=s.node.nodeValue)i=s;else if(t.docView.lastCompositionAfterCursor){let d=jn.get(r.node);!d||d instanceof Qi&&d.text!=r.node.nodeValue||(i=s)}}if(t.docView.lastCompositionAfterCursor=i!=r,!i)return null;let l=e-i.offset;return{from:l,to:l+i.node.nodeValue.length,node:i.node}}function DV(t,e,n){let r=xA(t,n);if(!r)return null;let{node:s,from:i,to:l}=r,c=s.nodeValue;if(/[\n\r]/.test(c)||t.state.doc.sliceString(r.from,r.to)!=c)return null;let d=e.invertedDesc,h=new ji(d.mapPos(i),d.mapPos(l),i,l),m=[];for(let p=s.parentNode;;p=p.parentNode){let x=jn.get(p);if(x instanceof ml)m.push({node:p,deco:x.mark});else{if(x instanceof pr||p.nodeName=="DIV"&&p.parentNode==t.contentDOM)return{range:h,text:s,marks:m,line:p};if(p!=t.contentDOM)m.push({node:p,deco:new i0({inclusive:!0,attributes:bV(p),tagName:p.tagName.toLowerCase()})});else return null}}}function RV(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{re.from&&(n=!0)}),n}function IV(t,e,n=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),i=e-s.from;if(s.length==0)return Ce.cursor(e);i==0?n=1:i==s.length&&(n=-1);let l=i,c=i;n<0?l=Vr(s.text,i,!1):c=Vr(s.text,i);let d=r(s.text.slice(l,c));for(;l>0;){let h=Vr(s.text,l,!1);if(r(s.text.slice(h,l))!=d)break;l=h}for(;ct?e.left-t:Math.max(0,t-e.right)}function FV(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function _y(t,e){return t.tope.top+1}function pj(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function q2(t,e,n){let r,s,i,l,c=!1,d,h,m,p;for(let b=t.firstChild;b;b=b.nextSibling){let k=ud(b);for(let O=0;OM||l==M&&i>T)&&(r=b,s=j,i=T,l=M,c=T?e0:Oj.bottom&&(!m||m.bottomj.top)&&(h=b,p=j):m&&_y(m,j)?m=gj(m,j.bottom):p&&_y(p,j)&&(p=pj(p,j.top))}}if(m&&m.bottom>=n?(r=d,s=m):p&&p.top<=n&&(r=h,s=p),!r)return{node:t,offset:0};let x=Math.max(s.left,Math.min(s.right,e));if(r.nodeType==3)return xj(r,x,n);if(c&&r.contentEditable!="false")return q2(r,x,n);let v=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(s.left+s.right)/2?1:0);return{node:t,offset:v}}function xj(t,e,n){let r=t.nodeValue.length,s=-1,i=1e9,l=0;for(let c=0;cn?m.top-n:n-m.bottom)-1;if(m.left-1<=e&&m.right+1>=e&&p=(m.left+m.right)/2,v=x;if(Fe.chrome||Fe.gecko){let b=wc(t,c).getBoundingClientRect();Math.abs(b.left-m.right)<.1&&(v=!x)}if(p<=0)return{node:t,offset:c+(v?1:0)};s=c+(v?1:0),i=p}}}return{node:t,offset:s>-1?s:l>0?t.nodeValue.length:0}}function vA(t,e,n,r=-1){var s,i;let l=t.contentDOM.getBoundingClientRect(),c=l.top+t.viewState.paddingTop,d,{docHeight:h}=t.viewState,{x:m,y:p}=e,x=p-c;if(x<0)return 0;if(x>h)return t.state.doc.length;for(let _=t.viewState.heightOracle.textHeight/2,D=!1;d=t.elementAtHeight(x),d.type!=fs.Text;)for(;x=r>0?d.bottom+_:d.top-_,!(x>=0&&x<=h);){if(D)return n?null:0;D=!0,r=-r}p=c+x;let v=d.from;if(vt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:vj(t,l,d,m,p);let b=t.dom.ownerDocument,k=t.root.elementFromPoint?t.root:b,O=k.elementFromPoint(m,p);O&&!t.contentDOM.contains(O)&&(O=null),O||(m=Math.max(l.left+1,Math.min(l.right-1,m)),O=k.elementFromPoint(m,p),O&&!t.contentDOM.contains(O)&&(O=null));let j,T=-1;if(O&&((s=t.docView.nearest(O))===null||s===void 0?void 0:s.isEditable)!=!1){if(b.caretPositionFromPoint){let _=b.caretPositionFromPoint(m,p);_&&({offsetNode:j,offset:T}=_)}else if(b.caretRangeFromPoint){let _=b.caretRangeFromPoint(m,p);_&&({startContainer:j,startOffset:T}=_)}j&&(!t.contentDOM.contains(j)||Fe.safari&&QV(j,T,m)||Fe.chrome&&$V(j,T,m))&&(j=void 0),j&&(T=Math.min(ya(j),T))}if(!j||!t.docView.dom.contains(j)){let _=pr.find(t.docView,v);if(!_)return x>d.top+d.height/2?d.to:d.from;({node:j,offset:T}=q2(_.dom,m,p))}let M=t.docView.nearest(j);if(!M)return null;if(M.isWidget&&((i=M.dom)===null||i===void 0?void 0:i.nodeType)==1){let _=M.dom.getBoundingClientRect();return e.y<_.top||e.y<=_.bottom&&e.x<=(_.left+_.right)/2?M.posAtStart:M.posAtEnd}else return M.localPosFromDOM(j,T)+M.posAtStart}function vj(t,e,n,r,s){let i=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let c=t.viewState.heightOracle.textHeight,d=Math.floor((s-n.top-(t.defaultLineHeight-c)*.5)/c);i+=d*t.viewState.heightOracle.lineLength}let l=t.state.sliceDoc(n.from,n.to);return n.from+j2(l,i,t.state.tabSize)}function yA(t,e,n){let r,s=t;if(t.nodeType!=3||e!=(r=t.nodeValue.length))return!1;for(;;){let i=s.nextSibling;if(i){if(i.nodeName=="BR")break;return!1}else{let l=s.parentNode;if(!l||l.nodeName=="DIV")break;s=l}}return wc(t,r-1,r).getBoundingClientRect().right>n}function QV(t,e,n){return yA(t,e,n)}function $V(t,e,n){if(e!=0)return yA(t,e,n);for(let s=t;;){let i=s.parentNode;if(!i||i.nodeType!=1||i.firstChild!=s)return!1;if(i.classList.contains("cm-line"))break;s=i}let r=t.nodeType==1?t.getBoundingClientRect():wc(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function F2(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let s;for(let i of r.type){if(i.from>e)break;if(!(i.toe)return i;(!s||i.type==fs.Text&&(s.type!=i.type||(n<0?i.frome)))&&(s=i)}}return s||r}return r}function HV(t,e,n,r){let s=F2(t,e.head,e.assoc||-1),i=!r||s.type!=fs.Text||!(t.lineWrapping||s.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(i){let l=t.dom.getBoundingClientRect(),c=t.textDirectionAt(s.from),d=t.posAtCoords({x:n==(c==Hn.LTR)?l.right-1:l.left+1,y:(i.top+i.bottom)/2});if(d!=null)return Ce.cursor(d,n?-1:1)}return Ce.cursor(n?s.to:s.from,n?-1:1)}function yj(t,e,n,r){let s=t.state.doc.lineAt(e.head),i=t.bidiSpans(s),l=t.textDirectionAt(s.from);for(let c=e,d=null;;){let h=MV(s,i,l,c,n),m=nA;if(!h){if(s.number==(n?t.state.doc.lines:1))return c;m=` +`,s=t.state.doc.line(s.number+(n?1:-1)),i=t.bidiSpans(s),h=t.visualLineSide(s,!n)}if(d){if(!d(m))return c}else{if(!r)return h;d=r(m)}c=h}}function UV(t,e,n){let r=t.state.charCategorizer(e),s=r(n);return i=>{let l=r(i);return s==Vn.Space&&(s=l),s==l}}function VV(t,e,n,r){let s=e.head,i=n?1:-1;if(s==(n?t.state.doc.length:0))return Ce.cursor(s,e.assoc);let l=e.goalColumn,c,d=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s,e.assoc||-1),m=t.documentTop;if(h)l==null&&(l=h.left-d.left),c=i<0?h.top:h.bottom;else{let v=t.viewState.lineBlockAt(s);l==null&&(l=Math.min(d.right-d.left,t.defaultCharacterWidth*(s-v.from))),c=(i<0?v.top:v.bottom)+m}let p=d.left+l,x=r??t.viewState.heightOracle.textHeight>>1;for(let v=0;;v+=10){let b=c+(x+v)*i,k=vA(t,{x:p,y:b},!1,i);if(bd.bottom||(i<0?ks)){let O=t.docView.coordsForChar(k),j=!O||b{if(e>i&&es(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:Ce.cursor(r,ri)&&!XV(l,n)&&this.lineBreak(),s=l}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,l=1,c;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),l=this.lineSeparator.length):(c=s.exec(n))&&(i=c.index,l=c[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),l>1)for(let d of this.points)d.node==e&&d.pos>this.text.length&&(d.pos-=l-1);r=i+l}}readNode(e){if(e.cmIgnore)return;let n=jn.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(GV(e,r.node,r.offset)?n:0))}}function GV(t,e,n){for(;;){if(!e||n-1;let{impreciseHead:i,impreciseAnchor:l}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let c=i||l?[]:ZV(e),d=new WV(c,e.state);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=JV(c,this.bounds.from)}else{let c=e.observer.selectionRange,d=i&&i.node==c.focusNode&&i.offset==c.focusOffset||!_2(e.contentDOM,c.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(c.focusNode,c.focusOffset),h=l&&l.node==c.anchorNode&&l.offset==c.anchorOffset||!_2(e.contentDOM,c.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(c.anchorNode,c.anchorOffset),m=e.viewport;if((Fe.ios||Fe.chrome)&&e.state.selection.main.empty&&d!=h&&(m.from>0||m.to-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Ce.range(h,d)):this.newSel=Ce.single(h,d)}}}function wA(t,e){let n,{newSel:r}=e,s=t.state.selection.main,i=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:l,to:c}=e.bounds,d=s.from,h=null;(i===8||Fe.android&&e.text.length=s.from&&n.to<=s.to&&(n.from!=s.from||n.to!=s.to)&&s.to-s.from-(n.to-n.from)<=4?n={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,s.to))}:t.state.doc.lineAt(s.from).toDate.now()-50?n={from:s.from,to:s.to,insert:t.state.toText(t.inputState.insertingText)}:Fe.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` + `&&t.lineWrapping&&(r&&(r=Ce.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:Wt.of([" "])}),n)return Mw(t,n,r,i);if(r&&!r.main.eq(s)){let l=!1,c="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(l=!0),c=t.inputState.lastSelectionOrigin,c=="select.pointer"&&(r=bA(t.state.facet(l0).map(d=>d(t)),r))),t.dispatch({selection:r,scrollIntoView:l,userEvent:c}),!0}else return!1}function Mw(t,e,n,r=-1){if(Fe.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(Fe.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&t.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Gu(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.lengths.head)&&Gu(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Gu(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let l,c=()=>l||(l=KV(t,e,n));return t.state.facet(lA).some(d=>d(t,e.from,e.to,i,c))||t.dispatch(c()),!0}function KV(t,e,n){let r,s=t.state,i=s.selection.main,l=-1;if(e.from==e.to&&e.fromi.to){let d=e.fromp(t)),h,d);e.from==m&&(l=m)}if(l>-1)r={changes:e,selection:Ce.cursor(e.from+e.insert.length,-1)};else if(e.from>=i.from&&e.to<=i.to&&e.to-e.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let d=i.frome.to?s.sliceDoc(e.to,i.to):"";r=s.replaceSelection(t.state.toText(d+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let d=s.changes(e),h=n&&n.main.to<=d.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=i.to+10&&e.to>=i.to-10){let m=t.state.sliceDoc(e.from,e.to),p,x=n&&xA(t,n.main.head);if(x){let b=e.insert.length-(e.to-e.from);p={from:x.from,to:x.to-b}}else p=t.state.doc.lineAt(i.head);let v=i.to-e.to;r=s.changeByRange(b=>{if(b.from==i.from&&b.to==i.to)return{changes:d,range:h||b.map(d)};let k=b.to-v,O=k-m.length;if(t.state.sliceDoc(O,k)!=m||k>=p.from&&O<=p.to)return{range:b};let j=s.changes({from:O,to:k,insert:e.insert}),T=b.to-i.to;return{changes:j,range:h?Ce.range(Math.max(0,h.anchor+T),Math.max(0,h.head+T)):b.map(j)}})}else r={changes:d,selection:h&&s.selection.replaceRange(h)}}let c="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,c+=".compose",t.inputState.compositionFirstChange&&(c+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:c,scrollIntoView:!0})}function SA(t,e,n,r){let s=Math.min(t.length,e.length),i=0;for(;i0&&c>0&&t.charCodeAt(l-1)==e.charCodeAt(c-1);)l--,c--;if(r=="end"){let d=Math.max(0,i-Math.min(l,c));n-=l+d-i}if(l=l?i-n:0;i-=d,c=i+(c-l),l=i}else if(c=c?i-n:0;i-=d,l=i+(l-c),c=i}return{from:i,toA:l,toB:c}}function ZV(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}=t.observer.selectionRange;return n&&(e.push(new bj(n,r)),(s!=n||i!=r)&&e.push(new bj(s,i))),e}function JV(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?Ce.single(n+e,r+e):null}class eW{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Fe.safari&&e.contentDOM.addEventListener("input",()=>null),Fe.gecko&&gW(e.contentDOM.ownerDocument)}handleEvent(e){!oW(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let s of r.observers)s(this.view,n);for(let s of r.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=tW(e),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let l=!n[i].handlers.length,c=r[i];c&&l!=!c.handlers.length&&(s.removeEventListener(i,this.handleEvent),c=null),c||s.addEventListener(i,this.handleEvent,{passive:l})}for(let i in r)i!="scroll"&&!n[i]&&s.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&OA.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Fe.android&&Fe.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return Fe.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=kA.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||nW.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from0?!0:Fe.safari&&!Fe.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function wj(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){Es(n.state,s)}}}function tW(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let s=r.spec,i=s&&s.plugin.domEventHandlers,l=s&&s.plugin.domEventObservers;if(i)for(let c in i){let d=i[c];d&&n(c).handlers.push(wj(r.value,d))}if(l)for(let c in l){let d=l[c];d&&n(c).observers.push(wj(r.value,d))}}for(let r in $i)n(r).handlers.push($i[r]);for(let r in Ci)n(r).observers.push(Ci[r]);return e}const kA=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],nW="dthko",OA=[16,17,18,20,91,92,224,225],rp=6;function sp(t){return Math.max(0,t)*.7+8}function rW(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class sW{constructor(e,n,r,s){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=hV(e.contentDOM),this.atoms=e.state.facet(l0).map(l=>l(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Vt.allowMultipleSelections)&&iW(e,n),this.dragging=lW(e,n)&&CA(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&rW(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,i=0,l=this.view.win.innerWidth,c=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:l}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:c}=this.scrollParents.y.getBoundingClientRect());let d=Tw(this.view);e.clientX-d.left<=s+rp?n=-sp(s-e.clientX):e.clientX+d.right>=l-rp&&(n=sp(e.clientX-l)),e.clientY-d.top<=i+rp?r=-sp(i-e.clientY):e.clientY+d.bottom>=c-rp&&(r=sp(e.clientY-c)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=bA(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function iW(t,e){let n=t.state.facet(rA);return n.length?n[0](e):Fe.mac?e.metaKey:e.ctrlKey}function aW(t,e){let n=t.state.facet(sA);return n.length?n[0](e):Fe.mac?!e.altKey:!e.ctrlKey}function lW(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=vf(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i=e.clientX&&l.top<=e.clientY&&l.bottom>=e.clientY)return!0}return!1}function oW(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=jn.get(n))&&r.ignoreEvent(e))return!1;return!0}const $i=Object.create(null),Ci=Object.create(null),jA=Fe.ie&&Fe.ie_version<15||Fe.ios&&Fe.webkit_version<604;function cW(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),NA(t,n.value)},50)}function kx(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function NA(t,e){e=kx(t.state,jw,e);let{state:n}=t,r,s=1,i=n.toText(e),l=i.lines==n.selection.ranges.length;if(Q2!=null&&n.selection.ranges.every(d=>d.empty)&&Q2==i.toString()){let d=-1;r=n.changeByRange(h=>{let m=n.doc.lineAt(h.from);if(m.from==d)return{range:h};d=m.from;let p=n.toText((l?i.line(s++).text:e)+n.lineBreak);return{changes:{from:m.from,insert:p},range:Ce.cursor(h.from+p.length)}})}else l?r=n.changeByRange(d=>{let h=i.line(s++);return{changes:{from:d.from,to:d.to,insert:h.text},range:Ce.cursor(d.from+h.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Ci.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};$i.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Ci.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Ci.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};$i.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(iA))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=hW(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new sW(t,e,n,r)),r&&t.observer.ignore(()=>{qM(t.contentDOM);let i=t.root.activeElement;i&&!i.contains(t.contentDOM)&&i.blur()});let s=t.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function Sj(t,e,n,r){if(r==1)return Ce.cursor(e,n);if(r==2)return IV(t.state,e,n);{let s=pr.find(t.docView,e),i=t.state.doc.lineAt(s?s.posAtEnd:e),l=s?s.posAtStart:i.from,c=s?s.posAtEnd:i.to;return ce>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function uW(t,e,n,r){let s=pr.find(t.docView,e);if(!s)return 1;let i=e-s.posAtStart;if(i==0)return 1;if(i==s.length)return-1;let l=s.coordsAt(i,-1);if(l&&kj(n,r,l))return-1;let c=s.coordsAt(i,1);return c&&kj(n,r,c)?1:l&&l.bottom>=r?-1:1}function Oj(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:uW(t,n,e.clientX,e.clientY)}}const dW=Fe.ie&&Fe.ie_version<=11;let jj=null,Nj=0,Cj=0;function CA(t){if(!dW)return t.detail;let e=jj,n=Cj;return jj=t,Cj=Date.now(),Nj=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Nj+1)%3:1}function hW(t,e){let n=Oj(t,e),r=CA(e),s=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,l,c){let d=Oj(t,i),h,m=Sj(t,d.pos,d.bias,r);if(n.pos!=d.pos&&!l){let p=Sj(t,n.pos,n.bias,r),x=Math.min(p.from,m.from),v=Math.max(p.to,m.to);m=x1&&(h=fW(s,d.pos))?h:c?s.addRange(m):Ce.create([m])}}}function fW(t,e){for(let n=0;n=e)return Ce.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}$i.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let s=t.docView.nearest(e.target);if(s&&s.isWidget){let i=s.posAtStart,l=i+s.length;(i>=n.to||l<=n.from)&&(n=Ce.range(i,l))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",kx(t.state,Nw,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};$i.dragend=t=>(t.inputState.draggedContent=null,!1);function Tj(t,e,n,r){if(n=kx(t.state,jw,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,l=r&&i&&aW(t,e)?{from:i.from,to:i.to}:null,c={from:s,insert:n},d=t.state.changes(l?[l,c]:c);t.focus(),t.dispatch({changes:d,selection:{anchor:d.mapPos(s,-1),head:d.mapPos(s,1)},userEvent:l?"move.drop":"input.drop"}),t.inputState.draggedContent=null}$i.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,i=()=>{++s==n.length&&Tj(t,e,r.filter(l=>l!=null).join(t.state.lineBreak),!1)};for(let l=0;l{/[\x00-\x08\x0e-\x1f]{2}/.test(c.result)||(r[l]=c.result),i()},c.readAsText(n[l])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Tj(t,e,r,!0),!0}return!1};$i.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=jA?null:e.clipboardData;return n?(NA(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(cW(t),!1)};function mW(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function pW(t){let e=[],n=[],r=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),n.push(s));if(!e.length){let s=-1;for(let{from:i}of t.selection.ranges){let l=t.doc.lineAt(i);l.number>s&&(e.push(l.text),n.push({from:l.from,to:Math.min(t.doc.length,l.to+1)})),s=l.number}r=!0}return{text:kx(t,Nw,e.join(t.lineBreak)),ranges:n,linewise:r}}let Q2=null;$i.copy=$i.cut=(t,e)=>{let{text:n,ranges:r,linewise:s}=pW(t.state);if(!n&&!s)return!1;Q2=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=jA?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(mW(t,n),!1)};const TA=Sa.define();function MA(t,e){let n=[];for(let r of t.facet(oA)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:TA.of(!0)}):null}function AA(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=MA(t.state,e);n?t.dispatch(n):t.update([])}},10)}Ci.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),AA(t)};Ci.blur=t=>{t.observer.clearSelectionRange(),AA(t)};Ci.compositionstart=Ci.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Ci.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Fe.chrome&&Fe.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Ci.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};$i.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let i=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),l=e.getTargetRanges();if(i&&l.length){let c=l[0],d=t.posAtDOM(c.startContainer,c.startOffset),h=t.posAtDOM(c.endContainer,c.endOffset);return Mw(t,{from:d,to:h,insert:t.state.toText(i)},null),!0}}let s;if(Fe.chrome&&Fe.android&&(s=kA.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var l;(((l=window.visualViewport)===null||l===void 0?void 0:l.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Fe.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Fe.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Ci.compositionend(t,e),20),!1};const Mj=new Set;function gW(t){Mj.has(t)||(Mj.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const Aj=["pre-wrap","normal","pre-line","break-spaces"];let fd=!1;function Ej(){fd=!1}class xW{constructor(e){this.lineWrapping=e,this.doc=Wt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Aj.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,d=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=c;if(this.lineWrapping=c,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,d){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Jp&&(fd=!0),this.height=e)}replace(e,n,r){return ms.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,s){let i=this,l=r.doc;for(let c=s.length-1;c>=0;c--){let{fromA:d,toA:h,fromB:m,toB:p}=s[c],x=i.lineAt(d,Qn.ByPosNoHeight,r.setDoc(n),0,0),v=x.to>=h?x:i.lineAt(h,Qn.ByPosNoHeight,r,0,0);for(p+=v.to-h,h=v.to;c>0&&x.from<=s[c-1].toA;)d=s[c-1].fromA,m=s[c-1].fromB,c--,di*2){let c=e[n-1];c.break?e.splice(--n,1,c.left,null,c.right):e.splice(--n,1,c.left,c.right),r+=1+c.break,s-=c.size}else if(i>s*2){let c=e[r];c.break?e.splice(r,1,c.left,null,c.right):e.splice(r,1,c.left,c.right),r+=2+c.break,i-=c.size}else break;else if(s=i&&l(this.blockAt(0,r,s,i))}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Js extends EA{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,s){return new la(s,this.length,r,this.height,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof Js||s instanceof $r&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof $r?s=new Js(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):ms.of(r)}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setHeight(s.heights[s.index++]):(r||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class $r extends ms{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,s=e.doc.lineAt(n+this.length).number,i=s-r+1,l,c=0;if(e.lineWrapping){let d=Math.min(this.height,e.lineHeight*i);l=d/i,this.length>i+1&&(c=(this.height-d)/(this.length-i-1))}else l=this.height/i;return{firstLine:r,lastLine:s,perLine:l,perChar:c}}blockAt(e,n,r,s){let{firstLine:i,lastLine:l,perLine:c,perChar:d}=this.heightMetrics(n,s);if(n.lineWrapping){let h=s+(e0){let i=r[r.length-1];i instanceof $r?r[r.length-1]=new $r(i.length+s):r.push(null,new $r(s-1))}if(e>0){let i=r[0];i instanceof $r?r[0]=new $r(e+i.length):r.unshift(new $r(e-1),null)}return ms.of(r)}decomposeLeft(e,n){n.push(new $r(e-1),null)}decomposeRight(e,n){n.push(null,new $r(this.length-e-1))}updateHeight(e,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let l=[],c=Math.max(n,s.from),d=-1;for(s.from>n&&l.push(new $r(s.from-n-1).updateHeight(e,n));c<=i&&s.more;){let m=e.doc.lineAt(c).length;l.length&&l.push(null);let p=s.heights[s.index++];d==-1?d=p:Math.abs(p-d)>=Jp&&(d=-2);let x=new Js(m,p);x.outdated=!1,l.push(x),c+=m+1}c<=i&&l.push(null,new $r(i-c).updateHeight(e,c));let h=ms.of(l);return(d<0||Math.abs(h.height-this.height)>=Jp||Math.abs(d-this.heightMetrics(e,n).perLine)>=Jp)&&(fd=!0),Cg(this,h)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class yW extends ms{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,s){let i=r+this.left.height;return ec))return h;let m=n==Qn.ByPosNoHeight?Qn.ByPosNoHeight:Qn.ByPos;return d?h.join(this.right.lineAt(c,m,r,l,c)):this.left.lineAt(c,m,r,s,i).join(h)}forEachLine(e,n,r,s,i,l){let c=s+this.left.height,d=i+this.left.length+this.break;if(this.break)e=d&&this.right.forEachLine(e,n,r,c,d,l);else{let h=this.lineAt(d,Qn.ByPos,r,s,i);e=e&&h.from<=n&&l(h),n>h.to&&this.right.forEachLine(h.to+1,n,r,c,d,l)}}replace(e,n,r){let s=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-s,n-s,r));let i=[];e>0&&this.decomposeLeft(e,i);let l=i.length;for(let c of r)i.push(c);if(e>0&&_j(i,l-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,n);e2*n.size||n.size>2*e.size?ms.of(this.break?[e,null,n]:[e,n]):(this.left=Cg(this.left,e),this.right=Cg(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,s){let{left:i,right:l}=this,c=n+i.length+this.break,d=null;return s&&s.from<=n+i.length&&s.more?d=i=i.updateHeight(e,n,r,s):i.updateHeight(e,n,r),s&&s.from<=c+l.length&&s.more?d=l=l.updateHeight(e,c,r,s):l.updateHeight(e,c,r),d?this.balanced(i,l):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function _j(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof $r&&(r=t[e+1])instanceof $r&&t.splice(e-1,3,new $r(n.length+1+r.length))}const bW=5;class Aw{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Js?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Js(r-this.pos,-1)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e=bW)&&this.addLineDeco(s,i,l)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new Js(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new $r(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Js)return e;let n=new Js(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Js)&&!this.isCovered?this.nodes.push(new Js(0,-1)):(this.writtenTom.clientHeight||m.scrollWidth>m.clientWidth)&&p.overflow!="visible"){let x=m.getBoundingClientRect();i=Math.max(i,x.left),l=Math.min(l,x.right),c=Math.max(c,x.top),d=Math.min(h==t.parentNode?s.innerHeight:d,x.bottom)}h=p.position=="absolute"||p.position=="fixed"?m.offsetParent:m.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:i-n.left,right:Math.max(i,l)-n.left,top:c-(n.top+e),bottom:Math.max(c,d)-(n.top+e)}}function OW(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function jW(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class Ry{constructor(e,n,r,s){this.from=e,this.to=n,this.size=r,this.displaySize=s}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;rtypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new xW(n),this.stateDeco=e.facet(yf).filter(r=>typeof r!="function"),this.heightMap=ms.empty().applyChanges(this.stateDeco,Wt.empty,this.heightOracle.setDoc(e.doc),[new ji(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Je.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!e.some(({from:i,to:l})=>s>=i&&s<=l)){let{from:i,to:l}=this.lineBlockAt(s);e.push(new ip(i,l))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Rj:new Ew(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Hh(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(yf).filter(m=>typeof m!="function");let s=e.changedRanges,i=ji.extendWithRanges(s,wW(r,this.stateDeco,e?e.changes:kr.empty(this.state.doc.length))),l=this.heightMap.height,c=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Ej(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=l||fd)&&(e.flags|=2),c?(this.scrollAnchorPos=e.changes.mapPos(c.from,-1),this.scrollAnchorHeight=c.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=l);let d=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.headd.to)||!this.viewportIsAppropriate(d))&&(d=this.getViewport(0,n));let h=d.from!=this.viewport.from||d.to!=this.viewport.to;this.viewport=d,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(uA)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Hn.RTL:Hn.LTR;let l=this.heightOracle.mustRefreshForWrapping(i),c=n.getBoundingClientRect(),d=l||this.mustMeasureContent||this.contentDOMHeight!=c.height;this.contentDOMHeight=c.height,this.mustMeasureContent=!1;let h=0,m=0;if(c.width&&c.height){let{scaleX:_,scaleY:D}=IM(n,c);(_>.005&&Math.abs(this.scaleX-_)>.005||D>.005&&Math.abs(this.scaleY-D)>.005)&&(this.scaleX=_,this.scaleY=D,h|=16,l=d=!0)}let p=(parseInt(r.paddingTop)||0)*this.scaleY,x=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=p||this.paddingBottom!=x)&&(this.paddingTop=p,this.paddingBottom=x,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(d=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let v=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=v&&(this.scrollAnchorHeight=-1,this.scrollTop=v),this.scrolledToBottom=QM(e.scrollDOM);let b=(this.printing?jW:kW)(n,this.paddingTop),k=b.top-this.pixelViewport.top,O=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let j=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(j!=this.inView&&(this.inView=j,j&&(d=!0)),!this.inView&&!this.scrollTarget&&!OW(e.dom))return 0;let T=c.width;if((this.contentDOMWidth!=T||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=c.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),d){let _=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(_)&&(l=!0),l||s.lineWrapping&&Math.abs(T-this.contentDOMWidth)>s.charWidth){let{lineHeight:D,charWidth:E,textHeight:z}=e.docView.measureTextSize();l=D>0&&s.refresh(i,D,E,z,Math.max(5,T/E),_),l&&(e.docView.minWidth=0,h|=16)}k>0&&O>0?m=Math.max(k,O):k<0&&O<0&&(m=Math.min(k,O)),Ej();for(let D of this.viewports){let E=D.from==this.viewport.from?_:e.docView.measureVisibleLineHeights(D);this.heightMap=(l?ms.empty().applyChanges(this.stateDeco,Wt.empty,this.heightOracle,[new ji(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,l,new vW(D.from,E))}fd&&(h|=2)}let M=!this.viewportIsAppropriate(this.viewport,m)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return M&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(m,this.scrollTarget),h|=this.updateForViewport()),(h&2||M)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(l?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:l,visibleBottom:c}=this,d=new ip(s.lineAt(l-r*1e3,Qn.ByHeight,i,0,0).from,s.lineAt(c+(1-r)*1e3,Qn.ByHeight,i,0,0).to);if(n){let{head:h}=n.range;if(hd.to){let m=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),p=s.lineAt(h,Qn.ByPos,i,0,0),x;n.y=="center"?x=(p.top+p.bottom)/2-m/2:n.y=="start"||n.y=="nearest"&&h=c+Math.max(10,Math.min(r,250)))&&s>l-2*1e3&&i>1,l=s<<1;if(this.defaultTextDirection!=Hn.LTR&&!r)return[];let c=[],d=(m,p,x,v)=>{if(p-mm&&jj.from>=x.from&&j.to<=x.to&&Math.abs(j.from-m)j.fromT));if(!O){if(pM.from<=p&&M.to>=p)){let M=n.moveToLineBoundary(Ce.cursor(p),!1,!0).head;M>m&&(p=M)}let j=this.gapSize(x,m,p,v),T=r||j<2e6?j:2e6;O=new Ry(m,p,j,T)}c.push(O)},h=m=>{if(m.length2e6)for(let E of e)E.from>=m.from&&E.fromm.from&&d(m.from,v,m,p),bn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];Gt.spans(n,this.viewport.from,this.viewport.to,{span(i,l){r.push({from:i,to:l})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||Hh(this.heightMap.lineAt(e,Qn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||Hh(this.heightMap.lineAt(this.scaler.fromDOM(e),Qn.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return Hh(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}let ip=class{constructor(e,n){this.from=e,this.to=n}};function CW(t,e,n){let r=[],s=t,i=0;return Gt.spans(n,t,e,{span(){},point(l,c){l>s&&(r.push({from:s,to:l}),i+=l-s),s=c}},20),s=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let s=0;;s++){let{from:i,to:l}=e[s],c=l-i;if(r<=c)return i+r;r-=c}}function lp(t,e){let n=0;for(let{from:r,to:s}of t.ranges){if(e<=s){n+=e-r;break}n+=s-r}return n/t.total}function TW(t,e){for(let n of t)if(e(n))return n}const Rj={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class Ew{constructor(e,n,r){let s=0,i=0,l=0;this.viewports=r.map(({from:c,to:d})=>{let h=n.lineAt(c,Qn.ByPos,e,0,0).top,m=n.lineAt(d,Qn.ByPos,e,0,0).bottom;return s+=m-h,{from:c,to:d,top:h,bottom:m,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let c of this.viewports)c.domTop=l+(c.top-i)*this.scale,l=c.domBottom=c.domTop+(c.bottom-c.top),i=c.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let i=nn.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function Hh(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new la(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>Hh(s,e)):t._content)}const op=He.define({combine:t=>t.join(" ")}),$2=He.define({combine:t=>t.indexOf(!0)>-1}),H2=ho.newName(),_A=ho.newName(),DA=ho.newName(),RA={"&light":"."+_A,"&dark":"."+DA};function U2(t,e,n){return new ho(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return t;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):t+" "+r}})}const MW=U2("."+H2,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},RA),AW={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},zy=Fe.ie&&Fe.ie_version<=11;class EW{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new fV,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(Fe.ie&&Fe.ie_version<=11||Fe.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Fe.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Fe.chrome&&Fe.chrome_version<126)&&(this.editContext=new DW(e),e.state.facet(sl)&&(e.contentDOM.editContext=this.editContext.editContext)),zy&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(sl)?r.root.activeElement!=this.dom:!Kp(this.dom,s))return;let i=s.anchorNode&&r.docView.nearest(s.anchorNode);if(i&&i.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Fe.ie&&Fe.ie_version<=11||Fe.android&&Fe.chrome)&&!r.state.selection.main.empty&&s.focusNode&&ef(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=vf(e.root);if(!n)return!1;let r=Fe.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&_W(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=Kp(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&Gu(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of e){let l=this.readMutation(i);l&&(l.typeOver&&(s=!0),n==-1?{from:n,to:r}=l:(n=Math.min(l.from,n),r=Math.max(l.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&Kp(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new YV(this.view,e,n,r);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,s=wA(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let r=zj(n,e.previousSibling||e.target.previousSibling,-1),s=zj(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(sl)!=e.state.facet(sl)&&(e.view.contentDOM.editContext=e.state.facet(sl)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function zj(t,e,n){for(;e;){let r=jn.get(e);if(r&&r.parent==t)return r;let s=e.parentNode;e=s!=t.dom?s:n>0?e.nextSibling:e.previousSibling}return null}function Pj(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,l=t.docView.domAtPos(t.state.selection.main.anchor);return ef(l.node,l.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function _W(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return Pj(t,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?Pj(t,n):null}class DW{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let s=e.state.selection.main,{anchor:i,head:l}=s,c=this.toEditorPos(r.updateRangeStart),d=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:c,drifted:!1});let h=d-c>r.text.length;c==this.from&&ithis.to&&(d=i);let m=SA(e.state.sliceDoc(c,d),r.text,(h?s.from:s.to)-c,h?"end":null);if(!m){let x=Ce.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));x.main.eq(s)||e.dispatch({selection:x,userEvent:"select"});return}let p={from:m.from+c,to:m.toA+c,insert:Wt.of(r.text.slice(m.from,m.toB).split(` +`))};if((Fe.mac||Fe.android)&&p.from==l-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(p={from:c,to:d,insert:Wt.of([r.text.replace("."," ")])}),this.pendingContextChange=p,!e.state.readOnly){let x=this.to-this.from+(p.to-p.from+p.insert.length);Mw(e,p,Ce.single(this.toEditorPos(r.selectionStart,x),this.toEditorPos(r.selectionEnd,x)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),p.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let l=this.toEditorPos(r.rangeStart),c=this.toEditorPos(r.rangeEnd);l{let s=[];for(let i of r.getTextFormats()){let l=i.underlineStyle,c=i.underlineThickness;if(!/none/i.test(l)&&!/none/i.test(c)){let d=this.toEditorPos(i.rangeStart),h=this.toEditorPos(i.rangeEnd);if(d{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=vf(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((i,l,c,d,h)=>{if(r)return;let m=h.length-(l-i);if(s&&l>=s.to)if(s.from==i&&s.to==l&&s.insert.eq(h)){s=this.pendingContextChange=null,n+=m,this.to+=m;return}else s=null,this.revertPending(e.state);if(i+=n,l+=n,l<=this.from)this.from+=m,this.to+=m;else if(ithis.to||this.to-this.from+h.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(l),h.toString()),this.to+=m}n+=m}),s&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class qe{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(s=>s.forEach(i=>r(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||mV(e.parent)||document,this.viewState=new Dj(e.state||Vt.create(e)),e.scrollTo&&e.scrollTo.is(np)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Fu).map(s=>new Ey(s));for(let s of this.plugins)s.update(this);this.observer=new EW(this),this.inputState=new eW(this),this.inputState.ensureHandlers(this.plugins),this.docView=new mj(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof gr?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let x of e){if(x.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=x.state}if(this.destroyed){this.viewState.state=i;return}let l=this.hasFocus,c=0,d=null;e.some(x=>x.annotation(TA))?(this.inputState.notifiedFocused=l,c=1):l!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=l,d=MA(i,l),d||(c=1));let h=this.observer.delayedAndroidKey,m=null;if(h?(this.observer.clearDelayedAndroidKey(),m=this.observer.readChange(),(m&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(m=null)):this.observer.clear(),i.facet(Vt.phrases)!=this.state.facet(Vt.phrases))return this.setState(i);s=Ng.create(this,i,e),s.flags|=c;let p=this.viewState.scrollTarget;try{this.updateState=2;for(let x of e){if(p&&(p=p.map(x.changes)),x.scrollIntoView){let{main:v}=x.state.selection;p=new Xu(v.empty?v:Ce.cursor(v.head,v.head>v.anchor?-1:1))}for(let v of x.effects)v.is(np)&&(p=v.value.clip(this.state))}this.viewState.update(s,p),this.bidiCache=Tg.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(Qh)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(x=>x.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(op)!=s.state.facet(op)&&(this.viewState.mustMeasureContent=!0),(n||r||p||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let x of this.state.facet(I2))try{x(s)}catch(v){Es(this.state,v,"update listener")}(d||m)&&Promise.resolve().then(()=>{d&&this.state==d.startState&&this.dispatch(d),m&&!wA(this,m)&&h.force&&Gu(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new Dj(e),this.plugins=e.facet(Fu).map(r=>new Ey(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new mj(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Fu),r=e.state.facet(Fu);if(n!=r){let s=[];for(let i of r){let l=n.indexOf(i);if(l<0)s.push(new Ey(i));else{let c=this.plugins[l];c.mustUpdate=e,s.push(c)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:l}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(l=-1),this.viewState.scrollAnchorHeight=-1;try{for(let c=0;;c++){if(l<0)if(QM(r))i=-1,l=this.viewState.heightMap.height;else{let v=this.viewState.scrollAnchorAt(s);i=v.from,l=v.top}this.updateState=1;let d=this.viewState.measure(this);if(!d&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(c>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];d&4||([this.measureRequests,h]=[h,this.measureRequests]);let m=h.map(v=>{try{return v.read(this)}catch(b){return Es(this.state,b),Lj}}),p=Ng.create(this,this.state,[]),x=!1;p.flags|=d,n?n.flags|=d:n=p,this.updateState=2,p.empty||(this.updatePlugins(p),this.inputState.update(p),this.updateAttrs(),x=this.docView.update(p),x&&this.docViewUpdate());for(let v=0;v1||b<-1){s=s+b,r.scrollTop=s/this.scaleY,l=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let c of this.state.facet(I2))c(n)}get themeClasses(){return H2+" "+(this.state.facet($2)?DA:_A)+" "+this.state.facet(op)}updateAttrs(){let e=Bj(this,fA,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(sl)?"true":"false",class:"cm-content",style:`${Fe.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),Bj(this,Cw,n);let r=this.observer.ignore(()=>{let s=R2(this.contentDOM,this.contentAttrs,n),i=R2(this.dom,this.editorAttrs,e);return s||i});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let s of r.effects)if(s.is(qe.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Qh);let e=this.state.facet(qe.cspNonce);ho.mount(this.root,this.styleModules.concat(MW).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;nr.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return Dy(this,e,yj(this,e,n,r))}moveByGroup(e,n){return Dy(this,e,yj(this,e,n,r=>UV(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),i=r[n?r.length-1:0];return Ce.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return HV(this,e,n,r)}moveVertically(e,n,r){return Dy(this,e,VV(this,e,n,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),vA(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(e),i=this.bidiSpans(s),l=i[ro.find(i,e-s.from,-1,n)];return s0(r,l.dir==Hn.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(cA)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>RW)return tA(e.length);let n=this.textDirectionAt(e.from),r;for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||eA(i.isolates,r=fj(this,e))))return i.order;r||(r=fj(this,e));let s=TV(e.text,n,r);return this.bidiCache.push(new Tg(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Fe.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{qM(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return np.of(new Xu(typeof e=="number"?Ce.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return np.of(new Xu(Ce.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return lr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return lr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=ho.newName(),s=[op.of(r),Qh.of(U2(`.${r}`,e))];return n&&n.dark&&s.push($2.of(!0)),s}static baseTheme(e){return jo.lowest(Qh.of(U2("."+H2,e,RA)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&jn.get(r)||jn.get(e);return((n=s?.rootView)===null||n===void 0?void 0:n.view)||null}}qe.styleModule=Qh;qe.inputHandler=lA;qe.clipboardInputFilter=jw;qe.clipboardOutputFilter=Nw;qe.scrollHandler=dA;qe.focusChangeEffect=oA;qe.perLineTextDirection=cA;qe.exceptionSink=aA;qe.updateListener=I2;qe.editable=sl;qe.mouseSelectionStyle=iA;qe.dragMovesSelection=sA;qe.clickAddsSelectionRange=rA;qe.decorations=yf;qe.outerDecorations=mA;qe.atomicRanges=l0;qe.bidiIsolatedRanges=pA;qe.scrollMargins=gA;qe.darkTheme=$2;qe.cspNonce=He.define({combine:t=>t.length?t[0]:""});qe.contentAttributes=Cw;qe.editorAttributes=fA;qe.lineWrapping=qe.contentAttributes.of({class:"cm-lineWrapping"});qe.announce=xt.define();const RW=4096,Lj={};class Tg{constructor(e,n,r,s,i,l){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=l}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:Hn.LTR;for(let i=Math.max(0,e.length-10);i=0;s--){let i=r[s],l=typeof i=="function"?i(t):i;l&&D2(l,n)}return n}const zW=Fe.mac?"mac":Fe.windows?"win":Fe.linux?"linux":"key";function PW(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,l,c;for(let d=0;dr.concat(s),[]))),n}function BW(t,e,n){return PA(zA(t.state),e,t,n)}let to=null;const IW=4e3;function qW(t,e=zW){let n=Object.create(null),r=Object.create(null),s=(l,c)=>{let d=r[l];if(d==null)r[l]=c;else if(d!=c)throw new Error("Key binding "+l+" is used both as a regular binding and as a multi-stroke prefix")},i=(l,c,d,h,m)=>{var p,x;let v=n[l]||(n[l]=Object.create(null)),b=c.split(/ (?!$)/).map(j=>PW(j,e));for(let j=1;j{let _=to={view:M,prefix:T,scope:l};return setTimeout(()=>{to==_&&(to=null)},IW),!0}]})}let k=b.join(" ");s(k,!1);let O=v[k]||(v[k]={preventDefault:!1,stopPropagation:!1,run:((x=(p=v._any)===null||p===void 0?void 0:p.run)===null||x===void 0?void 0:x.slice())||[]});d&&O.run.push(d),h&&(O.preventDefault=!0),m&&(O.stopPropagation=!0)};for(let l of t){let c=l.scope?l.scope.split(" "):["editor"];if(l.any)for(let h of c){let m=n[h]||(n[h]=Object.create(null));m._any||(m._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:p}=l;for(let x in m)m[x].run.push(v=>p(v,V2))}let d=l[e]||l.key;if(d)for(let h of c)i(h,d,l.run,l.preventDefault,l.stopPropagation),l.shift&&i(h,"Shift-"+d,l.shift,l.preventDefault,l.stopPropagation)}return n}let V2=null;function PA(t,e,n,r){V2=e;let s=oV(e),i=Ms(s,0),l=aa(i)==s.length&&s!=" ",c="",d=!1,h=!1,m=!1;to&&to.view==n&&to.scope==r&&(c=to.prefix+" ",OA.indexOf(e.keyCode)<0&&(h=!0,to=null));let p=new Set,x=O=>{if(O){for(let j of O.run)if(!p.has(j)&&(p.add(j),j(n)))return O.stopPropagation&&(m=!0),!0;O.preventDefault&&(O.stopPropagation&&(m=!0),h=!0)}return!1},v=t[r],b,k;return v&&(x(v[c+cp(s,e,!l)])?d=!0:l&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Fe.windows&&e.ctrlKey&&e.altKey)&&!(Fe.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(b=fo[e.keyCode])&&b!=s?(x(v[c+cp(b,e,!0)])||e.shiftKey&&(k=xf[e.keyCode])!=s&&k!=b&&x(v[c+cp(k,e,!1)]))&&(d=!0):l&&e.shiftKey&&x(v[c+cp(s,e,!0)])&&(d=!0),!d&&x(v._any)&&(d=!0)),h&&(d=!0),d&&m&&e.stopPropagation(),V2=null,d}class c0{constructor(e,n,r,s,i){this.className=e,this.left=n,this.top=r,this.width=s,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let s=e.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let i=LA(e);return[new c0(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return FW(e,n,r)}}function LA(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Hn.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function qj(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let i=t.dom.getBoundingClientRect(),l=(s.top+s.bottom)/2,c=t.posAtCoords({x:i.left+1,y:l}),d=t.posAtCoords({x:i.right-1,y:l});return c==null||d==null?r:{from:Math.max(r.from,Math.min(c,d)),to:Math.min(r.to,Math.max(c,d))}}function FW(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),s=Math.min(n.to,t.viewport.to),i=t.textDirection==Hn.LTR,l=t.contentDOM,c=l.getBoundingClientRect(),d=LA(t),h=l.querySelector(".cm-line"),m=h&&window.getComputedStyle(h),p=c.left+(m?parseInt(m.paddingLeft)+Math.min(0,parseInt(m.textIndent)):0),x=c.right-(m?parseInt(m.paddingRight):0),v=F2(t,r,1),b=F2(t,s,-1),k=v.type==fs.Text?v:null,O=b.type==fs.Text?b:null;if(k&&(t.lineWrapping||v.widgetLineBreaks)&&(k=qj(t,r,1,k)),O&&(t.lineWrapping||b.widgetLineBreaks)&&(O=qj(t,s,-1,O)),k&&O&&k.from==O.from&&k.to==O.to)return T(M(n.from,n.to,k));{let D=k?M(n.from,null,k):_(v,!1),E=O?M(null,n.to,O):_(b,!0),z=[];return(k||v).to<(O||b).from-(k&&O?1:0)||v.widgetLineBreaks>1&&D.bottom+t.defaultLineHeight/2V&&W.from=H)break;R>J&&U(Math.max(ue,J),D==null&&ue<=V,Math.min(R,H),E==null&&R>=ce,ne.dir)}if(J=ae.to+1,J>=H)break}return B.length==0&&U(V,D==null,ce,E==null,t.textDirection),{top:Q,bottom:F,horizontal:B}}function _(D,E){let z=c.top+(E?D.top:D.bottom);return{top:z,bottom:z,horizontal:[]}}}function QW(t,e){return t.constructor==e.constructor&&t.eq(e)}class $W{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(eg)!=e.state.facet(eg)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(eg);for(;n!QW(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of e)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=e,Fe.safari&&Fe.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const eg=He.define();function BA(t){return[lr.define(e=>new $W(e,t)),eg.of(t)]}const bf=He.define({combine(t){return ka(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function HW(t={}){return[bf.of(t),UW,VW,WW,uA.of(!0)]}function IA(t){return t.startState.facet(bf)!=t.state.facet(bf)}const UW=BA({above:!0,markers(t){let{state:e}=t,n=e.facet(bf),r=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||n.drawRangeCursor){let l=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",c=s.empty?s:Ce.cursor(s.head,s.head>s.anchor?-1:1);for(let d of c0.forRange(t,l,c))r.push(d)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=IA(t);return n&&Fj(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){Fj(e.state,t)},class:"cm-cursorLayer"});function Fj(t,e){e.style.animationDuration=t.facet(bf).cursorBlinkRate+"ms"}const VW=BA({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:c0.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||IA(t)},class:"cm-selectionLayer"}),WW=jo.highest(qe.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),qA=xt.define({map(t,e){return t==null?null:e.mapPos(t)}}),Uh=Lr.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(qA)?r.value:n,t)}}),GW=lr.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(Uh);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Uh)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Uh),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Uh)!=t&&this.view.dispatch({effects:qA.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function XW(){return[Uh,GW]}function Qj(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),l=n,c;!i.next().done;l+=i.value.length)if(!i.lineBreak)for(;c=e.exec(i.value);)s(l+c.index,c)}function YW(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:s,to:i}of n)s=Math.max(t.state.doc.lineAt(s).from,s-e),i=Math.min(t.state.doc.lineAt(i).to,i+e),r.length&&r[r.length-1].to>=s?r[r.length-1].to=i:r.push({from:s,to:i});return r}class KW{constructor(e){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:l=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(c,d,h,m)=>s(m,h,h+c[0].length,c,d);else if(typeof r=="function")this.addMatch=(c,d,h,m)=>{let p=r(c,d,h);p&&m(h,h+c[0].length,p)};else if(r)this.addMatch=(c,d,h,m)=>m(h,h+c[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=l}createDeco(e){let n=new fl,r=n.add.bind(n);for(let{from:s,to:i}of YW(e,this.maxLength))Qj(e.state.doc,this.regexp,s,i,(l,c)=>this.addMatch(c,e,l,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,l,c,d)=>{d>=e.view.viewport.from&&c<=e.view.viewport.to&&(r=Math.min(c,r),s=Math.max(d,s))}),e.viewportMoved||s-r>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,n.map(e.changes),r,s):n}updateRange(e,n,r,s){for(let i of e.visibleRanges){let l=Math.max(i.from,r),c=Math.min(i.to,s);if(c>=l){let d=e.state.doc.lineAt(l),h=d.tod.from;l--)if(this.boundary.test(d.text[l-1-d.from])){m=l;break}for(;cx.push(j.range(k,O));if(d==h)for(this.regexp.lastIndex=m-d.from;(v=this.regexp.exec(d.text))&&v.indexthis.addMatch(O,e,k,b));n=n.update({filterFrom:m,filterTo:p,filter:(k,O)=>kp,add:x})}}return n}}const W2=/x/.unicode!=null?"gu":"g",ZW=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,W2),JW={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Py=null;function eG(){var t;if(Py==null&&typeof document<"u"&&document.body){let e=document.body.style;Py=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Py||!1}const tg=He.define({combine(t){let e=ka(t,{render:null,specialChars:ZW,addSpecialChars:null});return(e.replaceTabs=!eG())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,W2)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,W2)),e}});function tG(t={}){return[tg.of(t),nG()]}let $j=null;function nG(){return $j||($j=lr.fromClass(class{constructor(t){this.view=t,this.decorations=Je.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(tg)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new KW({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=Ms(e[0],0);if(i==9){let l=s.lineAt(r),c=n.state.tabSize,d=Td(l.text,c,r-l.from);return Je.replace({widget:new aG((c-d%c)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=Je.replace({widget:new iG(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(tg);t.startState.facet(tg)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const rG="•";function sG(t){return t>=32?rG:t==10?"␤":String.fromCharCode(9216+t)}class iG extends Oa{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=sG(this.code),r=e.state.phrase("Control character")+" "+(JW[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,n);if(s)return s;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class aG extends Oa{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function lG(){return cG}const oG=Je.line({class:"cm-activeLine"}),cG=lr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let s=t.lineBlockAt(r.head);s.from>e&&(n.push(oG.range(s.from)),e=s.from)}return Je.set(n)}},{decorations:t=>t.decorations});class uG extends Oa{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?ud(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),s=s0(n[0],r.direction!="rtl"),i=parseInt(r.lineHeight);return s.bottom-s.top>i*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+i}:s}ignoreEvent(){return!1}}function dG(t){let e=lr.fromClass(class{constructor(n){this.view=n,this.placeholder=t?Je.set([Je.widget({widget:new uG(t),side:1}).range(0)]):Je.none}get decorations(){return this.view.state.doc.length?Je.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,qe.contentAttributes.of({"aria-placeholder":t})]:e}const G2=2e3;function hG(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>G2||n.off>G2||e.col<0||n.col<0){let l=Math.min(e.off,n.off),c=Math.max(e.off,n.off);for(let d=r;d<=s;d++){let h=t.doc.line(d);h.length<=c&&i.push(Ce.range(h.from+l,h.to+c))}}else{let l=Math.min(e.col,n.col),c=Math.max(e.col,n.col);for(let d=r;d<=s;d++){let h=t.doc.line(d),m=j2(h.text,l,t.tabSize,!0);if(m<0)i.push(Ce.cursor(h.to));else{let p=j2(h.text,c,t.tabSize);i.push(Ce.range(h.from+m,h.from+p))}}}return i}function fG(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function Hj(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),s=n-r.from,i=s>G2?-1:s==r.length?fG(t,e.clientX):Td(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function mG(t,e){let n=Hj(t,e),r=t.state.selection;return n?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(n.line).from),l=s.state.doc.lineAt(i);n={line:l.number,col:n.col,off:Math.min(n.off,l.length)},r=r.map(s.changes)}},get(s,i,l){let c=Hj(t,s);if(!c)return r;let d=hG(t.state,n,c);return d.length?l?Ce.create(d.concat(r.ranges)):Ce.create(d):r}}:null}function pG(t){let e=(n=>n.altKey&&n.button==0);return qe.mouseSelectionStyle.of((n,r)=>e(r)?mG(n,r):null)}const gG={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},xG={style:"cursor: crosshair"};function vG(t={}){let[e,n]=gG[t.key||"Alt"],r=lr.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||n(s))},keyup(s){(s.keyCode==e||!n(s))&&this.set(!1)},mousemove(s){this.set(n(s))}}});return[r,qe.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?xG:null})]}const up="-10000px";class FA{constructor(e,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=e.state.facet(n),this.tooltips=this.input.filter(l=>l);let i=null;this.tooltipViews=this.tooltips.map(l=>i=r(l,i))}update(e,n){var r;let s=e.state.facet(this.facet),i=s.filter(d=>d);if(s===this.input){for(let d of this.tooltipViews)d.update&&d.update(e);return!1}let l=[],c=n?[]:null;for(let d=0;dn[h]=d),n.length=c.length),this.input=s,this.tooltips=i,this.tooltipViews=l,!0}}function yG(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Ly=He.define({combine:t=>{var e,n,r;return{position:Fe.ios?"absolute":((e=t.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(s=>s.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||yG}}}),Uj=new WeakMap,_w=lr.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Ly);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new FA(t,Dw,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(Ly);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",n.dom.appendChild(s)}return n.dom.style.position=this.position,n.dom.style.top=up,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(Fe.safari){let l=i.getBoundingClientRect();n=Math.abs(l.top+1e4)>1||Math.abs(l.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=Tw(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,l)=>{let c=this.manager.tooltipViews[l];return c.getCoords?c.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(Ly).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let c of this.manager.tooltipViews)c.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,l=[];for(let c=0;c=Math.min(n.bottom,r.bottom)||p.rightMath.min(n.right,r.right)+.1)){m.style.top=up;continue}let v=d.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,b=v?7:0,k=x.right-x.left,O=(e=Uj.get(h))!==null&&e!==void 0?e:x.bottom-x.top,j=h.offset||wG,T=this.view.textDirection==Hn.LTR,M=x.width>r.right-r.left?T?r.left:r.right-x.width:T?Math.max(r.left,Math.min(p.left-(v?14:0)+j.x,r.right-k)):Math.min(Math.max(r.left,p.left-k+(v?14:0)-j.x),r.right-k),_=this.above[c];!d.strictSide&&(_?p.top-O-b-j.yr.bottom)&&_==r.bottom-p.bottom>p.top-r.top&&(_=this.above[c]=!_);let D=(_?p.top-r.top:r.bottom-p.bottom)-b;if(DM&&Q.topE&&(E=_?Q.top-O-2-b:Q.bottom+b+2);if(this.position=="absolute"?(m.style.top=(E-t.parent.top)/i+"px",Vj(m,(M-t.parent.left)/s)):(m.style.top=E/i+"px",Vj(m,M/s)),v){let Q=p.left+(T?j.x:-j.x)-(M+14-7);v.style.left=Q/s+"px"}h.overlap!==!0&&l.push({left:M,top:E,right:z,bottom:E+O}),m.classList.toggle("cm-tooltip-above",_),m.classList.toggle("cm-tooltip-below",!_),h.positioned&&h.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=up}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Vj(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const bG=qe.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),wG={x:0,y:0},Dw=He.define({enables:[_w,bG]}),Mg=He.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Ox{static create(e){return new Ox(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new FA(e,Mg,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let s=r[e];if(s!==void 0){if(n===void 0)n=s;else if(n!==s)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const SG=Dw.compute([Mg],t=>{let e=t.facet(Mg);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:Ox.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class kG{constructor(e,n,r,s,i){this.view=e,this.source=n,this.field=r,this.setHover=s,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;ec.bottom||n.xc.right+e.defaultCharacterWidth)return;let d=e.bidiSpans(e.state.doc.lineAt(s)).find(m=>m.from<=s&&m.to>=s),h=d&&d.dir==Hn.RTL?-1:1;i=n.x{this.pending==c&&(this.pending=null,d&&!(Array.isArray(d)&&!d.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(d)?d:[d])}))},d=>Es(e.state,d,"hover tooltip"))}else l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])})}get tooltip(){let e=this.view.plugin(_w),n=e?e.manager.tooltips.findIndex(r=>r.create==Ox.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:i}=this;if(s.length&&i&&!OG(i.dom,e)||this.pending){let{pos:l}=s[0]||this.pending,c=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:l;(l==c?this.view.posAtCoords(this.lastMove)!=l:!jG(this.view,l,c,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const dp=4;function OG(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),l;if(l=t.querySelector(".cm-tooltip-arrow")){let c=l.getBoundingClientRect();s=Math.min(c.top,s),i=Math.max(c.bottom,i)}return e.clientX>=n-dp&&e.clientX<=r+dp&&e.clientY>=s-dp&&e.clientY<=i+dp}function jG(t,e,n,r,s,i){let l=t.scrollDOM.getBoundingClientRect(),c=t.documentTop+t.documentPadding.top+t.contentHeight;if(l.left>r||l.rights||Math.min(l.bottom,c)=e&&d<=n}function NG(t,e={}){let n=xt.define(),r=Lr.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(l=>!e.hideOn(i,l))),i.docChanged)){let l=[];for(let c of s){let d=i.changes.mapPos(c.pos,-1,Ur.TrackDel);if(d!=null){let h=Object.assign(Object.create(null),c);h.pos=d,h.end!=null&&(h.end=i.changes.mapPos(h.end)),l.push(h)}}s=l}for(let l of i.effects)l.is(n)&&(s=l.value),l.is(CG)&&(s=[]);return s},provide:s=>Mg.from(s)});return{active:r,extension:[r,lr.define(s=>new kG(s,t,r,n,e.hoverTime||300)),SG]}}function QA(t,e){let n=t.plugin(_w);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const CG=xt.define(),Wj=He.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function wf(t,e){let n=t.plugin($A),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const $A=lr.fromClass(class{constructor(t){this.input=t.state.facet(Sf),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(Wj);this.top=new hp(t,!0,e.topContainer),this.bottom=new hp(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(Wj);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new hp(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new hp(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Sf);if(n!=this.input){let r=n.filter(d=>d),s=[],i=[],l=[],c=[];for(let d of r){let h=this.specs.indexOf(d),m;h<0?(m=d(t.view),c.push(m)):(m=this.panels[h],m.update&&m.update(t)),s.push(m),(m.top?i:l).push(m)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(l);for(let d of c)d.dom.classList.add("cm-panel"),d.mount&&d.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>qe.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class hp{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=Gj(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=Gj(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Gj(t){let e=t.nextSibling;return t.remove(),e}const Sf=He.define({enables:$A});class pl extends yc{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}pl.prototype.elementClass="";pl.prototype.toDOM=void 0;pl.prototype.mapMode=Ur.TrackBefore;pl.prototype.startSide=pl.prototype.endSide=-1;pl.prototype.point=!0;const ng=He.define(),TG=He.define(),MG={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Gt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},rf=He.define();function AG(t){return[HA(),rf.of({...MG,...t})]}const Xj=He.define({combine:t=>t.some(e=>e)});function HA(t){return[EG]}const EG=lr.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(rf).map(e=>new Kj(t,e)),this.fixed=!t.state.facet(Xj);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Xj)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=Gt.iter(this.view.state.facet(ng),this.view.viewport.from),r=[],s=this.gutters.map(i=>new _G(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let l=!0;for(let c of i.type)if(c.type==fs.Text&&l){X2(n,r,c.from);for(let d of s)d.line(this.view,c,r);l=!1}else if(c.widget)for(let d of s)d.widget(this.view,c)}else if(i.type==fs.Text){X2(n,r,i.from);for(let l of s)l.line(this.view,i,r)}else if(i.widget)for(let l of s)l.widget(this.view,i);for(let i of s)i.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(rf),n=t.state.facet(rf),r=t.docChanged||t.heightChanged||t.viewportChanged||!Gt.eq(t.startState.facet(ng),t.state.facet(ng),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let i of n){let l=e.indexOf(i);l<0?s.push(new Kj(this.view,i)):(this.gutters[l].update(t),s.push(this.gutters[l]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>qe.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,s=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Hn.LTR?{left:r,right:s}:{right:r,left:s}})});function Yj(t){return Array.isArray(t)?t:[t]}function X2(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class _G{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Gt.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,i=(n.top-this.height)/e.scaleY,l=n.height/e.scaleY;if(this.i==s.elements.length){let c=new UA(e,l,i,r);s.elements.push(c),s.dom.appendChild(c.dom)}else s.elements[this.i].update(e,l,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];X2(this.cursor,s,n.from),r.length&&(s=s.concat(r));let i=this.gutter.config.lineMarker(e,n,s);i&&s.unshift(i);let l=this.gutter;s.length==0&&!l.config.renderEmptyElements||this.addElement(e,n,s)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),s=r?[r]:null;for(let i of e.state.facet(TG)){let l=i(e,n.widget,n);l&&(s||(s=[])).push(l)}s&&this.addElement(e,n,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class Kj{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let i=s.target,l;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let d=i.getBoundingClientRect();l=(d.top+d.bottom)/2}else l=s.clientY;let c=e.lineBlockAtHeight(l-e.documentTop);n.domEventHandlers[r](e,c,s)&&s.preventDefault()});this.markers=Yj(n.markers(e)),n.initialSpacer&&(this.spacer=new UA(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=Yj(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let r=e.view.viewport;return!Gt.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class UA{constructor(e,n,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,s)}update(e,n,r,s){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),DG(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,l=0;;){let c=l,d=ii(c,d,h)||l(c,d,h):l}return r}})}});class By extends pl{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Iy(t,e){return t.state.facet(Qu).formatNumber(e,t.state)}const PG=rf.compute([Qu],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(RG)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new By(Iy(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(zG)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Qu)!=e.state.facet(Qu),initialSpacer(e){return new By(Iy(e,Zj(e.state.doc.lines)))},updateSpacer(e,n){let r=Iy(n.view,Zj(n.view.state.doc.lines));return r==e.number?e:new By(r)},domEventHandlers:t.facet(Qu).domEventHandlers,side:"before"}));function LG(t={}){return[Qu.of(t),HA(),PG]}function Zj(t){let e=9;for(;e{let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>n&&(n=s,e.push(BG.range(s)))}return Gt.of(e)});function qG(){return IG}const VA=1024;let FG=0;class qy{constructor(e,n){this.from=e,this.to=n}}class Et{constructor(e={}){this.id=FG++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=gs.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Et.closedBy=new Et({deserialize:t=>t.split(" ")});Et.openedBy=new Et({deserialize:t=>t.split(" ")});Et.group=new Et({deserialize:t=>t.split(" ")});Et.isolate=new Et({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Et.contextHash=new Et({perNode:!0});Et.lookAhead=new Et({perNode:!0});Et.mounted=new Et({perNode:!0});class Ag{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[Et.mounted.id]}}const QG=Object.create(null);class gs{constructor(e,n,r,s=0){this.name=e,this.props=n,this.id=r,this.flags=s}static define(e){let n=e.props&&e.props.length?Object.create(null):QG,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new gs(e.name||"",n,e.id,r);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(s)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Et.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let s of r.split(" "))n[s]=e[r];return r=>{for(let s=r.prop(Et.group),i=-1;i<(s?s.length:0);i++){let l=n[i<0?r.name:s[i]];if(l)return l}}}}gs.none=new gs("",Object.create(null),0,8);class jx{constructor(e){this.types=e;for(let n=0;n0;for(let d=this.cursor(l|Or.IncludeAnonymous);;){let h=!1;if(d.from<=i&&d.to>=s&&(!c&&d.type.isAnonymous||n(d)!==!1)){if(d.firstChild())continue;h=!0}for(;h&&r&&(c||!d.type.isAnonymous)&&r(d),!d.nextSibling();){if(!d.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Pw(gs.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new _n(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new _n(gs.none,n,r,s)))}static build(e){return VG(e)}}_n.empty=new _n(gs.none,[],[],0);class Rw{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Rw(this.buffer,this.index)}}class po{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return gs.none}toString(){let e=[];for(let n=0;n0));d=l[d+3]);return c}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),l=0;for(let c=e,d=0;c=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function kf(t,e,n,r){for(var s;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?c.length:-1;e!=h;e+=n){let m=c[e],p=d[e]+l.from;if(WA(s,r,p,p+m.length)){if(m instanceof po){if(i&Or.ExcludeBuffers)continue;let x=m.findChild(0,m.buffer.length,n,r-p,s);if(x>-1)return new da(new $G(l,m,e,p),null,x)}else if(i&Or.IncludeAnonymous||!m.type.isAnonymous||zw(m)){let x;if(!(i&Or.IgnoreMounts)&&(x=Ag.get(m))&&!x.overlay)return new zs(x.tree,p,e,l);let v=new zs(m,p,e,l);return i&Or.IncludeAnonymous||!v.type.isAnonymous?v:v.nextChild(n<0?m.children.length-1:0,n,r,s)}}}if(i&Or.IncludeAnonymous||!l.type.isAnonymous||(l.index>=0?e=l.index+n:e=n<0?-1:l._parent._tree.children.length,l=l._parent,!l))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let s;if(!(r&Or.IgnoreOverlays)&&(s=Ag.get(this._tree))&&s.overlay){let i=e-this.from;for(let{from:l,to:c}of s.overlay)if((n>0?l<=i:l=i:c>i))return new zs(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function e7(t,e,n,r){let s=t.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let l=!1;!l;)if(l=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(e)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function Y2(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class $G{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class da extends GA{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.context.start,r);return i<0?null:new da(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&Or.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return i<0?null:new da(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new da(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new da(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let l=r.buffer[this.index+1];e.push(r.slice(s,i,l)),n.push(0)}return new _n(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function XA(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;in.from||l.to=e){let c=new zs(l.tree,l.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(kf(c,e,n,!1))}}return s?XA(s):r}class K2{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof zs)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof zs?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Or.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Or.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Or.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let i=n+e,l=e<0?-1:r._tree.children.length;i!=l;i+=e){let c=r._tree.children[i];if(this.mode&Or.IncludeAnonymous||c instanceof po||!c.type.isAnonymous||zw(c))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let l=e;l;l=l._parent)if(l.index==s){if(s==this.index)return l;n=l,r=i+1;break e}s=this.stack[--i]}for(let s=r;s=0;i--){if(i<0)return Y2(this._tree,e,s);let l=r[n.buffer[this.stack[i]]];if(!l.isAnonymous){if(e[s]&&e[s]!=l.name)return!1;s--}}return!0}}function zw(t){return t.children.some(e=>e instanceof po||!e.type.isAnonymous||zw(e))}function VG(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=VA,reused:i=[],minRepeatType:l=r.types.length}=t,c=Array.isArray(n)?new Rw(n,n.length):n,d=r.types,h=0,m=0;function p(D,E,z,Q,F,B){let{id:U,start:V,end:ce,size:W}=c,J=m,H=h;if(W<0)if(c.next(),W==-1){let me=i[U];z.push(me),Q.push(V-D);return}else if(W==-3){h=U;return}else if(W==-4){m=U;return}else throw new RangeError(`Unrecognized record size: ${W}`);let ae=d[U],ne,ue,R=V-D;if(ce-V<=s&&(ue=O(c.pos-E,F))){let me=new Uint16Array(ue.size-ue.skip),Y=c.pos-ue.size,P=me.length;for(;c.pos>Y;)P=j(ue.start,me,P);ne=new po(me,ce-ue.start,r),R=ue.start-D}else{let me=c.pos-W;c.next();let Y=[],P=[],K=U>=l?U:-1,$=0,fe=ce;for(;c.pos>me;)K>=0&&c.id==K&&c.size>=0?(c.end<=fe-s&&(b(Y,P,V,$,c.end,fe,K,J,H),$=Y.length,fe=c.end),c.next()):B>2500?x(V,me,Y,P):p(V,me,Y,P,K,B+1);if(K>=0&&$>0&&$-1&&$>0){let ve=v(ae,H);ne=Pw(ae,Y,P,0,Y.length,0,ce-V,ve,ve)}else ne=k(ae,Y,P,ce-V,J-ce,H)}z.push(ne),Q.push(R)}function x(D,E,z,Q){let F=[],B=0,U=-1;for(;c.pos>E;){let{id:V,start:ce,end:W,size:J}=c;if(J>4)c.next();else{if(U>-1&&ce=0;W-=3)V[J++]=F[W],V[J++]=F[W+1]-ce,V[J++]=F[W+2]-ce,V[J++]=J;z.push(new po(V,F[2]-ce,r)),Q.push(ce-D)}}function v(D,E){return(z,Q,F)=>{let B=0,U=z.length-1,V,ce;if(U>=0&&(V=z[U])instanceof _n){if(!U&&V.type==D&&V.length==F)return V;(ce=V.prop(Et.lookAhead))&&(B=Q[U]+V.length+ce)}return k(D,z,Q,F,B,E)}}function b(D,E,z,Q,F,B,U,V,ce){let W=[],J=[];for(;D.length>Q;)W.push(D.pop()),J.push(E.pop()+z-F);D.push(k(r.types[U],W,J,B-F,V-B,ce)),E.push(F-z)}function k(D,E,z,Q,F,B,U){if(B){let V=[Et.contextHash,B];U=U?[V].concat(U):[V]}if(F>25){let V=[Et.lookAhead,F];U=U?[V].concat(U):[V]}return new _n(D,E,z,Q,U)}function O(D,E){let z=c.fork(),Q=0,F=0,B=0,U=z.end-s,V={size:0,start:0,skip:0};e:for(let ce=z.pos-D;z.pos>ce;){let W=z.size;if(z.id==E&&W>=0){V.size=Q,V.start=F,V.skip=B,B+=4,Q+=4,z.next();continue}let J=z.pos-W;if(W<0||J=l?4:0,ae=z.start;for(z.next();z.pos>J;){if(z.size<0)if(z.size==-3)H+=4;else break e;else z.id>=l&&(H+=4);z.next()}F=ae,Q+=W,B+=H}return(E<0||Q==D)&&(V.size=Q,V.start=F,V.skip=B),V.size>4?V:void 0}function j(D,E,z){let{id:Q,start:F,end:B,size:U}=c;if(c.next(),U>=0&&Q4){let ce=c.pos-(U-4);for(;c.pos>ce;)z=j(D,E,z)}E[--z]=V,E[--z]=B-D,E[--z]=F-D,E[--z]=Q}else U==-3?h=Q:U==-4&&(m=Q);return z}let T=[],M=[];for(;c.pos>0;)p(t.start||0,t.bufferStart||0,T,M,-1,0);let _=(e=t.length)!==null&&e!==void 0?e:T.length?M[0]+T[0].length:0;return new _n(d[t.topID],T.reverse(),M.reverse(),_)}const t7=new WeakMap;function rg(t,e){if(!t.isAnonymous||e instanceof po||e.type!=t)return 1;let n=t7.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof _n)){n=1;break}n+=rg(t,r)}t7.set(e,n)}return n}function Pw(t,e,n,r,s,i,l,c,d){let h=0;for(let b=r;b=m)break;E+=z}if(M==_+1){if(E>m){let z=b[_];v(z.children,z.positions,0,z.children.length,k[_]+T);continue}p.push(b[_])}else{let z=k[M-1]+b[M-1].length-D;p.push(Pw(t,b,k,_,M,D,z,null,d))}x.push(D+T-i)}}return v(e,n,r,s,0),(c||d)(p,x,l)}class WG{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof da?this.setBuffer(e.context.buffer,e.index,n):e instanceof zs&&this.map.set(e.tree,n)}get(e){return e instanceof da?this.getBuffer(e.context.buffer,e.index):e instanceof zs?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class pc{constructor(e,n,r,s,i=!1,l=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(l?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let s=[new pc(0,e.length,e,0,!1,r)];for(let i of n)i.to>e.length&&s.push(i);return s}static applyChanges(e,n,r=128){if(!n.length)return e;let s=[],i=1,l=e.length?e[0]:null;for(let c=0,d=0,h=0;;c++){let m=c=r)for(;l&&l.from=x.from||p<=x.to||h){let v=Math.max(x.from,d)-h,b=Math.min(x.to,p)-h;x=v>=b?null:new pc(v,b,x.tree,x.offset+h,c>0,!!m)}if(x&&s.push(x),l.to>p)break;l=inew qy(s.from,s.to)):[new qy(0,0)]:[new qy(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let s=this.startParse(e,n,r);for(;;){let i=s.advance();if(i)return i}}};class GG{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new Et({perNode:!0});let XG=0;class vi{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=XG++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof vi&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new vi(r,[],null,[]);if(s.set.push(s),n)for(let i of n.set)s.set.push(i);return s}static defineModifier(e){let n=new Eg(e);return r=>r.modified.indexOf(n)>-1?r:Eg.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let YG=0;class Eg{constructor(e){this.name=e,this.instances=[],this.id=YG++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(c=>c.base==e&&KG(n,c.modified));if(r)return r;let s=[],i=new vi(e.name,s,e,n);for(let c of n)c.instances.push(i);let l=ZG(n);for(let c of e.set)if(!c.modified.length)for(let d of l)s.push(Eg.get(c,d));return i}}function KG(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function ZG(t){let e=[[]];for(let n=0;nr.length-n.length)}function Bw(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],l=2,c=s;for(let p=0;;){if(c=="..."&&p>0&&p+3==s.length){l=1;break}let x=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(c);if(!x)throw new RangeError("Invalid path: "+s);if(i.push(x[0]=="*"?"":x[0][0]=='"'?JSON.parse(x[0]):x[0]),p+=x[0].length,p==s.length)break;let v=s[p++];if(p==s.length&&v=="!"){l=0;break}if(v!="/")throw new RangeError("Invalid path: "+s);c=s.slice(p)}let d=i.length-1,h=i[d];if(!h)throw new RangeError("Invalid path: "+s);let m=new Of(r,l,d>0?i.slice(0,d):null);e[h]=m.sort(e[h])}}return YA.add(e)}const YA=new Et({combine(t,e){let n,r,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let i=new Of(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class Of{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let l=s;for(let c of i)for(let d of c.set){let h=n[d.id];if(h){l=l?l+" "+h:h;break}}return l},scope:r}}function JG(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function eX(t,e,n,r=0,s=t.length){let i=new tX(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class tX{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,s,i){let{type:l,from:c,to:d}=e;if(c>=r||d<=n)return;l.isTop&&(i=this.highlighters.filter(v=>!v.scope||v.scope(l)));let h=s,m=nX(e)||Of.empty,p=JG(i,m.tags);if(p&&(h&&(h+=" "),h+=p,m.mode==1&&(s+=(s?" ":"")+p)),this.startSpan(Math.max(n,c),h),m.opaque)return;let x=e.tree&&e.tree.prop(Et.mounted);if(x&&x.overlay){let v=e.node.enter(x.overlay[0].from+c,1),b=this.highlighters.filter(O=>!O.scope||O.scope(x.tree.type)),k=e.firstChild();for(let O=0,j=c;;O++){let T=O=M||!e.nextSibling())););if(!T||M>r)break;j=T.to+c,j>n&&(this.highlightRange(v.cursor(),Math.max(n,T.from+c),Math.min(r,j),"",b),this.startSpan(Math.min(r,j),h))}k&&e.parent()}else if(e.firstChild()){x&&(s="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,s,i),this.startSpan(Math.min(r,e.to),h)}while(e.nextSibling());e.parent()}}}function nX(t){let e=t.type.prop(YA);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ie=vi.define,mp=Ie(),Jl=Ie(),n7=Ie(Jl),r7=Ie(Jl),eo=Ie(),pp=Ie(eo),Fy=Ie(eo),na=Ie(),Ko=Ie(na),ea=Ie(),ta=Ie(),Z2=Ie(),Rh=Ie(Z2),gp=Ie(),he={comment:mp,lineComment:Ie(mp),blockComment:Ie(mp),docComment:Ie(mp),name:Jl,variableName:Ie(Jl),typeName:n7,tagName:Ie(n7),propertyName:r7,attributeName:Ie(r7),className:Ie(Jl),labelName:Ie(Jl),namespace:Ie(Jl),macroName:Ie(Jl),literal:eo,string:pp,docString:Ie(pp),character:Ie(pp),attributeValue:Ie(pp),number:Fy,integer:Ie(Fy),float:Ie(Fy),bool:Ie(eo),regexp:Ie(eo),escape:Ie(eo),color:Ie(eo),url:Ie(eo),keyword:ea,self:Ie(ea),null:Ie(ea),atom:Ie(ea),unit:Ie(ea),modifier:Ie(ea),operatorKeyword:Ie(ea),controlKeyword:Ie(ea),definitionKeyword:Ie(ea),moduleKeyword:Ie(ea),operator:ta,derefOperator:Ie(ta),arithmeticOperator:Ie(ta),logicOperator:Ie(ta),bitwiseOperator:Ie(ta),compareOperator:Ie(ta),updateOperator:Ie(ta),definitionOperator:Ie(ta),typeOperator:Ie(ta),controlOperator:Ie(ta),punctuation:Z2,separator:Ie(Z2),bracket:Rh,angleBracket:Ie(Rh),squareBracket:Ie(Rh),paren:Ie(Rh),brace:Ie(Rh),content:na,heading:Ko,heading1:Ie(Ko),heading2:Ie(Ko),heading3:Ie(Ko),heading4:Ie(Ko),heading5:Ie(Ko),heading6:Ie(Ko),contentSeparator:Ie(na),list:Ie(na),quote:Ie(na),emphasis:Ie(na),strong:Ie(na),link:Ie(na),monospace:Ie(na),strikethrough:Ie(na),inserted:Ie(),deleted:Ie(),changed:Ie(),invalid:Ie(),meta:gp,documentMeta:Ie(gp),annotation:Ie(gp),processingInstruction:Ie(gp),definition:vi.defineModifier("definition"),constant:vi.defineModifier("constant"),function:vi.defineModifier("function"),standard:vi.defineModifier("standard"),local:vi.defineModifier("local"),special:vi.defineModifier("special")};for(let t in he){let e=he[t];e instanceof vi&&(e.name=t)}KA([{tag:he.link,class:"tok-link"},{tag:he.heading,class:"tok-heading"},{tag:he.emphasis,class:"tok-emphasis"},{tag:he.strong,class:"tok-strong"},{tag:he.keyword,class:"tok-keyword"},{tag:he.atom,class:"tok-atom"},{tag:he.bool,class:"tok-bool"},{tag:he.url,class:"tok-url"},{tag:he.labelName,class:"tok-labelName"},{tag:he.inserted,class:"tok-inserted"},{tag:he.deleted,class:"tok-deleted"},{tag:he.literal,class:"tok-literal"},{tag:he.string,class:"tok-string"},{tag:he.number,class:"tok-number"},{tag:[he.regexp,he.escape,he.special(he.string)],class:"tok-string2"},{tag:he.variableName,class:"tok-variableName"},{tag:he.local(he.variableName),class:"tok-variableName tok-local"},{tag:he.definition(he.variableName),class:"tok-variableName tok-definition"},{tag:he.special(he.variableName),class:"tok-variableName2"},{tag:he.definition(he.propertyName),class:"tok-propertyName tok-definition"},{tag:he.typeName,class:"tok-typeName"},{tag:he.namespace,class:"tok-namespace"},{tag:he.className,class:"tok-className"},{tag:he.macroName,class:"tok-macroName"},{tag:he.propertyName,class:"tok-propertyName"},{tag:he.operator,class:"tok-operator"},{tag:he.comment,class:"tok-comment"},{tag:he.meta,class:"tok-meta"},{tag:he.invalid,class:"tok-invalid"},{tag:he.punctuation,class:"tok-punctuation"}]);var Qy;const lc=new Et;function ZA(t){return He.define({combine:t?e=>e.concat(t):void 0})}const rX=new Et;class bi{constructor(e,n,r=[],s=""){this.data=e,this.name=s,Vt.prototype.hasOwnProperty("tree")||Object.defineProperty(Vt.prototype,"tree",{get(){return zr(this)}}),this.parser=n,this.extension=[go.of(this),Vt.languageData.of((i,l,c)=>{let d=s7(i,l,c),h=d.type.prop(lc);if(!h)return[];let m=i.facet(h),p=d.type.prop(rX);if(p){let x=d.resolve(l-d.from,c);for(let v of p)if(v.test(x,i)){let b=i.facet(v.facet);return v.type=="replace"?b:b.concat(m)}}return m})].concat(r)}isActiveAt(e,n,r=-1){return s7(e,n,r).type.prop(lc)==this.data}findRegions(e){let n=e.facet(go);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,l)=>{if(i.prop(lc)==this.data){r.push({from:l,to:l+i.length});return}let c=i.prop(Et.mounted);if(c){if(c.tree.prop(lc)==this.data){if(c.overlay)for(let d of c.overlay)r.push({from:d.from+l,to:d.to+l});else r.push({from:l,to:l+i.length});return}else if(c.overlay){let d=r.length;if(s(c.tree,c.overlay[0].from+l),r.length>d)return}}for(let d=0;dr.isTop?n:void 0)]}),e.name)}configure(e,n){return new jf(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function zr(t){let e=t.field(bi.state,!1);return e?e.tree:_n.empty}class sX{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let zh=null;class md{constructor(e,n,r=[],s,i,l,c,d){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=l,this.skipped=c,this.scheduleOn=d,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new md(e,n,[],_n.empty,0,r,[],null)}startParse(){return this.parser.startParse(new sX(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=_n.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(pc.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=zh;zh=this;try{return e()}finally{zh=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=i7(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:l,skipped:c}=this;if(this.takeTree(),!e.empty){let d=[];if(e.iterChangedRanges((h,m,p,x)=>d.push({fromA:h,toA:m,fromB:p,toB:x})),r=pc.applyChanges(r,d),s=_n.empty,i=0,l={from:e.mapPos(l.from,-1),to:e.mapPos(l.to,1)},this.skipped.length){c=[];for(let h of this.skipped){let m=e.mapPos(h.from,1),p=e.mapPos(h.to,-1);me.from&&(this.fragments=i7(this.fragments,s,i),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends Lw{createParse(n,r,s){let i=s[0].from,l=s[s.length-1].to;return{parsedPos:i,advance(){let d=zh;if(d){for(let h of s)d.tempSkipped.push(h);e&&(d.scheduleOn=d.scheduleOn?Promise.all([d.scheduleOn,e]):e)}return this.parsedPos=l,new _n(gs.none,[],[],l-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return zh}}function i7(t,e,n){return pc.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class pd{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new pd(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=md.create(e.facet(go).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new pd(r)}}bi.state=Lr.define({create:pd.init,update(t,e){for(let n of e.effects)if(n.is(bi.setState))return n.value;return e.startState.facet(go)!=e.state.facet(go)?pd.init(e.state):t.apply(e)}});let JA=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(JA=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const $y=typeof navigator<"u"&&(!((Qy=navigator.scheduling)===null||Qy===void 0)&&Qy.isInputPending)?()=>navigator.scheduling.isInputPending():null,iX=lr.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(bi.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(bi.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=JA(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnds+1e3,d=i.context.work(()=>$y&&$y()||Date.now()>l,s+(c?0:1e5));this.chunkBudget-=Date.now()-n,(d||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:bi.setState.of(new pd(i.context))})),this.chunkBudget>0&&!(d&&!c)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Es(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),go=He.define({combine(t){return t.length?t[0]:null},enables:t=>[bi.state,iX,qe.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class eE{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const aX=He.define(),u0=He.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function kc(t){let e=t.facet(u0);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Nf(t,e){let n="",r=t.tabSize,s=t.facet(u0)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i=e?lX(t,n,e):null}class Nx{constructor(e,n={}){this.state=e,this.options=n,this.unit=kc(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==e?{text:"",from:e}:(n<0?s-1&&(i+=l-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return Td(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let l=i(s);if(l>-1)return l}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Cx=new Et;function lX(t,e,n){let r=e.resolveStack(n),s=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let l=s;l&&!(l.fromr.node.to||l.from==r.node.from&&l.type==r.node.type);l=l.parent)i.push(l);for(let l=i.length-1;l>=0;l--)r={node:i[l],next:r}}return tE(r,t,n)}function tE(t,e,n){for(let r=t;r;r=r.next){let s=cX(r.node);if(s)return s(qw.create(e,n,r))}return 0}function oX(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function cX(t){let e=t.type.prop(Cx);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Et.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return l=>nE(l,!0,1,void 0,i&&!oX(l)?s.from:void 0)}return t.parent==null?uX:null}function uX(){return 0}class qw extends Nx{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new qw(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(dX(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return tE(this.context.next,this.base,this.pos)}}function dX(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function hX(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let s=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),l=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let c=n.to;;){let d=e.childAfter(c);if(!d||d==r)return null;if(!d.type.isSkipped){if(d.from>=l)return null;let h=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+h}}c=d.to}}function Hy({closing:t,align:e=!0,units:n=1}){return r=>nE(r,e,n,t)}function nE(t,e,n,r,s){let i=t.textAfter,l=i.match(/^\s*/)[0].length,c=r&&i.slice(l,l+r.length)==r||s==t.pos+l,d=e?hX(t):null;return d?c?t.column(d.from):t.column(d.to):t.baseIndent+(c?0:t.unit*n)}function a7({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const fX=200;function mX(){return Vt.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,s=n.lineAt(r);if(r>s.from+fX)return t;let i=n.sliceString(s.from,r);if(!e.some(h=>h.test(i)))return t;let{state:l}=t,c=-1,d=[];for(let{head:h}of l.selection.ranges){let m=l.doc.lineAt(h);if(m.from==c)continue;c=m.from;let p=Iw(l,m.from);if(p==null)continue;let x=/^\s*/.exec(m.text)[0],v=Nf(l,p);x!=v&&d.push({from:m.from,to:m.from+x.length,insert:v})}return d.length?[t,{changes:d,sequential:!0}]:t})}const pX=He.define(),Fw=new Et;function rE(t){let e=t.firstChild,n=t.lastChild;return e&&e.ton)continue;if(i&&c.from=e&&h.to>n&&(i=h)}}return i}function xX(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function _g(t,e,n){for(let r of t.facet(pX)){let s=r(t,e,n);if(s)return s}return gX(t,e,n)}function sE(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const Tx=xt.define({map:sE}),d0=xt.define({map:sE});function iE(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const Oc=Lr.define({create(){return Je.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=l7(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(Tx)&&!vX(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(oE),s=r?Je.replace({widget:new jX(r(e.state,n.value))}):o7;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(d0)&&(t=t.update({filter:(r,s)=>n.value.from!=r||n.value.to!=s,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=l7(t,e.selection.main.head)),t},provide:t=>qe.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,s)=>{n.push(r,s)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n{se&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(s,i)=>s>=n||i<=e}):t}function Dg(t,e,n){var r;let s=null;return(r=t.field(Oc,!1))===null||r===void 0||r.between(e,n,(i,l)=>{(!s||s.from>i)&&(s={from:i,to:l})}),s}function vX(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function aE(t,e){return t.field(Oc,!1)?e:e.concat(xt.appendConfig.of(cE()))}const yX=t=>{for(let e of iE(t)){let n=_g(t.state,e.from,e.to);if(n)return t.dispatch({effects:aE(t.state,[Tx.of(n),lE(t,n)])}),!0}return!1},bX=t=>{if(!t.state.field(Oc,!1))return!1;let e=[];for(let n of iE(t)){let r=Dg(t.state,n.from,n.to);r&&e.push(d0.of(r),lE(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function lE(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return qe.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const wX=t=>{let{state:e}=t,n=[];for(let r=0;r{let e=t.state.field(Oc,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(d0.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},kX=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:yX},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:bX},{key:"Ctrl-Alt-[",run:wX},{key:"Ctrl-Alt-]",run:SX}],OX={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},oE=He.define({combine(t){return ka(t,OX)}});function cE(t){return[Oc,TX]}function uE(t,e){let{state:n}=t,r=n.facet(oE),s=l=>{let c=t.lineBlockAt(t.posAtDOM(l.target)),d=Dg(t.state,c.from,c.to);d&&t.dispatch({effects:d0.of(d)}),l.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,s,e);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const o7=Je.replace({widget:new class extends Oa{toDOM(t){return uE(t,null)}}});class jX extends Oa{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return uE(e,this.value)}}const NX={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Uy extends pl{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function CX(t={}){let e={...NX,...t},n=new Uy(e,!0),r=new Uy(e,!1),s=lr.fromClass(class{constructor(l){this.from=l.viewport.from,this.markers=this.buildMarkers(l)}update(l){(l.docChanged||l.viewportChanged||l.startState.facet(go)!=l.state.facet(go)||l.startState.field(Oc,!1)!=l.state.field(Oc,!1)||zr(l.startState)!=zr(l.state)||e.foldingChanged(l))&&(this.markers=this.buildMarkers(l.view))}buildMarkers(l){let c=new fl;for(let d of l.viewportLineBlocks){let h=Dg(l.state,d.from,d.to)?r:_g(l.state,d.from,d.to)?n:null;h&&c.add(d.from,d.from,h)}return c.finish()}}),{domEventHandlers:i}=e;return[s,AG({class:"cm-foldGutter",markers(l){var c;return((c=l.plugin(s))===null||c===void 0?void 0:c.markers)||Gt.empty},initialSpacer(){return new Uy(e,!1)},domEventHandlers:{...i,click:(l,c,d)=>{if(i.click&&i.click(l,c,d))return!0;let h=Dg(l.state,c.from,c.to);if(h)return l.dispatch({effects:d0.of(h)}),!0;let m=_g(l.state,c.from,c.to);return m?(l.dispatch({effects:Tx.of(m)}),!0):!1}}}),cE()]}const TX=qe.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class h0{constructor(e,n){this.specs=e;let r;function s(c){let d=ho.newName();return(r||(r=Object.create(null)))["."+d]=c,d}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,l=n.scope;this.scope=l instanceof bi?c=>c.prop(lc)==l.data:l?c=>c==l:void 0,this.style=KA(e.map(c=>({tag:c.tag,class:c.class||s(Object.assign({},c,{tag:null}))})),{all:i}).style,this.module=r?new ho(r):null,this.themeType=n.themeType}static define(e,n){return new h0(e,n||{})}}const J2=He.define(),dE=He.define({combine(t){return t.length?[t[0]]:null}});function Vy(t){let e=t.facet(J2);return e.length?e:t.facet(dE)}function hE(t,e){let n=[AX],r;return t instanceof h0&&(t.module&&n.push(qe.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(dE.of(t)):r?n.push(J2.computeN([qe.darkTheme],s=>s.facet(qe.darkTheme)==(r=="dark")?[t]:[])):n.push(J2.of(t)),n}class MX{constructor(e){this.markCache=Object.create(null),this.tree=zr(e.state),this.decorations=this.buildDeco(e,Vy(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=zr(e.state),r=Vy(e.state),s=r!=Vy(e.startState),{viewport:i}=e.view,l=e.changes.mapPos(this.decoratedTo,1);n.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=l):(n!=this.tree||e.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return Je.none;let r=new fl;for(let{from:s,to:i}of e.visibleRanges)eX(this.tree,n,(l,c,d)=>{r.add(l,c,this.markCache[d]||(this.markCache[d]=Je.mark({class:d})))},s,i);return r.finish()}}const AX=jo.high(lr.fromClass(MX,{decorations:t=>t.decorations})),EX=h0.define([{tag:he.meta,color:"#404740"},{tag:he.link,textDecoration:"underline"},{tag:he.heading,textDecoration:"underline",fontWeight:"bold"},{tag:he.emphasis,fontStyle:"italic"},{tag:he.strong,fontWeight:"bold"},{tag:he.strikethrough,textDecoration:"line-through"},{tag:he.keyword,color:"#708"},{tag:[he.atom,he.bool,he.url,he.contentSeparator,he.labelName],color:"#219"},{tag:[he.literal,he.inserted],color:"#164"},{tag:[he.string,he.deleted],color:"#a11"},{tag:[he.regexp,he.escape,he.special(he.string)],color:"#e40"},{tag:he.definition(he.variableName),color:"#00f"},{tag:he.local(he.variableName),color:"#30a"},{tag:[he.typeName,he.namespace],color:"#085"},{tag:he.className,color:"#167"},{tag:[he.special(he.variableName),he.macroName],color:"#256"},{tag:he.definition(he.propertyName),color:"#00c"},{tag:he.comment,color:"#940"},{tag:he.invalid,color:"#f00"}]),_X=qe.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),fE=1e4,mE="()[]{}",pE=He.define({combine(t){return ka(t,{afterCursor:!0,brackets:mE,maxScanDistance:fE,renderMatch:zX})}}),DX=Je.mark({class:"cm-matchingBracket"}),RX=Je.mark({class:"cm-nonmatchingBracket"});function zX(t){let e=[],n=t.matched?DX:RX;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const PX=Lr.define({create(){return Je.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(pE);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=ha(e.state,s.head,-1,r)||s.head>0&&ha(e.state,s.head-1,1,r)||r.afterCursor&&(ha(e.state,s.head,1,r)||s.headqe.decorations.from(t)}),LX=[PX,_X];function BX(t={}){return[pE.of(t),LX]}const IX=new Et;function e4(t,e,n){let r=t.prop(e<0?Et.openedBy:Et.closedBy);if(r)return r;if(t.name.length==1){let s=n.indexOf(t.name);if(s>-1&&s%2==(e<0?1:0))return[n[s+e]]}return null}function t4(t){let e=t.type.prop(IX);return e?e(t.node):t}function ha(t,e,n,r={}){let s=r.maxScanDistance||fE,i=r.brackets||mE,l=zr(t),c=l.resolveInner(e,n);for(let d=c;d;d=d.parent){let h=e4(d.type,n,i);if(h&&d.from0?e>=m.from&&em.from&&e<=m.to))return qX(t,e,n,d,m,h,i)}}return FX(t,e,n,l,c.type,s,i)}function qX(t,e,n,r,s,i,l){let c=r.parent,d={from:s.from,to:s.to},h=0,m=c?.cursor();if(m&&(n<0?m.childBefore(r.from):m.childAfter(r.to)))do if(n<0?m.to<=r.from:m.from>=r.to){if(h==0&&i.indexOf(m.type.name)>-1&&m.from0)return null;let h={from:n<0?e-1:e,to:n>0?e+1:e},m=t.doc.iterRange(e,n>0?t.doc.length:0),p=0;for(let x=0;!m.next().done&&x<=i;){let v=m.value;n<0&&(x+=v.length);let b=e+x*n;for(let k=n>0?0:v.length-1,O=n>0?v.length:-1;k!=O;k+=n){let j=l.indexOf(v[k]);if(!(j<0||r.resolveInner(b+k,1).type!=s))if(j%2==0==n>0)p++;else{if(p==1)return{start:h,end:{from:b+k,to:b+k+1},matched:j>>1==d>>1};p--}}n>0&&(x+=v.length)}return m.done?{start:h,matched:!1}:null}function c7(t,e,n,r=0,s=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let i=s;for(let l=r;l=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosr?l.toLowerCase():l,i=this.string.substr(this.pos,e.length);return s(i)==s(e)?(n!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&n!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function QX(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||$X,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||Hw,mergeTokens:t.mergeTokens!==!1}}function $X(t){if(typeof t!="object")return t;let e={};for(let n in t){let r=t[n];e[n]=r instanceof Array?r.slice():r}return e}const u7=new WeakMap;class Qw extends bi{constructor(e){let n=ZA(e.languageData),r=QX(e),s,i=new class extends Lw{createParse(l,c,d){return new UX(s,l,c,d)}};super(n,i,[],e.name),this.topNode=GX(n,this),s=this,this.streamParser=r,this.stateAfter=new Et({perNode:!0}),this.tokenTable=e.tokenTable?new bE(r.tokenTable):WX}static define(e){return new Qw(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=u7.get(e.state),n!=null&&n1e4)return null;for(;i=r&&n+e.length<=s&&e.prop(t.stateAfter);if(i)return{state:t.streamParser.copyState(i),pos:n+e.length};for(let l=e.children.length-1;l>=0;l--){let c=e.children[l],d=n+e.positions[l],h=c instanceof _n&&d=e.length)return e;!s&&n==0&&e.type==t.topNode&&(s=!0);for(let i=e.children.length-1;i>=0;i--){let l=e.positions[i],c=e.children[i],d;if(ln&&$w(t,i.tree,0-i.offset,n,c),h;if(d&&d.pos<=r&&(h=xE(t,i.tree,n+i.offset,d.pos+i.offset,!1)))return{state:d.state,tree:h}}return{state:t.streamParser.startState(s?kc(s):4),tree:_n.empty}}let UX=class{constructor(e,n,r,s){this.lang=e,this.input=n,this.fragments=r,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let i=md.get(),l=s[0].from,{state:c,tree:d}=HX(e,r,l,this.to,i?.state);this.state=c,this.parsedPos=this.chunkStart=l+d.length;for(let h=0;hh.from<=i.viewport.from&&h.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(kc(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=md.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos=n?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let n=this.input.chunk(e);if(this.input.lineChunks)n==` +`&&(n="");else{let r=n.indexOf(` +`);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let s=this.rangeIndex;;){let i=this.ranges[s].to;if(i>=r||(n=n.slice(0,i-(r-n.length)),s++,s==this.ranges.length))break;let l=this.ranges[s].from,c=this.lineAfter(l);n+=c,r=l+c.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let s=this.ranges[this.rangeIndex].to,i=e+n;if(r>0?s>i:s>=i)break;let l=this.ranges[++this.rangeIndex].from;n+=l-s}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){s=this.skipGapsTo(n,s,1),n+=s;let c=this.chunk.length;s=this.skipGapsTo(r,s,-1),r+=s,i+=this.chunk.length-c}let l=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&l>=0&&this.chunk[l]==e&&this.chunk[l+2]==n?this.chunk[l+2]=r:this.chunk.push(e,n,r,i),s}parseLine(e){let{line:n,end:r}=this.nextLine(),s=0,{streamParser:i}=this.lang,l=new gE(n,e?e.state.tabSize:4,e?kc(e.state):2);if(l.eol())i.blankLine(this.state,l.indentUnit);else for(;!l.eol();){let c=vE(i.token,l,this.state);if(c&&(s=this.emitToken(this.lang.tokenTable.resolve(c),this.parsedPos+l.start,this.parsedPos+l.pos,s)),l.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const Hw=Object.create(null),Cf=[gs.none],VX=new jx(Cf),d7=[],h7=Object.create(null),yE=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])yE[t]=wE(Hw,e);class bE{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),yE)}resolve(e){return e?this.table[e]||(this.table[e]=wE(this.extra,e)):0}}const WX=new bE(Hw);function Wy(t,e){d7.indexOf(t)>-1||(d7.push(t),console.warn(e))}function wE(t,e){let n=[];for(let c of e.split(" ")){let d=[];for(let h of c.split(".")){let m=t[h]||he[h];m?typeof m=="function"?d.length?d=d.map(m):Wy(h,`Modifier ${h} used at start of tag`):d.length?Wy(h,`Tag ${h} used as modifier`):d=Array.isArray(m)?m:[m]:Wy(h,`Unknown highlighting tag ${h}`)}for(let h of d)n.push(h)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(c=>c.id),i=h7[s];if(i)return i.id;let l=h7[s]=gs.define({id:Cf.length,name:r,props:[Bw({[r]:n})]});return Cf.push(l),l.id}function GX(t,e){let n=gs.define({id:Cf.length,name:"Document",props:[lc.add(()=>t),Cx.add(()=>r=>e.getIndent(r))],top:!0});return Cf.push(n),n}Hn.RTL,Hn.LTR;const XX=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Vw(t.state,n.from);return r.line?YX(t):r.block?ZX(t):!1};function Uw(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=t(e,n);return s?(r(n.update(s)),!0):!1}}const YX=Uw(tY,0),KX=Uw(SE,0),ZX=Uw((t,e)=>SE(t,e,eY(e)),0);function Vw(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Ph=50;function JX(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-Ph,r),l=t.sliceDoc(s,s+Ph),c=/\s*$/.exec(i)[0].length,d=/^\s*/.exec(l)[0].length,h=i.length-c;if(i.slice(h-e.length,h)==e&&l.slice(d,d+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:s+d,margin:d&&1}};let m,p;s-r<=2*Ph?m=p=t.sliceDoc(r,s):(m=t.sliceDoc(r,r+Ph),p=t.sliceDoc(s-Ph,s));let x=/^\s*/.exec(m)[0].length,v=/\s*$/.exec(p)[0].length,b=p.length-v-n.length;return m.slice(x,x+e.length)==e&&p.slice(b,b+n.length)==n?{open:{pos:r+x+e.length,margin:/\s/.test(m.charAt(x+e.length))?1:0},close:{pos:s-v-n.length,margin:/\s/.test(p.charAt(b-1))?1:0}}:null}function eY(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),s=n.to<=r.to?r:t.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>r.from?e[i].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function SE(t,e,n=e.selection.ranges){let r=n.map(i=>Vw(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,l)=>JX(e,r[l],i.from,i.to));if(t!=2&&!s.every(i=>i))return{changes:e.changes(n.map((i,l)=>s[l]?[]:[{from:i.from,insert:r[l].open+" "},{from:i.to,insert:" "+r[l].close}]))};if(t!=1&&s.some(i=>i)){let i=[];for(let l=0,c;ls&&(i==l||l>p.from)){s=p.from;let x=/^\s*/.exec(p.text)[0].length,v=x==p.length,b=p.text.slice(x,x+h.length)==h?x:-1;xi.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:c,token:d,indent:h,empty:m,single:p}of r)(p||!m)&&i.push({from:c.from+h,insert:d+" "});let l=e.changes(i);return{changes:l,selection:e.selection.map(l,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:l,comment:c,token:d}of r)if(c>=0){let h=l.from+c,m=h+d.length;l.text[m-l.from]==" "&&m++,i.push({from:h,to:m})}return{changes:i}}return null}const n4=Sa.define(),nY=Sa.define(),rY=He.define(),kE=He.define({combine(t){return ka(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,s)=>e(r,s)||n(r,s)})}}),OE=Lr.define({create(){return fa.empty},update(t,e){let n=e.state.facet(kE),r=e.annotation(n4);if(r){let d=_s.fromTransaction(e,r.selection),h=r.side,m=h==0?t.undone:t.done;return d?m=Rg(m,m.length,n.minDepth,d):m=CE(m,e.startState.selection),new fa(h==0?r.rest:m,h==0?m:r.rest)}let s=e.annotation(nY);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(gr.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=_s.fromTransaction(e),l=e.annotation(gr.time),c=e.annotation(gr.userEvent);return i?t=t.addChanges(i,l,c,n,e):e.selection&&(t=t.addSelection(e.startState.selection,l,c,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new fa(t.done.map(_s.fromJSON),t.undone.map(_s.fromJSON))}});function sY(t={}){return[OE,kE.of(t),qe.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?jE:e.inputType=="historyRedo"?r4:null;return r?(e.preventDefault(),r(n)):!1}})]}function Mx(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(OE,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const jE=Mx(0,!1),r4=Mx(1,!1),iY=Mx(0,!0),aY=Mx(1,!0);class _s{constructor(e,n,r,s,i){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(e){return new _s(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new _s(e.changes&&kr.fromJSON(e.changes),[],e.mapped&&xa.fromJSON(e.mapped),e.startSelection&&Ce.fromJSON(e.startSelection),e.selectionsAfter.map(Ce.fromJSON))}static fromTransaction(e,n){let r=wi;for(let s of e.startState.facet(rY)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new _s(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,wi)}static selection(e){return new _s(void 0,wi,void 0,void 0,e)}}function Rg(t,e,n,r){let s=e+1>n+20?e-n-1:0,i=t.slice(s,e);return i.push(r),i}function lY(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,l,c)=>{for(let d=0;d=h&&l<=m&&(r=!0)}}),r}function oY(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function NE(t,e){return t.length?e.length?t.concat(e):t:e}const wi=[],cY=200;function CE(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-cY));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Rg(t,t.length-1,1e9,n.setSelAfter(r)))}else return[_s.selection([e])]}function uY(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Gy(t,e){if(!t.length)return t;let n=t.length,r=wi;for(;n;){let s=dY(t[n-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=t.slice(0,n);return i[n-1]=s,i}else e=s.mapped,n--,r=s.selectionsAfter}return r.length?[_s.selection(r)]:wi}function dY(t,e,n){let r=NE(t.selectionsAfter.length?t.selectionsAfter.map(c=>c.map(e)):wi,n);if(!t.changes)return _s.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),l=t.mapped?t.mapped.composeDesc(i):i;return new _s(s,xt.mapEffects(t.effects,e),l,t.startSelection.map(i),r)}const hY=/^(input\.type|delete)($|\.)/;class fa{constructor(e,n,r=0,s=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new fa(this.done,this.undone):this}addChanges(e,n,r,s,i){let l=this.done,c=l[l.length-1];return c&&c.changes&&!c.changes.empty&&e.changes&&(!r||hY.test(r))&&(!c.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):Ax(n,e))}function is(t){return t.textDirectionAt(t.state.selection.main.head)==Hn.LTR}const ME=t=>TE(t,!is(t)),AE=t=>TE(t,is(t));function EE(t,e){return Wi(t,n=>n.empty?t.moveByGroup(n,e):Ax(n,e))}const mY=t=>EE(t,!is(t)),pY=t=>EE(t,is(t));function gY(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Ex(t,e,n){let r=zr(t).resolveInner(e.head),s=n?Et.closedBy:Et.openedBy;for(let d=e.head;;){let h=n?r.childAfter(d):r.childBefore(d);if(!h)break;gY(t,h,s)?r=h:d=n?h.to:h.from}let i=r.type.prop(s),l,c;return i&&(l=n?ha(t,r.from,1):ha(t,r.to,-1))&&l.matched?c=n?l.end.to:l.end.from:c=n?r.to:r.from,Ce.cursor(c,n?-1:1)}const xY=t=>Wi(t,e=>Ex(t.state,e,!is(t))),vY=t=>Wi(t,e=>Ex(t.state,e,is(t)));function _E(t,e){return Wi(t,n=>{if(!n.empty)return Ax(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const DE=t=>_E(t,!1),RE=t=>_E(t,!0);function zE(t){let e=t.scrollDOM.clientHeightl.empty?t.moveVertically(l,e,n.height):Ax(l,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let l=t.coordsAtPos(r.selection.main.head),c=t.scrollDOM.getBoundingClientRect(),d=c.top+n.marginTop,h=c.bottom-n.marginBottom;l&&l.top>d&&l.bottomPE(t,!1),s4=t=>PE(t,!0);function No(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(s=Ce.cursor(r.from+i))}return s}const yY=t=>Wi(t,e=>No(t,e,!0)),bY=t=>Wi(t,e=>No(t,e,!1)),wY=t=>Wi(t,e=>No(t,e,!is(t))),SY=t=>Wi(t,e=>No(t,e,is(t))),kY=t=>Wi(t,e=>Ce.cursor(t.lineBlockAt(e.head).from,1)),OY=t=>Wi(t,e=>Ce.cursor(t.lineBlockAt(e.head).to,-1));function jY(t,e,n){let r=!1,s=Md(t.selection,i=>{let l=ha(t,i.head,-1)||ha(t,i.head,1)||i.head>0&&ha(t,i.head-1,1)||i.headjY(t,e);function Ei(t,e){let n=Md(t.state.selection,r=>{let s=e(r);return Ce.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(Vi(t.state,n)),!0)}function LE(t,e){return Ei(t,n=>t.moveByChar(n,e))}const BE=t=>LE(t,!is(t)),IE=t=>LE(t,is(t));function qE(t,e){return Ei(t,n=>t.moveByGroup(n,e))}const CY=t=>qE(t,!is(t)),TY=t=>qE(t,is(t)),MY=t=>Ei(t,e=>Ex(t.state,e,!is(t))),AY=t=>Ei(t,e=>Ex(t.state,e,is(t)));function FE(t,e){return Ei(t,n=>t.moveVertically(n,e))}const QE=t=>FE(t,!1),$E=t=>FE(t,!0);function HE(t,e){return Ei(t,n=>t.moveVertically(n,e,zE(t).height))}const m7=t=>HE(t,!1),p7=t=>HE(t,!0),EY=t=>Ei(t,e=>No(t,e,!0)),_Y=t=>Ei(t,e=>No(t,e,!1)),DY=t=>Ei(t,e=>No(t,e,!is(t))),RY=t=>Ei(t,e=>No(t,e,is(t))),zY=t=>Ei(t,e=>Ce.cursor(t.lineBlockAt(e.head).from)),PY=t=>Ei(t,e=>Ce.cursor(t.lineBlockAt(e.head).to)),g7=({state:t,dispatch:e})=>(e(Vi(t,{anchor:0})),!0),x7=({state:t,dispatch:e})=>(e(Vi(t,{anchor:t.doc.length})),!0),v7=({state:t,dispatch:e})=>(e(Vi(t,{anchor:t.selection.main.anchor,head:0})),!0),y7=({state:t,dispatch:e})=>(e(Vi(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),LY=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),BY=({state:t,dispatch:e})=>{let n=_x(t).map(({from:r,to:s})=>Ce.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Ce.create(n),userEvent:"select"})),!0},IY=({state:t,dispatch:e})=>{let n=Md(t.selection,r=>{let s=zr(t),i=s.resolveStack(r.from,1);if(r.empty){let l=s.resolveStack(r.from,-1);l.node.from>=i.node.from&&l.node.to<=i.node.to&&(i=l)}for(let l=i;l;l=l.next){let{node:c}=l;if((c.from=r.to||c.to>r.to&&c.from<=r.from)&&l.next)return Ce.range(c.to,c.from)}return r});return n.eq(t.selection)?!1:(e(Vi(t,n)),!0)};function UE(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let l=n.doc.lineAt(i.head);if(e?l.to0)for(let c=i;;){let d=t.moveVertically(c,e);if(d.headl.to){s.some(h=>h.head==d.head)||s.push(d);break}else{if(d.head==c.head)break;c=d}}}return s.length==r.ranges.length?!1:(t.dispatch(Vi(n,Ce.create(s,s.length-1))),!0)}const qY=t=>UE(t,!1),FY=t=>UE(t,!0),QY=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Ce.create([n.main]):n.main.empty||(r=Ce.create([Ce.cursor(n.main.head)])),r?(e(Vi(t,r)),!0):!1};function f0(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:l,to:c}=i;if(l==c){let d=e(i);dl&&(n="delete.forward",d=xp(t,d,!0)),l=Math.min(l,d),c=Math.max(c,d)}else l=xp(t,l,!1),c=xp(t,c,!0);return l==c?{range:i}:{changes:{from:l,to:c},range:Ce.cursor(l,ls(t)))r.between(e,e,(s,i)=>{se&&(e=n?i:s)});return e}const VE=(t,e,n)=>f0(t,r=>{let s=r.from,{state:i}=t,l=i.doc.lineAt(s),c,d;if(n&&!e&&s>l.from&&sVE(t,!1,!0),WE=t=>VE(t,!0,!1),GE=(t,e)=>f0(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),l=s.charCategorizer(r);for(let c=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let d=Vr(i.text,r-i.from,e)+i.from,h=i.text.slice(Math.min(r,d)-i.from,Math.max(r,d)-i.from),m=l(h);if(c!=null&&m!=c)break;(h!=" "||r!=n.head)&&(c=m),r=d}return r}),XE=t=>GE(t,!1),$Y=t=>GE(t,!0),HY=t=>f0(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headf0(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),VY=t=>f0(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Wt.of(["",""])},range:Ce.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},GY=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,i=t.doc.lineAt(s),l=s==i.from?s-1:Vr(i.text,s-i.from,!1)+i.from,c=s==i.to?s+1:Vr(i.text,s-i.from,!0)+i.from;return{changes:{from:l,to:c,insert:t.doc.slice(s,c).append(t.doc.slice(l,s))},range:Ce.cursor(c)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function _x(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=s.number){let l=e[e.length-1];l.to=i.to,l.ranges.push(r)}else e.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return e}function YE(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of _x(t)){if(n?i.to==t.doc.length:i.from==0)continue;let l=t.doc.lineAt(n?i.to+1:i.from-1),c=l.length+1;if(n){r.push({from:i.to,to:l.to},{from:i.from,insert:l.text+t.lineBreak});for(let d of i.ranges)s.push(Ce.range(Math.min(t.doc.length,d.anchor+c),Math.min(t.doc.length,d.head+c)))}else{r.push({from:l.from,to:i.from},{from:i.to,insert:t.lineBreak+l.text});for(let d of i.ranges)s.push(Ce.range(d.anchor-c,d.head-c))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Ce.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const XY=({state:t,dispatch:e})=>YE(t,e,!1),YY=({state:t,dispatch:e})=>YE(t,e,!0);function KE(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of _x(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const KY=({state:t,dispatch:e})=>KE(t,e,!1),ZY=({state:t,dispatch:e})=>KE(t,e,!0),JY=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(_x(e).map(({from:s,to:i})=>(s>0?s--:i{let i;if(t.lineWrapping){let l=t.lineBlockAt(s.head),c=t.coordsAtPos(s.head,s.assoc||1);c&&(i=l.bottom+t.documentTop-c.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function eK(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=zr(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e),i;return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(Et.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const b7=ZE(!1),tK=ZE(!0);function ZE(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:l}=s,c=e.doc.lineAt(i),d=!t&&i==l&&eK(e,i);t&&(i=l=(l<=c.to?c:e.doc.lineAt(l)).to);let h=new Nx(e,{simulateBreak:i,simulateDoubleBreak:!!d}),m=Iw(h,i);for(m==null&&(m=Td(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));lc.from&&i{let s=[];for(let l=r.from;l<=r.to;){let c=t.doc.lineAt(l);c.number>n&&(r.empty||r.to>c.from)&&(e(c,s,r),n=c.number),l=c.to+1}let i=t.changes(s);return{changes:s,range:Ce.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const nK=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Nx(t,{overrideIndentation:i=>{let l=n[i];return l??-1}}),s=Ww(t,(i,l,c)=>{let d=Iw(r,i.from);if(d==null)return;/\S/.test(i.text)||(d=0);let h=/^\s*/.exec(i.text)[0],m=Nf(t,d);(h!=m||c.fromt.readOnly?!1:(e(t.update(Ww(t,(n,r)=>{r.push({from:n.from,insert:t.facet(u0)})}),{userEvent:"input.indent"})),!0),e_=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Ww(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Td(s,t.tabSize),l=0,c=Nf(t,Math.max(0,i-kc(t)));for(;l(t.setTabFocusMode(),!0),sK=[{key:"Ctrl-b",run:ME,shift:BE,preventDefault:!0},{key:"Ctrl-f",run:AE,shift:IE},{key:"Ctrl-p",run:DE,shift:QE},{key:"Ctrl-n",run:RE,shift:$E},{key:"Ctrl-a",run:kY,shift:zY},{key:"Ctrl-e",run:OY,shift:PY},{key:"Ctrl-d",run:WE},{key:"Ctrl-h",run:i4},{key:"Ctrl-k",run:HY},{key:"Ctrl-Alt-h",run:XE},{key:"Ctrl-o",run:WY},{key:"Ctrl-t",run:GY},{key:"Ctrl-v",run:s4}],iK=[{key:"ArrowLeft",run:ME,shift:BE,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:mY,shift:CY,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:wY,shift:DY,preventDefault:!0},{key:"ArrowRight",run:AE,shift:IE,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:pY,shift:TY,preventDefault:!0},{mac:"Cmd-ArrowRight",run:SY,shift:RY,preventDefault:!0},{key:"ArrowUp",run:DE,shift:QE,preventDefault:!0},{mac:"Cmd-ArrowUp",run:g7,shift:v7},{mac:"Ctrl-ArrowUp",run:f7,shift:m7},{key:"ArrowDown",run:RE,shift:$E,preventDefault:!0},{mac:"Cmd-ArrowDown",run:x7,shift:y7},{mac:"Ctrl-ArrowDown",run:s4,shift:p7},{key:"PageUp",run:f7,shift:m7},{key:"PageDown",run:s4,shift:p7},{key:"Home",run:bY,shift:_Y,preventDefault:!0},{key:"Mod-Home",run:g7,shift:v7},{key:"End",run:yY,shift:EY,preventDefault:!0},{key:"Mod-End",run:x7,shift:y7},{key:"Enter",run:b7,shift:b7},{key:"Mod-a",run:LY},{key:"Backspace",run:i4,shift:i4,preventDefault:!0},{key:"Delete",run:WE,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:XE,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:$Y,preventDefault:!0},{mac:"Mod-Backspace",run:UY,preventDefault:!0},{mac:"Mod-Delete",run:VY,preventDefault:!0}].concat(sK.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),aK=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:xY,shift:MY},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:vY,shift:AY},{key:"Alt-ArrowUp",run:XY},{key:"Shift-Alt-ArrowUp",run:KY},{key:"Alt-ArrowDown",run:YY},{key:"Shift-Alt-ArrowDown",run:ZY},{key:"Mod-Alt-ArrowUp",run:qY},{key:"Mod-Alt-ArrowDown",run:FY},{key:"Escape",run:QY},{key:"Mod-Enter",run:tK},{key:"Alt-l",mac:"Ctrl-l",run:BY},{key:"Mod-i",run:IY,preventDefault:!0},{key:"Mod-[",run:e_},{key:"Mod-]",run:JE},{key:"Mod-Alt-\\",run:nK},{key:"Shift-Mod-k",run:JY},{key:"Shift-Mod-\\",run:NY},{key:"Mod-/",run:XX},{key:"Alt-A",run:KX},{key:"Ctrl-m",mac:"Shift-Alt-m",run:rK}].concat(iK),lK={key:"Tab",run:JE,shift:e_},w7=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class gd{constructor(e,n,r=0,s=e.length,i,l){this.test=l,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=i?c=>i(w7(c)):w7,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ms(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=yw(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=aa(e);let s=this.normalize(n);if(s.length)for(let i=0,l=r;;i++){let c=s.charCodeAt(i),d=this.match(c,l,this.bufferPos+this.bufferStart);if(i==s.length-1){if(d)return this.value=d,this;break}l==r&&ithis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=zg(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||s.to<=n){let c=new Yu(n,e.sliceString(n,r));return Xy.set(e,c),c}if(s.from==n&&s.to==r)return s;let{text:i,from:l}=s;return l>n&&(i=e.sliceString(n,l)+i,l=n),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=zg(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Yu.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(n_.prototype[Symbol.iterator]=r_.prototype[Symbol.iterator]=function(){return this});function oK(t){try{return new RegExp(t,Gw),!0}catch{return!1}}function zg(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function a4(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=An("input",{class:"cm-textfield",name:"line",value:e}),r=An("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),t.dispatch({effects:sf.of(!1)}),t.focus()):i.keyCode==13&&(i.preventDefault(),s())},onsubmit:i=>{i.preventDefault(),s()}},An("label",t.state.phrase("Go to line"),": ",n)," ",An("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),An("button",{name:"close",onclick:()=>{t.dispatch({effects:sf.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function s(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!i)return;let{state:l}=t,c=l.doc.lineAt(l.selection.main.head),[,d,h,m,p]=i,x=m?+m.slice(1):0,v=h?+h:c.number;if(h&&p){let O=v/100;d&&(O=O*(d=="-"?-1:1)+c.number/l.doc.lines),v=Math.round(l.doc.lines*O)}else h&&d&&(v=v*(d=="-"?-1:1)+c.number);let b=l.doc.line(Math.max(1,Math.min(l.doc.lines,v))),k=Ce.cursor(b.from+Math.max(0,Math.min(x,b.length)));t.dispatch({effects:[sf.of(!1),qe.scrollIntoView(k.from,{y:"center"})],selection:k}),t.focus()}return{dom:r}}const sf=xt.define(),S7=Lr.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(sf)&&(t=n.value);return t},provide:t=>Sf.from(t,e=>e?a4:null)}),cK=t=>{let e=wf(t,a4);if(!e){let n=[sf.of(!0)];t.state.field(S7,!1)==null&&n.push(xt.appendConfig.of([S7,uK])),t.dispatch({effects:n}),e=wf(t,a4)}return e&&e.dom.querySelector("input").select(),!0},uK=qe.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),dK={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},hK=He.define({combine(t){return ka(t,dK,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function fK(t){return[vK,xK]}const mK=Je.mark({class:"cm-selectionMatch"}),pK=Je.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function k7(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Vn.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Vn.Word)}function gK(t,e,n,r){return t(e.sliceDoc(n,n+1))==Vn.Word&&t(e.sliceDoc(r-1,r))==Vn.Word}const xK=lr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(hK),{state:n}=t,r=n.selection;if(r.ranges.length>1)return Je.none;let s=r.main,i,l=null;if(s.empty){if(!e.highlightWordAroundCursor)return Je.none;let d=n.wordAt(s.head);if(!d)return Je.none;l=n.charCategorizer(s.head),i=n.sliceDoc(d.from,d.to)}else{let d=s.to-s.from;if(d200)return Je.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),l=n.charCategorizer(s.head),!(k7(l,n,s.from,s.to)&&gK(l,n,s.from,s.to)))return Je.none}else if(i=n.sliceDoc(s.from,s.to),!i)return Je.none}let c=[];for(let d of t.visibleRanges){let h=new gd(n.doc,i,d.from,d.to);for(;!h.next().done;){let{from:m,to:p}=h.value;if((!l||k7(l,n,m,p))&&(s.empty&&m<=s.from&&p>=s.to?c.push(pK.range(m,p)):(m>=s.to||p<=s.from)&&c.push(mK.range(m,p)),c.length>e.maxMatches))return Je.none}}return Je.set(c)}},{decorations:t=>t.decorations}),vK=qe.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),yK=({state:t,dispatch:e})=>{let{selection:n}=t,r=Ce.create(n.ranges.map(s=>t.wordAt(s.head)||Ce.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function bK(t,e){let{main:n,ranges:r}=t.selection,s=t.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let l=!1,c=new gd(t.doc,e,r[r.length-1].to);;)if(c.next(),c.done){if(l)return null;c=new gd(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),l=!0}else{if(l&&r.some(d=>d.from==c.value.from))continue;if(i){let d=t.wordAt(c.value.from);if(!d||d.from!=c.value.from||d.to!=c.value.to)continue}return c.value}}const wK=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return yK({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=r))return!1;let s=bK(t,r);return s?(e(t.update({selection:t.selection.addRange(Ce.range(s.from,s.to),!1),effects:qe.scrollIntoView(s.to)})),!0):!1},Ad=He.define({combine(t){return ka(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new DK(e),scrollToMatch:e=>qe.scrollIntoView(e)})}});class s_{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||oK(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?` +`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new jK(this):new kK(this)}getCursor(e,n=0,r){let s=e.doc?e:Vt.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?zu(this,s,n,r):Ru(this,s,n,r)}}class i_{constructor(e){this.spec=e}}function Ru(t,e,n,r){return new gd(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?SK(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function SK(t,e){return(n,r,s,i)=>((i>n||i+s.length=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=Ru(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}function zu(t,e,n,r){return new n_(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?OK(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function Pg(t,e){return t.slice(Vr(t,e,!1),e)}function Lg(t,e){return t.slice(e,Vr(t,e))}function OK(t){return(e,n,r)=>!r[0].length||(t(Pg(r.input,r.index))!=Vn.Word||t(Lg(r.input,r.index))!=Vn.Word)&&(t(Lg(r.input,r.index+r[0].length))!=Vn.Word||t(Pg(r.input,r.index+r[0].length))!=Vn.Word)}class jK extends i_{nextMatch(e,n,r){let s=zu(this.spec,e,r,e.doc.length).next();return s.done&&(s=zu(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),l=zu(this.spec,e,i,r),c=null;for(;!l.next().done;)c=l.value;if(c&&(i==n||c.from>i+10))return c;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=zu(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}const Tf=xt.define(),Xw=xt.define(),ao=Lr.define({create(t){return new Yy(l4(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Tf)?t=new Yy(n.value.create(),t.panel):n.is(Xw)&&(t=new Yy(t.query,n.value?Yw:null));return t},provide:t=>Sf.from(t,e=>e.panel)});class Yy{constructor(e,n){this.query=e,this.panel=n}}const NK=Je.mark({class:"cm-searchMatch"}),CK=Je.mark({class:"cm-searchMatch cm-searchMatch-selected"}),TK=lr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(ao))}update(t){let e=t.state.field(ao);(e!=t.startState.field(ao)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return Je.none;let{view:n}=this,r=new fl;for(let s=0,i=n.visibleRanges,l=i.length;si[s+1].from-500;)d=i[++s].to;t.highlight(n.state,c,d,(h,m)=>{let p=n.state.selection.ranges.some(x=>x.from==h&&x.to==m);r.add(h,m,p?CK:NK)})}return r.finish()}},{decorations:t=>t.decorations});function m0(t){return e=>{let n=e.state.field(ao,!1);return n&&n.query.spec.valid?t(e,n):o_(e)}}const Bg=m0((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=Ce.single(r.from,r.to),i=t.state.facet(Ad);return t.dispatch({selection:s,effects:[Kw(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),l_(t),!0}),Ig=m0((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=Ce.single(s.from,s.to),l=t.state.facet(Ad);return t.dispatch({selection:i,effects:[Kw(t,s),l.scrollToMatch(i.main,t)],userEvent:"select.search"}),l_(t),!0}),MK=m0((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Ce.create(n.map(r=>Ce.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),AK=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],l=0;for(let c=new gd(t.doc,t.sliceDoc(r,s));!c.next().done;){if(i.length>1e3)return!1;c.value.from==r&&(l=i.length),i.push(Ce.range(c.value.from,c.value.to))}return e(t.update({selection:Ce.create(i,l),userEvent:"select.search.matches"})),!0},O7=m0((t,{query:e})=>{let{state:n}=t,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,r,r);if(!i)return!1;let l=i,c=[],d,h,m=[];l.from==r&&l.to==s&&(h=n.toText(e.getReplacement(l)),c.push({from:l.from,to:l.to,insert:h}),l=e.nextMatch(n,l.from,l.to),m.push(qe.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let p=t.state.changes(c);return l&&(d=Ce.single(l.from,l.to).map(p),m.push(Kw(t,l)),m.push(n.facet(Ad).scrollToMatch(d.main,t))),t.dispatch({changes:p,selection:d,effects:m,userEvent:"input.replace"}),!0}),EK=m0((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(s=>{let{from:i,to:l}=s;return{from:i,to:l,insert:e.getReplacement(s)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:qe.announce.of(r),userEvent:"input.replace.all"}),!0});function Yw(t){return t.state.facet(Ad).createPanel(t)}function l4(t,e){var n,r,s,i,l;let c=t.selection.main,d=c.empty||c.to>c.from+100?"":t.sliceDoc(c.from,c.to);if(e&&!d)return e;let h=t.facet(Ad);return new s_({search:((n=e?.literal)!==null&&n!==void 0?n:h.literal)?d:d.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:h.regexp,wholeWord:(l=e?.wholeWord)!==null&&l!==void 0?l:h.wholeWord})}function a_(t){let e=wf(t,Yw);return e&&e.dom.querySelector("[main-field]")}function l_(t){let e=a_(t);e&&e==t.root.activeElement&&e.select()}const o_=t=>{let e=t.state.field(ao,!1);if(e&&e.panel){let n=a_(t);if(n&&n!=t.root.activeElement){let r=l4(t.state,e.query.spec);r.valid&&t.dispatch({effects:Tf.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[Xw.of(!0),e?Tf.of(l4(t.state,e.query.spec)):xt.appendConfig.of(zK)]});return!0},c_=t=>{let e=t.state.field(ao,!1);if(!e||!e.panel)return!1;let n=wf(t,Yw);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Xw.of(!1)}),!0},_K=[{key:"Mod-f",run:o_,scope:"editor search-panel"},{key:"F3",run:Bg,shift:Ig,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Bg,shift:Ig,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:c_,scope:"editor search-panel"},{key:"Mod-Shift-l",run:AK},{key:"Mod-Alt-g",run:cK},{key:"Mod-d",run:wK,preventDefault:!0}];class DK{constructor(e){this.view=e;let n=this.query=e.state.field(ao).query.spec;this.commit=this.commit.bind(this),this.searchField=An("input",{value:n.search,placeholder:Xs(e,"Find"),"aria-label":Xs(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=An("input",{value:n.replace,placeholder:Xs(e,"Replace"),"aria-label":Xs(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=An("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=An("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=An("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,l){return An("button",{class:"cm-button",name:s,onclick:i,type:"button"},l)}this.dom=An("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>Bg(e),[Xs(e,"next")]),r("prev",()=>Ig(e),[Xs(e,"previous")]),r("select",()=>MK(e),[Xs(e,"all")]),An("label",null,[this.caseField,Xs(e,"match case")]),An("label",null,[this.reField,Xs(e,"regexp")]),An("label",null,[this.wordField,Xs(e,"by word")]),...e.state.readOnly?[]:[An("br"),this.replaceField,r("replace",()=>O7(e),[Xs(e,"replace")]),r("replaceAll",()=>EK(e),[Xs(e,"replace all")])],An("button",{name:"close",onclick:()=>c_(e),"aria-label":Xs(e,"close"),type:"button"},["×"])])}commit(){let e=new s_({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Tf.of(e)}))}keydown(e){BW(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ig:Bg)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),O7(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Tf)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Ad).top}}function Xs(t,e){return t.state.phrase(e)}const vp=30,yp=/[\s\.,:;?!]/;function Kw(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),s=t.state.doc.lineAt(n).to,i=Math.max(r.from,e-vp),l=Math.min(s,n+vp),c=t.state.sliceDoc(i,l);if(i!=r.from){for(let d=0;dc.length-vp;d--)if(!yp.test(c[d-1])&&yp.test(c[d])){c=c.slice(0,d);break}}return qe.announce.of(`${t.state.phrase("current match")}. ${c} ${t.state.phrase("on line")} ${r.number}.`)}const RK=qe.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),zK=[ao,jo.low(TK),RK];class u_{constructor(e,n,r,s){this.state=e,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=zr(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(h_(e,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function j7(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function PK(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;itypeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:PK(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function LK(t,e){return n=>{for(let r=zr(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}let N7=class{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}};function gc(t){return t.selection.main.from}function h_(t,e){var n;let{source:r}=t,s=e&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const Zw=Sa.define();function BK(t,e,n,r){let{main:s}=t.selection,i=n-s.from,l=r-s.from;return{...t.changeByRange(c=>{if(c!=s&&n!=r&&t.sliceDoc(c.from+i,c.from+l)!=t.sliceDoc(n,r))return{range:c};let d=t.toText(e);return{changes:{from:c.from+i,to:r==s.from?c.to:c.from+l,insert:d},range:Ce.cursor(c.from+i+d.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const C7=new WeakMap;function IK(t){if(!Array.isArray(t))return t;let e=C7.get(t);return e||C7.set(t,e=d_(t)),e}const qg=xt.define(),Mf=xt.define();class qK{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&D<=57||D>=97&&D<=122?2:D>=65&&D<=90?1:0:(E=yw(D))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!T||z==1&&O||_==0&&z!=0)&&(n[p]==D||r[p]==D&&(x=!0)?l[p++]=T:l.length&&(j=!1)),_=z,T+=aa(D)}return p==d&&l[0]==0&&j?this.result(-100+(x?-200:0),l,e):v==d&&b==0?this.ret(-200-e.length+(k==e.length?0:-100),[0,k]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):v==d?this.ret(-900-e.length,[b,k]):p==d?this.result(-100+(x?-200:0)+-700+(j?0:-1100),l,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let l of n){let c=l+(this.astral?aa(Ms(r,l)):1);i&&s[i-1]==l?s[i-1]=c:(s[i++]=l,s[i++]=c)}return this.ret(e-r.length,s)}}class FK{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:QK,filterStrict:!1,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>T7(e(r),n(r)),optionClass:(e,n)=>r=>T7(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function T7(t,e){return t?e?t+" "+e:t:e}function QK(t,e,n,r,s,i){let l=t.textDirection==Hn.RTL,c=l,d=!1,h="top",m,p,x=e.left-s.left,v=s.right-e.right,b=r.right-r.left,k=r.bottom-r.top;if(c&&x=k||T>e.top?m=n.bottom-e.top:(h="bottom",m=e.bottom-n.top)}let O=(e.bottom-e.top)/i.offsetHeight,j=(e.right-e.left)/i.offsetWidth;return{style:`${h}: ${m/O}px; max-width: ${p/j}px`,class:"cm-completionInfo-"+(d?l?"left-narrow":"right-narrow":c?"left":"right")}}function $K(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let l=document.createElement("span");l.className="cm-completionLabel";let c=n.displayLabel||n.label,d=0;for(let h=0;hd&&l.appendChild(document.createTextNode(c.slice(d,m)));let x=l.appendChild(document.createElement("span"));x.appendChild(document.createTextNode(c.slice(m,p))),x.className="cm-completionMatchedText",d=p}return dn.position-r.position).map(n=>n.render)}function Ky(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/n);return{from:s*n,to:(s+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class HK{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:d=>this.placeInfo(d),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:l}=s.open,c=e.state.facet(Dr);this.optionContent=$K(c),this.optionClass=c.optionClass,this.tooltipClass=c.tooltipClass,this.range=Ky(i.length,l,c.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",d=>{let{options:h}=e.state.field(n).open;for(let m=d.target,p;m&&m!=this.dom;m=m.parentNode)if(m.nodeName=="LI"&&(p=/-(\d+)$/.exec(m.id))&&+p[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(Dr).closeOnBlur&&d.relatedTarget!=e.contentDOM&&e.dispatch({effects:Mf.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:l,disabled:c}=r.open;(!s.open||s.open.options!=i)&&(this.range=Ky(i.length,l,e.state.facet(Dr).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),c!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!c)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=Ky(n.options.length,n.selected,this.view.state.facet(Dr).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let l=typeof i=="string"?document.createTextNode(i):i(s);if(!l)return;"then"in l?l.then(c=>{c&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(c,s)}).catch(c=>Es(this.view.state,c,"completion info")):(this.addInfoPane(l,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&VK(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let l=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:l.clientWidth,bottom:l.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom{l.target==s&&l.preventDefault()});let i=null;for(let l=r.from;lr.from||r.from==0))if(i=x,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let v=s.appendChild(document.createElement("completion-section"));v.textContent=x}}const m=s.appendChild(document.createElement("li"));m.id=n+"-"+l,m.setAttribute("role","option");let p=this.optionClass(c);p&&(m.className=p);for(let x of this.optionContent){let v=x(c,this.view.state,this.view,d);v&&m.appendChild(v)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.tonew HK(n,t,e)}function VK(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.topn.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function M7(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function WK(t,e){let n=[],r=null,s=null,i=m=>{n.push(m);let{section:p}=m.completion;if(p){r||(r=[]);let x=typeof p=="string"?p:p.name;r.some(v=>v.name==x)||r.push(typeof p=="string"?{name:x}:p)}},l=e.facet(Dr);for(let m of t)if(m.hasResult()){let p=m.result.getMatch;if(m.result.filter===!1)for(let x of m.result.options)i(new N7(x,m.source,p?p(x):[],1e9-n.length));else{let x=e.sliceDoc(m.from,m.to),v,b=l.filterStrict?new FK(x):new qK(x);for(let k of m.result.options)if(v=b.match(k.label)){let O=k.displayLabel?p?p(k,v.matched):[]:v.matched,j=v.score+(k.boost||0);if(i(new N7(k,m.source,O,j)),typeof k.section=="object"&&k.section.rank==="dynamic"){let{name:T}=k.section;s||(s=Object.create(null)),s[T]=Math.max(j,s[T]||-1e9)}}}}if(r){let m=Object.create(null),p=0,x=(v,b)=>(v.rank==="dynamic"&&b.rank==="dynamic"?s[b.name]-s[v.name]:0)||(typeof v.rank=="number"?v.rank:1e9)-(typeof b.rank=="number"?b.rank:1e9)||(v.namex.score-p.score||h(p.completion,x.completion))){let p=m.completion;!d||d.label!=p.label||d.detail!=p.detail||d.type!=null&&p.type!=null&&d.type!=p.type||d.apply!=p.apply||d.boost!=p.boost?c.push(m):M7(m.completion)>M7(d)&&(c[c.length-1]=m),d=m.completion}return c}class $u{constructor(e,n,r,s,i,l){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=l}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new $u(this.options,A7(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,l){if(s&&!l&&e.some(h=>h.isPending))return s.setDisabled();let c=WK(e,n);if(!c.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let d=n.facet(Dr).selectOnOpen?0:-1;if(s&&s.selected!=d&&s.selected!=-1){let h=s.options[s.selected].completion;for(let m=0;mm.hasResult()?Math.min(h,m.from):h,1e8),create:JK,above:i.aboveCursor},s?s.timestamp:Date.now(),d,!1)}map(e){return new $u(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new $u(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Fg{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new Fg(KK,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Dr),i=(r.override||n.languageDataAt("autocomplete",gc(n)).map(IK)).map(d=>(this.active.find(m=>m.source==d)||new Si(d,this.active.some(m=>m.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((d,h)=>d==this.active[h])&&(i=this.active);let l=this.open,c=e.effects.some(d=>d.is(Jw));l&&e.docChanged&&(l=l.map(e.changes)),e.selection||i.some(d=>d.hasResult()&&e.changes.touchesRange(d.from,d.to))||!GK(i,this.active)||c?l=$u.build(i,n,this.id,l,r,c):l&&l.disabled&&!i.some(d=>d.isPending)&&(l=null),!l&&i.every(d=>!d.isPending)&&i.some(d=>d.hasResult())&&(i=i.map(d=>d.hasResult()?new Si(d.source,0):d));for(let d of e.effects)d.is(m_)&&(l=l&&l.setSelected(d.value,this.id));return i==this.active&&l==this.open?this:new Fg(i,this.id,l)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?XK:YK}}function GK(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}const KK=[];function f_(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(Zw);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Si{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=f_(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new Si(s.source,0)),r&4&&s.state==0&&(s=new Si(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(qg))s=new Si(s.source,1,i.value);else if(i.is(Mf))s=new Si(s.source,0);else if(i.is(Jw))for(let l of i.value)l.source==s.source&&(s=l);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(gc(e.state))}}class Ku extends Si{constructor(e,n,r,s,i,l){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=l}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),l=e.changes.mapPos(this.to,1),c=gc(e.state);if(c>l||!s||n&2&&(gc(e.startState)==this.from||cn.map(e))}}),m_=xt.define(),As=Lr.define({create(){return Fg.start()},update(t,e){return t.update(e)},provide:t=>[Dw.from(t,e=>e.tooltip),qe.contentAttributes.from(t,e=>e.attrs)]});function e5(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(As).active.find(s=>s.source==e.source);return r instanceof Ku?(typeof n=="string"?t.dispatch({...BK(t.state,n,r.from,r.to),annotations:Zw.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const JK=UK(As,e5);function bp(t,e="option"){return n=>{let r=n.state.field(As,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+s*(t?1:-1):t?0:l-1;return c<0?c=e=="page"?0:l-1:c>=l&&(c=e=="page"?l-1:0),n.dispatch({effects:m_.of(c)}),!0}}const eZ=t=>{let e=t.state.field(As,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(As,!1)?(t.dispatch({effects:qg.of(!0)}),!0):!1,tZ=t=>{let e=t.state.field(As,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Mf.of(null)}),!0)};class nZ{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const rZ=50,sZ=1e3,iZ=lr.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(As).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(As),n=t.state.facet(Dr);if(!t.selectionSet&&!t.docChanged&&t.startState.field(As)==e)return;let r=t.transactions.some(i=>{let l=f_(i,n);return l&8||(i.selection||i.docChanged)&&!(l&3)});for(let i=0;irZ&&Date.now()-l.time>sZ){for(let c of l.context.abortListeners)try{c()}catch(d){Es(this.view.state,d)}l.context.abortListeners=null,this.running.splice(i--,1)}else l.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(l=>l.is(qg)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(l=>l.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(As);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Dr).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=gc(e),r=new u_(e,n,t.explicit,this.view),s=new nZ(t,r);this.running.push(s),Promise.resolve(t.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:Mf.of(null)}),Es(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Dr).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Dr),r=this.view.state.field(As);for(let s=0;sc.source==i.active.source);if(l&&l.isPending)if(i.done==null){let c=new Si(i.active.source,0);for(let d of i.updates)c=c.update(d,n);c.isPending||e.push(c)}else this.startQuery(l)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:Jw.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(As,!1);if(e&&e.tooltip&&this.view.state.facet(Dr).closeOnBlur){let n=e.open&&QA(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Mf.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:qg.of(!1)}),20),this.composing=0}}}),aZ=typeof navigator=="object"&&/Win/.test(navigator.platform),lZ=jo.highest(qe.domEventHandlers({keydown(t,e){let n=e.state.field(As,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(aZ&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(l=>l.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&e5(e,r),!1}})),p_=qe.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class oZ{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class t5{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Ur.TrackDel),r=e.mapPos(this.to,1,Ur.TrackDel);return n==null||r==null?null:new t5(this.field,n,r)}}class n5{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),l=/^\s*/.exec(i.text)[0];for(let d of this.lines){if(r.length){let h=l,m=/^\t*/.exec(d)[0].length;for(let p=0;pnew t5(d.field,s[d.line]+d.from,s[d.line]+d.to));return{text:r,ranges:c}}static parse(e){let n=[],r=[],s=[],i;for(let l of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(l);){let c=i[1]?+i[1]:null,d=i[2]||i[3]||"",h=-1,m=d.replace(/\\[{}]/g,p=>p[1]);for(let p=0;p=h&&x.field++}for(let p of s)if(p.line==r.length&&p.from>i.index){let x=i[2]?3+(i[1]||"").length:2;p.from-=x,p.to-=x}s.push(new oZ(h,r.length,i.index,i.index+m.length)),l=l.slice(0,i.index)+d+l.slice(i.index+i[0].length)}l=l.replace(/\\([{}])/g,(c,d,h)=>{for(let m of s)m.line==r.length&&m.from>h&&(m.from--,m.to--);return d}),r.push(l)}return new n5(r,s)}}let cZ=Je.widget({widget:new class extends Oa{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),uZ=Je.mark({class:"cm-snippetField"});class Ed{constructor(e,n){this.ranges=e,this.active=n,this.deco=Je.set(e.map(r=>(r.from==r.to?cZ:uZ).range(r.from,r.to)),!0)}map(e){let n=[];for(let r of this.ranges){let s=r.map(e);if(!s)return null;n.push(s)}return new Ed(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const p0=xt.define({map(t,e){return t&&t.map(e)}}),dZ=xt.define(),Af=Lr.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(p0))return n.value;if(n.is(dZ)&&t)return new Ed(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>qe.decorations.from(t,e=>e?e.deco:Je.none)});function r5(t,e){return Ce.create(t.filter(n=>n.field==e).map(n=>Ce.range(n.from,n.to)))}function hZ(t){let e=n5.parse(t);return(n,r,s,i)=>{let{text:l,ranges:c}=e.instantiate(n.state,s),{main:d}=n.state.selection,h={changes:{from:s,to:i==d.from?d.to:i,insert:Wt.of(l)},scrollIntoView:!0,annotations:r?[Zw.of(r),gr.userEvent.of("input.complete")]:void 0};if(c.length&&(h.selection=r5(c,0)),c.some(m=>m.field>0)){let m=new Ed(c,0),p=h.effects=[p0.of(m)];n.state.field(Af,!1)===void 0&&p.push(xt.appendConfig.of([Af,xZ,vZ,p_]))}n.dispatch(n.state.update(h))}}function g_(t){return({state:e,dispatch:n})=>{let r=e.field(Af,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(l=>l.field==s+t);return n(e.update({selection:r5(r.ranges,s),effects:p0.of(i?null:new Ed(r.ranges,s)),scrollIntoView:!0})),!0}}const fZ=({state:t,dispatch:e})=>t.field(Af,!1)?(e(t.update({effects:p0.of(null)})),!0):!1,mZ=g_(1),pZ=g_(-1),gZ=[{key:"Tab",run:mZ,shift:pZ},{key:"Escape",run:fZ}],E7=He.define({combine(t){return t.length?t[0]:gZ}}),xZ=jo.highest(o0.compute([E7],t=>t.facet(E7)));function Xa(t,e){return{...e,apply:hZ(t)}}const vZ=qe.domEventHandlers({mousedown(t,e){let n=e.state.field(Af,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let s=n.ranges.find(i=>i.from<=r&&i.to>=r);return!s||s.field==n.active?!1:(e.dispatch({selection:r5(n.ranges,s.field),effects:p0.of(n.ranges.some(i=>i.field>s.field)?new Ed(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),Ef={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},oc=xt.define({map(t,e){let n=e.mapPos(t,-1,Ur.TrackAfter);return n??void 0}}),s5=new class extends yc{};s5.startSide=1;s5.endSide=-1;const x_=Lr.define({create(){return Gt.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(oc)&&(t=t.update({add:[s5.range(n.value,n.value+1)]}));return t}});function yZ(){return[wZ,x_]}const Jy="()[]{}<>«»»«[]{}";function v_(t){for(let e=0;e{if((bZ?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&aa(Ms(r,0))==1||e!=s.from||n!=s.to)return!1;let i=OZ(t.state,r);return i?(t.dispatch(i),!0):!1}),SZ=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=y_(t,t.selection.main.head).brackets||Ef.brackets,s=null,i=t.changeByRange(l=>{if(l.empty){let c=jZ(t.doc,l.head);for(let d of r)if(d==c&&Dx(t.doc,l.head)==v_(Ms(d,0)))return{changes:{from:l.head-d.length,to:l.head+d.length},range:Ce.cursor(l.head-d.length)}}return{range:s=l}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},kZ=[{key:"Backspace",run:SZ}];function OZ(t,e){let n=y_(t,t.selection.main.head),r=n.brackets||Ef.brackets;for(let s of r){let i=v_(Ms(s,0));if(e==s)return i==s?TZ(t,s,r.indexOf(s+s+s)>-1,n):NZ(t,s,i,n.before||Ef.before);if(e==i&&b_(t,t.selection.main.from))return CZ(t,s,i)}return null}function b_(t,e){let n=!1;return t.field(x_).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function Dx(t,e){let n=t.sliceString(e,e+2);return n.slice(0,aa(Ms(n,0)))}function jZ(t,e){let n=t.sliceString(e-2,e);return aa(Ms(n,0))==n.length?n:n.slice(1)}function NZ(t,e,n,r){let s=null,i=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:n,from:l.to}],effects:oc.of(l.to+e.length),range:Ce.range(l.anchor+e.length,l.head+e.length)};let c=Dx(t.doc,l.head);return!c||/\s/.test(c)||r.indexOf(c)>-1?{changes:{insert:e+n,from:l.head},effects:oc.of(l.head+e.length),range:Ce.cursor(l.head+e.length)}:{range:s=l}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function CZ(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&Dx(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Ce.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function TZ(t,e,n,r){let s=r.stringPrefixes||Ef.stringPrefixes,i=null,l=t.changeByRange(c=>{if(!c.empty)return{changes:[{insert:e,from:c.from},{insert:e,from:c.to}],effects:oc.of(c.to+e.length),range:Ce.range(c.anchor+e.length,c.head+e.length)};let d=c.head,h=Dx(t.doc,d),m;if(h==e){if(_7(t,d))return{changes:{insert:e+e,from:d},effects:oc.of(d+e.length),range:Ce.cursor(d+e.length)};if(b_(t,d)){let x=n&&t.sliceDoc(d,d+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:d,to:d+x.length,insert:x},range:Ce.cursor(d+x.length)}}}else{if(n&&t.sliceDoc(d-2*e.length,d)==e+e&&(m=D7(t,d-2*e.length,s))>-1&&_7(t,m))return{changes:{insert:e+e+e+e,from:d},effects:oc.of(d+e.length),range:Ce.cursor(d+e.length)};if(t.charCategorizer(d)(h)!=Vn.Word&&D7(t,d,s)>-1&&!MZ(t,d,e,s))return{changes:{insert:e+e,from:d},effects:oc.of(d+e.length),range:Ce.cursor(d+e.length)}}return{range:i=c}});return i?null:t.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function _7(t,e){let n=zr(t).resolveInner(e+1);return n.parent&&n.from==e}function MZ(t,e,n,r){let s=zr(t).resolveInner(e,-1),i=r.reduce((l,c)=>Math.max(l,c.length),0);for(let l=0;l<5;l++){let c=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),d=c.indexOf(n);if(!d||d>-1&&r.indexOf(c.slice(0,d))>-1){let m=s.firstChild;for(;m&&m.from==s.from&&m.to-m.from>n.length+d;){if(t.sliceDoc(m.to-n.length,m.to)==n)return!1;m=m.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function D7(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Vn.Word)return e;for(let s of n){let i=e-s.length;if(t.sliceDoc(i,e)==s&&r(t.sliceDoc(i-1,i))!=Vn.Word)return i}return-1}function AZ(t={}){return[lZ,As,Dr.of(t),iZ,EZ,p_]}const w_=[{key:"Ctrl-Space",run:Zy},{mac:"Alt-`",run:Zy},{mac:"Alt-i",run:Zy},{key:"Escape",run:tZ},{key:"ArrowDown",run:bp(!0)},{key:"ArrowUp",run:bp(!1)},{key:"PageDown",run:bp(!0,"page")},{key:"PageUp",run:bp(!1,"page")},{key:"Enter",run:eZ}],EZ=jo.highest(o0.computeN([Dr],t=>t.facet(Dr).defaultKeymap?[w_]:[]));class R7{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class sc{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(_f).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((v,b)=>v.from-b.from||v.to-b.to),l=new fl,c=[],d=0,h=r.doc.iter(),m=0,p=r.doc.length;for(let v=0;;){let b=v==i.length?null:i[v];if(!b&&!c.length)break;let k,O;if(c.length)k=d,O=c.reduce((M,_)=>Math.min(M,_.to),b&&b.from>k?b.from:1e8);else{if(k=b.from,k>p)break;O=b.to,c.push(b),v++}for(;vM.from||M.to==k))c.push(M),v++,O=Math.min(M.to,O);else{O=Math.min(M.from,O);break}}O=Math.min(O,p);let j=!1;if(c.some(M=>M.from==k&&(M.to==O||O==p))&&(j=k==O,!j&&O-k<10)){let M=k-(m+h.value.length);M>0&&(h.next(M),m=k);for(let _=k;;){if(_>=O){j=!0;break}if(!h.lineBreak&&m+h.value.length>_)break;_=m+h.value.length,m+=h.value.length,h.next()}}let T=HZ(c);if(j)l.add(k,k,Je.widget({widget:new qZ(T),diagnostics:c.slice()}));else{let M=c.reduce((_,D)=>D.markClass?_+" "+D.markClass:_,"");l.add(k,O,Je.mark({class:"cm-lintRange cm-lintRange-"+T+M,diagnostics:c.slice(),inclusiveEnd:c.some(_=>_.to>O)}))}if(d=O,d==p)break;for(let M=0;M{if(!(e&&l.diagnostics.indexOf(e)<0))if(!r)r=new R7(s,i,e||l.diagnostics[0]);else{if(l.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new R7(r.from,i,r.diagnostic)}}),r}function _Z(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(_f).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(l=>l.is(S_))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function DZ(t,e){return t.field(ni,!1)?e:e.concat(xt.appendConfig.of(UZ))}const S_=xt.define(),i5=xt.define(),k_=xt.define(),ni=Lr.define({create(){return new sc(Je.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,s=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=xd(n,t.selected.diagnostic,i)||xd(n,null,i)}!n.size&&s&&e.state.facet(_f).autoPanel&&(s=null),t=new sc(n,s,r)}for(let n of e.effects)if(n.is(S_)){let r=e.state.facet(_f).autoPanel?n.value.length?Df.open:null:t.panel;t=sc.init(n.value,r,e.state)}else n.is(i5)?t=new sc(t.diagnostics,n.value?Df.open:null,t.selected):n.is(k_)&&(t=new sc(t.diagnostics,t.panel,n.value));return t},provide:t=>[Sf.from(t,e=>e.panel),qe.decorations.from(t,e=>e.diagnostics)]}),RZ=Je.mark({class:"cm-lintRange cm-lintRange-active"});function zZ(t,e,n){let{diagnostics:r}=t.state.field(ni),s,i=-1,l=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(d,h,{spec:m})=>{if(e>=d&&e<=h&&(d==h||(e>d||n>0)&&(ej_(t,n,!1)))}const LZ=t=>{let e=t.state.field(ni,!1);(!e||!e.panel)&&t.dispatch({effects:DZ(t.state,[i5.of(!0)])});let n=wf(t,Df.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},z7=t=>{let e=t.state.field(ni,!1);return!e||!e.panel?!1:(t.dispatch({effects:i5.of(!1)}),!0)},BZ=t=>{let e=t.state.field(ni,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},IZ=[{key:"Mod-Shift-m",run:LZ,preventDefault:!0},{key:"F8",run:BZ}],_f=He.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...ka(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:P7,tooltipFilter:P7,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,s,i)=>e(r,s,i)||n(r,s,i):e:n,autoPanel:(e,n)=>e||n})}}});function P7(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function O_(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;ri.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function j_(t,e,n){var r;let s=n?O_(e.actions):[];return An("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},An("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,l)=>{let c=!1,d=v=>{if(v.preventDefault(),c)return;c=!0;let b=xd(t.state.field(ni).diagnostics,e);b&&i.apply(t,b.from,b.to)},{name:h}=i,m=s[l]?h.indexOf(s[l]):-1,p=m<0?h:[h.slice(0,m),An("u",h.slice(m,m+1)),h.slice(m+1)],x=i.markClass?" "+i.markClass:"";return An("button",{type:"button",class:"cm-diagnosticAction"+x,onclick:d,onmousedown:d,"aria-label":` Action: ${h}${m<0?"":` (access key "${s[l]})"`}.`},p)}),e.source&&An("div",{class:"cm-diagnosticSource"},e.source))}class qZ extends Oa{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return An("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class L7{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=j_(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Df{constructor(e){this.view=e,this.items=[];let n=s=>{if(s.keyCode==27)z7(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],l=O_(i.actions);for(let c=0;c{for(let i=0;iz7(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(ni).selected;if(!e)return-1;for(let n=0;n{for(let m of h.diagnostics){if(l.has(m))continue;l.add(m);let p=-1,x;for(let v=r;vr&&(this.items.splice(r,p-r),s=!0)),n&&x.diagnostic==n.diagnostic?x.dom.hasAttribute("aria-selected")||(x.dom.setAttribute("aria-selected","true"),i=x):x.dom.hasAttribute("aria-selected")&&x.dom.removeAttribute("aria-selected"),r++}});r({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:c,panel:d})=>{let h=d.height/this.list.offsetHeight;c.topd.bottom&&(this.list.scrollTop+=(c.bottom-d.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(ni),r=xd(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:k_.of(r)})}static open(e){return new Df(e)}}function FZ(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function wp(t){return FZ(``,'width="6" height="3"')}const QZ=qe.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:wp("#d11")},".cm-lintRange-warning":{backgroundImage:wp("orange")},".cm-lintRange-info":{backgroundImage:wp("#999")},".cm-lintRange-hint":{backgroundImage:wp("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function $Z(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function HZ(t){let e="hint",n=1;for(let r of t){let s=$Z(r.severity);s>n&&(n=s,e=r.severity)}return e}const UZ=[ni,qe.decorations.compute([ni],t=>{let{selected:e,panel:n}=t.field(ni);return!e||!n||e.from==e.to?Je.none:Je.set([RZ.range(e.from,e.to)])}),NG(zZ,{hideOn:_Z}),QZ];var B7=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(kZ)),e.defaultKeymap!==!1&&(r=r.concat(aK)),e.searchKeymap!==!1&&(r=r.concat(_K)),e.historyKeymap!==!1&&(r=r.concat(fY)),e.foldKeymap!==!1&&(r=r.concat(kX)),e.completionKeymap!==!1&&(r=r.concat(w_)),e.lintKeymap!==!1&&(r=r.concat(IZ));var s=[];return e.lineNumbers!==!1&&s.push(LG()),e.highlightActiveLineGutter!==!1&&s.push(qG()),e.highlightSpecialChars!==!1&&s.push(tG()),e.history!==!1&&s.push(sY()),e.foldGutter!==!1&&s.push(CX()),e.drawSelection!==!1&&s.push(HW()),e.dropCursor!==!1&&s.push(XW()),e.allowMultipleSelections!==!1&&s.push(Vt.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(mX()),e.syntaxHighlighting!==!1&&s.push(hE(EX,{fallback:!0})),e.bracketMatching!==!1&&s.push(BX()),e.closeBrackets!==!1&&s.push(yZ()),e.autocompletion!==!1&&s.push(AZ()),e.rectangularSelection!==!1&&s.push(pG()),n!==!1&&s.push(vG()),e.highlightActiveLine!==!1&&s.push(lG()),e.highlightSelectionMatches!==!1&&s.push(fK()),e.tabSize&&typeof e.tabSize=="number"&&s.push(u0.of(" ".repeat(e.tabSize))),s.concat([o0.of(r.flat())]).filter(Boolean)};const VZ="#e5c07b",I7="#e06c75",WZ="#56b6c2",GZ="#ffffff",sg="#abb2bf",o4="#7d8799",XZ="#61afef",YZ="#98c379",q7="#d19a66",KZ="#c678dd",ZZ="#21252b",F7="#2c313a",Q7="#282c34",eb="#353a42",JZ="#3E4451",$7="#528bff",eJ=qe.theme({"&":{color:sg,backgroundColor:Q7},".cm-content":{caretColor:$7},".cm-cursor, .cm-dropCursor":{borderLeftColor:$7},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:JZ},".cm-panels":{backgroundColor:ZZ,color:sg},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Q7,color:o4,border:"none"},".cm-activeLineGutter":{backgroundColor:F7},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:eb},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:eb,borderBottomColor:eb},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:F7,color:sg}}},{dark:!0}),tJ=h0.define([{tag:he.keyword,color:KZ},{tag:[he.name,he.deleted,he.character,he.propertyName,he.macroName],color:I7},{tag:[he.function(he.variableName),he.labelName],color:XZ},{tag:[he.color,he.constant(he.name),he.standard(he.name)],color:q7},{tag:[he.definition(he.name),he.separator],color:sg},{tag:[he.typeName,he.className,he.number,he.changed,he.annotation,he.modifier,he.self,he.namespace],color:VZ},{tag:[he.operator,he.operatorKeyword,he.url,he.escape,he.regexp,he.link,he.special(he.string)],color:WZ},{tag:[he.meta,he.comment],color:o4},{tag:he.strong,fontWeight:"bold"},{tag:he.emphasis,fontStyle:"italic"},{tag:he.strikethrough,textDecoration:"line-through"},{tag:he.link,color:o4,textDecoration:"underline"},{tag:he.heading,fontWeight:"bold",color:I7},{tag:[he.atom,he.bool,he.special(he.variableName)],color:q7},{tag:[he.processingInstruction,he.string,he.inserted],color:YZ},{tag:he.invalid,color:GZ}]),N_=[eJ,hE(tJ)];var nJ=qe.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),rJ=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:i="light",placeholder:l="",basicSetup:c=!0}=e,d=[];switch(n&&d.unshift(o0.of([lK])),c&&(typeof c=="boolean"?d.unshift(B7()):d.unshift(B7(c))),l&&d.unshift(dG(l)),i){case"light":d.push(nJ);break;case"dark":d.push(N_);break;case"none":break;default:d.push(i);break}return r===!1&&d.push(qe.editable.of(!1)),s&&d.push(Vt.readOnly.of(!0)),[...d]},sJ=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class iJ{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class H7{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var tb=null,aJ=()=>typeof window>"u"?new H7:(tb||(tb=new H7),tb),U7=Sa.define(),lJ=200,oJ=[];function cJ(t){var{value:e,selection:n,onChange:r,onStatistics:s,onCreateEditor:i,onUpdate:l,extensions:c=oJ,autoFocus:d,theme:h="light",height:m=null,minHeight:p=null,maxHeight:x=null,width:v=null,minWidth:b=null,maxWidth:k=null,placeholder:O="",editable:j=!0,readOnly:T=!1,indentWithTab:M=!0,basicSetup:_=!0,root:D,initialState:E}=t,[z,Q]=S.useState(),[F,B]=S.useState(),[U,V]=S.useState(),ce=S.useState(()=>({current:null}))[0],W=S.useState(()=>({current:null}))[0],J=qe.theme({"&":{height:m,minHeight:p,maxHeight:x,width:v,minWidth:b,maxWidth:k},"& .cm-scroller":{height:"100% !important"}}),H=qe.updateListener.of(ue=>{if(ue.docChanged&&typeof r=="function"&&!ue.transactions.some(Y=>Y.annotation(U7))){ce.current?ce.current.reset():(ce.current=new iJ(()=>{if(W.current){var Y=W.current;W.current=null,Y()}ce.current=null},lJ),aJ().add(ce.current));var R=ue.state.doc,me=R.toString();r(me,ue)}s&&s(sJ(ue))}),ae=rJ({theme:h,editable:j,readOnly:T,placeholder:O,indentWithTab:M,basicSetup:_}),ne=[H,J,...ae];return l&&typeof l=="function"&&ne.push(qe.updateListener.of(l)),ne=ne.concat(c),S.useLayoutEffect(()=>{if(z&&!U){var ue={doc:e,selection:n,extensions:ne},R=E?Vt.fromJSON(E.json,ue,E.fields):Vt.create(ue);if(V(R),!F){var me=new qe({state:R,parent:z,root:D});B(me),i&&i(me,R)}}return()=>{F&&(V(void 0),B(void 0))}},[z,U]),S.useEffect(()=>{t.container&&Q(t.container)},[t.container]),S.useEffect(()=>()=>{F&&(F.destroy(),B(void 0)),ce.current&&(ce.current.cancel(),ce.current=null)},[F]),S.useEffect(()=>{d&&F&&F.focus()},[d,F]),S.useEffect(()=>{F&&F.dispatch({effects:xt.reconfigure.of(ne)})},[h,c,m,p,x,v,b,k,O,j,T,M,_,r,l]),S.useEffect(()=>{if(e!==void 0){var ue=F?F.state.doc.toString():"";if(F&&e!==ue){var R=ce.current&&!ce.current.isDone,me=()=>{F&&e!==F.state.doc.toString()&&F.dispatch({changes:{from:0,to:F.state.doc.toString().length,insert:e||""},annotations:[U7.of(!0)]})};R?W.current=me:me()}}},[e,F]),{state:U,setState:V,view:F,setView:B,container:z,setContainer:Q}}var uJ=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],C_=S.forwardRef((t,e)=>{var{className:n,value:r="",selection:s,extensions:i=[],onChange:l,onStatistics:c,onCreateEditor:d,onUpdate:h,autoFocus:m,theme:p="light",height:x,minHeight:v,maxHeight:b,width:k,minWidth:O,maxWidth:j,basicSetup:T,placeholder:M,indentWithTab:_,editable:D,readOnly:E,root:z,initialState:Q}=t,F=VI(t,uJ),B=S.useRef(null),{state:U,view:V,container:ce,setContainer:W}=cJ({root:z,value:r,autoFocus:m,theme:p,height:x,minHeight:v,maxHeight:b,width:k,minWidth:O,maxWidth:j,basicSetup:T,placeholder:M,indentWithTab:_,editable:D,readOnly:E,selection:s,onChange:l,onStatistics:c,onCreateEditor:d,onUpdate:h,extensions:i,initialState:Q});S.useImperativeHandle(e,()=>({editor:B.current,state:U,view:V}),[B,ce,U,V]);var J=S.useCallback(ae=>{B.current=ae,W(ae)},[W]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var H=typeof p=="string"?"cm-theme-"+p:"cm-theme";return a.jsx("div",WI({ref:J,className:""+H+(n?" "+n:"")},F))});C_.displayName="CodeMirror";var V7={};class Qg{constructor(e,n,r,s,i,l,c,d,h,m=0,p){this.p=e,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=l,this.buffer=c,this.bufferBase=d,this.curContext=h,this.lookAhead=m,this.parent=p}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let s=e.parser.context;return new Qg(e,[],n,r,r,0,[],0,s?new W7(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,s=e&65535,{parser:i}=this.p,l=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=m):this.p.lastBigReductionSized;)this.stack.pop();this.reduceContext(s,h)}storeNode(e,n,r,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&l.buffer[c-4]==0&&l.buffer[c-1]>-1){if(n==r)return;if(l.buffer[c-2]>=n){l.buffer[c-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,s);else{let l=this.buffer.length;if(l>0&&(this.buffer[l-4]!=0||this.buffer[l-1]<0)){let c=!1;for(let d=l;d>0&&this.buffer[d-2]>r;d-=4)if(this.buffer[d-1]>=0){c=!0;break}if(c)for(;l>0&&this.buffer[l-2]>r;)this.buffer[l]=this.buffer[l-4],this.buffer[l+1]=this.buffer[l-3],this.buffer[l+2]=this.buffer[l-2],this.buffer[l+3]=this.buffer[l-1],l-=4,s>4&&(s-=4)}this.buffer[l]=e,this.buffer[l+1]=n,this.buffer[l+2]=r,this.buffer[l+3]=s}}shift(e,n,r,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:l}=this.p;(s>this.pos||n<=l.maxNode)&&(this.pos=s,l.stateFlag(i,1)||(this.reducePos=s)),this.pushState(i,r),this.shiftContext(n,r),n<=l.maxNode&&this.buffer.push(n,r,s,4)}else this.pos=s,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,s,4)}apply(e,n,r,s){e&65536?this.reduce(e):this.shift(e,n,r,s)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(n,s),this.buffer.push(r,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),s=e.bufferBase+n;for(;e&&s==e.bufferBase;)e=e.parent;return new Qg(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new dJ(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let s=[];for(let i=0,l;id&1&&c==l)||s.push(n[i],l)}n=s}let r=[];for(let s=0;s>19,s=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let l=this.findForcedReduction();if(l==null)return!1;n=l}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(s,i)=>{if(!n.includes(s))return n.push(s),e.allActions(s,l=>{if(!(l&393216))if(l&65536){let c=(l>>19)-i;if(c>1){let d=l&65535,h=this.stack.length-c*3;if(h>=0&&e.getGoto(this.stack[h],d,!1)>=0)return c<<19|65536|d}}else{let c=r(l,i+1);if(c!=null)return c}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;nthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class W7{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class dJ{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=s}}class $g{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new $g(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new $g(this.stack,this.pos,this.index)}}function Sp(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r=92&&l--,l>=34&&l--;let d=l-32;if(d>=46&&(d-=46,c=!0),i+=d,c)break;i*=46}n?n[s++]=i:n=new e(i)}return n}class ig{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const G7=new ig;class hJ{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=G7,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,s=this.rangeIndex,i=this.pos+e;for(;ir.to:i>=r.to;){if(s==this.ranges.length-1)return null;let l=this.ranges[++s];i+=l.from-r.to,r=l}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n=this.chunk2Pos&&rc.to&&(this.chunk2=this.chunk2.slice(0,c.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=G7,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let s of this.ranges){if(s.from>=n)break;s.to>e&&(r+=this.input.read(Math.max(s.from,e),Math.min(s.to,n)))}return r}}class Zu{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;fJ(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Zu.prototype.contextual=Zu.prototype.fallback=Zu.prototype.extend=!1;Zu.prototype.fallback=Zu.prototype.extend=!1;class Rx{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function fJ(t,e,n,r,s,i){let l=0,c=1<0){let b=t[v];if(d.allows(b)&&(e.token.value==-1||e.token.value==b||mJ(b,e.token.value,s,i))){e.acceptToken(b);break}}let m=e.next,p=0,x=t[l+2];if(e.next<0&&x>p&&t[h+x*3-3]==65535){l=t[h+x*3-1];continue e}for(;p>1,b=h+v+(v<<1),k=t[b],O=t[b+1]||65536;if(m=O)p=v+1;else{l=t[b+2],e.advance();continue e}}break}}function X7(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function mJ(t,e,n,r){let s=X7(n,r,e);return s<0||X7(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class pJ{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Y7(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Y7(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=l,null;if(i instanceof _n){if(l==e){if(l=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(l),this.index.push(0))}else this.index[n]++,this.nextStart=l+i.length}}}class gJ{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new ig)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,l=s.stateSlot(e.state,3),c=e.curContext?e.curContext.hash:0,d=0;for(let h=0;hp.end+25&&(d=Math.max(p.lookAhead,d)),p.value!=0)){let x=n;if(p.extended>-1&&(n=this.addActions(e,p.extended,p.end,n)),n=this.addActions(e,p.value,p.end,n),!m.extend&&(r=p,n>x))break}}for(;this.actions.length>n;)this.actions.pop();return d&&e.setLookAhead(d),!r&&e.pos==this.stream.end&&(r=new ig,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new ig,{pos:r,p:s}=e;return n.start=r,n.end=Math.min(r+1,s.stream.end),n.value=r==s.stream.end?s.parser.eofTerm:0,n}updateCachedToken(e,n,r){let s=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(s,e),r),e.value>-1){let{parser:i}=r.p;for(let l=0;l=0&&r.p.parser.dialect.allows(c>>1)){(c&1)==0?e.value=c>>1:e.extended=c>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;ie.bufferLength*4?new pJ(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],s,i;if(this.bigReductionCount>300&&e.length==1){let[l]=e;for(;l.forceReduce()&&l.stack.length&&l.stack[l.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let l=0;ln)r.push(c);else{if(this.advanceStack(c,r,e))continue;{s||(s=[],i=[]),s.push(c);let d=this.tokens.getMainToken(c);i.push(d.value,d.end)}}break}}if(!r.length){let l=s&&bJ(s);if(l)return Ys&&console.log("Finish with "+this.stackID(l)),this.stackToTree(l);if(this.parser.strict)throw Ys&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&s){let l=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,r);if(l)return Ys&&console.log("Force-finish "+this.stackID(l)),this.stackToTree(l.forceAll())}if(this.recovering){let l=this.recovering==1?1:this.recovering*3;if(r.length>l)for(r.sort((c,d)=>d.score-c.score);r.length>l;)r.pop();r.some(c=>c.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let l=0;l500&&h.buffer.length>500)if((c.score-h.score||c.buffer.length-h.buffer.length)>0)r.splice(d--,1);else{r.splice(l--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let l=1;l ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,m=h?e.curContext.hash:0;for(let p=this.fragments.nodeAt(s);p;){let x=this.parser.nodeSet.types[p.type.id]==p.type?i.getGoto(e.state,p.type.id):-1;if(x>-1&&p.length&&(!h||(p.prop(Et.contextHash)||0)==m))return e.useNode(p,x),Ys&&console.log(l+this.stackID(e)+` (via reuse of ${i.getName(p.type.id)})`),!0;if(!(p instanceof _n)||p.children.length==0||p.positions[0]>0)break;let v=p.children[0];if(v instanceof _n&&p.positions[0]==0)p=v;else break}}let c=i.stateSlot(e.state,4);if(c>0)return e.reduce(c),Ys&&console.log(l+this.stackID(e)+` (via always-reduce ${i.getName(c&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let d=this.tokens.getActions(e);for(let h=0;hs?n.push(b):r.push(b)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return K7(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let l=0;l ":"";if(c.deadEnd&&(i||(i=!0,c.restart(),Ys&&console.log(m+this.stackID(c)+" (restarted)"),this.advanceFully(c,r))))continue;let p=c.split(),x=m;for(let v=0;v<10&&p.forceReduce()&&(Ys&&console.log(x+this.stackID(p)+" (via force-reduce)"),!this.advanceFully(p,r));v++)Ys&&(x=this.stackID(p)+" -> ");for(let v of c.recoverByInsert(d))Ys&&console.log(m+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,r);this.stream.end>c.pos?(h==c.pos&&(h++,d=0),c.recoverByDelete(d,h),Ys&&console.log(m+this.stackID(c)+` (via recover-delete ${this.parser.getName(d)})`),K7(c,r)):(!s||s.scoret;class yJ{constructor(e){this.start=e.start,this.shift=e.shift||rb,this.reduce=e.reduce||rb,this.reuse=e.reuse||rb,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Rf extends Lw{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let c=0;ce.topRules[c][1]),s=[];for(let c=0;c=0)i(m,d,c[h++]);else{let p=c[h+-m];for(let x=-m;x>0;x--)i(c[h++],d,p);h++}}}this.nodeSet=new jx(n.map((c,d)=>gs.define({name:d>=this.minRepeatTerm?void 0:c,id:d,props:s[d],top:r.indexOf(d)>-1,error:d==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(d)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=VA;let l=Sp(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let c=0;ctypeof c=="number"?new Zu(l,c):c),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let s=new xJ(this,e,n,r);for(let i of this.wrappers)s=i(s,e,n,r);return s}getGoto(e,n,r=!1){let s=this.goto;if(n>=s[0])return-1;for(let i=s[n+1];;){let l=s[i++],c=l&1,d=s[i++];if(c&&r)return d;for(let h=i+(l>>1);i0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),s=r?n(r):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=nl(this.data,i+2);else break;s=n(nl(this.data,i+1))}return s}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=nl(this.data,r+2);else break;if((this.data[r+2]&1)==0){let s=this.data[r+1];n.some((i,l)=>l&1&&i==s)||n.push(this.data[r],s)}}return n}configure(e){let n=Object.assign(Object.create(Rf.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let s=e.tokenizers.find(i=>i.from==r);return s?s.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,s)=>{let i=e.specializers.find(c=>c.from==r.external);if(!i)return r;let l=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=Z7(l),l})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let l=n.indexOf(i);l>=0&&(r[l]=!0)}let s=null;for(let i=0;ir)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}const wJ=1,T_=194,M_=195,SJ=196,J7=197,kJ=198,OJ=199,jJ=200,NJ=2,A_=3,e8=201,CJ=24,TJ=25,MJ=49,AJ=50,EJ=55,_J=56,DJ=57,RJ=59,zJ=60,PJ=61,LJ=62,BJ=63,IJ=65,qJ=238,FJ=71,QJ=241,$J=242,HJ=243,UJ=244,VJ=245,WJ=246,GJ=247,XJ=248,E_=72,YJ=249,KJ=250,ZJ=251,JJ=252,eee=253,tee=254,nee=255,ree=256,see=73,iee=77,aee=263,lee=112,oee=130,cee=151,uee=152,dee=155,jc=10,zf=13,a5=32,zx=9,l5=35,hee=40,fee=46,c4=123,t8=125,__=39,D_=34,n8=92,mee=111,pee=120,gee=78,xee=117,vee=85,yee=new Set([TJ,MJ,AJ,aee,IJ,oee,_J,DJ,qJ,LJ,BJ,E_,see,iee,zJ,PJ,cee,uee,dee,lee]);function sb(t){return t==jc||t==zf}function ib(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}const bee=new Rx((t,e)=>{let n;if(t.next<0)t.acceptToken(OJ);else if(e.context.flags&ag)sb(t.next)&&t.acceptToken(kJ,1);else if(((n=t.peek(-1))<0||sb(n))&&e.canShift(J7)){let r=0;for(;t.next==a5||t.next==zx;)t.advance(),r++;(t.next==jc||t.next==zf||t.next==l5)&&t.acceptToken(J7,-r)}else sb(t.next)&&t.acceptToken(SJ,1)},{contextual:!0}),wee=new Rx((t,e)=>{let n=e.context;if(n.flags)return;let r=t.peek(-1);if(r==jc||r==zf){let s=0,i=0;for(;;){if(t.next==a5)s++;else if(t.next==zx)s+=8-s%8;else break;t.advance(),i++}s!=n.indent&&t.next!=jc&&t.next!=zf&&t.next!=l5&&(s[t,e|R_])),Oee=new yJ({start:See,reduce(t,e,n,r){return t.flags&ag&&yee.has(e)||(e==FJ||e==E_)&&t.flags&R_?t.parent:t},shift(t,e,n,r){return e==T_?new lg(t,kee(r.read(r.pos,n.pos)),0):e==M_?t.parent:e==CJ||e==EJ||e==RJ||e==A_?new lg(t,0,ag):r8.has(e)?new lg(t,0,r8.get(e)|t.flags&ag):t},hash(t){return t.hash}}),jee=new Rx(t=>{for(let e=0;e<5;e++){if(t.next!="print".charCodeAt(e))return;t.advance()}if(!/\w/.test(String.fromCharCode(t.next)))for(let e=0;;e++){let n=t.peek(e);if(!(n==a5||n==zx)){n!=hee&&n!=fee&&n!=jc&&n!=zf&&n!=l5&&t.acceptToken(wJ);return}}}),Nee=new Rx((t,e)=>{let{flags:n}=e.context,r=n&Za?D_:__,s=(n&Ja)>0,i=!(n&el),l=(n&tl)>0,c=t.pos;for(;!(t.next<0);)if(l&&t.next==c4)if(t.peek(1)==c4)t.advance(2);else{if(t.pos==c){t.acceptToken(A_,1);return}break}else if(i&&t.next==n8){if(t.pos==c){t.advance();let d=t.next;d>=0&&(t.advance(),Cee(t,d)),t.acceptToken(NJ);return}break}else if(t.next==n8&&!i&&t.peek(1)>-1)t.advance(2);else if(t.next==r&&(!s||t.peek(1)==r&&t.peek(2)==r)){if(t.pos==c){t.acceptToken(e8,s?3:1);return}break}else if(t.next==jc){if(s)t.advance();else if(t.pos==c){t.acceptToken(e8);return}break}else t.advance();t.pos>c&&t.acceptToken(jJ)});function Cee(t,e){if(e==mee)for(let n=0;n<2&&t.next>=48&&t.next<=55;n++)t.advance();else if(e==pee)for(let n=0;n<2&&ib(t.next);n++)t.advance();else if(e==xee)for(let n=0;n<4&&ib(t.next);n++)t.advance();else if(e==vee)for(let n=0;n<8&&ib(t.next);n++)t.advance();else if(e==gee&&t.next==c4){for(t.advance();t.next>=0&&t.next!=t8&&t.next!=__&&t.next!=D_&&t.next!=jc;)t.advance();t.next==t8&&t.advance()}}const Tee=Bw({'async "*" "**" FormatConversion FormatSpec':he.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":he.controlKeyword,"in not and or is del":he.operatorKeyword,"from def class global nonlocal lambda":he.definitionKeyword,import:he.moduleKeyword,"with as print":he.keyword,Boolean:he.bool,None:he.null,VariableName:he.variableName,"CallExpression/VariableName":he.function(he.variableName),"FunctionDefinition/VariableName":he.function(he.definition(he.variableName)),"ClassDefinition/VariableName":he.definition(he.className),PropertyName:he.propertyName,"CallExpression/MemberExpression/PropertyName":he.function(he.propertyName),Comment:he.lineComment,Number:he.number,String:he.string,FormatString:he.special(he.string),Escape:he.escape,UpdateOp:he.updateOperator,"ArithOp!":he.arithmeticOperator,BitOp:he.bitwiseOperator,CompareOp:he.compareOperator,AssignOp:he.definitionOperator,Ellipsis:he.punctuation,At:he.meta,"( )":he.paren,"[ ]":he.squareBracket,"{ }":he.brace,".":he.derefOperator,", ;":he.separator}),Mee={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},Aee=Rf.deserialize({version:14,states:"##jO`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[jee,wee,bee,Nee,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:t=>Mee[t]||-1}],tokenPrec:7668}),s8=new WG,z_=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function kp(t){return(e,n,r)=>{if(r)return!1;let s=e.node.getChild("VariableName");return s&&n(s,t),!0}}const Eee={FunctionDefinition:kp("function"),ClassDefinition:kp("class"),ForStatement(t,e,n){if(n){for(let r=t.node.firstChild;r;r=r.nextSibling)if(r.name=="VariableName")e(r,"variable");else if(r.name=="in")break}},ImportStatement(t,e){var n,r;let{node:s}=t,i=((n=s.firstChild)===null||n===void 0?void 0:n.name)=="from";for(let l=s.getChild("import");l;l=l.nextSibling)l.name=="VariableName"&&((r=l.nextSibling)===null||r===void 0?void 0:r.name)!="as"&&e(l,i?"variable":"namespace")},AssignStatement(t,e){for(let n=t.node.firstChild;n;n=n.nextSibling)if(n.name=="VariableName")e(n,"variable");else if(n.name==":"||n.name=="AssignOp")break},ParamList(t,e){for(let n=null,r=t.node.firstChild;r;r=r.nextSibling)r.name=="VariableName"&&(!n||!/\*|AssignOp/.test(n.name))&&e(r,"variable"),n=r},CapturePattern:kp("variable"),AsPattern:kp("variable"),__proto__:null};function P_(t,e){let n=s8.get(e);if(n)return n;let r=[],s=!0;function i(l,c){let d=t.sliceString(l.from,l.to);r.push({label:d,type:c})}return e.cursor(Or.IncludeAnonymous).iterate(l=>{if(l.name){let c=Eee[l.name];if(c&&c(l,i,s)||!s&&z_.has(l.name))return!1;s=!1}else if(l.to-l.from>8192){for(let c of P_(t,l.node))r.push(c);return!1}}),s8.set(e,r),r}const i8=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,L_=["String","FormatString","Comment","PropertyName"];function _ee(t){let e=zr(t.state).resolveInner(t.pos,-1);if(L_.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&i8.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let s=e;s;s=s.parent)z_.has(s.name)&&(r=r.concat(P_(t.state.doc,s)));return{options:r,from:n?e.from:t.pos,validFor:i8}}const Dee=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(t=>({label:t,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(t=>({label:t,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(t=>({label:t,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(t=>({label:t,type:"function"}))),Ree=[Xa("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),Xa("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),Xa("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),Xa("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),Xa(`if \${}: + +`,{label:"if",detail:"block",type:"keyword"}),Xa("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),Xa("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),Xa("import ${module}",{label:"import",detail:"statement",type:"keyword"}),Xa("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],zee=LK(L_,d_(Dee.concat(Ree)));function ab(t){let{node:e,pos:n}=t,r=t.lineIndent(n,-1),s=null;for(;;){let i=e.childBefore(n);if(i)if(i.name=="Comment")n=i.from;else if(i.name=="Body"||i.name=="MatchBody")t.baseIndentFor(i)+t.unit<=r&&(s=i),e=i;else if(i.name=="MatchClause")e=i;else if(i.type.is("Statement"))e=i;else break;else break}return s}function lb(t,e){let n=t.baseIndentFor(e),r=t.lineAt(t.pos,-1),s=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&t.node.ton?null:n+t.unit}const ob=jf.define({name:"python",parser:Aee.configure({props:[Cx.add({Body:t=>{var e;let n=/^\s*(#|$)/.test(t.textAfter)&&ab(t)||t.node;return(e=lb(t,n))!==null&&e!==void 0?e:t.continue()},MatchBody:t=>{var e;let n=ab(t);return(e=lb(t,n||t.node))!==null&&e!==void 0?e:t.continue()},IfStatement:t=>/^\s*(else:|elif )/.test(t.textAfter)?t.baseIndent:t.continue(),"ForStatement WhileStatement":t=>/^\s*else:/.test(t.textAfter)?t.baseIndent:t.continue(),TryStatement:t=>/^\s*(except[ :]|finally:|else:)/.test(t.textAfter)?t.baseIndent:t.continue(),MatchStatement:t=>/^\s*case /.test(t.textAfter)?t.baseIndent+t.unit:t.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":Hy({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Hy({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Hy({closing:"]"}),MemberExpression:t=>t.baseIndent+t.unit,"String FormatString":()=>null,Script:t=>{var e;let n=ab(t);return(e=n&&lb(t,n))!==null&&e!==void 0?e:t.continue()}}),Fw.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":rE,Body:(t,e)=>({from:t.from+1,to:t.to-(t.to==e.doc.length?0:1)}),"String FormatString":(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function Pee(){return new eE(ob,[ob.data.of({autocomplete:_ee}),ob.data.of({autocomplete:zee})])}const Lee=Bw({String:he.string,Number:he.number,"True False":he.bool,PropertyName:he.propertyName,Null:he.null,", :":he.separator,"[ ]":he.squareBracket,"{ }":he.brace}),Bee=Rf.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[Lee],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Iee=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=qee(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function qee(t,e){let n;return(n=t.message.match(/at position (\d+)/))?Math.min(+n[1],e.length):(n=t.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+n[1]).from+ +n[2]-1,e.length):0}const Fee=jf.define({name:"json",parser:Bee.configure({props:[Cx.add({Object:a7({except:/^\s*\}/}),Array:a7({except:/^\s*\]/})}),Fw.add({"Object Array":rE})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Qee(){return new eE(Fee)}const $ee={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(t,e){let n;if(!e.inString&&(n=t.match(/^('''|"""|'|")/))&&(e.stringType=n[0],e.inString=!0),t.sol()&&!e.inString&&e.inArray===0&&(e.lhs=!0),e.inString){for(;e.inString;)if(t.match(e.stringType))e.inString=!1;else if(t.peek()==="\\")t.next(),t.next();else{if(t.eol())break;t.match(/^.[^\\\"\']*/)}return e.lhs?"property":"string"}else{if(e.inArray&&t.peek()==="]")return t.next(),e.inArray--,"bracket";if(e.lhs&&t.peek()==="["&&t.skipTo("]"))return t.next(),t.peek()==="]"&&t.next(),"atom";if(t.peek()==="#")return t.skipToEnd(),"comment";if(t.eatSpace())return null;if(e.lhs&&t.eatWhile(function(r){return r!="="&&r!=" "}))return"property";if(e.lhs&&t.peek()==="=")return t.next(),e.lhs=!1,null;if(!e.lhs&&t.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!e.lhs&&(t.match("true")||t.match("false")))return"atom";if(!e.lhs&&t.peek()==="[")return e.inArray++,t.next(),"bracket";if(!e.lhs&&t.match(/^\-?\d+(?:\.\d+)?/))return"number";t.eatSpace()||t.next()}return null},languageData:{commentTokens:{line:"#"}}},Hee={python:[Pee()],json:[Qee(),Iee()],toml:[Qw.define($ee)],text:[]};function Uee({value:t,onChange:e,language:n="text",readOnly:r=!1,height:s="400px",minHeight:i,maxHeight:l,placeholder:c,theme:d="dark",className:h=""}){const[m,p]=S.useState(!1);if(S.useEffect(()=>{p(!0)},[]),!m)return a.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${h}`,style:{height:s,minHeight:i,maxHeight:l}});const x=[...Hee[n]||[],qe.lineWrapping];return r&&x.push(qe.editable.of(!1)),a.jsx("div",{className:`rounded-md overflow-hidden border ${h}`,children:a.jsx(C_,{value:t,height:s,minHeight:i,maxHeight:l,theme:d==="dark"?N_:void 0,extensions:x,onChange:e,placeholder:c,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function Vee(){const[t,e]=S.useState(!0),[n,r]=S.useState(!1),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState("visual"),[b,k]=S.useState(""),[O,j]=S.useState(!1),{toast:T}=Pr(),[M,_]=S.useState(null),[D,E]=S.useState(null),[z,Q]=S.useState(null),[F,B]=S.useState(null),[U,V]=S.useState(null),[ce,W]=S.useState(null),[J,H]=S.useState(null),[ae,ne]=S.useState(null),[ue,R]=S.useState(null),[me,Y]=S.useState(null),[P,K]=S.useState(null),[$,fe]=S.useState(null),[ve,Re]=S.useState(null),[de,We]=S.useState(null),[ct,Oe]=S.useState(null),[nt,ut]=S.useState(null),[Ct,Bn]=S.useState(null),[Tn,Jn]=S.useState(null),nn=S.useRef(null),_t=S.useRef(!0),Yr=S.useRef({}),In=S.useCallback(async()=>{try{const re=await RU();k(re),j(!1)}catch(re){T({variant:"destructive",title:"加载失败",description:re instanceof Error?re.message:"加载源代码失败"})}},[T]),or=S.useCallback(async()=>{try{e(!0);const re=await DU();Yr.current=re,_(re.bot),E(re.personality);const Me=re.chat;Me.talk_value_rules||(Me.talk_value_rules=[]),Q(Me),B(re.expression),V(re.emoji),W(re.memory),H(re.tool),ne(re.mood),R(re.voice),Y(re.lpmm_knowledge),K(re.keyword_reaction),fe(re.response_post_process),Re(re.chinese_typo),We(re.response_splitter),Oe(re.log),ut(re.debug),Bn(re.maim_message),Jn(re.telemetry),c(!1),_t.current=!1,await In()}catch(re){console.error("加载配置失败:",re),T({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{e(!1)}},[T,In]);S.useEffect(()=>{or()},[or]);const yn=S.useCallback(async(re,Me)=>{if(!_t.current)try{i(!0),await PU(re,Me),c(!1)}catch(pt){console.error(`自动保存 ${re} 失败:`,pt),c(!0)}finally{i(!1)}},[]),ft=S.useCallback((re,Me)=>{_t.current||(c(!0),nn.current&&clearTimeout(nn.current),nn.current=setTimeout(()=>{yn(re,Me)},2e3))},[yn]);S.useEffect(()=>{M&&!_t.current&&ft("bot",M)},[M,ft]),S.useEffect(()=>{D&&!_t.current&&ft("personality",D)},[D,ft]),S.useEffect(()=>{z&&!_t.current&&ft("chat",z)},[z,ft]),S.useEffect(()=>{F&&!_t.current&&ft("expression",F)},[F,ft]),S.useEffect(()=>{U&&!_t.current&&ft("emoji",U)},[U,ft]),S.useEffect(()=>{ce&&!_t.current&&ft("memory",ce)},[ce,ft]),S.useEffect(()=>{J&&!_t.current&&ft("tool",J)},[J,ft]),S.useEffect(()=>{ae&&!_t.current&&ft("mood",ae)},[ae,ft]),S.useEffect(()=>{ue&&!_t.current&&ft("voice",ue)},[ue,ft]),S.useEffect(()=>{me&&!_t.current&&ft("lpmm_knowledge",me)},[me,ft]),S.useEffect(()=>{P&&!_t.current&&ft("keyword_reaction",P)},[P,ft]),S.useEffect(()=>{$&&!_t.current&&ft("response_post_process",$)},[$,ft]),S.useEffect(()=>{ve&&!_t.current&&ft("chinese_typo",ve)},[ve,ft]),S.useEffect(()=>{de&&!_t.current&&ft("response_splitter",de)},[de,ft]),S.useEffect(()=>{ct&&!_t.current&&ft("log",ct)},[ct,ft]),S.useEffect(()=>{nt&&!_t.current&&ft("debug",nt)},[nt,ft]),S.useEffect(()=>{Ct&&!_t.current&&ft("maim_message",Ct)},[Ct,ft]),S.useEffect(()=>{Tn&&!_t.current&&ft("telemetry",Tn)},[Tn,ft]);const ee=async()=>{try{r(!0),await zU(b),c(!1),j(!1),T({title:"保存成功",description:"配置已保存"}),await or()}catch(re){j(!0),T({variant:"destructive",title:"保存失败",description:re instanceof Error?re.message:"保存配置失败"})}finally{r(!1)}},Se=async re=>{if(l){T({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}v(re),re==="source"?await In():await or()},Le=async()=>{try{r(!0),nn.current&&clearTimeout(nn.current);const re={...Yr.current,bot:M,personality:D,chat:z,expression:F,emoji:U,memory:ce,tool:J,mood:ae,voice:ue,lpmm_knowledge:me,keyword_reaction:P,response_post_process:$,chinese_typo:ve,response_splitter:de,log:ct,debug:nt,maim_message:Ct,telemetry:Tn};await XO(re),c(!1),T({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(re){console.error("保存配置失败:",re),T({title:"保存失败",description:re.message,variant:"destructive"})}finally{r(!1)}},rt=async()=>{try{h(!0),xw().catch(()=>{}),p(!0)}catch(re){console.error("重启失败:",re),p(!1),T({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),h(!1)}},Tt=async()=>{try{r(!0),nn.current&&clearTimeout(nn.current);const re={...Yr.current,bot:M,personality:D,chat:z,expression:F,emoji:U,memory:ce,tool:J,mood:ae,voice:ue,lpmm_knowledge:me,keyword_reaction:P,response_post_process:$,chinese_typo:ve,response_splitter:de,log:ct,debug:nt,maim_message:Ct,telemetry:Tn};await XO(re),c(!1),T({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(Me=>setTimeout(Me,500)),await rt()}catch(re){console.error("保存失败:",re),T({title:"保存失败",description:re.message,variant:"destructive"})}finally{r(!1)}},cr=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Kr=()=>{p(!1),h(!1),T({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return t?a.jsx(fn,{className:"h-full",children:a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):a.jsx(fn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto items-center",children:[a.jsx(dl,{value:x,onValueChange:re=>Se(re),className:"w-auto",children:a.jsxs(va,{className:"h-9",children:[a.jsxs($t,{value:"visual",className:"text-xs sm:text-sm px-2 sm:px-3",children:[a.jsx(bq,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化"]}),a.jsxs($t,{value:"source",className:"text-xs sm:text-sm px-2 sm:px-3",children:[a.jsx(wq,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码"]})]})}),a.jsxs(ie,{onClick:x==="visual"?Le:ee,disabled:n||s||!l||d,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":s?"自动保存中...":l?"保存配置":"已保存"]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:n||s||d,size:"sm",className:"flex-1 sm:flex-none",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),d?"重启中...":l?"保存并重启":"重启麦麦"]})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认重启麦麦?"}),a.jsx(un,{children:l?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:l?Tt:rt,children:l?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(oo,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),x==="source"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs(ld,{children:[a.jsx(oo,{className:"h-4 w-4"}),a.jsxs(od,{children:[a.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",O&&a.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),a.jsx(Uee,{value:b,onChange:re=>{k(re),c(!0),O&&j(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),x==="visual"&&a.jsx(a.Fragment,{children:a.jsxs(dl,{defaultValue:"bot",className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:a.jsxs(va,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[a.jsx($t,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),a.jsx($t,{value:"personality",className:"flex-shrink-0",children:"人格"}),a.jsx($t,{value:"chat",className:"flex-shrink-0",children:"聊天"}),a.jsx($t,{value:"expression",className:"flex-shrink-0",children:"表达"}),a.jsx($t,{value:"features",className:"flex-shrink-0",children:"功能"}),a.jsx($t,{value:"processing",className:"flex-shrink-0",children:"处理"}),a.jsx($t,{value:"mood",className:"flex-shrink-0",children:"情绪"}),a.jsx($t,{value:"voice",className:"flex-shrink-0",children:"语音"}),a.jsx($t,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),a.jsx($t,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),a.jsx(kn,{value:"bot",className:"space-y-4",children:M&&a.jsx(Wee,{config:M,onChange:_})}),a.jsx(kn,{value:"personality",className:"space-y-4",children:D&&a.jsx(Gee,{config:D,onChange:E})}),a.jsx(kn,{value:"chat",className:"space-y-4",children:z&&a.jsx(Xee,{config:z,onChange:Q})}),a.jsx(kn,{value:"expression",className:"space-y-4",children:F&&a.jsx(Yee,{config:F,onChange:B})}),a.jsx(kn,{value:"features",className:"space-y-4",children:U&&ce&&J&&a.jsx(Kee,{emojiConfig:U,memoryConfig:ce,toolConfig:J,onEmojiChange:V,onMemoryChange:W,onToolChange:H})}),a.jsx(kn,{value:"processing",className:"space-y-4",children:P&&$&&ve&&de&&a.jsx(Zee,{keywordReactionConfig:P,responsePostProcessConfig:$,chineseTypoConfig:ve,responseSplitterConfig:de,onKeywordReactionChange:K,onResponsePostProcessChange:fe,onChineseTypoChange:Re,onResponseSplitterChange:We})}),a.jsx(kn,{value:"mood",className:"space-y-4",children:ae&&a.jsx(Jee,{config:ae,onChange:ne})}),a.jsx(kn,{value:"voice",className:"space-y-4",children:ue&&a.jsx(ete,{config:ue,onChange:R})}),a.jsx(kn,{value:"lpmm",className:"space-y-4",children:me&&a.jsx(tte,{config:me,onChange:Y})}),a.jsxs(kn,{value:"other",className:"space-y-4",children:[ct&&a.jsx(nte,{config:ct,onChange:Oe}),nt&&a.jsx(rte,{config:nt,onChange:ut}),Ct&&a.jsx(ste,{config:Ct,onChange:Bn}),Tn&&a.jsx(ite,{config:Tn,onChange:Jn})]})]})}),m&&a.jsx(vw,{onRestartComplete:cr,onRestartFailed:Kr})]})})}function Wee({config:t,onChange:e}){const n=()=>{e({...t,platforms:[...t.platforms,""]})},r=d=>{e({...t,platforms:t.platforms.filter((h,m)=>m!==d)})},s=(d,h)=>{const m=[...t.platforms];m[d]=h,e({...t,platforms:m})},i=()=>{e({...t,alias_names:[...t.alias_names,""]})},l=d=>{e({...t,alias_names:t.alias_names.filter((h,m)=>m!==d)})},c=(d,h)=>{const m=[...t.alias_names];m[d]=h,e({...t,alias_names:m})};return a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"platform",children:"平台"}),a.jsx(Ae,{id:"platform",value:t.platform,onChange:d=>e({...t,platform:d.target.value}),placeholder:"qq"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"qq_account",children:"QQ账号"}),a.jsx(Ae,{id:"qq_account",value:t.qq_account,onChange:d=>e({...t,qq_account:d.target.value}),placeholder:"123456789"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称"}),a.jsx(Ae,{id:"nickname",value:t.nickname,onChange:d=>e({...t,nickname:d.target.value}),placeholder:"麦麦"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"其他平台账号"}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),a.jsxs("div",{className:"space-y-2",children:[t.platforms.map((d,h)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ae,{value:d,onChange:m=>s(h,m.target.value),placeholder:"wx:114514"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:['确定要删除平台账号 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>r(h),children:"删除"})]})]})]})]},h)),t.platforms.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"别名"}),a.jsxs(ie,{onClick:i,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),a.jsxs("div",{className:"space-y-2",children:[t.alias_names.map((d,h)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ae,{value:d,onChange:m=>c(h,m.target.value),placeholder:"小麦"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:['确定要删除别名 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>l(h),children:"删除"})]})]})]})]},h)),t.alias_names.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function Gee({config:t,onChange:e}){const n=()=>{e({...t,states:[...t.states,""]})},r=i=>{e({...t,states:t.states.filter((l,c)=>c!==i)})},s=(i,l)=>{const c=[...t.states];c[i]=l,e({...t,states:c})};return a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"personality",children:"人格特质"}),a.jsx(On,{id:"personality",value:t.personality,onChange:i=>e({...t,personality:i.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"reply_style",children:"表达风格"}),a.jsx(On,{id:"reply_style",value:t.reply_style,onChange:i=>e({...t,reply_style:i.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"interest",children:"兴趣"}),a.jsx(On,{id:"interest",value:t.interest,onChange:i=>e({...t,interest:i.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"plan_style",children:"说话规则与行为风格"}),a.jsx(On,{id:"plan_style",value:t.plan_style,onChange:i=>e({...t,plan_style:i.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"visual_style",children:"识图规则"}),a.jsx(On,{id:"visual_style",value:t.visual_style,onChange:i=>e({...t,visual_style:i.target.value}),placeholder:"识图时的处理规则",rows:3})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"private_plan_style",children:"私聊规则"}),a.jsx(On,{id:"private_plan_style",value:t.private_plan_style,onChange:i=>e({...t,private_plan_style:i.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"状态列表(人格多样性)"}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),a.jsx("div",{className:"space-y-2",children:t.states.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(On,{value:i,onChange:c=>s(l,c.target.value),placeholder:"描述一个人格状态",rows:2}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsx(un,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>r(l),children:"删除"})]})]})]})]},l))})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"state_probability",children:"状态替换概率"}),a.jsx(Ae,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:t.state_probability,onChange:i=>e({...t,state_probability:parseFloat(i.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function Xee({config:t,onChange:e}){const n=()=>{e({...t,talk_value_rules:[...t.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},r=c=>{e({...t,talk_value_rules:t.talk_value_rules.filter((d,h)=>h!==c)})},s=(c,d,h)=>{const m=[...t.talk_value_rules];m[c]={...m[c],[d]:h},e({...t,talk_value_rules:m})},i=({value:c,onChange:d})=>{const[h,m]=S.useState("00"),[p,x]=S.useState("00"),[v,b]=S.useState("23"),[k,O]=S.useState("59");S.useEffect(()=>{const T=c.split("-");if(T.length===2){const[M,_]=T,[D,E]=M.split(":"),[z,Q]=_.split(":");D&&m(D.padStart(2,"0")),E&&x(E.padStart(2,"0")),z&&b(z.padStart(2,"0")),Q&&O(Q.padStart(2,"0"))}},[c]);const j=(T,M,_,D)=>{const E=`${T}:${M}-${_}:${D}`;d(E)};return a.jsxs(co,{children:[a.jsx(uo,{asChild:!0,children:a.jsxs(ie,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[a.jsx(uc,{className:"h-4 w-4 mr-2"}),c||"选择时间段"]})}),a.jsx(hl,{className:"w-80",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"小时"}),a.jsxs(Bt,{value:h,onValueChange:T=>{m(T),j(T,p,v,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:24},(T,M)=>M).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"分钟"}),a.jsxs(Bt,{value:p,onValueChange:T=>{x(T),j(h,T,v,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:60},(T,M)=>M).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"小时"}),a.jsxs(Bt,{value:v,onValueChange:T=>{b(T),j(h,p,T,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:24},(T,M)=>M).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"分钟"}),a.jsxs(Bt,{value:k,onValueChange:T=>{O(T),j(h,p,v,T)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:60},(T,M)=>M).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]})]})]})]})})]})},l=({rule:c})=>{const d=`{ target = "${c.target}", time = "${c.time}", value = ${c.value.toFixed(1)} }`;return a.jsxs(co,{children:[a.jsx(uo,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(Fi,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(hl,{className:"w-96",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:d}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),a.jsx(Ae,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:t.talk_value,onChange:c=>e({...t,talk_value:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"mentioned_bot_reply",children:"提及回复增幅"}),a.jsx(Ae,{id:"mentioned_bot_reply",type:"number",step:"0.1",min:"0",max:"1",value:t.mentioned_bot_reply,onChange:c=>e({...t,mentioned_bot_reply:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"提及时回复概率增幅,1 为 100% 回复"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_context_size",children:"上下文长度"}),a.jsx(Ae,{id:"max_context_size",type:"number",min:"1",value:t.max_context_size,onChange:c=>e({...t,max_context_size:parseInt(c.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"planner_smooth",children:"规划器平滑"}),a.jsx(Ae,{id:"planner_smooth",type:"number",step:"1",min:"0",value:t.planner_smooth,onChange:c=>e({...t,planner_smooth:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_talk_value_rules",checked:t.enable_talk_value_rules,onCheckedChange:c=>e({...t,enable_talk_value_rules:c})}),a.jsx(te,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"include_planner_reasoning",checked:t.include_planner_reasoning,onCheckedChange:c=>e({...t,include_planner_reasoning:c})}),a.jsx(te,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),t.enable_talk_value_rules&&a.jsxs("div",{className:"border-t pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),a.jsxs(ie,{onClick:n,size:"sm",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),t.talk_value_rules&&t.talk_value_rules.length>0?a.jsx("div",{className:"space-y-4",children:t.talk_value_rules.map((c,d)=>a.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",d+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(l,{rule:c}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{variant:"ghost",size:"sm",children:a.jsx(Ht,{className:"h-4 w-4 text-destructive"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:["确定要删除规则 #",d+1," 吗?此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>r(d),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"配置类型"}),a.jsxs(Bt,{value:c.target===""?"global":"specific",onValueChange:h=>{h==="global"?s(d,"target",""):s(d,"target","qq::group")},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"global",children:"全局配置"}),a.jsx(Pe,{value:"specific",children:"详细配置"})]})]})]}),c.target!==""&&(()=>{const h=c.target.split(":"),m=h[0]||"qq",p=h[1]||"",x=h[2]||"group";return a.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"平台"}),a.jsxs(Bt,{value:m,onValueChange:v=>{s(d,"target",`${v}:${p}:${x}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"qq",children:"QQ"}),a.jsx(Pe,{value:"wx",children:"微信"})]})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"群 ID"}),a.jsx(Ae,{value:p,onChange:v=>{s(d,"target",`${m}:${v.target.value}:${x}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"类型"}),a.jsxs(Bt,{value:x,onValueChange:v=>{s(d,"target",`${m}:${p}:${v}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"group",children:"群组(group)"}),a.jsx(Pe,{value:"private",children:"私聊(private)"})]})]})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",c.target||"(未设置)"]})]})})(),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"时间段 (Time)"}),a.jsx(i,{value:c.time,onChange:h=>s(d,"time",h)}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{htmlFor:`rule-value-${d}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),a.jsx(Ae,{id:`rule-value-${d}`,type:"number",step:"0.01",min:"0",max:"1",value:c.value,onChange:h=>{const m=parseFloat(h.target.value);isNaN(m)||s(d,"value",Math.max(0,Math.min(1,m)))},className:"w-20 h-8 text-xs"})]}),a.jsx(yx,{value:[c.value],onValueChange:h=>s(d,"value",h[0]),min:0,max:1,step:.01,className:"w-full"}),a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:"0 (完全沉默)"}),a.jsx("span",{children:"0.5"}),a.jsx("span",{children:"1.0 (正常)"})]})]})]})]},d))}):a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:a.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),a.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[a.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),a.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function Yee({config:t,onChange:e}){const n=()=>{e({...t,learning_list:[...t.learning_list,["","enable","enable","1.0"]]})},r=x=>{e({...t,learning_list:t.learning_list.filter((v,b)=>b!==x)})},s=(x,v,b)=>{const k=[...t.learning_list];k[x][v]=b,e({...t,learning_list:k})},i=({rule:x})=>{const v=`["${x[0]}", "${x[1]}", "${x[2]}", "${x[3]}"]`;return a.jsxs(co,{children:[a.jsx(uo,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(Fi,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(hl,{className:"w-96",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:v}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},l=({member:x,groupIndex:v,memberIndex:b,availableChatIds:k})=>{const O=k.includes(x)||x==="*",[j,T]=S.useState(!O);return a.jsxs("div",{className:"flex gap-2",children:[a.jsx("div",{className:"flex-1 flex gap-2",children:j?a.jsxs(a.Fragment,{children:[a.jsx(Ae,{value:x,onChange:M=>p(v,b,M.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),k.length>0&&a.jsx(ie,{size:"sm",variant:"outline",onClick:()=>T(!1),title:"切换到下拉选择",children:"下拉"})]}):a.jsxs(a.Fragment,{children:[a.jsxs(Bt,{value:x,onValueChange:M=>p(v,b,M),children:[a.jsx(Dt,{className:"flex-1",children:a.jsx(It,{placeholder:"选择聊天流"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"*",children:"* (全局共享)"}),k.map((M,_)=>a.jsx(Pe,{value:M,children:M},_))]})]}),a.jsx(ie,{size:"sm",variant:"outline",onClick:()=>T(!0),title:"切换到手动输入",children:"输入"})]})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:['确定要删除组成员 "',x||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>m(v,b),children:"删除"})]})]})]})]})},c=()=>{e({...t,expression_groups:[...t.expression_groups,[]]})},d=x=>{e({...t,expression_groups:t.expression_groups.filter((v,b)=>b!==x)})},h=x=>{const v=[...t.expression_groups];v[x]=[...v[x],""],e({...t,expression_groups:v})},m=(x,v)=>{const b=[...t.expression_groups];b[x]=b[x].filter((k,O)=>O!==v),e({...t,expression_groups:b})},p=(x,v,b)=>{const k=[...t.expression_groups];k[x][v]=b,e({...t,expression_groups:k})};return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),a.jsxs("div",{className:"space-y-4",children:[t.learning_list.map((x,v)=>{const b=t.learning_list.some((_,D)=>D!==v&&_[0]===""),k=x[0]==="",O=x[0].split(":"),j=O[0]||"qq",T=O[1]||"",M=O[2]||"group";return a.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["规则 ",v+1," ",k&&"(全局配置)"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(i,{rule:x}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:["确定要删除学习规则 ",v+1," 吗?此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>r(v),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"配置类型"}),a.jsxs(Bt,{value:k?"global":"specific",onValueChange:_=>{_==="global"?s(v,0,""):s(v,0,"qq::group")},disabled:b&&!k,children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"global",children:"全局配置"}),a.jsx(Pe,{value:"specific",disabled:b&&!k,children:"详细配置"})]})]}),b&&!k&&a.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!k&&a.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"平台"}),a.jsxs(Bt,{value:j,onValueChange:_=>{s(v,0,`${_}:${T}:${M}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"qq",children:"QQ"}),a.jsx(Pe,{value:"wx",children:"微信"})]})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"群 ID"}),a.jsx(Ae,{value:T,onChange:_=>{s(v,0,`${j}:${_.target.value}:${M}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"类型"}),a.jsxs(Bt,{value:M,onValueChange:_=>{s(v,0,`${j}:${T}:${_}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"group",children:"群组(group)"}),a.jsx(Pe,{value:"private",children:"私聊(private)"})]})]})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",x[0]||"(未设置)"]})]}),a.jsx("div",{className:"grid gap-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs font-medium",children:"使用学到的表达"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),a.jsx(jt,{checked:x[1]==="enable",onCheckedChange:_=>s(v,1,_?"enable":"disable")})]})}),a.jsx("div",{className:"grid gap-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs font-medium",children:"学习表达"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),a.jsx(jt,{checked:x[2]==="enable",onCheckedChange:_=>s(v,2,_?"enable":"disable")})]})}),a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-xs font-medium",children:"学习强度"}),a.jsx(Ae,{type:"number",step:"0.1",min:"0",max:"5",value:x[3],onChange:_=>{const D=parseFloat(_.target.value);isNaN(D)||s(v,3,Math.max(0,Math.min(5,D)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),a.jsx(yx,{value:[parseFloat(x[3])||1],onValueChange:_=>s(v,3,_[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:"0 (不学习)"}),a.jsx("span",{children:"2.5"}),a.jsx("span",{children:"5.0 (快速学习)"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},v)}),t.learning_list.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),a.jsxs(ie,{onClick:c,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),a.jsxs("div",{className:"space-y-4",children:[t.expression_groups.map((x,v)=>{const b=t.learning_list.map(k=>k[0]).filter(k=>k!=="");return a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",v+1,x.length===1&&x[0]==="*"&&"(全局共享)"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ie,{onClick:()=>h(v),size:"sm",variant:"outline",children:a.jsx(Wr,{className:"h-4 w-4"})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:["确定要删除共享组 ",v+1," 吗?此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>d(v),children:"删除"})]})]})]})]})]}),a.jsx("div",{className:"space-y-2",children:x.map((k,O)=>a.jsx(l,{member:k,groupIndex:v,memberIndex:O,availableChatIds:b},O))}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},v)}),t.expression_groups.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function Kee({emojiConfig:t,memoryConfig:e,toolConfig:n,onEmojiChange:r,onMemoryChange:s,onToolChange:i}){return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:l=>i({...n,enable_tool:l})}),a.jsx(te,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),a.jsx(Ae,{id:"max_agent_iterations",type:"number",min:"1",value:e.max_agent_iterations,onChange:l=>s({...e,max_agent_iterations:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"emoji_chance",children:"表情包激活概率"}),a.jsx(Ae,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:t.emoji_chance,onChange:l=>r({...t,emoji_chance:parseFloat(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_reg_num",children:"最大注册数量"}),a.jsx(Ae,{id:"max_reg_num",type:"number",min:"1",value:t.max_reg_num,onChange:l=>r({...t,max_reg_num:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),a.jsx(Ae,{id:"check_interval",type:"number",min:"1",value:t.check_interval,onChange:l=>r({...t,check_interval:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"do_replace",checked:t.do_replace,onCheckedChange:l=>r({...t,do_replace:l})}),a.jsx(te,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:l=>r({...t,steal_emoji:l})}),a.jsx(te,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),a.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:l=>r({...t,content_filtration:l})}),a.jsx(te,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),t.content_filtration&&a.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[a.jsx(te,{htmlFor:"filtration_prompt",children:"过滤要求"}),a.jsx(Ae,{id:"filtration_prompt",value:t.filtration_prompt,onChange:l=>r({...t,filtration_prompt:l.target.value}),placeholder:"符合公序良俗"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function Zee({keywordReactionConfig:t,responsePostProcessConfig:e,chineseTypoConfig:n,responseSplitterConfig:r,onKeywordReactionChange:s,onResponsePostProcessChange:i,onChineseTypoChange:l,onResponseSplitterChange:c}){const d=()=>{s({...t,regex_rules:[...t.regex_rules,{regex:[""],reaction:""}]})},h=_=>{s({...t,regex_rules:t.regex_rules.filter((D,E)=>E!==_)})},m=(_,D,E)=>{const z=[...t.regex_rules];D==="regex"&&typeof E=="string"?z[_]={...z[_],regex:[E]}:D==="reaction"&&typeof E=="string"&&(z[_]={...z[_],reaction:E}),s({...t,regex_rules:z})},p=({regex:_,reaction:D,onRegexChange:E,onReactionChange:z})=>{const[Q,F]=S.useState(!1),[B,U]=S.useState(""),[V,ce]=S.useState(null),[W,J]=S.useState(""),[H,ae]=S.useState({}),[ne,ue]=S.useState(""),R=S.useRef(null),[me,Y]=S.useState("build"),P=ve=>ve.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),K=(ve,Re=0)=>{const de=R.current;if(!de)return;const We=de.selectionStart||0,ct=de.selectionEnd||0,Oe=_.substring(0,We)+ve+_.substring(ct);E(Oe),setTimeout(()=>{const nt=We+ve.length+Re;de.setSelectionRange(nt,nt),de.focus()},0)};S.useEffect(()=>{if(!_||!B){ce(null),ae({}),ue(D),J("");return}try{const ve=P(_),Re=new RegExp(ve,"g"),de=B.match(Re);ce(de),J("");const ct=new RegExp(ve).exec(B);if(ct&&ct.groups){ae(ct.groups);let Oe=D;Object.entries(ct.groups).forEach(([nt,ut])=>{Oe=Oe.replace(new RegExp(`\\[${nt}\\]`,"g"),ut||"")}),ue(Oe)}else ae({}),ue(D)}catch(ve){J(ve.message),ce(null),ae({}),ue(D)}},[_,B,D]);const $=()=>{if(!B||!V||V.length===0)return a.jsx("span",{className:"text-muted-foreground",children:B||"请输入测试文本"});try{const ve=P(_),Re=new RegExp(ve,"g");let de=0;const We=[];let ct;for(;(ct=Re.exec(B))!==null;)ct.index>de&&We.push(a.jsx("span",{children:B.substring(de,ct.index)},`text-${de}`)),We.push(a.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:ct[0]},`match-${ct.index}`)),de=ct.index+ct[0].length;return de)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return a.jsxs(Rr,{open:Q,onOpenChange:F,children:[a.jsx(mw,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(fg,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"正则表达式编辑器"}),a.jsx(Gr,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),a.jsx(fn,{className:"max-h-[calc(90vh-120px)]",children:a.jsxs(dl,{value:me,onValueChange:ve=>Y(ve),className:"w-full",children:[a.jsxs(va,{className:"grid w-full grid-cols-2",children:[a.jsx($t,{value:"build",children:"🔧 构建器"}),a.jsx($t,{value:"test",children:"🧪 测试器"})]}),a.jsxs(kn,{value:"build",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"正则表达式"}),a.jsx(Ae,{ref:R,value:_,onChange:ve=>E(ve.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"Reaction 内容"}),a.jsx(On,{value:D,onChange:ve=>z(ve.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),a.jsxs("div",{className:"space-y-4 border-t pt-4",children:[fe.map(ve=>a.jsxs("div",{className:"space-y-2",children:[a.jsx("h5",{className:"text-xs font-semibold text-primary",children:ve.category}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:ve.items.map(Re=>a.jsx(ie,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>K(Re.pattern,Re.moveCursor||0),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsxs("div",{className:"flex items-center gap-2 w-full",children:[a.jsx("span",{className:"text-xs font-medium",children:Re.label}),a.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:Re.pattern})]}),a.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:Re.desc})]})},Re.label))})]},ve.category)),a.jsxs("div",{className:"space-y-2 border-t pt-4",children:[a.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("^(?P\\S{1,20})是这样的$"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?P.+?)(?:是|为什么|怎么)"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),a.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),a.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),a.jsxs("li",{children:["命名捕获组格式:",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),a.jsxs("li",{children:["在 reaction 中使用 ",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),a.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),a.jsxs(kn,{value:"test",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"当前正则表达式"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:_||"(未设置)"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),a.jsx(On,{id:"test-text",value:B,onChange:ve=>U(ve.target.value),placeholder:`在此输入要测试的文本... +例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),W&&a.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[a.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),a.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:W})]}),!W&&B&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"flex items-center gap-2",children:V&&V.length>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),a.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",V.length," 处)"]})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),a.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"匹配高亮"}),a.jsx(fn,{className:"h-40 rounded-md bg-muted p-3",children:a.jsx("div",{className:"text-sm break-words",children:$()})})]}),Object.keys(H).length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"命名捕获组"}),a.jsx(fn,{className:"h-32 rounded-md border p-3",children:a.jsx("div",{className:"space-y-2",children:Object.entries(H).map(([ve,Re])=>a.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[a.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",ve,"]"]}),a.jsx("span",{className:"text-muted-foreground",children:"="}),a.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:Re})]},ve))})})]}),Object.keys(H).length>0&&D&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"Reaction 替换预览"}),a.jsx(fn,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:a.jsx("div",{className:"text-sm break-words",children:ne})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),a.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),a.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),a.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),a.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),a.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},x=()=>{s({...t,keyword_rules:[...t.keyword_rules,{keywords:[],reaction:""}]})},v=_=>{s({...t,keyword_rules:t.keyword_rules.filter((D,E)=>E!==_)})},b=(_,D,E)=>{const z=[...t.keyword_rules];typeof E=="string"&&(z[_]={...z[_],reaction:E}),s({...t,keyword_rules:z})},k=_=>{const D=[...t.keyword_rules];D[_]={...D[_],keywords:[...D[_].keywords||[],""]},s({...t,keyword_rules:D})},O=(_,D)=>{const E=[...t.keyword_rules];E[_]={...E[_],keywords:(E[_].keywords||[]).filter((z,Q)=>Q!==D)},s({...t,keyword_rules:E})},j=(_,D,E)=>{const z=[...t.keyword_rules],Q=[...z[_].keywords||[]];Q[D]=E,z[_]={...z[_],keywords:Q},s({...t,keyword_rules:z})},T=({rule:_})=>{const D=`{ regex = [${(_.regex||[]).map(E=>`"${E}"`).join(", ")}], reaction = "${_.reaction}" }`;return a.jsxs(co,{children:[a.jsx(uo,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(Fi,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(hl,{className:"w-[95vw] sm:w-[500px]",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx(fn,{className:"h-60 rounded-md bg-muted p-3",children:a.jsx("pre",{className:"font-mono text-xs break-all",children:D})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},M=({rule:_})=>{const D=`[[keyword_reaction.keyword_rules]] +keywords = [${(_.keywords||[]).map(E=>`"${E}"`).join(", ")}] +reaction = "${_.reaction}"`;return a.jsxs(co,{children:[a.jsx(uo,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(Fi,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(hl,{className:"w-[95vw] sm:w-[500px]",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx(fn,{className:"h-60 rounded-md bg-muted p-3",children:a.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:D})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),a.jsxs(ie,{onClick:d,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),a.jsxs("div",{className:"space-y-3",children:[t.regex_rules.map((_,D)=>a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",D+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(p,{regex:_.regex&&_.regex[0]||"",reaction:_.reaction,onRegexChange:E=>m(D,"regex",E),onReactionChange:E=>m(D,"reaction",E)}),a.jsx(T,{rule:_}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:["确定要删除正则规则 ",D+1," 吗?此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>h(D),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),a.jsx(Ae,{value:_.regex&&_.regex[0]||"",onChange:E=>m(D,"regex",E.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"反应内容"}),a.jsx(On,{value:_.reaction,onChange:E=>m(D,"reaction",E.target.value),placeholder:`触发后麦麦的反应... +可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},D)),t.regex_rules.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),a.jsxs("div",{className:"space-y-4 border-t pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),a.jsxs(ie,{onClick:x,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),a.jsxs("div",{className:"space-y-3",children:[t.keyword_rules.map((_,D)=>a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",D+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(M,{rule:_}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:["确定要删除关键词规则 ",D+1," 吗?此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>v(D),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-xs font-medium",children:"关键词列表"}),a.jsxs(ie,{onClick:()=>k(D),size:"sm",variant:"ghost",children:[a.jsx(Wr,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),a.jsxs("div",{className:"space-y-2",children:[(_.keywords||[]).map((E,z)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ae,{value:E,onChange:Q=>j(D,z,Q.target.value),placeholder:"关键词",className:"flex-1"}),a.jsx(ie,{onClick:()=>O(D,z),size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})]},z)),(!_.keywords||_.keywords.length===0)&&a.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"反应内容"}),a.jsx(On,{value:_.reaction,onChange:E=>b(D,"reaction",E.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},D)),t.keyword_rules.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_response_post_process",checked:e.enable_response_post_process,onCheckedChange:_=>i({...e,enable_response_post_process:_})}),a.jsx(te,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),e.enable_response_post_process&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"border-t pt-6 space-y-4",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[a.jsx(jt,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:_=>l({...n,enable:_})}),a.jsx(te,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&a.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),a.jsx(Ae,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:_=>l({...n,error_rate:parseFloat(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),a.jsx(Ae,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:_=>l({...n,min_freq:parseInt(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),a.jsx(Ae,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:_=>l({...n,tone_error_rate:parseFloat(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),a.jsx(Ae,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:_=>l({...n,word_replace_rate:parseFloat(_.target.value)})})]})]})]})}),a.jsx("div",{className:"border-t pt-6 space-y-4",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[a.jsx(jt,{id:"enable_response_splitter",checked:r.enable,onCheckedChange:_=>c({...r,enable:_})}),a.jsx(te,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),r.enable&&a.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),a.jsx(Ae,{id:"max_length",type:"number",min:"1",value:r.max_length,onChange:_=>c({...r,max_length:parseInt(_.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),a.jsx(Ae,{id:"max_sentence_num",type:"number",min:"1",value:r.max_sentence_num,onChange:_=>c({...r,max_sentence_num:parseInt(_.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_kaomoji_protection",checked:r.enable_kaomoji_protection,onCheckedChange:_=>c({...r,enable_kaomoji_protection:_})}),a.jsx(te,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_overflow_return_all",checked:r.enable_overflow_return_all,onCheckedChange:_=>c({...r,enable_overflow_return_all:_})}),a.jsx(te,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),a.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function Jee({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用情绪系统"})]}),t.enable_mood&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"情绪更新阈值"}),a.jsx(Ae,{type:"number",min:"1",value:t.mood_update_threshold,onChange:n=>e({...t,mood_update_threshold:parseInt(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"情感特征"}),a.jsx(On,{value:t.emotion_style,onChange:n=>e({...t,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function ete({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable_asr,onCheckedChange:n=>e({...t,enable_asr:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用语音识别"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function tte({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),t.enable&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"LPMM 模式"}),a.jsxs(Bt,{value:t.lpmm_mode,onValueChange:n=>e({...t,lpmm_mode:n}),children:[a.jsx(Dt,{children:a.jsx(It,{placeholder:"选择 LPMM 模式"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"classic",children:"经典模式"}),a.jsx(Pe,{value:"agent",children:"Agent 模式"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"同义词搜索 TopK"}),a.jsx(Ae,{type:"number",min:"1",value:t.rag_synonym_search_top_k,onChange:n=>e({...t,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"同义词阈值"}),a.jsx(Ae,{type:"number",step:"0.1",min:"0",max:"1",value:t.rag_synonym_threshold,onChange:n=>e({...t,rag_synonym_threshold:parseFloat(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"实体提取线程数"}),a.jsx(Ae,{type:"number",min:"1",value:t.info_extraction_workers,onChange:n=>e({...t,info_extraction_workers:parseInt(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"嵌入向量维度"}),a.jsx(Ae,{type:"number",min:"1",value:t.embedding_dimension,onChange:n=>e({...t,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function nte({config:t,onChange:e}){const[n,r]=S.useState(""),[s,i]=S.useState("WARNING"),l=()=>{n&&!t.suppress_libraries.includes(n)&&(e({...t,suppress_libraries:[...t.suppress_libraries,n]}),r(""))},c=v=>{e({...t,suppress_libraries:t.suppress_libraries.filter(b=>b!==v)})},d=()=>{n&&!t.library_log_levels[n]&&(e({...t,library_log_levels:{...t.library_log_levels,[n]:s}}),r(""),i("WARNING"))},h=v=>{const b={...t.library_log_levels};delete b[v],e({...t,library_log_levels:b})},m=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],p=["FULL","compact","lite"],x=["none","title","full"];return a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日期格式"}),a.jsx(Ae,{value:t.date_style,onChange:v=>e({...t,date_style:v.target.value}),placeholder:"例如: m-d H:i:s"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日志级别样式"}),a.jsxs(Bt,{value:t.log_level_style,onValueChange:v=>e({...t,log_level_style:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:p.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日志文本颜色"}),a.jsxs(Bt,{value:t.color_text,onValueChange:v=>e({...t,color_text:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:x.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"全局日志级别"}),a.jsxs(Bt,{value:t.log_level,onValueChange:v=>e({...t,log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"控制台日志级别"}),a.jsxs(Bt,{value:t.console_log_level,onValueChange:v=>e({...t,console_log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"文件日志级别"}),a.jsxs(Bt,{value:t.file_log_level,onValueChange:v=>e({...t,file_log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"完全屏蔽的库"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Ae,{value:n,onChange:v=>r(v.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),l())}}),a.jsx(ie,{onClick:l,size:"sm",className:"flex-shrink-0",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:t.suppress_libraries.map(v=>a.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[a.jsx("span",{className:"text-sm",children:v}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>c(v),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},v))})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"特定库的日志级别"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Ae,{value:n,onChange:v=>r(v.target.value),placeholder:"输入库名",className:"flex-1"}),a.jsxs(Bt,{value:s,onValueChange:i,children:[a.jsx(Dt,{className:"w-32",children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]}),a.jsx(ie,{onClick:d,size:"sm",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"space-y-2",children:Object.entries(t.library_log_levels).map(([v,b])=>a.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[a.jsx("span",{className:"text-sm font-medium",children:v}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:b}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>h(v),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},v))})]})]})}function rte({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示 Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),a.jsx(jt,{checked:t.show_prompt,onCheckedChange:n=>e({...t,show_prompt:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示回复器 Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),a.jsx(jt,{checked:t.show_replyer_prompt,onCheckedChange:n=>e({...t,show_replyer_prompt:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示回复器推理"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),a.jsx(jt,{checked:t.show_replyer_reasoning,onCheckedChange:n=>e({...t,show_replyer_reasoning:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示 Jargon Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),a.jsx(jt,{checked:t.show_jargon_prompt,onCheckedChange:n=>e({...t,show_jargon_prompt:n})})]})]})]})}function ste({config:t,onChange:e}){const[n,r]=S.useState(""),s=()=>{n&&!t.auth_token.includes(n)&&(e({...t,auth_token:[...t.auth_token,n]}),r(""))},i=l=>{e({...t,auth_token:t.auth_token.filter((c,d)=>d!==l)})};return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"启用自定义服务器"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),a.jsx(jt,{checked:t.use_custom,onCheckedChange:l=>e({...t,use_custom:l})})]}),t.use_custom&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"主机地址"}),a.jsx(Ae,{value:t.host,onChange:l=>e({...t,host:l.target.value}),placeholder:"127.0.0.1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"端口号"}),a.jsx(Ae,{type:"number",value:t.port,onChange:l=>e({...t,port:parseInt(l.target.value)}),placeholder:"8090"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"连接模式"}),a.jsxs(Bt,{value:t.mode,onValueChange:l=>e({...t,mode:l}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"ws",children:"WebSocket (ws)"}),a.jsx(Pe,{value:"tcp",children:"TCP"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.use_wss,onCheckedChange:l=>e({...t,use_wss:l}),disabled:t.mode!=="ws"}),a.jsx(te,{children:"使用 WSS 安全连接"})]})]}),t.use_wss&&t.mode==="ws"&&a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"SSL 证书文件路径"}),a.jsx(Ae,{value:t.cert_file,onChange:l=>e({...t,cert_file:l.target.value}),placeholder:"cert.pem"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"SSL 密钥文件路径"}),a.jsx(Ae,{value:t.key_file,onChange:l=>e({...t,key_file:l.target.value}),placeholder:"key.pem"})]})]})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"认证令牌"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Ae,{value:n,onChange:l=>r(l.target.value),placeholder:"输入认证令牌",onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),s())}}),a.jsx(ie,{onClick:s,size:"sm",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"space-y-2",children:t.auth_token.map((l,c)=>a.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[a.jsx("span",{className:"text-sm font-mono",children:l}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>i(c),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},c))})]})]})}function ite({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"启用统计信息发送"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),a.jsx(jt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})})]})]})}const Ac=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{className:"relative w-full overflow-auto",children:a.jsx("table",{ref:n,className:ye("w-full caption-bottom text-sm",t),...e})}));Ac.displayName="Table";const Ec=S.forwardRef(({className:t,...e},n)=>a.jsx("thead",{ref:n,className:ye("[&_tr]:border-b",t),...e}));Ec.displayName="TableHeader";const _c=S.forwardRef(({className:t,...e},n)=>a.jsx("tbody",{ref:n,className:ye("[&_tr:last-child]:border-0",t),...e}));_c.displayName="TableBody";const ate=S.forwardRef(({className:t,...e},n)=>a.jsx("tfoot",{ref:n,className:ye("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));ate.displayName="TableFooter";const xr=S.forwardRef(({className:t,...e},n)=>a.jsx("tr",{ref:n,className:ye("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));xr.displayName="TableRow";const gt=S.forwardRef(({className:t,...e},n)=>a.jsx("th",{ref:n,className:ye("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));gt.displayName="TableHead";const it=S.forwardRef(({className:t,...e},n)=>a.jsx("td",{ref:n,className:ye("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));it.displayName="TableCell";const lte=S.forwardRef(({className:t,...e},n)=>a.jsx("caption",{ref:n,className:ye("mt-4 text-sm text-muted-foreground",t),...e}));lte.displayName="TableCaption";const ss=S.forwardRef(({className:t,...e},n)=>a.jsx(M9,{ref:n,className:ye("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:a.jsx(rq,{className:ye("grid place-content-center text-current"),children:a.jsx(hc,{className:"h-4 w-4"})})}));ss.displayName=M9.displayName;function ote(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(null),[T,M]=S.useState(null),[_,D]=S.useState(!1),[E,z]=S.useState(null),[Q,F]=S.useState(!1),[B,U]=S.useState(""),[V,ce]=S.useState(new Set),[W,J]=S.useState(!1),[H,ae]=S.useState(1),[ne,ue]=S.useState(20),[R,me]=S.useState(""),{toast:Y}=Pr(),P=S.useRef(null),K=S.useRef(!0);S.useEffect(()=>{$()},[]);const $=async()=>{try{r(!0);const ee=await Vu();e(ee.api_providers||[]),h(!1),K.current=!1}catch(ee){console.error("加载配置失败:",ee)}finally{r(!1)}},fe=async()=>{try{p(!0),xw().catch(()=>{}),v(!0)}catch(ee){console.error("重启失败:",ee),v(!1),Y({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),p(!1)}},ve=async()=>{try{i(!0),P.current&&clearTimeout(P.current);const ee=await Vu();ee.api_providers=t,await wg(ee),h(!1),Y({title:"保存成功",description:"正在重启麦麦..."}),await fe()}catch(ee){console.error("保存配置失败:",ee),Y({title:"保存失败",description:ee.message,variant:"destructive"}),i(!1)}},Re=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},de=()=>{v(!1),p(!1),Y({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},We=S.useCallback(async ee=>{if(!K.current)try{c(!0),await h2("api_providers",ee),h(!1)}catch(Se){console.error("自动保存失败:",Se),h(!0)}finally{c(!1)}},[]);S.useEffect(()=>{if(!K.current)return h(!0),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{We(t)},2e3),()=>{P.current&&clearTimeout(P.current)}},[t,We]);const ct=async()=>{try{i(!0),P.current&&clearTimeout(P.current);const ee=await Vu();ee.api_providers=t,await wg(ee),h(!1),Y({title:"保存成功",description:"模型提供商配置已保存"})}catch(ee){console.error("保存配置失败:",ee),Y({title:"保存失败",description:ee.message,variant:"destructive"})}finally{i(!1)}},Oe=(ee,Se)=>{j(ee||{name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),M(Se),F(!1),k(!0)},nt=async()=>{if(O?.api_key)try{await navigator.clipboard.writeText(O.api_key),Y({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{Y({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},ut=()=>{if(!O)return;const ee={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};if(T!==null){const Se=[...t];Se[T]=ee,e(Se)}else e([...t,ee]);k(!1),j(null),M(null)},Ct=ee=>{if(!ee&&O){const Se={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};j(Se)}k(ee)},Bn=ee=>{z(ee),D(!0)},Tn=()=>{if(E!==null){const ee=t.filter((Se,Le)=>Le!==E);e(ee),Y({title:"删除成功",description:"提供商已从列表中移除"})}D(!1),z(null)},Jn=ee=>{const Se=new Set(V);Se.has(ee)?Se.delete(ee):Se.add(ee),ce(Se)},nn=()=>{if(V.size===In.length)ce(new Set);else{const ee=In.map((Se,Le)=>t.findIndex(rt=>rt===In[Le]));ce(new Set(ee))}},_t=()=>{if(V.size===0){Y({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}J(!0)},Yr=()=>{const ee=t.filter((Se,Le)=>!V.has(Le));e(ee),ce(new Set),J(!1),Y({title:"批量删除成功",description:`已删除 ${V.size} 个提供商`})},In=t.filter(ee=>{if(!B)return!0;const Se=B.toLowerCase();return ee.name.toLowerCase().includes(Se)||ee.base_url.toLowerCase().includes(Se)||ee.client_type.toLowerCase().includes(Se)}),or=Math.ceil(In.length/ne),yn=In.slice((H-1)*ne,H*ne),ft=()=>{const ee=parseInt(R);ee>=1&&ee<=or&&(ae(ee),me(""))};return n?a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型提供商配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 API 提供商配置"})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[V.size>0&&a.jsxs(ie,{onClick:_t,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",V.size,")"]}),a.jsxs(ie,{onClick:()=>Oe(null,null),size:"sm",className:"w-full sm:w-auto",children:[a.jsx(Wr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),a.jsxs(ie,{onClick:ct,disabled:s||l||!d||m,size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),s?"保存中...":l?"自动保存中...":d?"保存配置":"已保存"]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:s||l||m,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),m?"重启中...":d?"保存并重启":"重启麦麦"]})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认重启麦麦?"}),a.jsx(un,{children:d?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:d?ve:fe,children:d?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(oo,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),a.jsxs(fn,{className:"h-[calc(100vh-260px)]",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[a.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[a.jsx(Ps,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Ae,{placeholder:"搜索提供商名称、URL 或类型...",value:B,onChange:ee=>U(ee.target.value),className:"pl-9"})]}),B&&a.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",In.length," 个结果"]})]}),a.jsx("div",{className:"md:hidden space-y-3",children:In.length===0?a.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:B?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):yn.map((ee,Se)=>{const Le=t.findIndex(rt=>rt===ee);return a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h3",{className:"font-semibold text-base truncate",children:ee.name}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:ee.base_url})]}),a.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Oe(ee,Le),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>Bn(Le),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),a.jsx("p",{className:"font-medium",children:ee.client_type})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),a.jsx("p",{className:"font-medium",children:ee.max_retry})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),a.jsx("p",{className:"font-medium",children:ee.timeout})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),a.jsx("p",{className:"font-medium",children:ee.retry_interval})]})]})]},Se)})}),a.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:a.jsxs(Ac,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(gt,{className:"w-12",children:a.jsx(ss,{checked:V.size===In.length&&In.length>0,onCheckedChange:nn})}),a.jsx(gt,{children:"名称"}),a.jsx(gt,{children:"基础URL"}),a.jsx(gt,{children:"客户端类型"}),a.jsx(gt,{className:"text-right",children:"最大重试"}),a.jsx(gt,{className:"text-right",children:"超时(秒)"}),a.jsx(gt,{className:"text-right",children:"重试间隔(秒)"}),a.jsx(gt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:yn.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center text-muted-foreground py-8",children:B?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):yn.map((ee,Se)=>{const Le=t.findIndex(rt=>rt===ee);return a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:V.has(Le),onCheckedChange:()=>Jn(Le)})}),a.jsx(it,{className:"font-medium",children:ee.name}),a.jsx(it,{className:"max-w-xs truncate",title:ee.base_url,children:ee.base_url}),a.jsx(it,{children:ee.client_type}),a.jsx(it,{className:"text-right",children:ee.max_retry}),a.jsx(it,{className:"text-right",children:ee.timeout}),a.jsx(it,{className:"text-right",children:ee.retry_interval}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Oe(ee,Le),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>Bn(Le),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Se)})})]})}),In.length>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Bt,{value:ne.toString(),onValueChange:ee=>{ue(parseInt(ee)),ae(1),ce(new Set)},children:[a.jsx(Dt,{id:"page-size-provider",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(H-1)*ne+1," 到"," ",Math.min(H*ne,In.length)," 条,共 ",In.length," 条"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ae(1),disabled:H===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(ee=>Math.max(1,ee-1)),disabled:H===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ae,{type:"number",value:R,onChange:ee=>me(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&ft(),placeholder:H.toString(),className:"w-16 h-8 text-center",min:1,max:or}),a.jsx(ie,{variant:"outline",size:"sm",onClick:ft,disabled:!R,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(ee=>ee+1),disabled:H>=or,children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Mc,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ae(or),disabled:H>=or,className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]}),a.jsx(Rr,{open:b,onOpenChange:Ct,children:a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:T!==null?"编辑提供商":"添加提供商"}),a.jsx(Gr,{children:"配置 API 提供商的连接信息和参数"})]}),a.jsxs("div",{className:"grid gap-4 py-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"name",children:"名称 *"}),a.jsx(Ae,{id:"name",value:O?.name||"",onChange:ee=>j(Se=>Se?{...Se,name:ee.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"base_url",children:"基础 URL *"}),a.jsx(Ae,{id:"base_url",value:O?.base_url||"",onChange:ee=>j(Se=>Se?{...Se,base_url:ee.target.value}:null),placeholder:"https://api.example.com/v1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"api_key",children:"API Key *"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ae,{id:"api_key",type:Q?"text":"password",value:O?.api_key||"",onChange:ee=>j(Se=>Se?{...Se,api_key:ee.target.value}:null),placeholder:"sk-...",className:"flex-1"}),a.jsx(ie,{type:"button",variant:"outline",size:"icon",onClick:()=>F(!Q),title:Q?"隐藏密钥":"显示密钥",children:Q?a.jsx(Yb,{className:"h-4 w-4"}):a.jsx(Fi,{className:"h-4 w-4"})}),a.jsx(ie,{type:"button",variant:"outline",size:"icon",onClick:nt,title:"复制密钥",children:a.jsx(Xb,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"client_type",children:"客户端类型"}),a.jsxs(Bt,{value:O?.client_type||"openai",onValueChange:ee=>j(Se=>Se?{...Se,client_type:ee}:null),children:[a.jsx(Dt,{id:"client_type",children:a.jsx(It,{placeholder:"选择客户端类型"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"openai",children:"OpenAI"}),a.jsx(Pe,{value:"gemini",children:"Gemini"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_retry",children:"最大重试"}),a.jsx(Ae,{id:"max_retry",type:"number",min:"0",value:O?.max_retry??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Le=>Le?{...Le,max_retry:Se}:null)},placeholder:"默认: 2"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"timeout",children:"超时(秒)"}),a.jsx(Ae,{id:"timeout",type:"number",min:"1",value:O?.timeout??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Le=>Le?{...Le,timeout:Se}:null)},placeholder:"默认: 30"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),a.jsx(Ae,{id:"retry_interval",type:"number",min:"1",value:O?.retry_interval??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Le=>Le?{...Le,retry_interval:Se}:null)},placeholder:"默认: 10"})]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>k(!1),children:"取消"}),a.jsx(ie,{onClick:ut,children:"保存"})]})]})}),a.jsx(mn,{open:_,onOpenChange:D,children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:['确定要删除提供商 "',E!==null?t[E]?.name:"",'" 吗? 此操作无法撤销。']})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:Tn,children:"删除"})]})]})}),a.jsx(mn,{open:W,onOpenChange:J,children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认批量删除"}),a.jsxs(un,{children:["确定要删除选中的 ",V.size," 个提供商吗? 此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:Yr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),x&&a.jsx(vw,{onRestartComplete:Re,onRestartFailed:de})]})}var a8=1,cte=.9,ute=.8,dte=.17,cb=.1,ub=.999,hte=.9999,fte=.99,mte=/[\\\/_+.#"@\[\(\{&]/,pte=/[\\\/_+.#"@\[\(\{&]/g,gte=/[\s-]/,B_=/[\s-]/g;function u4(t,e,n,r,s,i,l){if(i===e.length)return s===t.length?a8:fte;var c=`${s},${i}`;if(l[c]!==void 0)return l[c];for(var d=r.charAt(i),h=n.indexOf(d,s),m=0,p,x,v,b;h>=0;)p=u4(t,e,n,r,h+1,i+1,l),p>m&&(h===s?p*=a8:mte.test(t.charAt(h-1))?(p*=ute,v=t.slice(s,h-1).match(pte),v&&s>0&&(p*=Math.pow(ub,v.length))):gte.test(t.charAt(h-1))?(p*=cte,b=t.slice(s,h-1).match(B_),b&&s>0&&(p*=Math.pow(ub,b.length))):(p*=dte,s>0&&(p*=Math.pow(ub,h-s))),t.charAt(h)!==e.charAt(i)&&(p*=hte)),(pp&&(p=x*cb)),p>m&&(m=p),h=n.indexOf(d,h+1);return l[c]=m,m}function l8(t){return t.toLowerCase().replace(B_," ")}function xte(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,u4(t,e,l8(t),l8(e),0,0,{})}var vte=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Co=vte.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Lh='[cmdk-group=""]',db='[cmdk-group-items=""]',yte='[cmdk-group-heading=""]',I_='[cmdk-item=""]',o8=`${I_}:not([aria-disabled="true"])`,d4="cmdk-item-select",Pu="data-value",bte=(t,e,n)=>xte(t,e,n),q_=S.createContext(void 0),g0=()=>S.useContext(q_),F_=S.createContext(void 0),o5=()=>S.useContext(F_),Q_=S.createContext(void 0),$_=S.forwardRef((t,e)=>{let n=Lu(()=>{var Y,P;return{search:"",value:(P=(Y=t.value)!=null?Y:t.defaultValue)!=null?P:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Lu(()=>new Set),s=Lu(()=>new Map),i=Lu(()=>new Map),l=Lu(()=>new Set),c=H_(t),{label:d,children:h,value:m,onValueChange:p,filter:x,shouldFilter:v,loop:b,disablePointerSelection:k=!1,vimBindings:O=!0,...j}=t,T=Oi(),M=Oi(),_=Oi(),D=S.useRef(null),E=Ete();Nc(()=>{if(m!==void 0){let Y=m.trim();n.current.value=Y,z.emit()}},[m]),Nc(()=>{E(6,ce)},[]);let z=S.useMemo(()=>({subscribe:Y=>(l.current.add(Y),()=>l.current.delete(Y)),snapshot:()=>n.current,setState:(Y,P,K)=>{var $,fe,ve,Re;if(!Object.is(n.current[Y],P)){if(n.current[Y]=P,Y==="search")V(),B(),E(1,U);else if(Y==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let de=document.getElementById(_);de?de.focus():($=document.getElementById(T))==null||$.focus()}if(E(7,()=>{var de;n.current.selectedItemId=(de=W())==null?void 0:de.id,z.emit()}),K||E(5,ce),((fe=c.current)==null?void 0:fe.value)!==void 0){let de=P??"";(Re=(ve=c.current).onValueChange)==null||Re.call(ve,de);return}}z.emit()}},emit:()=>{l.current.forEach(Y=>Y())}}),[]),Q=S.useMemo(()=>({value:(Y,P,K)=>{var $;P!==(($=i.current.get(Y))==null?void 0:$.value)&&(i.current.set(Y,{value:P,keywords:K}),n.current.filtered.items.set(Y,F(P,K)),E(2,()=>{B(),z.emit()}))},item:(Y,P)=>(r.current.add(Y),P&&(s.current.has(P)?s.current.get(P).add(Y):s.current.set(P,new Set([Y]))),E(3,()=>{V(),B(),n.current.value||U(),z.emit()}),()=>{i.current.delete(Y),r.current.delete(Y),n.current.filtered.items.delete(Y);let K=W();E(4,()=>{V(),K?.getAttribute("id")===Y&&U(),z.emit()})}),group:Y=>(s.current.has(Y)||s.current.set(Y,new Set),()=>{i.current.delete(Y),s.current.delete(Y)}),filter:()=>c.current.shouldFilter,label:d||t["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:T,inputId:_,labelId:M,listInnerRef:D}),[]);function F(Y,P){var K,$;let fe=($=(K=c.current)==null?void 0:K.filter)!=null?$:bte;return Y?fe(Y,n.current.search,P):0}function B(){if(!n.current.search||c.current.shouldFilter===!1)return;let Y=n.current.filtered.items,P=[];n.current.filtered.groups.forEach($=>{let fe=s.current.get($),ve=0;fe.forEach(Re=>{let de=Y.get(Re);ve=Math.max(de,ve)}),P.push([$,ve])});let K=D.current;J().sort(($,fe)=>{var ve,Re;let de=$.getAttribute("id"),We=fe.getAttribute("id");return((ve=Y.get(We))!=null?ve:0)-((Re=Y.get(de))!=null?Re:0)}).forEach($=>{let fe=$.closest(db);fe?fe.appendChild($.parentElement===fe?$:$.closest(`${db} > *`)):K.appendChild($.parentElement===K?$:$.closest(`${db} > *`))}),P.sort(($,fe)=>fe[1]-$[1]).forEach($=>{var fe;let ve=(fe=D.current)==null?void 0:fe.querySelector(`${Lh}[${Pu}="${encodeURIComponent($[0])}"]`);ve?.parentElement.appendChild(ve)})}function U(){let Y=J().find(K=>K.getAttribute("aria-disabled")!=="true"),P=Y?.getAttribute(Pu);z.setState("value",P||void 0)}function V(){var Y,P,K,$;if(!n.current.search||c.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let fe=0;for(let ve of r.current){let Re=(P=(Y=i.current.get(ve))==null?void 0:Y.value)!=null?P:"",de=($=(K=i.current.get(ve))==null?void 0:K.keywords)!=null?$:[],We=F(Re,de);n.current.filtered.items.set(ve,We),We>0&&fe++}for(let[ve,Re]of s.current)for(let de of Re)if(n.current.filtered.items.get(de)>0){n.current.filtered.groups.add(ve);break}n.current.filtered.count=fe}function ce(){var Y,P,K;let $=W();$&&(((Y=$.parentElement)==null?void 0:Y.firstChild)===$&&((K=(P=$.closest(Lh))==null?void 0:P.querySelector(yte))==null||K.scrollIntoView({block:"nearest"})),$.scrollIntoView({block:"nearest"}))}function W(){var Y;return(Y=D.current)==null?void 0:Y.querySelector(`${I_}[aria-selected="true"]`)}function J(){var Y;return Array.from(((Y=D.current)==null?void 0:Y.querySelectorAll(o8))||[])}function H(Y){let P=J()[Y];P&&z.setState("value",P.getAttribute(Pu))}function ae(Y){var P;let K=W(),$=J(),fe=$.findIndex(Re=>Re===K),ve=$[fe+Y];(P=c.current)!=null&&P.loop&&(ve=fe+Y<0?$[$.length-1]:fe+Y===$.length?$[0]:$[fe+Y]),ve&&z.setState("value",ve.getAttribute(Pu))}function ne(Y){let P=W(),K=P?.closest(Lh),$;for(;K&&!$;)K=Y>0?Mte(K,Lh):Ate(K,Lh),$=K?.querySelector(o8);$?z.setState("value",$.getAttribute(Pu)):ae(Y)}let ue=()=>H(J().length-1),R=Y=>{Y.preventDefault(),Y.metaKey?ue():Y.altKey?ne(1):ae(1)},me=Y=>{Y.preventDefault(),Y.metaKey?H(0):Y.altKey?ne(-1):ae(-1)};return S.createElement(Co.div,{ref:e,tabIndex:-1,...j,"cmdk-root":"",onKeyDown:Y=>{var P;(P=j.onKeyDown)==null||P.call(j,Y);let K=Y.nativeEvent.isComposing||Y.keyCode===229;if(!(Y.defaultPrevented||K))switch(Y.key){case"n":case"j":{O&&Y.ctrlKey&&R(Y);break}case"ArrowDown":{R(Y);break}case"p":case"k":{O&&Y.ctrlKey&&me(Y);break}case"ArrowUp":{me(Y);break}case"Home":{Y.preventDefault(),H(0);break}case"End":{Y.preventDefault(),ue();break}case"Enter":{Y.preventDefault();let $=W();if($){let fe=new Event(d4);$.dispatchEvent(fe)}}}}},S.createElement("label",{"cmdk-label":"",htmlFor:Q.inputId,id:Q.labelId,style:Dte},d),Px(t,Y=>S.createElement(F_.Provider,{value:z},S.createElement(q_.Provider,{value:Q},Y))))}),wte=S.forwardRef((t,e)=>{var n,r;let s=Oi(),i=S.useRef(null),l=S.useContext(Q_),c=g0(),d=H_(t),h=(r=(n=d.current)==null?void 0:n.forceMount)!=null?r:l?.forceMount;Nc(()=>{if(!h)return c.item(s,l?.id)},[h]);let m=U_(s,i,[t.value,t.children,i],t.keywords),p=o5(),x=xo(E=>E.value&&E.value===m.current),v=xo(E=>h||c.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);S.useEffect(()=>{let E=i.current;if(!(!E||t.disabled))return E.addEventListener(d4,b),()=>E.removeEventListener(d4,b)},[v,t.onSelect,t.disabled]);function b(){var E,z;k(),(z=(E=d.current).onSelect)==null||z.call(E,m.current)}function k(){p.setState("value",m.current,!0)}if(!v)return null;let{disabled:O,value:j,onSelect:T,forceMount:M,keywords:_,...D}=t;return S.createElement(Co.div,{ref:lo(i,e),...D,id:s,"cmdk-item":"",role:"option","aria-disabled":!!O,"aria-selected":!!x,"data-disabled":!!O,"data-selected":!!x,onPointerMove:O||c.getDisablePointerSelection()?void 0:k,onClick:O?void 0:b},t.children)}),Ste=S.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,l=Oi(),c=S.useRef(null),d=S.useRef(null),h=Oi(),m=g0(),p=xo(v=>s||m.filter()===!1?!0:v.search?v.filtered.groups.has(l):!0);Nc(()=>m.group(l),[]),U_(l,c,[t.value,t.heading,d]);let x=S.useMemo(()=>({id:l,forceMount:s}),[s]);return S.createElement(Co.div,{ref:lo(c,e),...i,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},n&&S.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),Px(t,v=>S.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},S.createElement(Q_.Provider,{value:x},v))))}),kte=S.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=S.useRef(null),i=xo(l=>!l.search);return!n&&!i?null:S.createElement(Co.div,{ref:lo(s,e),...r,"cmdk-separator":"",role:"separator"})}),Ote=S.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=o5(),l=xo(h=>h.search),c=xo(h=>h.selectedItemId),d=g0();return S.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),S.createElement(Co.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":c,id:d.inputId,type:"text",value:s?t.value:l,onChange:h=>{s||i.setState("search",h.target.value),n?.(h.target.value)}})}),jte=S.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=S.useRef(null),l=S.useRef(null),c=xo(h=>h.selectedItemId),d=g0();return S.useEffect(()=>{if(l.current&&i.current){let h=l.current,m=i.current,p,x=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let v=h.offsetHeight;m.style.setProperty("--cmdk-list-height",v.toFixed(1)+"px")})});return x.observe(h),()=>{cancelAnimationFrame(p),x.unobserve(h)}}},[]),S.createElement(Co.div,{ref:lo(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":r,id:d.listId},Px(t,h=>S.createElement("div",{ref:lo(l,d.listInnerRef),"cmdk-list-sizer":""},h)))}),Nte=S.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:l,...c}=t;return S.createElement(W4,{open:n,onOpenChange:r},S.createElement($4,{container:l},S.createElement(nx,{"cmdk-overlay":"",className:s}),S.createElement(rx,{"aria-label":t.label,"cmdk-dialog":"",className:i},S.createElement($_,{ref:e,...c}))))}),Cte=S.forwardRef((t,e)=>xo(n=>n.filtered.count===0)?S.createElement(Co.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),Tte=S.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return S.createElement(Co.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Px(t,l=>S.createElement("div",{"aria-hidden":!0},l)))}),Bs=Object.assign($_,{List:jte,Item:wte,Input:Ote,Group:Ste,Separator:kte,Dialog:Nte,Empty:Cte,Loading:Tte});function Mte(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function Ate(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function H_(t){let e=S.useRef(t);return Nc(()=>{e.current=t}),e}var Nc=typeof window>"u"?S.useEffect:S.useLayoutEffect;function Lu(t){let e=S.useRef();return e.current===void 0&&(e.current=t()),e}function xo(t){let e=o5(),n=()=>t(e.snapshot());return S.useSyncExternalStore(e.subscribe,n,n)}function U_(t,e,n,r=[]){let s=S.useRef(),i=g0();return Nc(()=>{var l;let c=(()=>{var h;for(let m of n){if(typeof m=="string")return m.trim();if(typeof m=="object"&&"current"in m)return m.current?(h=m.current.textContent)==null?void 0:h.trim():s.current}})(),d=r.map(h=>h.trim());i.value(t,c,d),(l=e.current)==null||l.setAttribute(Pu,c),s.current=c}),s}var Ete=()=>{let[t,e]=S.useState(),n=Lu(()=>new Map);return Nc(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function _te(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function Px({asChild:t,children:e},n){return t&&S.isValidElement(e)?S.cloneElement(_te(e),{ref:e.ref},n(e.props.children)):n(e)}var Dte={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const V_=S.forwardRef(({className:t,...e},n)=>a.jsx(Bs,{ref:n,className:ye("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));V_.displayName=Bs.displayName;const W_=S.forwardRef(({className:t,...e},n)=>a.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[a.jsx(Ps,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),a.jsx(Bs.Input,{ref:n,className:ye("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));W_.displayName=Bs.Input.displayName;const G_=S.forwardRef(({className:t,...e},n)=>a.jsx(Bs.List,{ref:n,className:ye("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));G_.displayName=Bs.List.displayName;const X_=S.forwardRef((t,e)=>a.jsx(Bs.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));X_.displayName=Bs.Empty.displayName;const Y_=S.forwardRef(({className:t,...e},n)=>a.jsx(Bs.Group,{ref:n,className:ye("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...e}));Y_.displayName=Bs.Group.displayName;const Rte=S.forwardRef(({className:t,...e},n)=>a.jsx(Bs.Separator,{ref:n,className:ye("-mx-1 h-px bg-border",t),...e}));Rte.displayName=Bs.Separator.displayName;const K_=S.forwardRef(({className:t,...e},n)=>a.jsx(Bs.Item,{ref:n,className:ye("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...e}));K_.displayName=Bs.Item.displayName;function zte({options:t,selected:e,onChange:n,placeholder:r="选择选项...",emptyText:s="未找到选项",className:i}){const[l,c]=S.useState(!1),d=m=>{e.includes(m)?n(e.filter(p=>p!==m)):n([...e,m])},h=m=>{n(e.filter(p=>p!==m))};return a.jsxs(co,{open:l,onOpenChange:c,children:[a.jsx(uo,{asChild:!0,children:a.jsxs(ie,{variant:"outline",role:"combobox","aria-expanded":l,className:ye("w-full justify-between min-h-10 h-auto",i),children:[a.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:e.length===0?a.jsx("span",{className:"text-muted-foreground",children:r}):e.map(m=>{const p=t.find(x=>x.value===m);return a.jsxs($n,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80",onClick:x=>{x.stopPropagation(),h(m)},children:[p?.label||m,a.jsx(Gf,{className:"ml-1 h-3 w-3",strokeWidth:2,fill:"none"})]},m)})}),a.jsx(Sq,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),a.jsx(hl,{className:"w-full p-0",align:"start",children:a.jsxs(V_,{children:[a.jsx(W_,{placeholder:"搜索...",className:"h-9"}),a.jsxs(G_,{children:[a.jsx(X_,{children:s}),a.jsx(Y_,{children:t.map(m=>{const p=e.includes(m.value);return a.jsxs(K_,{value:m.value,onSelect:()=>d(m.value),children:[a.jsx("div",{className:ye("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",p?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:a.jsx(hc,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),a.jsx("span",{children:m.label})]},m.value)})})]})]})})]})}function Pte(){const[t,e]=S.useState([]),[n,r]=S.useState([]),[s,i]=S.useState([]),[l,c]=S.useState(null),[d,h]=S.useState(!0),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,M]=S.useState(!1),[_,D]=S.useState(!1),[E,z]=S.useState(null),[Q,F]=S.useState(null),[B,U]=S.useState(!1),[V,ce]=S.useState(null),[W,J]=S.useState(""),[H,ae]=S.useState(new Set),[ne,ue]=S.useState(!1),[R,me]=S.useState(1),[Y,P]=S.useState(20),[K,$]=S.useState(""),{toast:fe}=Pr(),ve=S.useRef(null),Re=S.useRef(null),de=S.useRef(!0);S.useEffect(()=>{We()},[]);const We=async()=>{try{h(!0);const re=await Vu(),Me=re.models||[];e(Me),i(Me.map(vt=>vt.name));const pt=re.api_providers||[];r(pt.map(vt=>vt.name)),c(re.model_task_config||null),k(!1),de.current=!1}catch(re){console.error("加载配置失败:",re)}finally{h(!1)}},ct=async()=>{try{j(!0),xw().catch(()=>{}),M(!0)}catch(re){console.error("重启失败:",re),M(!1),fe({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),j(!1)}},Oe=async()=>{try{p(!0),ve.current&&clearTimeout(ve.current),Re.current&&clearTimeout(Re.current);const re=await Vu();re.models=t,re.model_task_config=l,await wg(re),k(!1),fe({title:"保存成功",description:"正在重启麦麦..."}),await ct()}catch(re){console.error("保存配置失败:",re),fe({title:"保存失败",description:re.message,variant:"destructive"}),p(!1)}},nt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},ut=()=>{M(!1),j(!1),fe({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Ct=S.useCallback(async re=>{if(!de.current)try{v(!0),await h2("models",re),k(!1)}catch(Me){console.error("自动保存模型列表失败:",Me),k(!0)}finally{v(!1)}},[]),Bn=S.useCallback(async re=>{if(!de.current)try{v(!0),await h2("model_task_config",re),k(!1)}catch(Me){console.error("自动保存任务配置失败:",Me),k(!0)}finally{v(!1)}},[]);S.useEffect(()=>{if(!de.current)return k(!0),ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{Ct(t)},2e3),()=>{ve.current&&clearTimeout(ve.current)}},[t,Ct]),S.useEffect(()=>{if(!(de.current||!l))return k(!0),Re.current&&clearTimeout(Re.current),Re.current=setTimeout(()=>{Bn(l)},2e3),()=>{Re.current&&clearTimeout(Re.current)}},[l,Bn]);const Tn=async()=>{try{p(!0),ve.current&&clearTimeout(ve.current),Re.current&&clearTimeout(Re.current);const re=await Vu();re.models=t,re.model_task_config=l,await wg(re),k(!1),fe({title:"保存成功",description:"模型配置已保存"}),await We()}catch(re){console.error("保存配置失败:",re),fe({title:"保存失败",description:re.message,variant:"destructive"})}finally{p(!1)}},Jn=(re,Me)=>{z(re||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),F(Me),D(!0)},nn=()=>{if(!E)return;const re={...E,price_in:E.price_in??0,price_out:E.price_out??0};let Me;Q!==null?(Me=[...t],Me[Q]=re):Me=[...t,re],e(Me),i(Me.map(pt=>pt.name)),D(!1),z(null),F(null)},_t=re=>{if(!re&&E){const Me={...E,price_in:E.price_in??0,price_out:E.price_out??0};z(Me)}D(re)},Yr=re=>{ce(re),U(!0)},In=()=>{if(V!==null){const re=t.filter((Me,pt)=>pt!==V);e(re),i(re.map(Me=>Me.name)),fe({title:"删除成功",description:"模型已从列表中移除"})}U(!1),ce(null)},or=re=>{const Me=new Set(H);Me.has(re)?Me.delete(re):Me.add(re),ae(Me)},yn=()=>{if(H.size===Le.length)ae(new Set);else{const re=Le.map((Me,pt)=>t.findIndex(vt=>vt===Le[pt]));ae(new Set(re))}},ft=()=>{if(H.size===0){fe({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ue(!0)},ee=()=>{const re=t.filter((Me,pt)=>!H.has(pt));e(re),i(re.map(Me=>Me.name)),ae(new Set),ue(!1),fe({title:"批量删除成功",description:`已删除 ${H.size} 个模型`})},Se=(re,Me,pt)=>{l&&c({...l,[re]:{...l[re],[Me]:pt}})},Le=t.filter(re=>{if(!W)return!0;const Me=W.toLowerCase();return re.name.toLowerCase().includes(Me)||re.model_identifier.toLowerCase().includes(Me)||re.api_provider.toLowerCase().includes(Me)}),rt=Math.ceil(Le.length/Y),Tt=Le.slice((R-1)*Y,R*Y),cr=()=>{const re=parseInt(K);re>=1&&re<=rt&&(me(re),$(""))},Kr=re=>l?[l.utils?.model_list||[],l.utils_small?.model_list||[],l.tool_use?.model_list||[],l.replyer?.model_list||[],l.planner?.model_list||[],l.vlm?.model_list||[],l.voice?.model_list||[],l.embedding?.model_list||[],l.lpmm_entity_extract?.model_list||[],l.lpmm_rdf_build?.model_list||[],l.lpmm_qa?.model_list||[]].some(pt=>pt.includes(re)):!1;return d?a.jsx(fn,{className:"h-full",children:a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):a.jsx(fn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理模型和任务配置"})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[a.jsxs(ie,{onClick:Tn,disabled:m||x||!b||O,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),m?"保存中...":x?"自动保存中...":b?"保存配置":"已保存"]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:m||x||O,size:"sm",className:"flex-1 sm:flex-none",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),O?"重启中...":b?"保存并重启":"重启麦麦"]})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认重启麦麦?"}),a.jsx(un,{children:b?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:b?Oe:ct,children:b?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(oo,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),a.jsxs(dl,{defaultValue:"models",className:"w-full",children:[a.jsxs(va,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[a.jsx($t,{value:"models",children:"模型配置"}),a.jsx($t,{value:"tasks",children:"模型任务配置"})]}),a.jsxs(kn,{value:"models",className:"space-y-4 mt-0",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[H.size>0&&a.jsxs(ie,{onClick:ft,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",H.size,")"]}),a.jsxs(ie,{onClick:()=>Jn(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(Wr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[a.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[a.jsx(Ps,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Ae,{placeholder:"搜索模型名称、标识符或提供商...",value:W,onChange:re=>J(re.target.value),className:"pl-9"})]}),W&&a.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Le.length," 个结果"]})]}),a.jsx("div",{className:"md:hidden space-y-3",children:Tt.length===0?a.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:W?"未找到匹配的模型":"暂无模型配置"}):Tt.map((re,Me)=>{const pt=t.findIndex(vs=>vs===re),vt=Kr(re.name);return a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("h3",{className:"font-semibold text-base",children:re.name}),a.jsx($n,{variant:vt?"default":"secondary",className:vt?"bg-green-600 hover:bg-green-700":"",children:vt?"已使用":"未使用"})]}),a.jsx("p",{className:"text-xs text-muted-foreground break-all",title:re.model_identifier,children:re.model_identifier})]}),a.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Jn(re,pt),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>Yr(pt),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),a.jsx("p",{className:"font-medium",children:re.api_provider})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),a.jsx("p",{className:"font-medium",children:re.force_stream_mode?"是":"否"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),a.jsxs("p",{className:"font-medium",children:["¥",re.price_in,"/M"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),a.jsxs("p",{className:"font-medium",children:["¥",re.price_out,"/M"]})]})]})]},Me)})}),a.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:a.jsxs(Ac,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(gt,{className:"w-12",children:a.jsx(ss,{checked:H.size===Le.length&&Le.length>0,onCheckedChange:yn})}),a.jsx(gt,{className:"w-24",children:"使用状态"}),a.jsx(gt,{children:"模型名称"}),a.jsx(gt,{children:"模型标识符"}),a.jsx(gt,{children:"提供商"}),a.jsx(gt,{className:"text-right",children:"输入价格"}),a.jsx(gt,{className:"text-right",children:"输出价格"}),a.jsx(gt,{className:"text-center",children:"强制流式"}),a.jsx(gt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:Tt.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:9,className:"text-center text-muted-foreground py-8",children:W?"未找到匹配的模型":"暂无模型配置"})}):Tt.map((re,Me)=>{const pt=t.findIndex(vs=>vs===re),vt=Kr(re.name);return a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:H.has(pt),onCheckedChange:()=>or(pt)})}),a.jsx(it,{children:a.jsx($n,{variant:vt?"default":"secondary",className:vt?"bg-green-600 hover:bg-green-700":"",children:vt?"已使用":"未使用"})}),a.jsx(it,{className:"font-medium",children:re.name}),a.jsx(it,{className:"max-w-xs truncate",title:re.model_identifier,children:re.model_identifier}),a.jsx(it,{children:re.api_provider}),a.jsxs(it,{className:"text-right",children:["¥",re.price_in,"/M"]}),a.jsxs(it,{className:"text-right",children:["¥",re.price_out,"/M"]}),a.jsx(it,{className:"text-center",children:re.force_stream_mode?"是":"否"}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Jn(re,pt),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>Yr(pt),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Me)})})]})}),Le.length>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Bt,{value:Y.toString(),onValueChange:re=>{P(parseInt(re)),me(1),ae(new Set)},children:[a.jsx(Dt,{id:"page-size-model",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*Y+1," 到"," ",Math.min(R*Y,Le.length)," 条,共 ",Le.length," 条"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>me(1),disabled:R===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>me(re=>Math.max(1,re-1)),disabled:R===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ae,{type:"number",value:K,onChange:re=>$(re.target.value),onKeyDown:re=>re.key==="Enter"&&cr(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:rt}),a.jsx(ie,{variant:"outline",size:"sm",onClick:cr,disabled:!K,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>me(re=>re+1),disabled:R>=rt,children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Mc,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>me(rt),disabled:R>=rt,className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]}),a.jsxs(kn,{value:"tasks",className:"space-y-6 mt-0",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),l&&a.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[a.jsx(zi,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:l.utils,modelNames:s,onChange:(re,Me)=>Se("utils",re,Me)}),a.jsx(zi,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:l.utils_small,modelNames:s,onChange:(re,Me)=>Se("utils_small",re,Me)}),a.jsx(zi,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:l.tool_use,modelNames:s,onChange:(re,Me)=>Se("tool_use",re,Me)}),a.jsx(zi,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:l.replyer,modelNames:s,onChange:(re,Me)=>Se("replyer",re,Me)}),a.jsx(zi,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:l.planner,modelNames:s,onChange:(re,Me)=>Se("planner",re,Me)}),a.jsx(zi,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:l.vlm,modelNames:s,onChange:(re,Me)=>Se("vlm",re,Me),hideTemperature:!0}),a.jsx(zi,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:l.voice,modelNames:s,onChange:(re,Me)=>Se("voice",re,Me),hideTemperature:!0,hideMaxTokens:!0}),a.jsx(zi,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:l.embedding,modelNames:s,onChange:(re,Me)=>Se("embedding",re,Me),hideTemperature:!0,hideMaxTokens:!0}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),a.jsx(zi,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:l.lpmm_entity_extract,modelNames:s,onChange:(re,Me)=>Se("lpmm_entity_extract",re,Me)}),a.jsx(zi,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:l.lpmm_rdf_build,modelNames:s,onChange:(re,Me)=>Se("lpmm_rdf_build",re,Me)}),a.jsx(zi,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:l.lpmm_qa,modelNames:s,onChange:(re,Me)=>Se("lpmm_qa",re,Me)})]})]})]})]}),a.jsx(Rr,{open:_,onOpenChange:_t,children:a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:Q!==null?"编辑模型":"添加模型"}),a.jsx(Gr,{children:"配置模型的基本信息和参数"})]}),a.jsxs("div",{className:"grid gap-4 py-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"model_name",children:"模型名称 *"}),a.jsx(Ae,{id:"model_name",value:E?.name||"",onChange:re=>z(Me=>Me?{...Me,name:re.target.value}:null),placeholder:"例如: qwen3-30b"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"model_identifier",children:"模型标识符 *"}),a.jsx(Ae,{id:"model_identifier",value:E?.model_identifier||"",onChange:re=>z(Me=>Me?{...Me,model_identifier:re.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"API 提供商提供的模型 ID"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"api_provider",children:"API 提供商 *"}),a.jsxs(Bt,{value:E?.api_provider||"",onValueChange:re=>z(Me=>Me?{...Me,api_provider:re}:null),children:[a.jsx(Dt,{id:"api_provider",children:a.jsx(It,{placeholder:"选择提供商"})}),a.jsx(Rt,{children:n.map(re=>a.jsx(Pe,{value:re,children:re},re))})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),a.jsx(Ae,{id:"price_in",type:"number",step:"0.1",min:"0",value:E?.price_in??"",onChange:re=>{const Me=re.target.value===""?null:parseFloat(re.target.value);z(pt=>pt?{...pt,price_in:Me}:null)},placeholder:"默认: 0"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),a.jsx(Ae,{id:"price_out",type:"number",step:"0.1",min:"0",value:E?.price_out??"",onChange:re=>{const Me=re.target.value===""?null:parseFloat(re.target.value);z(pt=>pt?{...pt,price_out:Me}:null)},placeholder:"默认: 0"})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"force_stream_mode",checked:E?.force_stream_mode||!1,onCheckedChange:re=>z(Me=>Me?{...Me,force_stream_mode:re}:null)}),a.jsx(te,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>D(!1),children:"取消"}),a.jsx(ie,{onClick:nn,children:"保存"})]})]})}),a.jsx(mn,{open:B,onOpenChange:U,children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:['确定要删除模型 "',V!==null?t[V]?.name:"",'" 吗? 此操作无法撤销。']})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:In,children:"删除"})]})]})}),a.jsx(mn,{open:ne,onOpenChange:ue,children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认批量删除"}),a.jsxs(un,{children:["确定要删除选中的 ",H.size," 个模型吗? 此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),T&&a.jsx(vw,{onRestartComplete:nt,onRestartFailed:ut})]})})}function zi({title:t,description:e,taskConfig:n,modelNames:r,onChange:s,hideTemperature:i=!1,hideMaxTokens:l=!1}){const c=d=>{s("model_list",d)};return a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:t}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:e})]}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"模型列表"}),a.jsx(zte,{options:r.map(d=>({label:d,value:d})),selected:n.model_list||[],onChange:c,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!i&&a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"温度"}),a.jsx(Ae,{type:"number",step:"0.1",min:"0",max:"1",value:n.temperature??.3,onChange:d=>{const h=parseFloat(d.target.value);!isNaN(h)&&h>=0&&h<=1&&s("temperature",h)},className:"w-20 h-8 text-sm"})]}),a.jsx(yx,{value:[n.temperature??.3],onValueChange:d=>s("temperature",d[0]),min:0,max:1,step:.1,className:"w-full"})]}),!l&&a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"最大 Token"}),a.jsx(Ae,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:d=>s("max_tokens",parseInt(d.target.value))})]})]})]})]})}const Lx="/api/webui/config";async function Lte(){const e=await(await ot(`${Lx}/adapter-config/path`)).json();return!e.success||!e.path?null:{path:e.path,lastModified:e.lastModified}}async function Bte(t){const n=await(await ot(`${Lx}/adapter-config/path`,{method:"POST",headers:bt(),body:JSON.stringify({path:t})})).json();if(!n.success)throw new Error(n.message||"保存路径失败")}async function Ite(t){const n=await(await ot(`${Lx}/adapter-config?path=${encodeURIComponent(t)}`)).json();if(!n.success)throw new Error("读取配置文件失败");return n.content}async function c8(t,e){const r=await(await ot(`${Lx}/adapter-config`,{method:"POST",headers:bt(),body:JSON.stringify({path:t,content:e})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}const Ks={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}};function qte(){const[t,e]=S.useState("upload"),[n,r]=S.useState(null),[s,i]=S.useState(""),[l,c]=S.useState(""),[d,h]=S.useState(""),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,M]=S.useState(null),_=S.useRef(null),{toast:D}=Pr(),E=S.useRef(null),z=K=>{if(!K.trim())return{valid:!1,error:"路径不能为空"};const $=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,fe=/^(\/|~\/).+\.toml$/i,ve=$.test(K),Re=fe.test(K);return!ve&&!Re?{valid:!1,error:"路径格式错误。Windows: C:\\path\\file.toml,Linux: /path/file.toml"}:K.toLowerCase().endsWith(".toml")?/[<>"|?*\x00-\x1F]/.test(K)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}:{valid:!1,error:"文件必须是 .toml 格式"}},Q=K=>{if(c(K),K.trim()){const $=z(K);h($.error)}else h("")};S.useEffect(()=>{(async()=>{try{const $=await Lte();$&&$.path&&(c($.path),e("path"),await F($.path))}catch($){console.error("加载保存的路径失败:",$)}})()},[]);const F=async K=>{const $=z(K);if(!$.valid){h($.error),D({title:"路径无效",description:$.error,variant:"destructive"});return}h(""),v(!0);try{const fe=await Ite(K),ve=ue(fe);r(ve),c(K),await Bte(K),D({title:"加载成功",description:"已从配置文件加载"})}catch(fe){console.error("加载配置失败:",fe),D({title:"加载失败",description:fe instanceof Error?fe.message:"无法读取配置文件",variant:"destructive"})}finally{v(!1)}},B=S.useCallback(K=>{t!=="path"||!l||(E.current&&clearTimeout(E.current),E.current=setTimeout(async()=>{p(!0);try{const $=R(K);await c8(l,$),D({title:"自动保存成功",description:"配置已保存到文件"})}catch($){console.error("自动保存失败:",$),D({title:"自动保存失败",description:$ instanceof Error?$.message:"保存配置失败",variant:"destructive"})}finally{p(!1)}},1e3))},[t,l,D]),U=async()=>{if(!n||!l)return;const K=z(l);if(!K.valid){D({title:"保存失败",description:K.error,variant:"destructive"});return}p(!0);try{const $=R(n);await c8(l,$),D({title:"保存成功",description:"配置已保存到文件"})}catch($){console.error("保存失败:",$),D({title:"保存失败",description:$ instanceof Error?$.message:"保存配置失败",variant:"destructive"})}finally{p(!1)}},V=async()=>{l&&await F(l)},ce=K=>{if(K!==t){if(n){M(K),k(!0);return}W(K)}},W=K=>{r(null),i(""),h(""),e(K),D({title:"已切换模式",description:K==="upload"?"现在可以上传配置文件":"现在可以指定配置文件路径"})},J=()=>{T&&(W(T),M(null)),k(!1)},H=()=>{if(n){j(!0);return}ae()},ae=()=>{c(""),r(null),h(""),D({title:"已清空",description:"路径和配置已清空"})},ne=()=>{ae(),j(!1)},ue=K=>{const $=JSON.parse(JSON.stringify(Ks)),fe=K.split(` +`);let ve="";for(const Re of fe){const de=Re.trim();if(!de||de.startsWith("#"))continue;const We=de.match(/^\[(\w+)\]$/);if(We){ve=We[1];continue}const ct=de.match(/^(\w+)\s*=\s*(.+)$/);if(ct&&ve){const[,Oe,nt]=ct,ut=nt.trim();let Ct;if(ut==="true")Ct=!0;else if(ut==="false")Ct=!1;else if(ut.startsWith("[")&&ut.endsWith("]")){const Bn=ut.slice(1,-1).trim();if(Bn){const Tn=Bn.split(",").map(nn=>{const _t=nn.trim();return isNaN(Number(_t))?_t.replace(/"/g,""):Number(_t)}),Jn=typeof Tn[0];Ct=Tn.every(nn=>typeof nn===Jn)?Tn:Tn.filter(nn=>typeof nn=="number")}else Ct=[]}else ut.startsWith('"')&&ut.endsWith('"')?Ct=ut.slice(1,-1):isNaN(Number(ut))?Ct=ut.replace(/"/g,""):Ct=Number(ut);if(ve in $){const Bn=$[ve];Bn[Oe]=Ct}}}return $},R=K=>{const $=[],fe=(ve,Re)=>ve===""||ve===null||ve===void 0?Re:ve;return $.push("[inner]"),$.push(`version = "${fe(K.inner.version,Ks.inner.version)}" # 版本号`),$.push("# 请勿修改版本号,除非你知道自己在做什么"),$.push(""),$.push("[nickname] # 现在没用"),$.push(`nickname = "${fe(K.nickname.nickname,Ks.nickname.nickname)}"`),$.push(""),$.push("[napcat_server] # Napcat连接的ws服务设置"),$.push(`host = "${fe(K.napcat_server.host,Ks.napcat_server.host)}" # Napcat设定的主机地址`),$.push(`port = ${fe(K.napcat_server.port||0,Ks.napcat_server.port)} # Napcat设定的端口`),$.push(`token = "${fe(K.napcat_server.token,Ks.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),$.push(`heartbeat_interval = ${fe(K.napcat_server.heartbeat_interval||0,Ks.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),$.push(""),$.push("[maibot_server] # 连接麦麦的ws服务设置"),$.push(`host = "${fe(K.maibot_server.host,Ks.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),$.push(`port = ${fe(K.maibot_server.port||0,Ks.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),$.push(""),$.push("[chat] # 黑白名单功能"),$.push(`group_list_type = "${fe(K.chat.group_list_type,Ks.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),$.push(`group_list = [${K.chat.group_list.join(", ")}] # 群组名单`),$.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),$.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),$.push(`private_list_type = "${fe(K.chat.private_list_type,Ks.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),$.push(`private_list = [${K.chat.private_list.join(", ")}] # 私聊名单`),$.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),$.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),$.push(`ban_user_id = [${K.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),$.push(`ban_qq_bot = ${K.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),$.push(`enable_poke = ${K.chat.enable_poke} # 是否启用戳一戳功能`),$.push(""),$.push("[voice] # 发送语音设置"),$.push(`use_tts = ${K.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),$.push(""),$.push("[debug]"),$.push(`level = "${fe(K.debug.level,Ks.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),$.join(` +`)},me=K=>{const $=K.target.files?.[0];if(!$)return;const fe=new FileReader;fe.onload=ve=>{try{const Re=ve.target?.result,de=ue(Re);r(de),i($.name),D({title:"上传成功",description:`已加载配置文件:${$.name}`})}catch(Re){console.error("解析配置文件失败:",Re),D({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},fe.readAsText($)},Y=()=>{if(!n)return;const K=R(n),$=new Blob([K],{type:"text/plain;charset=utf-8"}),fe=URL.createObjectURL($),ve=document.createElement("a");ve.href=fe,ve.download=s||"config.toml",document.body.appendChild(ve),ve.click(),document.body.removeChild(ve),URL.revokeObjectURL(fe),D({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},P=()=>{r(JSON.parse(JSON.stringify(Ks))),i("config.toml"),D({title:"已加载默认配置",description:"可以开始编辑配置"})};return a.jsx(fn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"工作模式"}),a.jsx(Sr,{children:"选择配置文件的管理方式"})]}),a.jsxs(vn,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 md:gap-4",children:[a.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>ce("upload"),children:a.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[a.jsx(oO,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),a.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>ce("path"),children:a.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[a.jsx(kq,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),t==="path"&&a.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs("div",{className:"flex-1 space-y-1",children:[a.jsx(Ae,{id:"config-path",value:l,onChange:K=>Q(K.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${d?"border-destructive":""}`}),d&&a.jsx("p",{className:"text-xs text-destructive",children:d})]}),a.jsx(ie,{onClick:()=>F(l),disabled:x||!l||!!d,className:"w-full sm:w-auto",children:x?a.jsxs(a.Fragment,{children:[a.jsx(Ii,{className:"h-4 w-4 animate-spin mr-2"}),a.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"sm:hidden",children:"加载配置"}),a.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),a.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[a.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[a.jsx("span",{children:"路径格式说明"}),a.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),a.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[a.jsx("div",{children:"C:\\Adapter\\config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),a.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[a.jsx("div",{children:"/opt/adapter/config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),a.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(oo,{className:"h-4 w-4"}),a.jsx(od,{children:t==="upload"?a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",m&&" (正在保存...)"]})})]}),t==="upload"&&!n&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[a.jsx("input",{ref:_,type:"file",accept:".toml",className:"hidden",onChange:me}),a.jsxs(ie,{onClick:()=>_.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(oO,{className:"mr-2 h-4 w-4"}),"上传配置"]}),a.jsxs(ie,{onClick:P,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(io,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),t==="upload"&&n&&a.jsx("div",{className:"flex gap-2",children:a.jsxs(ie,{onClick:Y,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(fc,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),t==="path"&&n&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs(ie,{onClick:U,size:"sm",disabled:m||!!d,className:"w-full sm:w-auto",children:[a.jsx(lx,{className:"mr-2 h-4 w-4"}),m?"保存中...":"立即保存"]}),a.jsxs(ie,{onClick:V,size:"sm",variant:"outline",disabled:x,className:"w-full sm:w-auto",children:[a.jsx(Ii,{className:`mr-2 h-4 w-4 ${x?"animate-spin":""}`}),"刷新"]}),a.jsxs(ie,{onClick:H,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),n?a.jsxs(dl,{defaultValue:"napcat",className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:a.jsxs(va,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[a.jsxs($t,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),a.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),a.jsxs($t,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),a.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),a.jsxs($t,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),a.jsx("span",{className:"sm:hidden",children:"聊天"})]}),a.jsxs($t,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),a.jsx("span",{className:"sm:hidden",children:"语音"})]}),a.jsx($t,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),a.jsx(kn,{value:"napcat",className:"space-y-4",children:a.jsx(Fte,{config:n,onChange:K=>{r(K),B(K)}})}),a.jsx(kn,{value:"maibot",className:"space-y-4",children:a.jsx(Qte,{config:n,onChange:K=>{r(K),B(K)}})}),a.jsx(kn,{value:"chat",className:"space-y-4",children:a.jsx($te,{config:n,onChange:K=>{r(K),B(K)}})}),a.jsx(kn,{value:"voice",className:"space-y-4",children:a.jsx(Hte,{config:n,onChange:K=>{r(K),B(K)}})}),a.jsx(kn,{value:"debug",className:"space-y-4",children:a.jsx(Ute,{config:n,onChange:K=>{r(K),B(K)}})})]}):a.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:a.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[a.jsx(io,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:t==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),a.jsx(mn,{open:b,onOpenChange:k,children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认切换模式"}),a.jsxs(un,{children:["切换模式将清空当前配置,确定要继续吗?",a.jsx("br",{}),a.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),a.jsxs(on,{children:[a.jsx(hn,{onClick:()=>{k(!1),M(null)},children:"取消"}),a.jsx(dn,{onClick:J,children:"确认切换"})]})]})}),a.jsx(mn,{open:O,onOpenChange:j,children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认清空路径"}),a.jsxs(un,{children:["清空路径将清除当前配置,确定要继续吗?",a.jsx("br",{}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),a.jsxs(on,{children:[a.jsx(hn,{onClick:()=>j(!1),children:"取消"}),a.jsx(dn,{onClick:ne,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function Fte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),a.jsxs("div",{className:"grid gap-3 md:gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),a.jsx(Ae,{id:"napcat-host",value:t.napcat_server.host,onChange:n=>e({...t,napcat_server:{...t.napcat_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),a.jsx(Ae,{id:"napcat-port",type:"number",value:t.napcat_server.port||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),a.jsx(Ae,{id:"napcat-token",type:"password",value:t.napcat_server.token,onChange:n=>e({...t,napcat_server:{...t.napcat_server,token:n.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),a.jsx(Ae,{id:"napcat-heartbeat",type:"number",value:t.napcat_server.heartbeat_interval||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,heartbeat_interval:n.target.value?parseInt(n.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function Qte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),a.jsxs("div",{className:"grid gap-3 md:gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),a.jsx(Ae,{id:"maibot-host",value:t.maibot_server.host,onChange:n=>e({...t,maibot_server:{...t.maibot_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),a.jsx(Ae,{id:"maibot-port",type:"number",value:t.maibot_server.port||"",onChange:n=>e({...t,maibot_server:{...t.maibot_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function $te({config:t,onChange:e}){const n=i=>{const l={...t};i==="group"?l.chat.group_list=[...l.chat.group_list,0]:i==="private"?l.chat.private_list=[...l.chat.private_list,0]:l.chat.ban_user_id=[...l.chat.ban_user_id,0],e(l)},r=(i,l)=>{const c={...t};i==="group"?c.chat.group_list=c.chat.group_list.filter((d,h)=>h!==l):i==="private"?c.chat.private_list=c.chat.private_list.filter((d,h)=>h!==l):c.chat.ban_user_id=c.chat.ban_user_id.filter((d,h)=>h!==l),e(c)},s=(i,l,c)=>{const d={...t};i==="group"?d.chat.group_list[l]=c:i==="private"?d.chat.private_list[l]=c:d.chat.ban_user_id[l]=c,e(d)};return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),a.jsxs("div",{className:"grid gap-4 md:gap-6",children:[a.jsxs("div",{className:"space-y-3 md:space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"群组名单类型"}),a.jsxs(Bt,{value:t.chat.group_list_type,onValueChange:i=>e({...t,chat:{...t.chat,group_list_type:i}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),a.jsx(Pe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsx(te,{className:"text-sm md:text-base",children:"群组列表"}),a.jsxs(ie,{onClick:()=>n("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(io,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),t.chat.group_list.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ae,{type:"number",value:i,onChange:c=>s("group",l,parseInt(c.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:["确定要删除群号 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>r("group",l),children:"删除"})]})]})]})]},l)),t.chat.group_list.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),a.jsxs("div",{className:"space-y-3 md:space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"私聊名单类型"}),a.jsxs(Bt,{value:t.chat.private_list_type,onValueChange:i=>e({...t,chat:{...t.chat,private_list_type:i}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),a.jsx(Pe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsx(te,{className:"text-sm md:text-base",children:"私聊列表"}),a.jsxs(ie,{onClick:()=>n("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(io,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.private_list.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ae,{type:"number",value:i,onChange:c=>s("private",l,parseInt(c.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:["确定要删除用户 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>r("private",l),children:"删除"})]})]})]})]},l)),t.chat.private_list.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"全局禁止名单"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),a.jsxs(ie,{onClick:()=>n("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(io,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.ban_user_id.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ae,{type:"number",value:i,onChange:c=>s("ban",l,parseInt(c.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:["确定要从全局禁止名单中删除用户 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>r("ban",l),children:"删除"})]})]})]})]},l)),t.chat.ban_user_id.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),a.jsx(jt,{checked:t.chat.ban_qq_bot,onCheckedChange:i=>e({...t,chat:{...t.chat,ban_qq_bot:i}})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),a.jsx(jt,{checked:t.chat.enable_poke,onCheckedChange:i=>e({...t,chat:{...t.chat,enable_poke:i}})})]})]})]})})}function Hte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),a.jsx(jt,{checked:t.voice.use_tts,onCheckedChange:n=>e({...t,voice:{use_tts:n}})})]})]})})}function Ute({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),a.jsx("div",{className:"grid gap-3 md:gap-4",children:a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"日志等级"}),a.jsxs(Bt,{value:t.debug.level,onValueChange:n=>e({...t,debug:{level:n}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"DEBUG",children:"DEBUG(调试)"}),a.jsx(Pe,{value:"INFO",children:"INFO(信息)"}),a.jsx(Pe,{value:"WARNING",children:"WARNING(警告)"}),a.jsx(Pe,{value:"ERROR",children:"ERROR(错误)"}),a.jsx(Pe,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function u8(t){const e=[],n=String(t||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const l=n.slice(s,r).trim();(l||!i)&&e.push(l),s=r+1,r=n.indexOf(",",s)}return e}function Vte(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Wte=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Gte=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xte={};function d8(t,e){return(Xte.jsx?Gte:Wte).test(t)}const Yte=/[ \t\n\f\r]/g;function Kte(t){return typeof t=="object"?t.type==="text"?h8(t.value):!1:h8(t)}function h8(t){return t.replace(Yte,"")===""}class x0{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}x0.prototype.normal={};x0.prototype.property={};x0.prototype.space=void 0;function Z_(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new x0(n,r,e)}function Pf(t){return t.toLowerCase()}class Is{constructor(e,n){this.attribute=n,this.property=e}}Is.prototype.attribute="";Is.prototype.booleanish=!1;Is.prototype.boolean=!1;Is.prototype.commaOrSpaceSeparated=!1;Is.prototype.commaSeparated=!1;Is.prototype.defined=!1;Is.prototype.mustUseProperty=!1;Is.prototype.number=!1;Is.prototype.overloadedBoolean=!1;Is.prototype.property="";Is.prototype.spaceSeparated=!1;Is.prototype.space=void 0;let Zte=0;const Ot=Dc(),mr=Dc(),h4=Dc(),ze=Dc(),Pn=Dc(),Ju=Dc(),Zs=Dc();function Dc(){return 2**++Zte}const f4=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ot,booleanish:mr,commaOrSpaceSeparated:Zs,commaSeparated:Ju,number:ze,overloadedBoolean:h4,spaceSeparated:Pn},Symbol.toStringTag,{value:"Module"})),hb=Object.keys(f4);class c5 extends Is{constructor(e,n,r,s){let i=-1;if(super(e,n),f8(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&rne.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(m8,ine);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!m8.test(i)){let l=i.replace(nne,sne);l.charAt(0)!=="-"&&(l="-"+l),e="data"+l}}s=c5}return new s(r,e)}function sne(t){return"-"+t.toLowerCase()}function ine(t){return t.charAt(1).toUpperCase()}const aD=Z_([J_,Jte,nD,rD,sD],"html"),Bx=Z_([J_,ene,nD,rD,sD],"svg");function p8(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function ane(t){return t.join(" ").trim()}var Nu={},fb,g8;function lne(){if(g8)return fb;g8=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,d=` +`,h="/",m="*",p="",x="comment",v="declaration";function b(O,j){if(typeof O!="string")throw new TypeError("First argument must be a string");if(!O)return[];j=j||{};var T=1,M=1;function _(W){var J=W.match(e);J&&(T+=J.length);var H=W.lastIndexOf(d);M=~H?W.length-H:M+W.length}function D(){var W={line:T,column:M};return function(J){return J.position=new E(W),F(),J}}function E(W){this.start=W,this.end={line:T,column:M},this.source=j.source}E.prototype.content=O;function z(W){var J=new Error(j.source+":"+T+":"+M+": "+W);if(J.reason=W,J.filename=j.source,J.line=T,J.column=M,J.source=O,!j.silent)throw J}function Q(W){var J=W.exec(O);if(J){var H=J[0];return _(H),O=O.slice(H.length),J}}function F(){Q(n)}function B(W){var J;for(W=W||[];J=U();)J!==!1&&W.push(J);return W}function U(){var W=D();if(!(h!=O.charAt(0)||m!=O.charAt(1))){for(var J=2;p!=O.charAt(J)&&(m!=O.charAt(J)||h!=O.charAt(J+1));)++J;if(J+=2,p===O.charAt(J-1))return z("End of comment missing");var H=O.slice(2,J-2);return M+=2,_(H),O=O.slice(J),M+=2,W({type:x,comment:H})}}function V(){var W=D(),J=Q(r);if(J){if(U(),!Q(s))return z("property missing ':'");var H=Q(i),ae=W({type:v,property:k(J[0].replace(t,p)),value:H?k(H[0].replace(t,p)):p});return Q(l),ae}}function ce(){var W=[];B(W);for(var J;J=V();)J!==!1&&(W.push(J),B(W));return W}return F(),ce()}function k(O){return O?O.replace(c,p):p}return fb=b,fb}var x8;function one(){if(x8)return Nu;x8=1;var t=Nu&&Nu.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Nu,"__esModule",{value:!0}),Nu.default=n;const e=t(lne());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const l=(0,e.default)(r),c=typeof s=="function";return l.forEach(d=>{if(d.type!=="declaration")return;const{property:h,value:m}=d;c?s(h,m,d):m&&(i=i||{},i[h]=m)}),i}return Nu}var Bh={},v8;function cne(){if(v8)return Bh;v8=1,Object.defineProperty(Bh,"__esModule",{value:!0}),Bh.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(h){return!h||n.test(h)||t.test(h)},l=function(h,m){return m.toUpperCase()},c=function(h,m){return"".concat(m,"-")},d=function(h,m){return m===void 0&&(m={}),i(h)?h:(h=h.toLowerCase(),m.reactCompat?h=h.replace(s,c):h=h.replace(r,c),h.replace(e,l))};return Bh.camelCase=d,Bh}var Ih,y8;function une(){if(y8)return Ih;y8=1;var t=Ih&&Ih.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(one()),n=cne();function r(s,i){var l={};return!s||typeof s!="string"||(0,e.default)(s,function(c,d){c&&d&&(l[(0,n.camelCase)(c,i)]=d)}),l}return r.default=r,Ih=r,Ih}var dne=une();const hne=u9(dne),lD=oD("end"),u5=oD("start");function oD(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function fne(t){const e=u5(t),n=lD(t);if(e&&n)return{start:e,end:n}}function af(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?b8(t.position):"start"in t||"end"in t?b8(t):"line"in t||"column"in t?m4(t):""}function m4(t){return w8(t&&t.line)+":"+w8(t&&t.column)}function b8(t){return m4(t&&t.start)+"-"+m4(t&&t.end)}function w8(t){return t&&typeof t=="number"?t:1}class as extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},l=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?s=e:!i.cause&&e&&(l=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?i.ruleId=r:(i.source=r.slice(0,d),i.ruleId=r.slice(d+1))}if(!i.place&&i.ancestors&&i.ancestors){const d=i.ancestors[i.ancestors.length-1];d&&(i.place=d.position)}const c=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=c?c.line:void 0,this.name=af(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=l&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}as.prototype.file="";as.prototype.name="";as.prototype.reason="";as.prototype.message="";as.prototype.stack="";as.prototype.column=void 0;as.prototype.line=void 0;as.prototype.ancestors=void 0;as.prototype.cause=void 0;as.prototype.fatal=void 0;as.prototype.place=void 0;as.prototype.ruleId=void 0;as.prototype.source=void 0;const d5={}.hasOwnProperty,mne=new Map,pne=/[A-Z]/g,gne=new Set(["table","tbody","thead","tfoot","tr"]),xne=new Set(["td","th"]),cD="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function vne(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Nne(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=jne(n,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?Bx:aD,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=uD(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function uD(t,e,n){if(e.type==="element")return yne(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return bne(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return Sne(t,e,n);if(e.type==="mdxjsEsm")return wne(t,e);if(e.type==="root")return kne(t,e,n);if(e.type==="text")return One(t,e)}function yne(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Bx,t.schema=s),t.ancestors.push(e);const i=hD(t,e.tagName,!1),l=Cne(t,e);let c=f5(t,e);return gne.has(e.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!Kte(d):!0})),dD(t,l,i,e),h5(l,c),t.ancestors.pop(),t.schema=r,t.create(e,i,l,n)}function bne(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}Lf(t,e.position)}function wne(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Lf(t,e.position)}function Sne(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=Bx,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:hD(t,e.name,!0),l=Tne(t,e),c=f5(t,e);return dD(t,l,i,e),h5(l,c),t.ancestors.pop(),t.schema=r,t.create(e,i,l,n)}function kne(t,e,n){const r={};return h5(r,f5(t,e)),t.create(e,t.Fragment,r,n)}function One(t,e){return e.value}function dD(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function h5(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function jne(t,e,n){return r;function r(s,i,l,c){const h=Array.isArray(l.children)?n:e;return c?h(i,l,c):h(i,l)}}function Nne(t,e){return n;function n(r,s,i,l){const c=Array.isArray(i.children),d=u5(r);return e(s,i,l,c,{columnNumber:d?d.column-1:void 0,fileName:t,lineNumber:d?d.line:void 0},void 0)}}function Cne(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&d5.call(e.properties,s)){const i=Mne(t,s,e.properties[s]);if(i){const[l,c]=i;t.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&xne.has(e.tagName)?r=c:n[l]=c}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Tne(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const l=i.expression;l.type;const c=l.properties[0];c.type,Object.assign(n,t.evaluater.evaluateExpression(c.argument))}else Lf(t,e.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const c=r.value.data.estree.body[0];c.type,i=t.evaluater.evaluateExpression(c.expression)}else Lf(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function f5(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:mne;for(;++rs?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(e,n),t.splice(...l);else for(n&&t.splice(e,n);i0?(ri(t,t.length,0,e),t):e}const O8={}.hasOwnProperty;function mD(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function qi(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ds=To(/[A-Za-z]/),rs=To(/[\dA-Za-z]/),Bne=To(/[#-'*+\--9=?A-Z^-~]/);function Hg(t){return t!==null&&(t<32||t===127)}const p4=To(/\d/),Ine=To(/[\dA-Fa-f]/),qne=To(/[!-/:-@[-`{-~]/);function Ze(t){return t!==null&&t<-2}function Dn(t){return t!==null&&(t<0||t===32)}function qt(t){return t===-2||t===-1||t===32}const Ix=To(new RegExp("\\p{P}|\\p{S}","u")),Cc=To(/\s/);function To(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Dd(t){const e=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const c=t.charCodeAt(n+1);i<56320&&c>56319&&c<57344?(l=String.fromCharCode(i,c),s=1):l="�"}else l=String.fromCharCode(i);l&&(e.push(t.slice(r,n),encodeURIComponent(l)),r=n+s+1,l=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function zt(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return l;function l(d){return qt(d)?(t.enter(n),c(d)):e(d)}function c(d){return qt(d)&&i++l))return;const z=e.events.length;let Q=z,F,B;for(;Q--;)if(e.events[Q][0]==="exit"&&e.events[Q][1].type==="chunkFlow"){if(F){B=e.events[Q][1].end;break}F=!0}for(j(r),E=z;EM;){const D=n[_];e.containerState=D[1],D[0].exit.call(e,t)}n.length=M}function T(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function Une(t,e,n){return zt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function vd(t){if(t===null||Dn(t)||Cc(t))return 1;if(Ix(t))return 2}function qx(t,e,n){const r=[];let s=-1;for(;++s1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const p={...t[r][1].end},x={...t[n][1].start};N8(p,-d),N8(x,d),l={type:d>1?"strongSequence":"emphasisSequence",start:p,end:{...t[r][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:x},i={type:d>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:d>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},t[r][1].end={...l.start},t[n][1].start={...c.end},h=[],t[r][1].end.offset-t[r][1].start.offset&&(h=yi(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=yi(h,[["enter",s,e],["enter",l,e],["exit",l,e],["enter",i,e]]),h=yi(h,qx(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=yi(h,[["exit",i,e],["enter",c,e],["exit",c,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(m=2,h=yi(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):m=0,ri(t,r-1,n-r+3,h),n=r+h.length-m-2;break}}for(n=-1;++n0&&qt(E)?zt(t,T,"linePrefix",i+1)(E):T(E)}function T(E){return E===null||Ze(E)?t.check(C8,k,_)(E):(t.enter("codeFlowValue"),M(E))}function M(E){return E===null||Ze(E)?(t.exit("codeFlowValue"),T(E)):(t.consume(E),M)}function _(E){return t.exit("codeFenced"),e(E)}function D(E,z,Q){let F=0;return B;function B(J){return E.enter("lineEnding"),E.consume(J),E.exit("lineEnding"),U}function U(J){return E.enter("codeFencedFence"),qt(J)?zt(E,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(J):V(J)}function V(J){return J===c?(E.enter("codeFencedFenceSequence"),ce(J)):Q(J)}function ce(J){return J===c?(F++,E.consume(J),ce):F>=l?(E.exit("codeFencedFenceSequence"),qt(J)?zt(E,W,"whitespace")(J):W(J)):Q(J)}function W(J){return J===null||Ze(J)?(E.exit("codeFencedFence"),z(J)):Q(J)}}}function rre(t,e,n){const r=this;return s;function s(l){return l===null?n(l):(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i)}function i(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}const pb={name:"codeIndented",tokenize:ire},sre={partial:!0,tokenize:are};function ire(t,e,n){const r=this;return s;function s(h){return t.enter("codeIndented"),zt(t,i,"linePrefix",5)(h)}function i(h){const m=r.events[r.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(h):n(h)}function l(h){return h===null?d(h):Ze(h)?t.attempt(sre,l,d)(h):(t.enter("codeFlowValue"),c(h))}function c(h){return h===null||Ze(h)?(t.exit("codeFlowValue"),l(h)):(t.consume(h),c)}function d(h){return t.exit("codeIndented"),e(h)}}function are(t,e,n){const r=this;return s;function s(l){return r.parser.lazy[r.now().line]?n(l):Ze(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),s):zt(t,i,"linePrefix",5)(l)}function i(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(l):Ze(l)?s(l):n(l)}}const lre={name:"codeText",previous:cre,resolve:ore,tokenize:ure};function ore(t){let e=t.length-4,n=3,r,s;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&qh(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),qh(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),qh(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(l):t.interrupt(r.parser.constructs.flow,n,e)(l)}}function bD(t,e,n,r,s,i,l,c,d){const h=d||Number.POSITIVE_INFINITY;let m=0;return p;function p(j){return j===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(j),t.exit(i),x):j===null||j===32||j===41||Hg(j)?n(j):(t.enter(r),t.enter(l),t.enter(c),t.enter("chunkString",{contentType:"string"}),k(j))}function x(j){return j===62?(t.enter(i),t.consume(j),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(c),t.enter("chunkString",{contentType:"string"}),v(j))}function v(j){return j===62?(t.exit("chunkString"),t.exit(c),x(j)):j===null||j===60||Ze(j)?n(j):(t.consume(j),j===92?b:v)}function b(j){return j===60||j===62||j===92?(t.consume(j),v):v(j)}function k(j){return!m&&(j===null||j===41||Dn(j))?(t.exit("chunkString"),t.exit(c),t.exit(l),t.exit(r),e(j)):m999||v===null||v===91||v===93&&!d||v===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(v):v===93?(t.exit(i),t.enter(s),t.consume(v),t.exit(s),t.exit(r),e):Ze(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),m):(t.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===null||v===91||v===93||Ze(v)||c++>999?(t.exit("chunkString"),m(v)):(t.consume(v),d||(d=!qt(v)),v===92?x:p)}function x(v){return v===91||v===92||v===93?(t.consume(v),c++,p):p(v)}}function SD(t,e,n,r,s,i){let l;return c;function c(x){return x===34||x===39||x===40?(t.enter(r),t.enter(s),t.consume(x),t.exit(s),l=x===40?41:x,d):n(x)}function d(x){return x===l?(t.enter(s),t.consume(x),t.exit(s),t.exit(r),e):(t.enter(i),h(x))}function h(x){return x===l?(t.exit(i),d(l)):x===null?n(x):Ze(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),zt(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===l||x===null||Ze(x)?(t.exit("chunkString"),h(x)):(t.consume(x),x===92?p:m)}function p(x){return x===l||x===92?(t.consume(x),m):m(x)}}function lf(t,e){let n;return r;function r(s){return Ze(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):qt(s)?zt(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const vre={name:"definition",tokenize:bre},yre={partial:!0,tokenize:wre};function bre(t,e,n){const r=this;let s;return i;function i(v){return t.enter("definition"),l(v)}function l(v){return wD.call(r,t,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function c(v){return s=qi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),d):n(v)}function d(v){return Dn(v)?lf(t,h)(v):h(v)}function h(v){return bD(t,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function m(v){return t.attempt(yre,p,p)(v)}function p(v){return qt(v)?zt(t,x,"whitespace")(v):x(v)}function x(v){return v===null||Ze(v)?(t.exit("definition"),r.parser.defined.push(s),e(v)):n(v)}}function wre(t,e,n){return r;function r(c){return Dn(c)?lf(t,s)(c):n(c)}function s(c){return SD(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function i(c){return qt(c)?zt(t,l,"whitespace")(c):l(c)}function l(c){return c===null||Ze(c)?e(c):n(c)}}const Sre={name:"hardBreakEscape",tokenize:kre};function kre(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return Ze(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const Ore={name:"headingAtx",resolve:jre,tokenize:Nre};function jre(t,e){let n=t.length-2,r=3,s,i;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},ri(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function Nre(t,e,n){let r=0;return s;function s(m){return t.enter("atxHeading"),i(m)}function i(m){return t.enter("atxHeadingSequence"),l(m)}function l(m){return m===35&&r++<6?(t.consume(m),l):m===null||Dn(m)?(t.exit("atxHeadingSequence"),c(m)):n(m)}function c(m){return m===35?(t.enter("atxHeadingSequence"),d(m)):m===null||Ze(m)?(t.exit("atxHeading"),e(m)):qt(m)?zt(t,c,"whitespace")(m):(t.enter("atxHeadingText"),h(m))}function d(m){return m===35?(t.consume(m),d):(t.exit("atxHeadingSequence"),c(m))}function h(m){return m===null||m===35||Dn(m)?(t.exit("atxHeadingText"),c(m)):(t.consume(m),h)}}const Cre=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],M8=["pre","script","style","textarea"],Tre={concrete:!0,name:"htmlFlow",resolveTo:Ere,tokenize:_re},Mre={partial:!0,tokenize:Rre},Are={partial:!0,tokenize:Dre};function Ere(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function _re(t,e,n){const r=this;let s,i,l,c,d;return h;function h(P){return m(P)}function m(P){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(P),p}function p(P){return P===33?(t.consume(P),x):P===47?(t.consume(P),i=!0,k):P===63?(t.consume(P),s=3,r.interrupt?e:R):ds(P)?(t.consume(P),l=String.fromCharCode(P),O):n(P)}function x(P){return P===45?(t.consume(P),s=2,v):P===91?(t.consume(P),s=5,c=0,b):ds(P)?(t.consume(P),s=4,r.interrupt?e:R):n(P)}function v(P){return P===45?(t.consume(P),r.interrupt?e:R):n(P)}function b(P){const K="CDATA[";return P===K.charCodeAt(c++)?(t.consume(P),c===K.length?r.interrupt?e:V:b):n(P)}function k(P){return ds(P)?(t.consume(P),l=String.fromCharCode(P),O):n(P)}function O(P){if(P===null||P===47||P===62||Dn(P)){const K=P===47,$=l.toLowerCase();return!K&&!i&&M8.includes($)?(s=1,r.interrupt?e(P):V(P)):Cre.includes(l.toLowerCase())?(s=6,K?(t.consume(P),j):r.interrupt?e(P):V(P)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):i?T(P):M(P))}return P===45||rs(P)?(t.consume(P),l+=String.fromCharCode(P),O):n(P)}function j(P){return P===62?(t.consume(P),r.interrupt?e:V):n(P)}function T(P){return qt(P)?(t.consume(P),T):B(P)}function M(P){return P===47?(t.consume(P),B):P===58||P===95||ds(P)?(t.consume(P),_):qt(P)?(t.consume(P),M):B(P)}function _(P){return P===45||P===46||P===58||P===95||rs(P)?(t.consume(P),_):D(P)}function D(P){return P===61?(t.consume(P),E):qt(P)?(t.consume(P),D):M(P)}function E(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(t.consume(P),d=P,z):qt(P)?(t.consume(P),E):Q(P)}function z(P){return P===d?(t.consume(P),d=null,F):P===null||Ze(P)?n(P):(t.consume(P),z)}function Q(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||Dn(P)?D(P):(t.consume(P),Q)}function F(P){return P===47||P===62||qt(P)?M(P):n(P)}function B(P){return P===62?(t.consume(P),U):n(P)}function U(P){return P===null||Ze(P)?V(P):qt(P)?(t.consume(P),U):n(P)}function V(P){return P===45&&s===2?(t.consume(P),H):P===60&&s===1?(t.consume(P),ae):P===62&&s===4?(t.consume(P),me):P===63&&s===3?(t.consume(P),R):P===93&&s===5?(t.consume(P),ue):Ze(P)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(Mre,Y,ce)(P)):P===null||Ze(P)?(t.exit("htmlFlowData"),ce(P)):(t.consume(P),V)}function ce(P){return t.check(Are,W,Y)(P)}function W(P){return t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),J}function J(P){return P===null||Ze(P)?ce(P):(t.enter("htmlFlowData"),V(P))}function H(P){return P===45?(t.consume(P),R):V(P)}function ae(P){return P===47?(t.consume(P),l="",ne):V(P)}function ne(P){if(P===62){const K=l.toLowerCase();return M8.includes(K)?(t.consume(P),me):V(P)}return ds(P)&&l.length<8?(t.consume(P),l+=String.fromCharCode(P),ne):V(P)}function ue(P){return P===93?(t.consume(P),R):V(P)}function R(P){return P===62?(t.consume(P),me):P===45&&s===2?(t.consume(P),R):V(P)}function me(P){return P===null||Ze(P)?(t.exit("htmlFlowData"),Y(P)):(t.consume(P),me)}function Y(P){return t.exit("htmlFlow"),e(P)}}function Dre(t,e,n){const r=this;return s;function s(l){return Ze(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i):n(l)}function i(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}function Rre(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(v0,e,n)}}const zre={name:"htmlText",tokenize:Pre};function Pre(t,e,n){const r=this;let s,i,l;return c;function c(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),d}function d(R){return R===33?(t.consume(R),h):R===47?(t.consume(R),D):R===63?(t.consume(R),M):ds(R)?(t.consume(R),Q):n(R)}function h(R){return R===45?(t.consume(R),m):R===91?(t.consume(R),i=0,b):ds(R)?(t.consume(R),T):n(R)}function m(R){return R===45?(t.consume(R),v):n(R)}function p(R){return R===null?n(R):R===45?(t.consume(R),x):Ze(R)?(l=p,ae(R)):(t.consume(R),p)}function x(R){return R===45?(t.consume(R),v):p(R)}function v(R){return R===62?H(R):R===45?x(R):p(R)}function b(R){const me="CDATA[";return R===me.charCodeAt(i++)?(t.consume(R),i===me.length?k:b):n(R)}function k(R){return R===null?n(R):R===93?(t.consume(R),O):Ze(R)?(l=k,ae(R)):(t.consume(R),k)}function O(R){return R===93?(t.consume(R),j):k(R)}function j(R){return R===62?H(R):R===93?(t.consume(R),j):k(R)}function T(R){return R===null||R===62?H(R):Ze(R)?(l=T,ae(R)):(t.consume(R),T)}function M(R){return R===null?n(R):R===63?(t.consume(R),_):Ze(R)?(l=M,ae(R)):(t.consume(R),M)}function _(R){return R===62?H(R):M(R)}function D(R){return ds(R)?(t.consume(R),E):n(R)}function E(R){return R===45||rs(R)?(t.consume(R),E):z(R)}function z(R){return Ze(R)?(l=z,ae(R)):qt(R)?(t.consume(R),z):H(R)}function Q(R){return R===45||rs(R)?(t.consume(R),Q):R===47||R===62||Dn(R)?F(R):n(R)}function F(R){return R===47?(t.consume(R),H):R===58||R===95||ds(R)?(t.consume(R),B):Ze(R)?(l=F,ae(R)):qt(R)?(t.consume(R),F):H(R)}function B(R){return R===45||R===46||R===58||R===95||rs(R)?(t.consume(R),B):U(R)}function U(R){return R===61?(t.consume(R),V):Ze(R)?(l=U,ae(R)):qt(R)?(t.consume(R),U):F(R)}function V(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),s=R,ce):Ze(R)?(l=V,ae(R)):qt(R)?(t.consume(R),V):(t.consume(R),W)}function ce(R){return R===s?(t.consume(R),s=void 0,J):R===null?n(R):Ze(R)?(l=ce,ae(R)):(t.consume(R),ce)}function W(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Dn(R)?F(R):(t.consume(R),W)}function J(R){return R===47||R===62||Dn(R)?F(R):n(R)}function H(R){return R===62?(t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),e):n(R)}function ae(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),ne}function ne(R){return qt(R)?zt(t,ue,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):ue(R)}function ue(R){return t.enter("htmlTextData"),l(R)}}const g5={name:"labelEnd",resolveAll:qre,resolveTo:Fre,tokenize:Qre},Lre={tokenize:$re},Bre={tokenize:Hre},Ire={tokenize:Ure};function qre(t){let e=-1;const n=[];for(;++e=3&&(h===null||Ze(h))?(t.exit("thematicBreak"),e(h)):n(h)}function d(h){return h===s?(t.consume(h),r++,d):(t.exit("thematicBreakSequence"),qt(h)?zt(t,c,"whitespace")(h):c(h))}}const Ns={continuation:{tokenize:tse},exit:rse,name:"list",tokenize:ese},Zre={partial:!0,tokenize:sse},Jre={partial:!0,tokenize:nse};function ese(t,e,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,l=0;return c;function c(v){const b=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:p4(v)){if(r.containerState.type||(r.containerState.type=b,t.enter(b,{_container:!0})),b==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(og,n,h)(v):h(v);if(!r.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),d(v)}return n(v)}function d(v){return p4(v)&&++l<10?(t.consume(v),d):(!r.interrupt||l<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),h(v)):n(v)}function h(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,t.check(v0,r.interrupt?n:m,t.attempt(Zre,x,p))}function m(v){return r.containerState.initialBlankLine=!0,i++,x(v)}function p(v){return qt(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),x):n(v)}function x(v){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(v)}}function tse(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(v0,s,i);function s(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,zt(t,e,"listItemIndent",r.containerState.size+1)(c)}function i(c){return r.containerState.furtherBlankLines||!qt(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(Jre,e,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,zt(t,t.attempt(Ns,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function nse(t,e,n){const r=this;return zt(t,s,"listItemIndent",r.containerState.size+1);function s(i){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?e(i):n(i)}}function rse(t){t.exit(this.containerState.type)}function sse(t,e,n){const r=this;return zt(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const l=r.events[r.events.length-1];return!qt(i)&&l&&l[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const A8={name:"setextUnderline",resolveTo:ise,tokenize:ase};function ise(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const l={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",l,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=l,t.push(["exit",l,e]),t}function ase(t,e,n){const r=this;let s;return i;function i(h){let m=r.events.length,p;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){p=r.events[m][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(t.enter("setextHeadingLine"),s=h,l(h)):n(h)}function l(h){return t.enter("setextHeadingLineSequence"),c(h)}function c(h){return h===s?(t.consume(h),c):(t.exit("setextHeadingLineSequence"),qt(h)?zt(t,d,"lineSuffix")(h):d(h))}function d(h){return h===null||Ze(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const lse={tokenize:ose};function ose(t){const e=this,n=t.attempt(v0,r,t.attempt(this.parser.constructs.flowInitial,s,zt(t,t.attempt(this.parser.constructs.flow,s,t.attempt(fre,s)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const cse={resolveAll:OD()},use=kD("string"),dse=kD("text");function kD(t){return{resolveAll:OD(t==="text"?hse:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,l,c);return l;function l(m){return h(m)?i(m):c(m)}function c(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),d}function d(m){return h(m)?(n.exit("data"),i(m)):(n.consume(m),d)}function h(m){if(m===null)return!0;const p=s[m];let x=-1;if(p)for(;++x-1){const c=l[0];typeof c=="string"?l[0]=c.slice(r):l.shift()}i>0&&l.push(t[s].slice(0,i))}return l}function jse(t,e){let n=-1;const r=[];let s;for(;++n0){const cr=Le.tokenStack[Le.tokenStack.length-1];(cr[1]||_8).call(Le,void 0,cr[0])}for(Se.position={start:Gl(ee.length>0?ee[0][1].start:{line:1,column:1,offset:0}),end:Gl(ee.length>0?ee[ee.length-2][1].end:{line:1,column:1,offset:0})},Tt=-1;++Tt1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};t.patch(e,d);const h={type:"element",tagName:"sup",properties:{},children:[d]};return t.patch(e,h),t.applyData(e,h)}function Qse(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function $se(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function CD(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const l=s[s.length-1];return l&&l.type==="text"?l.value+=r:s.push({type:"text",value:r}),s}function Hse(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return CD(t,e);const s={src:Dd(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,i),t.applyData(e,i)}function Use(t,e){const n={src:Dd(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function Vse(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function Wse(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return CD(t,e);const s={href:Dd(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function Gse(t,e){const n={href:Dd(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Xse(t,e,n){const r=t.all(e),s=n?Yse(n):TD(e),i={},l=[];if(typeof e.checked=="boolean"){const m=r[0];let p;m&&m.type==="element"&&m.tagName==="p"?p=m:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let c=-1;for(;++c1}function Kse(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s0){const l={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},c=u5(e.children[1]),d=lD(e.children[e.children.length-1]);c&&d&&(l.position={start:c,end:d}),s.push(l)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function nie(t,e,n){const r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,c=l?l.length:e.children.length;let d=-1;const h=[];for(;++d0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return i.push(z8(e.slice(s),s>0,!1)),i.join("")}function z8(t,e,n){let r=0,s=t.length;if(e){let i=t.codePointAt(r);for(;i===D8||i===R8;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(s-1);for(;i===D8||i===R8;)s--,i=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function iie(t,e){const n={type:"text",value:sie(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function aie(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const lie={blockquote:Pse,break:Lse,code:Bse,delete:Ise,emphasis:qse,footnoteReference:Fse,heading:Qse,html:$se,imageReference:Hse,image:Use,inlineCode:Vse,linkReference:Wse,link:Gse,listItem:Xse,list:Kse,paragraph:Zse,root:Jse,strong:eie,table:tie,tableCell:rie,tableRow:nie,text:iie,thematicBreak:aie,toml:Op,yaml:Op,definition:Op,footnoteDefinition:Op};function Op(){}const MD=-1,Fx=0,of=1,Ug=2,x5=3,v5=4,y5=5,b5=6,AD=7,ED=8,P8=typeof self=="object"?self:globalThis,oie=(t,e)=>{const n=(s,i)=>(t.set(i,s),s),r=s=>{if(t.has(s))return t.get(s);const[i,l]=e[s];switch(i){case Fx:case MD:return n(l,s);case of:{const c=n([],s);for(const d of l)c.push(r(d));return c}case Ug:{const c=n({},s);for(const[d,h]of l)c[r(d)]=r(h);return c}case x5:return n(new Date(l),s);case v5:{const{source:c,flags:d}=l;return n(new RegExp(c,d),s)}case y5:{const c=n(new Map,s);for(const[d,h]of l)c.set(r(d),r(h));return c}case b5:{const c=n(new Set,s);for(const d of l)c.add(r(d));return c}case AD:{const{name:c,message:d}=l;return n(new P8[c](d),s)}case ED:return n(BigInt(l),s);case"BigInt":return n(Object(BigInt(l)),s);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:c}=new Uint8Array(l);return n(new DataView(c),l)}}return n(new P8[i](l),s)};return r},L8=t=>oie(new Map,t)(0),Cu="",{toString:cie}={},{keys:uie}=Object,Fh=t=>{const e=typeof t;if(e!=="object"||!t)return[Fx,e];const n=cie.call(t).slice(8,-1);switch(n){case"Array":return[of,Cu];case"Object":return[Ug,Cu];case"Date":return[x5,Cu];case"RegExp":return[v5,Cu];case"Map":return[y5,Cu];case"Set":return[b5,Cu];case"DataView":return[of,n]}return n.includes("Array")?[of,n]:n.includes("Error")?[AD,n]:[Ug,n]},jp=([t,e])=>t===Fx&&(e==="function"||e==="symbol"),die=(t,e,n,r)=>{const s=(l,c)=>{const d=r.push(l)-1;return n.set(c,d),d},i=l=>{if(n.has(l))return n.get(l);let[c,d]=Fh(l);switch(c){case Fx:{let m=l;switch(d){case"bigint":c=ED,m=l.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+d);m=null;break;case"undefined":return s([MD],l)}return s([c,m],l)}case of:{if(d){let x=l;return d==="DataView"?x=new Uint8Array(l.buffer):d==="ArrayBuffer"&&(x=new Uint8Array(l)),s([d,[...x]],l)}const m=[],p=s([c,m],l);for(const x of l)m.push(i(x));return p}case Ug:{if(d)switch(d){case"BigInt":return s([d,l.toString()],l);case"Boolean":case"Number":case"String":return s([d,l.valueOf()],l)}if(e&&"toJSON"in l)return i(l.toJSON());const m=[],p=s([c,m],l);for(const x of uie(l))(t||!jp(Fh(l[x])))&&m.push([i(x),i(l[x])]);return p}case x5:return s([c,l.toISOString()],l);case v5:{const{source:m,flags:p}=l;return s([c,{source:m,flags:p}],l)}case y5:{const m=[],p=s([c,m],l);for(const[x,v]of l)(t||!(jp(Fh(x))||jp(Fh(v))))&&m.push([i(x),i(v)]);return p}case b5:{const m=[],p=s([c,m],l);for(const x of l)(t||!jp(Fh(x)))&&m.push(i(x));return p}}const{message:h}=l;return s([c,{name:d,message:h}],l)};return i},B8=(t,{json:e,lossy:n}={})=>{const r=[];return die(!(e||n),!!e,new Map,r)(t),r},Vg=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?L8(B8(t,e)):structuredClone(t):(t,e)=>L8(B8(t,e));function hie(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function fie(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function mie(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||hie,r=t.options.footnoteBackLabel||fie,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",l=t.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let d=-1;for(;++d0&&b.push({type:"text",value:" "});let T=typeof n=="string"?n:n(d,v);typeof T=="string"&&(T={type:"text",value:T}),b.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+x+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(d,v),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}const O=m[m.length-1];if(O&&O.type==="element"&&O.tagName==="p"){const T=O.children[O.children.length-1];T&&T.type==="text"?T.value+=" ":O.children.push({type:"text",value:" "}),O.children.push(...b)}else m.push(...b);const j={type:"element",tagName:"li",properties:{id:e+"fn-"+x},children:t.wrap(m,!0)};t.patch(h,j),c.push(j)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Vg(l),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:t.wrap(c,!0)},{type:"text",value:` +`}]}}const y0=(function(t){if(t==null)return vie;if(typeof t=="function")return Qx(t);if(typeof t=="object")return Array.isArray(t)?pie(t):gie(t);if(typeof t=="string")return xie(t);throw new Error("Expected function, string, or object as test")});function pie(t){const e=[];let n=-1;for(;++n":""))+")"})}return x;function x(){let v=_D,b,k,O;if((!e||i(d,h,m[m.length-1]||void 0))&&(v=wie(n(d,m)),v[0]===x4))return v;if("children"in d&&d.children){const j=d;if(j.children&&v[0]!==DD)for(k=(r?j.children.length:-1)+l,O=m.concat(j);k>-1&&k0&&n.push({type:"text",value:` +`}),n}function I8(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function q8(t,e){const n=kie(t,e),r=n.one(t,void 0),s=mie(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:` +`},s),i}function Tie(t,e){return t&&"run"in t?async function(n,r){const s=q8(n,{file:r,...e});await t.run(s,r)}:function(n,r){return q8(n,{file:r,...t||e})}}function F8(t){if(t)throw t}var xb,Q8;function Mie(){if(Q8)return xb;Q8=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):e.call(h)==="[object Array]"},i=function(h){if(!h||e.call(h)!=="[object Object]")return!1;var m=t.call(h,"constructor"),p=h.constructor&&h.constructor.prototype&&t.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!m&&!p)return!1;var x;for(x in h);return typeof x>"u"||t.call(h,x)},l=function(h,m){n&&m.name==="__proto__"?n(h,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):h[m.name]=m.newValue},c=function(h,m){if(m==="__proto__")if(t.call(h,m)){if(r)return r(h,m).value}else return;return h[m]};return xb=function d(){var h,m,p,x,v,b,k=arguments[0],O=1,j=arguments.length,T=!1;for(typeof k=="boolean"&&(T=k,k=arguments[1]||{},O=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});Ol.length;let d;c&&l.push(s);try{d=t.apply(this,l)}catch(h){const m=h;if(c&&n)throw m;return s(m)}c||(d&&d.then&&typeof d.then=="function"?d.then(i,s):d instanceof Error?s(d):i(d))}function s(l,...c){n||(n=!0,e(l,...c))}function i(l){s(null,l)}}const ra={basename:Die,dirname:Rie,extname:zie,join:Pie,sep:"/"};function Die(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');b0(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let l=-1,c=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else l<0&&(i=!0,l=s+1),c>-1&&(t.codePointAt(s)===e.codePointAt(c--)?c<0&&(r=s):(c=-1,r=l));return n===r?r=l:r<0&&(r=t.length),t.slice(n,r)}function Rie(t){if(b0(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function zie(t){b0(t);let e=t.length,n=-1,r=0,s=-1,i=0,l;for(;e--;){const c=t.codePointAt(e);if(c===47){if(l){r=e+1;break}continue}n<0&&(l=!0,n=e+1),c===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function Pie(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function Bie(t,e){let n="",r=0,s=-1,i=0,l=-1,c,d;for(;++l<=t.length;){if(l2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",r=0):(n=n.slice(0,d),r=n.length-1-n.lastIndexOf("/")),s=l,i=0;continue}}else if(n.length>0){n="",r=0,s=l,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,l):n=t.slice(s+1,l),r=l-s-1;s=l,i=0}else c===46&&i>-1?i++:i=-1}return n}function b0(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Iie={cwd:qie};function qie(){return"/"}function b4(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function Fie(t){if(typeof t=="string")t=new URL(t);else if(!b4(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Qie(t)}function Qie(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[v,...b]=m;const k=r[x][1];y4(k)&&y4(v)&&(v=vb(!0,k,v)),r[x]=[h,v,...b]}}}}const Vie=new k5().freeze();function Sb(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function kb(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Ob(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function H8(t){if(!y4(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function U8(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Np(t){return Wie(t)?t:new RD(t)}function Wie(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Gie(t){return typeof t=="string"||Xie(t)}function Xie(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Yie="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",V8=[],W8={allowDangerousHtml:!0},Kie=/^(https?|ircs?|mailto|xmpp)$/i,Zie=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Jie(t){const e=eae(t),n=tae(t);return nae(e.runSync(e.parse(n),n),t)}function eae(t){const e=t.rehypePlugins||V8,n=t.remarkPlugins||V8,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...W8}:W8;return Vie().use(zse).use(n).use(Tie,r).use(e)}function tae(t){const e=t.children||"",n=new RD;return typeof e=="string"&&(n.value=e),n}function nae(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,l=e.skipHtml,c=e.unwrapDisallowed,d=e.urlTransform||rae;for(const m of Zie)Object.hasOwn(e,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+Yie+m.id,void 0);return S5(t,h),vne(t,{Fragment:a.Fragment,components:s,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function h(m,p,x){if(m.type==="raw"&&x&&typeof p=="number")return l?x.children.splice(p,1):x.children[p]={type:"text",value:m.value},p;if(m.type==="element"){let v;for(v in mb)if(Object.hasOwn(mb,v)&&Object.hasOwn(m.properties,v)){const b=m.properties[v],k=mb[v];(k===null||k.includes(m.tagName))&&(m.properties[v]=d(String(b||""),v,m))}}if(m.type==="element"){let v=n?!n.includes(m.tagName):i?i.includes(m.tagName):!1;if(!v&&r&&typeof p=="number"&&(v=!r(m,p,x)),v&&x&&typeof p=="number")return c&&m.children?x.children.splice(p,1,...m.children):x.children.splice(p,1),p}}}function rae(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||Kie.test(t.slice(0,e))?t:""}function G8(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function sae(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function iae(t,e,n){const s=y0((n||{}).ignore||[]),i=aae(e);let l=-1;for(;++l0?{type:"text",value:E}:void 0),E===!1?x.lastIndex=_+1:(b!==_&&T.push({type:"text",value:h.value.slice(b,_)}),Array.isArray(E)?T.push(...E):E&&T.push(E),b=_+M[0].length,j=!0),!x.global)break;M=x.exec(h.value)}return j?(b?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const s=G8(t,"(");let i=G8(t,")");for(;r!==-1&&s>i;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[t,n]}function zD(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Cc(n)||Ix(n))&&(!e||n!==47)}PD.peek=Mae;function wae(){this.buffer()}function Sae(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function kae(){this.buffer()}function Oae(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function jae(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=qi(this.sliceSerialize(t)).toLowerCase(),n.label=e}function Nae(t){this.exit(t)}function Cae(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=qi(this.sliceSerialize(t)).toLowerCase(),n.label=e}function Tae(t){this.exit(t)}function Mae(){return"["}function PD(t,e,n,r){const s=n.createTracker(r);let i=s.move("[^");const l=n.enter("footnoteReference"),c=n.enter("reference");return i+=s.move(n.safe(n.associationId(t),{after:"]",before:i})),c(),l(),i+=s.move("]"),i}function Aae(){return{enter:{gfmFootnoteCallString:wae,gfmFootnoteCall:Sae,gfmFootnoteDefinitionLabelString:kae,gfmFootnoteDefinition:Oae},exit:{gfmFootnoteCallString:jae,gfmFootnoteCall:Nae,gfmFootnoteDefinitionLabelString:Cae,gfmFootnoteDefinition:Tae}}}function Eae(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:PD},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,l){const c=i.createTracker(l);let d=c.move("[^");const h=i.enter("footnoteDefinition"),m=i.enter("label");return d+=c.move(i.safe(i.associationId(r),{before:d,after:"]"})),m(),d+=c.move("]:"),r.children&&r.children.length>0&&(c.shift(4),d+=c.move((e?` +`:" ")+i.indentLines(i.containerFlow(r,c.current()),e?LD:_ae))),h(),d}}function _ae(t,e,n){return e===0?t:LD(t,e,n)}function LD(t,e,n){return(n?"":" ")+t}const Dae=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];BD.peek=Bae;function Rae(){return{canContainEols:["delete"],enter:{strikethrough:Pae},exit:{strikethrough:Lae}}}function zae(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Dae}],handlers:{delete:BD}}}function Pae(t){this.enter({type:"delete",children:[]},t)}function Lae(t){this.exit(t)}function BD(t,e,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let l=s.move("~~");return l+=n.containerPhrasing(t,{...s.current(),before:l,after:"~"}),l+=s.move("~~"),i(),l}function Bae(){return"~"}function Iae(t){return t.length}function qae(t,e){const n=e||{},r=(n.align||[]).concat(),s=n.stringLength||Iae,i=[],l=[],c=[],d=[];let h=0,m=-1;for(;++mh&&(h=t[m].length);++jd[j])&&(d[j]=M)}k.push(T)}l[m]=k,c[m]=O}let p=-1;if(typeof r=="object"&&"length"in r)for(;++pd[p]&&(d[p]=T),v[p]=T),x[p]=M}l.splice(1,0,x),c.splice(1,0,v),m=-1;const b=[];for(;++m "),i.shift(2);const l=n.indentLines(n.containerFlow(t,i.current()),$ae);return s(),l}function $ae(t,e,n){return">"+(n?"":" ")+t}function Hae(t,e){return Y8(t,e.inConstruct,!0)&&!Y8(t,e.notInConstruct,!1)}function Y8(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++rl&&(l=i):i=1,s=r+e.length,r=n.indexOf(e,s);return l}function Uae(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function Vae(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function Wae(t,e,n,r){const s=Vae(n),i=t.value||"",l=s==="`"?"GraveAccent":"Tilde";if(Uae(t,n)){const p=n.enter("codeIndented"),x=n.indentLines(i,Gae);return p(),x}const c=n.createTracker(r),d=s.repeat(Math.max(ID(i,s)+1,3)),h=n.enter("codeFenced");let m=c.move(d);if(t.lang){const p=n.enter(`codeFencedLang${l}`);m+=c.move(n.safe(t.lang,{before:m,after:" ",encode:["`"],...c.current()})),p()}if(t.lang&&t.meta){const p=n.enter(`codeFencedMeta${l}`);m+=c.move(" "),m+=c.move(n.safe(t.meta,{before:m,after:` +`,encode:["`"],...c.current()})),p()}return m+=c.move(` +`),i&&(m+=c.move(i+` +`)),m+=c.move(d),h(),m}function Gae(t,e,n){return(n?"":" ")+t}function O5(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function Xae(t,e,n,r){const s=O5(n),i=s==='"'?"Quote":"Apostrophe",l=n.enter("definition");let c=n.enter("label");const d=n.createTracker(r);let h=d.move("[");return h+=d.move(n.safe(n.associationId(t),{before:h,after:"]",...d.current()})),h+=d.move("]: "),c(),!t.url||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(n.safe(t.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(c=n.enter("destinationRaw"),h+=d.move(n.safe(t.url,{before:h,after:t.title?" ":` +`,...d.current()}))),c(),t.title&&(c=n.enter(`title${i}`),h+=d.move(" "+s),h+=d.move(n.safe(t.title,{before:h,after:s,...d.current()})),h+=d.move(s),c()),l(),h}function Yae(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function Bf(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Wg(t,e,n){const r=vd(t),s=vd(e);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}qD.peek=Kae;function qD(t,e,n,r){const s=Yae(n),i=n.enter("emphasis"),l=n.createTracker(r),c=l.move(s);let d=l.move(n.containerPhrasing(t,{after:s,before:c,...l.current()}));const h=d.charCodeAt(0),m=Wg(r.before.charCodeAt(r.before.length-1),h,s);m.inside&&(d=Bf(h)+d.slice(1));const p=d.charCodeAt(d.length-1),x=Wg(r.after.charCodeAt(0),p,s);x.inside&&(d=d.slice(0,-1)+Bf(p));const v=l.move(s);return i(),n.attentionEncodeSurroundingInfo={after:x.outside,before:m.outside},c+d+v}function Kae(t,e,n){return n.options.emphasis||"*"}function Zae(t,e){let n=!1;return S5(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,x4}),!!((!t.depth||t.depth<3)&&m5(t)&&(e.options.setext||n))}function Jae(t,e,n,r){const s=Math.max(Math.min(6,t.depth||1),1),i=n.createTracker(r);if(Zae(t,n)){const m=n.enter("headingSetext"),p=n.enter("phrasing"),x=n.containerPhrasing(t,{...i.current(),before:` +`,after:` +`});return p(),m(),x+` +`+(s===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(` +`))+1))}const l="#".repeat(s),c=n.enter("headingAtx"),d=n.enter("phrasing");i.move(l+" ");let h=n.containerPhrasing(t,{before:"# ",after:` +`,...i.current()});return/^[\t ]/.test(h)&&(h=Bf(h.charCodeAt(0))+h.slice(1)),h=h?l+" "+h:l,n.options.closeAtx&&(h+=" "+l),d(),c(),h}FD.peek=ele;function FD(t){return t.value||""}function ele(){return"<"}QD.peek=tle;function QD(t,e,n,r){const s=O5(n),i=s==='"'?"Quote":"Apostrophe",l=n.enter("image");let c=n.enter("label");const d=n.createTracker(r);let h=d.move("![");return h+=d.move(n.safe(t.alt,{before:h,after:"]",...d.current()})),h+=d.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(n.safe(t.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(c=n.enter("destinationRaw"),h+=d.move(n.safe(t.url,{before:h,after:t.title?" ":")",...d.current()}))),c(),t.title&&(c=n.enter(`title${i}`),h+=d.move(" "+s),h+=d.move(n.safe(t.title,{before:h,after:s,...d.current()})),h+=d.move(s),c()),h+=d.move(")"),l(),h}function tle(){return"!"}$D.peek=nle;function $D(t,e,n,r){const s=t.referenceType,i=n.enter("imageReference");let l=n.enter("label");const c=n.createTracker(r);let d=c.move("![");const h=n.safe(t.alt,{before:d,after:"]",...c.current()});d+=c.move(h+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(t),{before:d,after:"]",...c.current()});return l(),n.stack=m,i(),s==="full"||!h||h!==p?d+=c.move(p+"]"):s==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function nle(){return"!"}HD.peek=rle;function HD(t,e,n){let r=t.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i\u007F]/.test(t.url))}VD.peek=sle;function VD(t,e,n,r){const s=O5(n),i=s==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let c,d;if(UD(t,n)){const m=n.stack;n.stack=[],c=n.enter("autolink");let p=l.move("<");return p+=l.move(n.containerPhrasing(t,{before:p,after:">",...l.current()})),p+=l.move(">"),c(),n.stack=m,p}c=n.enter("link"),d=n.enter("label");let h=l.move("[");return h+=l.move(n.containerPhrasing(t,{before:h,after:"](",...l.current()})),h+=l.move("]("),d(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(d=n.enter("destinationLiteral"),h+=l.move("<"),h+=l.move(n.safe(t.url,{before:h,after:">",...l.current()})),h+=l.move(">")):(d=n.enter("destinationRaw"),h+=l.move(n.safe(t.url,{before:h,after:t.title?" ":")",...l.current()}))),d(),t.title&&(d=n.enter(`title${i}`),h+=l.move(" "+s),h+=l.move(n.safe(t.title,{before:h,after:s,...l.current()})),h+=l.move(s),d()),h+=l.move(")"),c(),h}function sle(t,e,n){return UD(t,n)?"<":"["}WD.peek=ile;function WD(t,e,n,r){const s=t.referenceType,i=n.enter("linkReference");let l=n.enter("label");const c=n.createTracker(r);let d=c.move("[");const h=n.containerPhrasing(t,{before:d,after:"]",...c.current()});d+=c.move(h+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(t),{before:d,after:"]",...c.current()});return l(),n.stack=m,i(),s==="full"||!h||h!==p?d+=c.move(p+"]"):s==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function ile(){return"["}function j5(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function ale(t){const e=j5(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function lle(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function GD(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function ole(t,e,n,r){const s=n.enter("list"),i=n.bulletCurrent;let l=t.ordered?lle(n):j5(n);const c=t.ordered?l==="."?")":".":ale(n);let d=e&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!t.ordered){const m=t.children?t.children[0]:void 0;if((l==="*"||l==="-")&&m&&(!m.children||!m.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(d=!0),GD(n)===l&&m){let p=-1;for(;++p-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+i);let l=i.length+1;(s==="tab"||s==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(l=Math.ceil(l/4)*4);const c=n.createTracker(r);c.move(i+" ".repeat(l-i.length)),c.shift(l);const d=n.enter("listItem"),h=n.indentLines(n.containerFlow(t,c.current()),m);return d(),h;function m(p,x,v){return x?(v?"":" ".repeat(l))+p:(v?i:i+" ".repeat(l-i.length))+p}}function dle(t,e,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),l=n.containerPhrasing(t,r);return i(),s(),l}const hle=y0(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function fle(t,e,n,r){return(t.children.some(function(l){return hle(l)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function mle(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}XD.peek=ple;function XD(t,e,n,r){const s=mle(n),i=n.enter("strong"),l=n.createTracker(r),c=l.move(s+s);let d=l.move(n.containerPhrasing(t,{after:s,before:c,...l.current()}));const h=d.charCodeAt(0),m=Wg(r.before.charCodeAt(r.before.length-1),h,s);m.inside&&(d=Bf(h)+d.slice(1));const p=d.charCodeAt(d.length-1),x=Wg(r.after.charCodeAt(0),p,s);x.inside&&(d=d.slice(0,-1)+Bf(p));const v=l.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:x.outside,before:m.outside},c+d+v}function ple(t,e,n){return n.options.strong||"*"}function gle(t,e,n,r){return n.safe(t.value,r)}function xle(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function vle(t,e,n){const r=(GD(n)+(n.options.ruleSpaces?" ":"")).repeat(xle(n));return n.options.ruleSpaces?r.slice(0,-1):r}const YD={blockquote:Qae,break:K8,code:Wae,definition:Xae,emphasis:qD,hardBreak:K8,heading:Jae,html:FD,image:QD,imageReference:$D,inlineCode:HD,link:VD,linkReference:WD,list:ole,listItem:ule,paragraph:dle,root:fle,strong:XD,text:gle,thematicBreak:vle};function yle(){return{enter:{table:ble,tableData:Z8,tableHeader:Z8,tableRow:Sle},exit:{codeText:kle,table:wle,tableData:Tb,tableHeader:Tb,tableRow:Tb}}}function ble(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function wle(t){this.exit(t),this.data.inTable=void 0}function Sle(t){this.enter({type:"tableRow",children:[]},t)}function Tb(t){this.exit(t)}function Z8(t){this.enter({type:"tableCell",children:[]},t)}function kle(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,Ole));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function Ole(t,e){return e==="|"?e:t}function jle(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,s=e.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:l,tableCell:d,tableRow:c}};function l(v,b,k,O){return h(m(v,k,O),v.align)}function c(v,b,k,O){const j=p(v,k,O),T=h([j]);return T.slice(0,T.indexOf(` +`))}function d(v,b,k,O){const j=k.enter("tableCell"),T=k.enter("phrasing"),M=k.containerPhrasing(v,{...O,before:i,after:i});return T(),j(),M}function h(v,b){return qae(v,{align:b,alignDelimiters:r,padding:n,stringLength:s})}function m(v,b,k){const O=v.children;let j=-1;const T=[],M=b.enter("table");for(;++j0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const $le={tokenize:Kle,partial:!0};function Hle(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Gle,continuation:{tokenize:Xle},exit:Yle}},text:{91:{name:"gfmFootnoteCall",tokenize:Wle},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Ule,resolveTo:Vle}}}}function Ule(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;s--;){const d=r.events[s][1];if(d.type==="labelImage"){l=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return c;function c(d){if(!l||!l._balanced)return n(d);const h=qi(r.sliceSerialize({start:l.end,end:r.now()}));return h.codePointAt(0)!==94||!i.includes(h.slice(1))?n(d):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),e(d))}}function Vle(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},c=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",l,e],["exit",l,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...c),t}function Wle(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,l;return c;function c(p){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),d}function d(p){return p!==94?n(p):(t.enter("gfmFootnoteCallMarker"),t.consume(p),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(p){if(i>999||p===93&&!l||p===null||p===91||Dn(p))return n(p);if(p===93){t.exit("chunkString");const x=t.exit("gfmFootnoteCallString");return s.includes(qi(r.sliceSerialize(x)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(p)}return Dn(p)||(l=!0),i++,t.consume(p),p===92?m:h}function m(p){return p===91||p===92||p===93?(t.consume(p),i++,h):h(p)}}function Gle(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,l=0,c;return d;function d(b){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(b){return b===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",m):n(b)}function m(b){if(l>999||b===93&&!c||b===null||b===91||Dn(b))return n(b);if(b===93){t.exit("chunkString");const k=t.exit("gfmFootnoteDefinitionLabelString");return i=qi(r.sliceSerialize(k)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),x}return Dn(b)||(c=!0),l++,t.consume(b),b===92?p:m}function p(b){return b===91||b===92||b===93?(t.consume(b),l++,m):m(b)}function x(b){return b===58?(t.enter("definitionMarker"),t.consume(b),t.exit("definitionMarker"),s.includes(i)||s.push(i),zt(t,v,"gfmFootnoteDefinitionWhitespace")):n(b)}function v(b){return e(b)}}function Xle(t,e,n){return t.check(v0,e,t.attempt($le,e,n))}function Yle(t){t.exit("gfmFootnoteDefinition")}function Kle(t,e,n){const r=this;return zt(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?e(i):n(i)}}function Zle(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(l,c){let d=-1;for(;++d1?d(b):(l.consume(b),p++,v);if(p<2&&!n)return d(b);const O=l.exit("strikethroughSequenceTemporary"),j=vd(b);return O._open=!j||j===2&&!!k,O._close=!k||k===2&&!!j,c(b)}}}class Jle{constructor(){this.map=[]}add(e,n,r){eoe(this,e,n,r)}consume(e){if(this.map.sort(function(i,l){return i[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let s=r.pop();for(;s;){for(const i of s)e.push(i);s=r.pop()}this.map.length=0}}function eoe(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const W=r.events[U][1].type;if(W==="lineEnding"||W==="linePrefix")U--;else break}const V=U>-1?r.events[U][1].type:null,ce=V==="tableHead"||V==="tableRow"?E:d;return ce===E&&r.parser.lazy[r.now().line]?n(B):ce(B)}function d(B){return t.enter("tableHead"),t.enter("tableRow"),h(B)}function h(B){return B===124||(l=!0,i+=1),m(B)}function m(B){return B===null?n(B):Ze(B)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(B),t.exit("lineEnding"),v):n(B):qt(B)?zt(t,m,"whitespace")(B):(i+=1,l&&(l=!1,s+=1),B===124?(t.enter("tableCellDivider"),t.consume(B),t.exit("tableCellDivider"),l=!0,m):(t.enter("data"),p(B)))}function p(B){return B===null||B===124||Dn(B)?(t.exit("data"),m(B)):(t.consume(B),B===92?x:p)}function x(B){return B===92||B===124?(t.consume(B),p):p(B)}function v(B){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(B):(t.enter("tableDelimiterRow"),l=!1,qt(B)?zt(t,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):b(B))}function b(B){return B===45||B===58?O(B):B===124?(l=!0,t.enter("tableCellDivider"),t.consume(B),t.exit("tableCellDivider"),k):D(B)}function k(B){return qt(B)?zt(t,O,"whitespace")(B):O(B)}function O(B){return B===58?(i+=1,l=!0,t.enter("tableDelimiterMarker"),t.consume(B),t.exit("tableDelimiterMarker"),j):B===45?(i+=1,j(B)):B===null||Ze(B)?_(B):D(B)}function j(B){return B===45?(t.enter("tableDelimiterFiller"),T(B)):D(B)}function T(B){return B===45?(t.consume(B),T):B===58?(l=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(B),t.exit("tableDelimiterMarker"),M):(t.exit("tableDelimiterFiller"),M(B))}function M(B){return qt(B)?zt(t,_,"whitespace")(B):_(B)}function _(B){return B===124?b(B):B===null||Ze(B)?!l||s!==i?D(B):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(B)):D(B)}function D(B){return n(B)}function E(B){return t.enter("tableRow"),z(B)}function z(B){return B===124?(t.enter("tableCellDivider"),t.consume(B),t.exit("tableCellDivider"),z):B===null||Ze(B)?(t.exit("tableRow"),e(B)):qt(B)?zt(t,z,"whitespace")(B):(t.enter("data"),Q(B))}function Q(B){return B===null||B===124||Dn(B)?(t.exit("data"),z(B)):(t.consume(B),B===92?F:Q)}function F(B){return B===92||B===124?(t.consume(B),Q):Q(B)}}function soe(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],l=[0,0,0,0],c=!1,d=0,h,m,p;const x=new Jle;for(;++nn[2]+1){const b=n[2]+1,k=n[3]-n[2]-1;t.add(b,k,[])}}t.add(n[3]+1,0,[["exit",p,e]])}return s!==void 0&&(i.end=Object.assign({},Bu(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function eN(t,e,n,r,s){const i=[],l=Bu(e.events,n);s&&(s.end=Object.assign({},l),i.push(["exit",s,e])),r.end=Object.assign({},l),i.push(["exit",r,e]),t.add(n+1,0,i)}function Bu(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const ioe={name:"tasklistCheck",tokenize:loe};function aoe(){return{text:{91:ioe}}}function loe(t,e,n){const r=this;return s;function s(d){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(d):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),i)}function i(d){return Dn(d)?(t.enter("taskListCheckValueUnchecked"),t.consume(d),t.exit("taskListCheckValueUnchecked"),l):d===88||d===120?(t.enter("taskListCheckValueChecked"),t.consume(d),t.exit("taskListCheckValueChecked"),l):n(d)}function l(d){return d===93?(t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),c):n(d)}function c(d){return Ze(d)?e(d):qt(d)?t.check({tokenize:ooe},e,n)(d):n(d)}}function ooe(t,e,n){return zt(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function coe(t){return mD([Rle(),Hle(),Zle(t),noe(),aoe()])}const uoe={};function doe(t){const e=this,n=t||uoe,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(coe(n)),i.push(Ale()),l.push(Ele(n))}function hoe(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:c,mathText:l,mathTextData:c}};function t(d){const h={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[h]}},d)}function e(){this.buffer()}function n(){const d=this.resume(),h=this.stack[this.stack.length-1];h.type,h.meta=d}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(d){const h=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),m=this.stack[this.stack.length-1];m.type,this.exit(d),m.value=h;const p=m.data.hChildren[0];p.type,p.tagName,p.children.push({type:"text",value:h}),this.data.mathFlowInside=void 0}function i(d){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},d),this.buffer()}function l(d){const h=this.resume(),m=this.stack[this.stack.length-1];m.type,this.exit(d),m.value=h,m.data.hChildren.push({type:"text",value:h})}function c(d){this.config.enter.data.call(this,d),this.config.exit.data.call(this,d)}}function foe(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` +`,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(i,l,c,d){const h=i.value||"",m=c.createTracker(d),p="$".repeat(Math.max(ID(h,"$")+1,2)),x=c.enter("mathFlow");let v=m.move(p);if(i.meta){const b=c.enter("mathFlowMeta");v+=m.move(c.safe(i.meta,{after:` +`,before:v,encode:["$"],...m.current()})),b()}return v+=m.move(` +`),h&&(v+=m.move(h+` +`)),v+=m.move(p),x(),v}function r(i,l,c){let d=i.value||"",h=1;for(e||h++;new RegExp("(^|[^$])"+"\\$".repeat(h)+"([^$]|$)").test(d);)h++;const m="$".repeat(h);/[^ \r\n]/.test(d)&&(/^[ \r\n]/.test(d)&&/[ \r\n]$/.test(d)||/^\$|\$$/.test(d))&&(d=" "+d+" ");let p=-1;for(;++p15?h="…"+c.slice(s-15,s):h=c.slice(0,s);var m;i+15":">","<":"<",'"':""","'":"'"},joe=/[&><"']/g;function Noe(t){return String(t).replace(joe,e=>Ooe[e])}var iR=function t(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?t(e.body[0]):e:e.type==="font"?t(e.body):e},Coe=function(e){var n=iR(e);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},Toe=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},Moe=function(e){var n=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},tn={deflt:woe,escape:Noe,hyphenate:koe,getBaseElem:iR,isCharacterBox:Coe,protocolFromUrl:Moe},cg={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand ",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function Aoe(t){if(t.default)return t.default;var e=t.type,n=Array.isArray(e)?e[0]:e;if(typeof n!="string")return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class C5{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var n in cg)if(cg.hasOwnProperty(n)){var r=cg[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:Aoe(r)}}reportNonstrict(e,n,r){var s=this.strict;if(typeof s=="function"&&(s=s(e,n,r)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new De("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+e+"]"),r);s==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]"))}}useStrictBehavior(e,n,r){var s=this.strict;if(typeof s=="function")try{s=s(e,n,r)}catch{s="error"}return!s||s==="ignore"?!1:s===!0||s==="error"?!0:s==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var n=tn.protocolFromUrl(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class Xl{constructor(e,n,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=n,this.cramped=r}sup(){return ia[Eoe[this.id]]}sub(){return ia[_oe[this.id]]}fracNum(){return ia[Doe[this.id]]}fracDen(){return ia[Roe[this.id]]}cramp(){return ia[zoe[this.id]]}text(){return ia[Poe[this.id]]}isTight(){return this.size>=2}}var T5=0,Gg=1,ed=2,cl=3,If=4,ki=5,yd=6,hs=7,ia=[new Xl(T5,0,!1),new Xl(Gg,0,!0),new Xl(ed,1,!1),new Xl(cl,1,!0),new Xl(If,2,!1),new Xl(ki,2,!0),new Xl(yd,3,!1),new Xl(hs,3,!0)],Eoe=[If,ki,If,ki,yd,hs,yd,hs],_oe=[ki,ki,ki,ki,hs,hs,hs,hs],Doe=[ed,cl,If,ki,yd,hs,yd,hs],Roe=[cl,cl,ki,ki,hs,hs,hs,hs],zoe=[Gg,Gg,cl,cl,ki,ki,hs,hs],Poe=[T5,Gg,ed,cl,ed,cl,ed,cl],at={DISPLAY:ia[T5],TEXT:ia[ed],SCRIPT:ia[If],SCRIPTSCRIPT:ia[yd]},S4=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function Loe(t){for(var e=0;e=s[0]&&t<=s[1])return n.name}return null}var ug=[];S4.forEach(t=>t.blocks.forEach(e=>ug.push(...e)));function aR(t){for(var e=0;e=ug[e]&&t<=ug[e+1])return!0;return!1}var Tu=80,Boe=function(e,n){return"M95,"+(622+e+n)+` +c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 +c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 +c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 +s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429 +c69,-144,104.5,-217.7,106.5,-221 +l`+e/2.075+" -"+e+` +c5.3,-9.3,12,-14,20,-14 +H400000v`+(40+e)+`H845.2724 +s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 +c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z +M`+(834+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},Ioe=function(e,n){return"M263,"+(601+e+n)+`c0.7,0,18,39.7,52,119 +c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 +c340,-704.7,510.7,-1060.3,512,-1067 +l`+e/2.084+" -"+e+` +c4.7,-7.3,11,-11,19,-11 +H40000v`+(40+e)+`H1012.3 +s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232 +c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 +s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 +c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z +M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},qoe=function(e,n){return"M983 "+(10+e+n)+` +l`+e/3.13+" -"+e+` +c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+` +H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 +s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744 +c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 +c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 +c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 +c53.7,-170.3,84.5,-266.8,92.5,-289.5z +M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},Foe=function(e,n){return"M424,"+(2398+e+n)+` +c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 +c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 +s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 +s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081 +l`+e/4.223+" -"+e+`c4,-6.7,10,-10,18,-10 H400000 +v`+(40+e)+`H1014.6 +s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 +c-2,6,-10,9,-24,9 +c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+" "+n+` +h400000v`+(40+e)+"h-400000z"},Qoe=function(e,n){return"M473,"+(2713+e+n)+` +c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+" -"+e+` +c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7 +s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 +c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 +c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 +s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, +606zM`+(1001+e)+" "+n+"h400000v"+(40+e)+"H1017.7z"},$oe=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},Hoe=function(e,n,r){var s=r-54-n-e;return"M702 "+(e+n)+"H400000"+(40+e)+` +H742v`+s+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 +h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 +c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 +219 661 l218 661zM702 `+n+"H400000v"+(40+e)+"H742z"},Uoe=function(e,n,r){n=1e3*n;var s="";switch(e){case"sqrtMain":s=Boe(n,Tu);break;case"sqrtSize1":s=Ioe(n,Tu);break;case"sqrtSize2":s=qoe(n,Tu);break;case"sqrtSize3":s=Foe(n,Tu);break;case"sqrtSize4":s=Qoe(n,Tu);break;case"sqrtTall":s=Hoe(n,Tu,r)}return s},Voe=function(e,n){switch(e){case"⎜":return"M291 0 H417 V"+n+" H291z M291 0 H417 V"+n+" H291z";case"∣":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z";case"∥":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z"+("M367 0 H410 V"+n+" H367z M367 0 H410 V"+n+" H367z");case"⎟":return"M457 0 H583 V"+n+" H457z M457 0 H583 V"+n+" H457z";case"⎢":return"M319 0 H403 V"+n+" H319z M319 0 H403 V"+n+" H319z";case"⎥":return"M263 0 H347 V"+n+" H263z M263 0 H347 V"+n+" H263z";case"⎪":return"M384 0 H504 V"+n+" H384z M384 0 H504 V"+n+" H384z";case"⏐":return"M312 0 H355 V"+n+" H312z M312 0 H355 V"+n+" H312z";case"‖":return"M257 0 H300 V"+n+" H257z M257 0 H300 V"+n+" H257z"+("M478 0 H521 V"+n+" H478z M478 0 H521 V"+n+" H478z");default:return""}},nN={doubleleftarrow:`M262 157 +l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3 + 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28 + 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5 +c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5 + 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87 +-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7 +-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z +m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l +-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5 + 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88 +-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68 +-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18 +-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782 +c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3 +-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120 + 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8 +-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247 +c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208 + 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3 + 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202 + l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117 +-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7 + 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13 + 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688 + 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7 +-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80 +H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0 + 435 0h399565z`,leftgroupunder:`M400000 262 +H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219 + 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3 +-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5 +-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7 +-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5 + 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3 +-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7 +-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z +m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333 + 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5 + 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667 +-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12 + 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7 +-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0 +v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5 +-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3 +-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21 + 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z +M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z +M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23 +-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8 +c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3 + 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z +M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334 +c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14 +-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7 + 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11 + 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214 +c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14 + 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3 + 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0 +-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6 +-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z +m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8 +60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8 +-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z +m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2 +c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6 +-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z +m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0 +85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8 +-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z +m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1 +c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128 +-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 + 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 + 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85 +-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 +-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 + 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l +-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5 +s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1 +c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3 + 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237 +-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0 + 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18 + 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3 +-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2 +-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 + 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11 +-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7 + 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z +m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8 + 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5 +-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95 +-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8 + 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 + 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3 +-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z +m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3 + 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0 +-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21 + 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z +M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23 + 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32 +-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142 +-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40 + 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69 +-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3 +-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19 +-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101 + 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167 +c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3 + 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42 + 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333 +-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70 + 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7 +-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0 + 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0 + 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128 +-68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418 +-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9 + 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114 +c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751 + 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457 +-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0 + 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697 + 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696 + -338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345 +-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409 + 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9 + 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409 + -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5 +3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11 +10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63 +-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1 +-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59 +H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359 +c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22 +c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1, +-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202 +c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5 +c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130 +s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47 +121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6 +s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11 +c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z +M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32 +-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0 +13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39 +-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5 +-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 +-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 +151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 +c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17 +c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21 +c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40 +c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z +M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0 +c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, +-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 +c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z +M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 +c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9, +1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7, +-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z +M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0 +c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, +-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 +c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z +M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},Woe=function(e,n){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v1759 h347 v-84 +H403z M403 1759 V0 H319 V1759 v`+n+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v1759 H0 v84 H347z +M347 1759 V0 H263 V1759 v`+n+" v1759 h84z";case"vert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+" v585 h43z";case"doublevert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+` v585 h43z +M367 15 v585 v`+n+` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+n+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+n+` v1715 h263 v84 H319z +MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+n+` v1799 H0 v-84 H319z +MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v602 h84z +M403 1759 V0 H319 V1759 v`+n+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v602 h84z +M347 1759 V0 h-84 V1759 v`+n+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1 +c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349, +-36,557 l0,`+(n+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210, +949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9 +c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5, +-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189 +l0,-`+(n+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3, +-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3, +63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5 +c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(n+9)+` +c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664 +c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11 +c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 +c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 +l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, +-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class w0{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),n=0;nn.toText();return this.children.map(e).join("")}}var ma={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Tp={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},rN={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function Goe(t,e){ma[t]=e}function M5(t,e,n){if(!ma[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),s=ma[e][r];if(!s&&t[0]in rN&&(r=rN[t[0]].charCodeAt(0),s=ma[e][r]),!s&&n==="text"&&aR(r)&&(s=ma[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var Mb={};function Xoe(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!Mb[e]){var n=Mb[e]={cssEmPerMu:Tp.quad[e]/18};for(var r in Tp)Tp.hasOwnProperty(r)&&(n[r]=Tp[r][e])}return Mb[e]}var Yoe=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],sN=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],iN=function(e,n){return n.size<2?e:Yoe[e-1][n.size-1]};class rl{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||rl.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=sN[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return new rl(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:iN(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:sN[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=iN(rl.BASESIZE,e);return this.size===n&&this.textSize===rl.BASESIZE&&this.style===e?this:this.extend({style:e,size:n})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==rl.BASESIZE?["sizing","reset-size"+this.size,"size"+rl.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Xoe(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}rl.BASESIZE=6;var k4={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},Koe={ex:!0,em:!0,mu:!0},lR=function(e){return typeof e!="string"&&(e=e.unit),e in k4||e in Koe||e==="ex"},Kn=function(e,n){var r;if(e.unit in k4)r=k4[e.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(e.unit==="mu")r=n.fontMetrics().cssEmPerMu;else{var s;if(n.style.isTight()?s=n.havingStyle(n.style.text()):s=n,e.unit==="ex")r=s.fontMetrics().xHeight;else if(e.unit==="em")r=s.fontMetrics().quad;else throw new De("Invalid unit: '"+e.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},Be=function(e){return+e.toFixed(4)+"em"},vo=function(e){return e.filter(n=>n).join(" ")},oR=function(e,n,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},n){n.style.isTight()&&this.classes.push("mtight");var s=n.getColor();s&&(this.style.color=s)}},cR=function(e){var n=document.createElement(e);n.className=vo(this.classes);for(var r in this.style)this.style.hasOwnProperty(r)&&(n.style[r]=this.style[r]);for(var s in this.attributes)this.attributes.hasOwnProperty(s)&&n.setAttribute(s,this.attributes[s]);for(var i=0;i/=\x00-\x1f]/,uR=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+tn.escape(vo(this.classes))+'"');var r="";for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=tn.hyphenate(s)+":"+this.style[s]+";");r&&(n+=' style="'+tn.escape(r)+'"');for(var i in this.attributes)if(this.attributes.hasOwnProperty(i)){if(Zoe.test(i))throw new De("Invalid attribute name '"+i+"'");n+=" "+i+'="'+tn.escape(this.attributes[i])+'"'}n+=">";for(var l=0;l",n};class S0{constructor(e,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,oR.call(this,e,r,s),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return cR.call(this,"span")}toMarkup(){return uR.call(this,"span")}}class A5{constructor(e,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,oR.call(this,n,s),this.children=r||[],this.setAttribute("href",e)}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return cR.call(this,"a")}toMarkup(){return uR.call(this,"a")}}class Joe{constructor(e,n,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=e,this.classes=["mord"],this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var n in this.style)this.style.hasOwnProperty(n)&&(e.style[n]=this.style[n]);return e}toMarkup(){var e=''+tn.escape(this.alt)+'0&&(n=document.createElement("span"),n.style.marginRight=Be(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=vo(this.classes));for(var r in this.style)this.style.hasOwnProperty(r)&&(n=n||document.createElement("span"),n.style[r]=this.style[r]);return n?(n.appendChild(e),n):e}toMarkup(){var e=!1,n="0&&(r+="margin-right:"+this.italic+"em;");for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=tn.hyphenate(s)+":"+this.style[s]+";");r&&(e=!0,n+=' style="'+tn.escape(r)+'"');var i=tn.escape(this.text);return e?(n+=">",n+=i,n+="",n):i}}class gl{constructor(e,n){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=n||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);for(var s=0;s':''}}class O4{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"line");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var e=" but got "+String(t)+".")}var nce={bin:1,close:1,inner:1,open:1,punct:1,rel:1},rce={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Ln={math:{},text:{}};function N(t,e,n,r,s,i){Ln[t][s]={font:e,group:n,replace:r},i&&r&&(Ln[t][r]=Ln[t][s])}var C="math",Ee="text",L="main",G="ams",Wn="accent-token",Ve="bin",xs="close",Rd="inner",st="mathord",yr="op-token",ai="open",$x="punct",X="rel",wl="spacing",le="textord";N(C,L,X,"≡","\\equiv",!0);N(C,L,X,"≺","\\prec",!0);N(C,L,X,"≻","\\succ",!0);N(C,L,X,"∼","\\sim",!0);N(C,L,X,"⊥","\\perp");N(C,L,X,"⪯","\\preceq",!0);N(C,L,X,"⪰","\\succeq",!0);N(C,L,X,"≃","\\simeq",!0);N(C,L,X,"∣","\\mid",!0);N(C,L,X,"≪","\\ll",!0);N(C,L,X,"≫","\\gg",!0);N(C,L,X,"≍","\\asymp",!0);N(C,L,X,"∥","\\parallel");N(C,L,X,"⋈","\\bowtie",!0);N(C,L,X,"⌣","\\smile",!0);N(C,L,X,"⊑","\\sqsubseteq",!0);N(C,L,X,"⊒","\\sqsupseteq",!0);N(C,L,X,"≐","\\doteq",!0);N(C,L,X,"⌢","\\frown",!0);N(C,L,X,"∋","\\ni",!0);N(C,L,X,"∝","\\propto",!0);N(C,L,X,"⊢","\\vdash",!0);N(C,L,X,"⊣","\\dashv",!0);N(C,L,X,"∋","\\owns");N(C,L,$x,".","\\ldotp");N(C,L,$x,"⋅","\\cdotp");N(C,L,le,"#","\\#");N(Ee,L,le,"#","\\#");N(C,L,le,"&","\\&");N(Ee,L,le,"&","\\&");N(C,L,le,"ℵ","\\aleph",!0);N(C,L,le,"∀","\\forall",!0);N(C,L,le,"ℏ","\\hbar",!0);N(C,L,le,"∃","\\exists",!0);N(C,L,le,"∇","\\nabla",!0);N(C,L,le,"♭","\\flat",!0);N(C,L,le,"ℓ","\\ell",!0);N(C,L,le,"♮","\\natural",!0);N(C,L,le,"♣","\\clubsuit",!0);N(C,L,le,"℘","\\wp",!0);N(C,L,le,"♯","\\sharp",!0);N(C,L,le,"♢","\\diamondsuit",!0);N(C,L,le,"ℜ","\\Re",!0);N(C,L,le,"♡","\\heartsuit",!0);N(C,L,le,"ℑ","\\Im",!0);N(C,L,le,"♠","\\spadesuit",!0);N(C,L,le,"§","\\S",!0);N(Ee,L,le,"§","\\S");N(C,L,le,"¶","\\P",!0);N(Ee,L,le,"¶","\\P");N(C,L,le,"†","\\dag");N(Ee,L,le,"†","\\dag");N(Ee,L,le,"†","\\textdagger");N(C,L,le,"‡","\\ddag");N(Ee,L,le,"‡","\\ddag");N(Ee,L,le,"‡","\\textdaggerdbl");N(C,L,xs,"⎱","\\rmoustache",!0);N(C,L,ai,"⎰","\\lmoustache",!0);N(C,L,xs,"⟯","\\rgroup",!0);N(C,L,ai,"⟮","\\lgroup",!0);N(C,L,Ve,"∓","\\mp",!0);N(C,L,Ve,"⊖","\\ominus",!0);N(C,L,Ve,"⊎","\\uplus",!0);N(C,L,Ve,"⊓","\\sqcap",!0);N(C,L,Ve,"∗","\\ast");N(C,L,Ve,"⊔","\\sqcup",!0);N(C,L,Ve,"◯","\\bigcirc",!0);N(C,L,Ve,"∙","\\bullet",!0);N(C,L,Ve,"‡","\\ddagger");N(C,L,Ve,"≀","\\wr",!0);N(C,L,Ve,"⨿","\\amalg");N(C,L,Ve,"&","\\And");N(C,L,X,"⟵","\\longleftarrow",!0);N(C,L,X,"⇐","\\Leftarrow",!0);N(C,L,X,"⟸","\\Longleftarrow",!0);N(C,L,X,"⟶","\\longrightarrow",!0);N(C,L,X,"⇒","\\Rightarrow",!0);N(C,L,X,"⟹","\\Longrightarrow",!0);N(C,L,X,"↔","\\leftrightarrow",!0);N(C,L,X,"⟷","\\longleftrightarrow",!0);N(C,L,X,"⇔","\\Leftrightarrow",!0);N(C,L,X,"⟺","\\Longleftrightarrow",!0);N(C,L,X,"↦","\\mapsto",!0);N(C,L,X,"⟼","\\longmapsto",!0);N(C,L,X,"↗","\\nearrow",!0);N(C,L,X,"↩","\\hookleftarrow",!0);N(C,L,X,"↪","\\hookrightarrow",!0);N(C,L,X,"↘","\\searrow",!0);N(C,L,X,"↼","\\leftharpoonup",!0);N(C,L,X,"⇀","\\rightharpoonup",!0);N(C,L,X,"↙","\\swarrow",!0);N(C,L,X,"↽","\\leftharpoondown",!0);N(C,L,X,"⇁","\\rightharpoondown",!0);N(C,L,X,"↖","\\nwarrow",!0);N(C,L,X,"⇌","\\rightleftharpoons",!0);N(C,G,X,"≮","\\nless",!0);N(C,G,X,"","\\@nleqslant");N(C,G,X,"","\\@nleqq");N(C,G,X,"⪇","\\lneq",!0);N(C,G,X,"≨","\\lneqq",!0);N(C,G,X,"","\\@lvertneqq");N(C,G,X,"⋦","\\lnsim",!0);N(C,G,X,"⪉","\\lnapprox",!0);N(C,G,X,"⊀","\\nprec",!0);N(C,G,X,"⋠","\\npreceq",!0);N(C,G,X,"⋨","\\precnsim",!0);N(C,G,X,"⪹","\\precnapprox",!0);N(C,G,X,"≁","\\nsim",!0);N(C,G,X,"","\\@nshortmid");N(C,G,X,"∤","\\nmid",!0);N(C,G,X,"⊬","\\nvdash",!0);N(C,G,X,"⊭","\\nvDash",!0);N(C,G,X,"⋪","\\ntriangleleft");N(C,G,X,"⋬","\\ntrianglelefteq",!0);N(C,G,X,"⊊","\\subsetneq",!0);N(C,G,X,"","\\@varsubsetneq");N(C,G,X,"⫋","\\subsetneqq",!0);N(C,G,X,"","\\@varsubsetneqq");N(C,G,X,"≯","\\ngtr",!0);N(C,G,X,"","\\@ngeqslant");N(C,G,X,"","\\@ngeqq");N(C,G,X,"⪈","\\gneq",!0);N(C,G,X,"≩","\\gneqq",!0);N(C,G,X,"","\\@gvertneqq");N(C,G,X,"⋧","\\gnsim",!0);N(C,G,X,"⪊","\\gnapprox",!0);N(C,G,X,"⊁","\\nsucc",!0);N(C,G,X,"⋡","\\nsucceq",!0);N(C,G,X,"⋩","\\succnsim",!0);N(C,G,X,"⪺","\\succnapprox",!0);N(C,G,X,"≆","\\ncong",!0);N(C,G,X,"","\\@nshortparallel");N(C,G,X,"∦","\\nparallel",!0);N(C,G,X,"⊯","\\nVDash",!0);N(C,G,X,"⋫","\\ntriangleright");N(C,G,X,"⋭","\\ntrianglerighteq",!0);N(C,G,X,"","\\@nsupseteqq");N(C,G,X,"⊋","\\supsetneq",!0);N(C,G,X,"","\\@varsupsetneq");N(C,G,X,"⫌","\\supsetneqq",!0);N(C,G,X,"","\\@varsupsetneqq");N(C,G,X,"⊮","\\nVdash",!0);N(C,G,X,"⪵","\\precneqq",!0);N(C,G,X,"⪶","\\succneqq",!0);N(C,G,X,"","\\@nsubseteqq");N(C,G,Ve,"⊴","\\unlhd");N(C,G,Ve,"⊵","\\unrhd");N(C,G,X,"↚","\\nleftarrow",!0);N(C,G,X,"↛","\\nrightarrow",!0);N(C,G,X,"⇍","\\nLeftarrow",!0);N(C,G,X,"⇏","\\nRightarrow",!0);N(C,G,X,"↮","\\nleftrightarrow",!0);N(C,G,X,"⇎","\\nLeftrightarrow",!0);N(C,G,X,"△","\\vartriangle");N(C,G,le,"ℏ","\\hslash");N(C,G,le,"▽","\\triangledown");N(C,G,le,"◊","\\lozenge");N(C,G,le,"Ⓢ","\\circledS");N(C,G,le,"®","\\circledR");N(Ee,G,le,"®","\\circledR");N(C,G,le,"∡","\\measuredangle",!0);N(C,G,le,"∄","\\nexists");N(C,G,le,"℧","\\mho");N(C,G,le,"Ⅎ","\\Finv",!0);N(C,G,le,"⅁","\\Game",!0);N(C,G,le,"‵","\\backprime");N(C,G,le,"▲","\\blacktriangle");N(C,G,le,"▼","\\blacktriangledown");N(C,G,le,"■","\\blacksquare");N(C,G,le,"⧫","\\blacklozenge");N(C,G,le,"★","\\bigstar");N(C,G,le,"∢","\\sphericalangle",!0);N(C,G,le,"∁","\\complement",!0);N(C,G,le,"ð","\\eth",!0);N(Ee,L,le,"ð","ð");N(C,G,le,"╱","\\diagup");N(C,G,le,"╲","\\diagdown");N(C,G,le,"□","\\square");N(C,G,le,"□","\\Box");N(C,G,le,"◊","\\Diamond");N(C,G,le,"¥","\\yen",!0);N(Ee,G,le,"¥","\\yen",!0);N(C,G,le,"✓","\\checkmark",!0);N(Ee,G,le,"✓","\\checkmark");N(C,G,le,"ℶ","\\beth",!0);N(C,G,le,"ℸ","\\daleth",!0);N(C,G,le,"ℷ","\\gimel",!0);N(C,G,le,"ϝ","\\digamma",!0);N(C,G,le,"ϰ","\\varkappa");N(C,G,ai,"┌","\\@ulcorner",!0);N(C,G,xs,"┐","\\@urcorner",!0);N(C,G,ai,"└","\\@llcorner",!0);N(C,G,xs,"┘","\\@lrcorner",!0);N(C,G,X,"≦","\\leqq",!0);N(C,G,X,"⩽","\\leqslant",!0);N(C,G,X,"⪕","\\eqslantless",!0);N(C,G,X,"≲","\\lesssim",!0);N(C,G,X,"⪅","\\lessapprox",!0);N(C,G,X,"≊","\\approxeq",!0);N(C,G,Ve,"⋖","\\lessdot");N(C,G,X,"⋘","\\lll",!0);N(C,G,X,"≶","\\lessgtr",!0);N(C,G,X,"⋚","\\lesseqgtr",!0);N(C,G,X,"⪋","\\lesseqqgtr",!0);N(C,G,X,"≑","\\doteqdot");N(C,G,X,"≓","\\risingdotseq",!0);N(C,G,X,"≒","\\fallingdotseq",!0);N(C,G,X,"∽","\\backsim",!0);N(C,G,X,"⋍","\\backsimeq",!0);N(C,G,X,"⫅","\\subseteqq",!0);N(C,G,X,"⋐","\\Subset",!0);N(C,G,X,"⊏","\\sqsubset",!0);N(C,G,X,"≼","\\preccurlyeq",!0);N(C,G,X,"⋞","\\curlyeqprec",!0);N(C,G,X,"≾","\\precsim",!0);N(C,G,X,"⪷","\\precapprox",!0);N(C,G,X,"⊲","\\vartriangleleft");N(C,G,X,"⊴","\\trianglelefteq");N(C,G,X,"⊨","\\vDash",!0);N(C,G,X,"⊪","\\Vvdash",!0);N(C,G,X,"⌣","\\smallsmile");N(C,G,X,"⌢","\\smallfrown");N(C,G,X,"≏","\\bumpeq",!0);N(C,G,X,"≎","\\Bumpeq",!0);N(C,G,X,"≧","\\geqq",!0);N(C,G,X,"⩾","\\geqslant",!0);N(C,G,X,"⪖","\\eqslantgtr",!0);N(C,G,X,"≳","\\gtrsim",!0);N(C,G,X,"⪆","\\gtrapprox",!0);N(C,G,Ve,"⋗","\\gtrdot");N(C,G,X,"⋙","\\ggg",!0);N(C,G,X,"≷","\\gtrless",!0);N(C,G,X,"⋛","\\gtreqless",!0);N(C,G,X,"⪌","\\gtreqqless",!0);N(C,G,X,"≖","\\eqcirc",!0);N(C,G,X,"≗","\\circeq",!0);N(C,G,X,"≜","\\triangleq",!0);N(C,G,X,"∼","\\thicksim");N(C,G,X,"≈","\\thickapprox");N(C,G,X,"⫆","\\supseteqq",!0);N(C,G,X,"⋑","\\Supset",!0);N(C,G,X,"⊐","\\sqsupset",!0);N(C,G,X,"≽","\\succcurlyeq",!0);N(C,G,X,"⋟","\\curlyeqsucc",!0);N(C,G,X,"≿","\\succsim",!0);N(C,G,X,"⪸","\\succapprox",!0);N(C,G,X,"⊳","\\vartriangleright");N(C,G,X,"⊵","\\trianglerighteq");N(C,G,X,"⊩","\\Vdash",!0);N(C,G,X,"∣","\\shortmid");N(C,G,X,"∥","\\shortparallel");N(C,G,X,"≬","\\between",!0);N(C,G,X,"⋔","\\pitchfork",!0);N(C,G,X,"∝","\\varpropto");N(C,G,X,"◀","\\blacktriangleleft");N(C,G,X,"∴","\\therefore",!0);N(C,G,X,"∍","\\backepsilon");N(C,G,X,"▶","\\blacktriangleright");N(C,G,X,"∵","\\because",!0);N(C,G,X,"⋘","\\llless");N(C,G,X,"⋙","\\gggtr");N(C,G,Ve,"⊲","\\lhd");N(C,G,Ve,"⊳","\\rhd");N(C,G,X,"≂","\\eqsim",!0);N(C,L,X,"⋈","\\Join");N(C,G,X,"≑","\\Doteq",!0);N(C,G,Ve,"∔","\\dotplus",!0);N(C,G,Ve,"∖","\\smallsetminus");N(C,G,Ve,"⋒","\\Cap",!0);N(C,G,Ve,"⋓","\\Cup",!0);N(C,G,Ve,"⩞","\\doublebarwedge",!0);N(C,G,Ve,"⊟","\\boxminus",!0);N(C,G,Ve,"⊞","\\boxplus",!0);N(C,G,Ve,"⋇","\\divideontimes",!0);N(C,G,Ve,"⋉","\\ltimes",!0);N(C,G,Ve,"⋊","\\rtimes",!0);N(C,G,Ve,"⋋","\\leftthreetimes",!0);N(C,G,Ve,"⋌","\\rightthreetimes",!0);N(C,G,Ve,"⋏","\\curlywedge",!0);N(C,G,Ve,"⋎","\\curlyvee",!0);N(C,G,Ve,"⊝","\\circleddash",!0);N(C,G,Ve,"⊛","\\circledast",!0);N(C,G,Ve,"⋅","\\centerdot");N(C,G,Ve,"⊺","\\intercal",!0);N(C,G,Ve,"⋒","\\doublecap");N(C,G,Ve,"⋓","\\doublecup");N(C,G,Ve,"⊠","\\boxtimes",!0);N(C,G,X,"⇢","\\dashrightarrow",!0);N(C,G,X,"⇠","\\dashleftarrow",!0);N(C,G,X,"⇇","\\leftleftarrows",!0);N(C,G,X,"⇆","\\leftrightarrows",!0);N(C,G,X,"⇚","\\Lleftarrow",!0);N(C,G,X,"↞","\\twoheadleftarrow",!0);N(C,G,X,"↢","\\leftarrowtail",!0);N(C,G,X,"↫","\\looparrowleft",!0);N(C,G,X,"⇋","\\leftrightharpoons",!0);N(C,G,X,"↶","\\curvearrowleft",!0);N(C,G,X,"↺","\\circlearrowleft",!0);N(C,G,X,"↰","\\Lsh",!0);N(C,G,X,"⇈","\\upuparrows",!0);N(C,G,X,"↿","\\upharpoonleft",!0);N(C,G,X,"⇃","\\downharpoonleft",!0);N(C,L,X,"⊶","\\origof",!0);N(C,L,X,"⊷","\\imageof",!0);N(C,G,X,"⊸","\\multimap",!0);N(C,G,X,"↭","\\leftrightsquigarrow",!0);N(C,G,X,"⇉","\\rightrightarrows",!0);N(C,G,X,"⇄","\\rightleftarrows",!0);N(C,G,X,"↠","\\twoheadrightarrow",!0);N(C,G,X,"↣","\\rightarrowtail",!0);N(C,G,X,"↬","\\looparrowright",!0);N(C,G,X,"↷","\\curvearrowright",!0);N(C,G,X,"↻","\\circlearrowright",!0);N(C,G,X,"↱","\\Rsh",!0);N(C,G,X,"⇊","\\downdownarrows",!0);N(C,G,X,"↾","\\upharpoonright",!0);N(C,G,X,"⇂","\\downharpoonright",!0);N(C,G,X,"⇝","\\rightsquigarrow",!0);N(C,G,X,"⇝","\\leadsto");N(C,G,X,"⇛","\\Rrightarrow",!0);N(C,G,X,"↾","\\restriction");N(C,L,le,"‘","`");N(C,L,le,"$","\\$");N(Ee,L,le,"$","\\$");N(Ee,L,le,"$","\\textdollar");N(C,L,le,"%","\\%");N(Ee,L,le,"%","\\%");N(C,L,le,"_","\\_");N(Ee,L,le,"_","\\_");N(Ee,L,le,"_","\\textunderscore");N(C,L,le,"∠","\\angle",!0);N(C,L,le,"∞","\\infty",!0);N(C,L,le,"′","\\prime");N(C,L,le,"△","\\triangle");N(C,L,le,"Γ","\\Gamma",!0);N(C,L,le,"Δ","\\Delta",!0);N(C,L,le,"Θ","\\Theta",!0);N(C,L,le,"Λ","\\Lambda",!0);N(C,L,le,"Ξ","\\Xi",!0);N(C,L,le,"Π","\\Pi",!0);N(C,L,le,"Σ","\\Sigma",!0);N(C,L,le,"Υ","\\Upsilon",!0);N(C,L,le,"Φ","\\Phi",!0);N(C,L,le,"Ψ","\\Psi",!0);N(C,L,le,"Ω","\\Omega",!0);N(C,L,le,"A","Α");N(C,L,le,"B","Β");N(C,L,le,"E","Ε");N(C,L,le,"Z","Ζ");N(C,L,le,"H","Η");N(C,L,le,"I","Ι");N(C,L,le,"K","Κ");N(C,L,le,"M","Μ");N(C,L,le,"N","Ν");N(C,L,le,"O","Ο");N(C,L,le,"P","Ρ");N(C,L,le,"T","Τ");N(C,L,le,"X","Χ");N(C,L,le,"¬","\\neg",!0);N(C,L,le,"¬","\\lnot");N(C,L,le,"⊤","\\top");N(C,L,le,"⊥","\\bot");N(C,L,le,"∅","\\emptyset");N(C,G,le,"∅","\\varnothing");N(C,L,st,"α","\\alpha",!0);N(C,L,st,"β","\\beta",!0);N(C,L,st,"γ","\\gamma",!0);N(C,L,st,"δ","\\delta",!0);N(C,L,st,"ϵ","\\epsilon",!0);N(C,L,st,"ζ","\\zeta",!0);N(C,L,st,"η","\\eta",!0);N(C,L,st,"θ","\\theta",!0);N(C,L,st,"ι","\\iota",!0);N(C,L,st,"κ","\\kappa",!0);N(C,L,st,"λ","\\lambda",!0);N(C,L,st,"μ","\\mu",!0);N(C,L,st,"ν","\\nu",!0);N(C,L,st,"ξ","\\xi",!0);N(C,L,st,"ο","\\omicron",!0);N(C,L,st,"π","\\pi",!0);N(C,L,st,"ρ","\\rho",!0);N(C,L,st,"σ","\\sigma",!0);N(C,L,st,"τ","\\tau",!0);N(C,L,st,"υ","\\upsilon",!0);N(C,L,st,"ϕ","\\phi",!0);N(C,L,st,"χ","\\chi",!0);N(C,L,st,"ψ","\\psi",!0);N(C,L,st,"ω","\\omega",!0);N(C,L,st,"ε","\\varepsilon",!0);N(C,L,st,"ϑ","\\vartheta",!0);N(C,L,st,"ϖ","\\varpi",!0);N(C,L,st,"ϱ","\\varrho",!0);N(C,L,st,"ς","\\varsigma",!0);N(C,L,st,"φ","\\varphi",!0);N(C,L,Ve,"∗","*",!0);N(C,L,Ve,"+","+");N(C,L,Ve,"−","-",!0);N(C,L,Ve,"⋅","\\cdot",!0);N(C,L,Ve,"∘","\\circ",!0);N(C,L,Ve,"÷","\\div",!0);N(C,L,Ve,"±","\\pm",!0);N(C,L,Ve,"×","\\times",!0);N(C,L,Ve,"∩","\\cap",!0);N(C,L,Ve,"∪","\\cup",!0);N(C,L,Ve,"∖","\\setminus",!0);N(C,L,Ve,"∧","\\land");N(C,L,Ve,"∨","\\lor");N(C,L,Ve,"∧","\\wedge",!0);N(C,L,Ve,"∨","\\vee",!0);N(C,L,le,"√","\\surd");N(C,L,ai,"⟨","\\langle",!0);N(C,L,ai,"∣","\\lvert");N(C,L,ai,"∥","\\lVert");N(C,L,xs,"?","?");N(C,L,xs,"!","!");N(C,L,xs,"⟩","\\rangle",!0);N(C,L,xs,"∣","\\rvert");N(C,L,xs,"∥","\\rVert");N(C,L,X,"=","=");N(C,L,X,":",":");N(C,L,X,"≈","\\approx",!0);N(C,L,X,"≅","\\cong",!0);N(C,L,X,"≥","\\ge");N(C,L,X,"≥","\\geq",!0);N(C,L,X,"←","\\gets");N(C,L,X,">","\\gt",!0);N(C,L,X,"∈","\\in",!0);N(C,L,X,"","\\@not");N(C,L,X,"⊂","\\subset",!0);N(C,L,X,"⊃","\\supset",!0);N(C,L,X,"⊆","\\subseteq",!0);N(C,L,X,"⊇","\\supseteq",!0);N(C,G,X,"⊈","\\nsubseteq",!0);N(C,G,X,"⊉","\\nsupseteq",!0);N(C,L,X,"⊨","\\models");N(C,L,X,"←","\\leftarrow",!0);N(C,L,X,"≤","\\le");N(C,L,X,"≤","\\leq",!0);N(C,L,X,"<","\\lt",!0);N(C,L,X,"→","\\rightarrow",!0);N(C,L,X,"→","\\to");N(C,G,X,"≱","\\ngeq",!0);N(C,G,X,"≰","\\nleq",!0);N(C,L,wl," ","\\ ");N(C,L,wl," ","\\space");N(C,L,wl," ","\\nobreakspace");N(Ee,L,wl," ","\\ ");N(Ee,L,wl," "," ");N(Ee,L,wl," ","\\space");N(Ee,L,wl," ","\\nobreakspace");N(C,L,wl,null,"\\nobreak");N(C,L,wl,null,"\\allowbreak");N(C,L,$x,",",",");N(C,L,$x,";",";");N(C,G,Ve,"⊼","\\barwedge",!0);N(C,G,Ve,"⊻","\\veebar",!0);N(C,L,Ve,"⊙","\\odot",!0);N(C,L,Ve,"⊕","\\oplus",!0);N(C,L,Ve,"⊗","\\otimes",!0);N(C,L,le,"∂","\\partial",!0);N(C,L,Ve,"⊘","\\oslash",!0);N(C,G,Ve,"⊚","\\circledcirc",!0);N(C,G,Ve,"⊡","\\boxdot",!0);N(C,L,Ve,"△","\\bigtriangleup");N(C,L,Ve,"▽","\\bigtriangledown");N(C,L,Ve,"†","\\dagger");N(C,L,Ve,"⋄","\\diamond");N(C,L,Ve,"⋆","\\star");N(C,L,Ve,"◃","\\triangleleft");N(C,L,Ve,"▹","\\triangleright");N(C,L,ai,"{","\\{");N(Ee,L,le,"{","\\{");N(Ee,L,le,"{","\\textbraceleft");N(C,L,xs,"}","\\}");N(Ee,L,le,"}","\\}");N(Ee,L,le,"}","\\textbraceright");N(C,L,ai,"{","\\lbrace");N(C,L,xs,"}","\\rbrace");N(C,L,ai,"[","\\lbrack",!0);N(Ee,L,le,"[","\\lbrack",!0);N(C,L,xs,"]","\\rbrack",!0);N(Ee,L,le,"]","\\rbrack",!0);N(C,L,ai,"(","\\lparen",!0);N(C,L,xs,")","\\rparen",!0);N(Ee,L,le,"<","\\textless",!0);N(Ee,L,le,">","\\textgreater",!0);N(C,L,ai,"⌊","\\lfloor",!0);N(C,L,xs,"⌋","\\rfloor",!0);N(C,L,ai,"⌈","\\lceil",!0);N(C,L,xs,"⌉","\\rceil",!0);N(C,L,le,"\\","\\backslash");N(C,L,le,"∣","|");N(C,L,le,"∣","\\vert");N(Ee,L,le,"|","\\textbar",!0);N(C,L,le,"∥","\\|");N(C,L,le,"∥","\\Vert");N(Ee,L,le,"∥","\\textbardbl");N(Ee,L,le,"~","\\textasciitilde");N(Ee,L,le,"\\","\\textbackslash");N(Ee,L,le,"^","\\textasciicircum");N(C,L,X,"↑","\\uparrow",!0);N(C,L,X,"⇑","\\Uparrow",!0);N(C,L,X,"↓","\\downarrow",!0);N(C,L,X,"⇓","\\Downarrow",!0);N(C,L,X,"↕","\\updownarrow",!0);N(C,L,X,"⇕","\\Updownarrow",!0);N(C,L,yr,"∐","\\coprod");N(C,L,yr,"⋁","\\bigvee");N(C,L,yr,"⋀","\\bigwedge");N(C,L,yr,"⨄","\\biguplus");N(C,L,yr,"⋂","\\bigcap");N(C,L,yr,"⋃","\\bigcup");N(C,L,yr,"∫","\\int");N(C,L,yr,"∫","\\intop");N(C,L,yr,"∬","\\iint");N(C,L,yr,"∭","\\iiint");N(C,L,yr,"∏","\\prod");N(C,L,yr,"∑","\\sum");N(C,L,yr,"⨂","\\bigotimes");N(C,L,yr,"⨁","\\bigoplus");N(C,L,yr,"⨀","\\bigodot");N(C,L,yr,"∮","\\oint");N(C,L,yr,"∯","\\oiint");N(C,L,yr,"∰","\\oiiint");N(C,L,yr,"⨆","\\bigsqcup");N(C,L,yr,"∫","\\smallint");N(Ee,L,Rd,"…","\\textellipsis");N(C,L,Rd,"…","\\mathellipsis");N(Ee,L,Rd,"…","\\ldots",!0);N(C,L,Rd,"…","\\ldots",!0);N(C,L,Rd,"⋯","\\@cdots",!0);N(C,L,Rd,"⋱","\\ddots",!0);N(C,L,le,"⋮","\\varvdots");N(Ee,L,le,"⋮","\\varvdots");N(C,L,Wn,"ˊ","\\acute");N(C,L,Wn,"ˋ","\\grave");N(C,L,Wn,"¨","\\ddot");N(C,L,Wn,"~","\\tilde");N(C,L,Wn,"ˉ","\\bar");N(C,L,Wn,"˘","\\breve");N(C,L,Wn,"ˇ","\\check");N(C,L,Wn,"^","\\hat");N(C,L,Wn,"⃗","\\vec");N(C,L,Wn,"˙","\\dot");N(C,L,Wn,"˚","\\mathring");N(C,L,st,"","\\@imath");N(C,L,st,"","\\@jmath");N(C,L,le,"ı","ı");N(C,L,le,"ȷ","ȷ");N(Ee,L,le,"ı","\\i",!0);N(Ee,L,le,"ȷ","\\j",!0);N(Ee,L,le,"ß","\\ss",!0);N(Ee,L,le,"æ","\\ae",!0);N(Ee,L,le,"œ","\\oe",!0);N(Ee,L,le,"ø","\\o",!0);N(Ee,L,le,"Æ","\\AE",!0);N(Ee,L,le,"Œ","\\OE",!0);N(Ee,L,le,"Ø","\\O",!0);N(Ee,L,Wn,"ˊ","\\'");N(Ee,L,Wn,"ˋ","\\`");N(Ee,L,Wn,"ˆ","\\^");N(Ee,L,Wn,"˜","\\~");N(Ee,L,Wn,"ˉ","\\=");N(Ee,L,Wn,"˘","\\u");N(Ee,L,Wn,"˙","\\.");N(Ee,L,Wn,"¸","\\c");N(Ee,L,Wn,"˚","\\r");N(Ee,L,Wn,"ˇ","\\v");N(Ee,L,Wn,"¨",'\\"');N(Ee,L,Wn,"˝","\\H");N(Ee,L,Wn,"◯","\\textcircled");var dR={"--":!0,"---":!0,"``":!0,"''":!0};N(Ee,L,le,"–","--",!0);N(Ee,L,le,"–","\\textendash");N(Ee,L,le,"—","---",!0);N(Ee,L,le,"—","\\textemdash");N(Ee,L,le,"‘","`",!0);N(Ee,L,le,"‘","\\textquoteleft");N(Ee,L,le,"’","'",!0);N(Ee,L,le,"’","\\textquoteright");N(Ee,L,le,"“","``",!0);N(Ee,L,le,"“","\\textquotedblleft");N(Ee,L,le,"”","''",!0);N(Ee,L,le,"”","\\textquotedblright");N(C,L,le,"°","\\degree",!0);N(Ee,L,le,"°","\\degree");N(Ee,L,le,"°","\\textdegree",!0);N(C,L,le,"£","\\pounds");N(C,L,le,"£","\\mathsterling",!0);N(Ee,L,le,"£","\\pounds");N(Ee,L,le,"£","\\textsterling",!0);N(C,G,le,"✠","\\maltese");N(Ee,G,le,"✠","\\maltese");var lN='0123456789/@."';for(var Ab=0;Ab0)return Li(i,h,s,n,l.concat(m));if(d){var p,x;if(d==="boldsymbol"){var v=ace(i,s,n,l,r);p=v.fontName,x=[v.fontClass]}else c?(p=mR[d].fontName,x=[d]):(p=_p(d,n.fontWeight,n.fontShape),x=[d,n.fontWeight,n.fontShape]);if(Hx(i,p,s).metrics)return Li(i,p,s,n,l.concat(x));if(dR.hasOwnProperty(i)&&p.slice(0,10)==="Typewriter"){for(var b=[],k=0;k{if(vo(t.classes)!==vo(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize)return!1;if(t.classes.length===1){var n=t.classes[0];if(n==="mbin"||n==="mord")return!1}for(var r in t.style)if(t.style.hasOwnProperty(r)&&t.style[r]!==e.style[r])return!1;for(var s in e.style)if(e.style.hasOwnProperty(s)&&t.style[s]!==e.style[s])return!1;return!0},cce=t=>{for(var e=0;en&&(n=l.height),l.depth>r&&(r=l.depth),l.maxFontSize>s&&(s=l.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=s},Cs=function(e,n,r,s){var i=new S0(e,n,r,s);return E5(i),i},hR=(t,e,n,r)=>new S0(t,e,n,r),uce=function(e,n,r){var s=Cs([e],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Be(s.height),s.maxFontSize=1,s},dce=function(e,n,r,s){var i=new A5(e,n,r,s);return E5(i),i},fR=function(e){var n=new w0(e);return E5(n),n},hce=function(e,n){return e instanceof w0?Cs([],[e],n):e},fce=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,l=1;l{var n=Cs(["mspace"],[],e),r=Kn(t,e);return n.style.marginRight=Be(r),n},_p=function(e,n,r){var s="";switch(e){case"amsrm":s="AMS";break;case"textrm":s="Main";break;case"textsf":s="SansSerif";break;case"texttt":s="Typewriter";break;default:s=e}var i;return n==="textbf"&&r==="textit"?i="BoldItalic":n==="textbf"?i="Bold":n==="textit"?i="Italic":i="Regular",s+"-"+i},mR={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},pR={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},gce=function(e,n){var[r,s,i]=pR[e],l=new yo(r),c=new gl([l],{width:Be(s),height:Be(i),style:"width:"+Be(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),d=hR(["overlay"],[c],n);return d.height=i,d.style.height=Be(i),d.style.width=Be(s),d},ge={fontMap:mR,makeSymbol:Li,mathsym:ice,makeSpan:Cs,makeSvgSpan:hR,makeLineSpan:uce,makeAnchor:dce,makeFragment:fR,wrapFragment:hce,makeVList:mce,makeOrd:lce,makeGlue:pce,staticSvg:gce,svgData:pR,tryCombineChars:cce},Xn={number:3,unit:"mu"},ec={number:4,unit:"mu"},Ya={number:5,unit:"mu"},xce={mord:{mop:Xn,mbin:ec,mrel:Ya,minner:Xn},mop:{mord:Xn,mop:Xn,mrel:Ya,minner:Xn},mbin:{mord:ec,mop:ec,mopen:ec,minner:ec},mrel:{mord:Ya,mop:Ya,mopen:Ya,minner:Ya},mopen:{},mclose:{mop:Xn,mbin:ec,mrel:Ya,minner:Xn},mpunct:{mord:Xn,mop:Xn,mrel:Ya,mopen:Xn,mclose:Xn,mpunct:Xn,minner:Xn},minner:{mord:Xn,mop:Xn,mbin:ec,mrel:Ya,mopen:Xn,mpunct:Xn,minner:Xn}},vce={mord:{mop:Xn},mop:{mord:Xn,mop:Xn},mbin:{},mrel:{},mopen:{},mclose:{mop:Xn},mpunct:{},minner:{mop:Xn}},gR={},Yg={},Kg={};function Qe(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:l}=t,c={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:s},d=0;d{var O=k.classes[0],j=b.classes[0];O==="mbin"&&bce.includes(j)?k.classes[0]="mord":j==="mbin"&&yce.includes(O)&&(b.classes[0]="mord")},{node:p},x,v),hN(i,(b,k)=>{var O=N4(k),j=N4(b),T=O&&j?b.hasClass("mtight")?vce[O][j]:xce[O][j]:null;if(T)return ge.makeGlue(T,h)},{node:p},x,v),i},hN=function t(e,n,r,s,i){s&&e.push(s);for(var l=0;lx=>{e.splice(p+1,0,x),l++})(l)}s&&e.pop()},xR=function(e){return e instanceof w0||e instanceof A5||e instanceof S0&&e.hasClass("enclosing")?e:null},kce=function t(e,n){var r=xR(e);if(r){var s=r.children;if(s.length){if(n==="right")return t(s[s.length-1],"right");if(n==="left")return t(s[0],"left")}}return e},N4=function(e,n){return e?(n&&(e=kce(e,n)),Sce[e.classes[0]]||null):null},qf=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return xl(n.concat(r))},Xt=function(e,n,r){if(!e)return xl();if(Yg[e.type]){var s=Yg[e.type](e,n);if(r&&n.size!==r.size){s=xl(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new De("Got group of unknown type: '"+e.type+"'")};function Dp(t,e){var n=xl(["base"],t,e),r=xl(["strut"]);return r.style.height=Be(n.height+n.depth),n.depth&&(r.style.verticalAlign=Be(-n.depth)),n.children.unshift(r),n}function C4(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=Mr(t,e,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],l=[],c=0;c0&&(i.push(Dp(l,e)),l=[]),i.push(r[c]));l.length>0&&i.push(Dp(l,e));var h;n?(h=Dp(Mr(n,e,!0)),h.classes=["tag"],i.push(h)):s&&i.push(s);var m=xl(["katex-html"],i);if(m.setAttribute("aria-hidden","true"),h){var p=h.children[0];p.style.height=Be(m.height+m.depth),m.depth&&(p.style.verticalAlign=Be(-m.depth))}return m}function vR(t){return new w0(t)}class ti{constructor(e,n,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=n||[],this.classes=r||[]}setAttribute(e,n){this.attributes[e]=n}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&e.setAttribute(n,this.attributes[n]);this.classes.length>0&&(e.className=vo(this.classes));for(var r=0;r0&&(e+=' class ="'+tn.escape(vo(this.classes))+'"'),e+=">";for(var r=0;r",e}toText(){return this.children.map(e=>e.toText()).join("")}}class pa{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return tn.escape(this.toText())}toText(){return this.text}}class Oce{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",Be(this.width)),e}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var _e={MathNode:ti,TextNode:pa,SpaceNode:Oce,newDocumentFragment:vR},Mi=function(e,n,r){return Ln[n][e]&&Ln[n][e].replace&&e.charCodeAt(0)!==55349&&!(dR.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=Ln[n][e].replace),new _e.TextNode(e)},_5=function(e){return e.length===1?e[0]:new _e.MathNode("mrow",e)},D5=function(e,n){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold";var r=n.font;if(!r||r==="mathnormal")return null;var s=e.mode;if(r==="mathit")return"italic";if(r==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(r==="mathbf")return"bold";if(r==="mathbb")return"double-struck";if(r==="mathsfit")return"sans-serif-italic";if(r==="mathfrak")return"fraktur";if(r==="mathscr"||r==="mathcal")return"script";if(r==="mathsf")return"sans-serif";if(r==="mathtt")return"monospace";var i=e.text;if(["\\imath","\\jmath"].includes(i))return null;Ln[s][i]&&Ln[s][i].replace&&(i=Ln[s][i].replace);var l=ge.fontMap[r].fontName;return M5(i,l,s)?ge.fontMap[r].variant:null};function Rb(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof pa&&e.text==="."}else if(t.type==="mo"&&t.children.length===1&&t.getAttribute("separator")==="true"&&t.getAttribute("lspace")==="0em"&&t.getAttribute("rspace")==="0em"){var n=t.children[0];return n instanceof pa&&n.text===","}else return!1}var qs=function(e,n,r){if(e.length===1){var s=Rn(e[0],n);return r&&s instanceof ti&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],l,c=0;c=1&&(l.type==="mn"||Rb(l))){var h=d.children[0];h instanceof ti&&h.type==="mn"&&(h.children=[...l.children,...h.children],i.pop())}else if(l.type==="mi"&&l.children.length===1){var m=l.children[0];if(m instanceof pa&&m.text==="̸"&&(d.type==="mo"||d.type==="mi"||d.type==="mn")){var p=d.children[0];p instanceof pa&&p.text.length>0&&(p.text=p.text.slice(0,1)+"̸"+p.text.slice(1),i.pop())}}}i.push(d),l=d}return i},bo=function(e,n,r){return _5(qs(e,n,r))},Rn=function(e,n){if(!e)return new _e.MathNode("mrow");if(Kg[e.type]){var r=Kg[e.type](e,n);return r}else throw new De("Got group of unknown type: '"+e.type+"'")};function fN(t,e,n,r,s){var i=qs(t,n),l;i.length===1&&i[0]instanceof ti&&["mrow","mtable"].includes(i[0].type)?l=i[0]:l=new _e.MathNode("mrow",i);var c=new _e.MathNode("annotation",[new _e.TextNode(e)]);c.setAttribute("encoding","application/x-tex");var d=new _e.MathNode("semantics",[l,c]),h=new _e.MathNode("math",[d]);h.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&h.setAttribute("display","block");var m=s?"katex":"katex-mathml";return ge.makeSpan([m],[h])}var yR=function(e){return new rl({style:e.displayMode?at.DISPLAY:at.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},bR=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=ge.makeSpan(r,[e])}return e},jce=function(e,n,r){var s=yR(r),i;if(r.output==="mathml")return fN(e,n,s,r.displayMode,!0);if(r.output==="html"){var l=C4(e,s);i=ge.makeSpan(["katex"],[l])}else{var c=fN(e,n,s,r.displayMode,!1),d=C4(e,s);i=ge.makeSpan(["katex"],[c,d])}return bR(i,r)},Nce=function(e,n,r){var s=yR(r),i=C4(e,s),l=ge.makeSpan(["katex"],[i]);return bR(l,r)},Cce={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Tce=function(e){var n=new _e.MathNode("mo",[new _e.TextNode(Cce[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},Mce={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Ace=function(e){return e.type==="ordgroup"?e.body.length:1},Ece=function(e,n){function r(){var c=4e5,d=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(d)){var h=e,m=Ace(h.base),p,x,v;if(m>5)d==="widehat"||d==="widecheck"?(p=420,c=2364,v=.42,x=d+"4"):(p=312,c=2340,v=.34,x="tilde4");else{var b=[1,1,2,2,3,3][m];d==="widehat"||d==="widecheck"?(c=[0,1062,2364,2364,2364][b],p=[0,239,300,360,420][b],v=[0,.24,.3,.3,.36,.42][b],x=d+b):(c=[0,600,1033,2339,2340][b],p=[0,260,286,306,312][b],v=[0,.26,.286,.3,.306,.34][b],x="tilde"+b)}var k=new yo(x),O=new gl([k],{width:"100%",height:Be(v),viewBox:"0 0 "+c+" "+p,preserveAspectRatio:"none"});return{span:ge.makeSvgSpan([],[O],n),minWidth:0,height:v}}else{var j=[],T=Mce[d],[M,_,D]=T,E=D/1e3,z=M.length,Q,F;if(z===1){var B=T[3];Q=["hide-tail"],F=[B]}else if(z===2)Q=["halfarrow-left","halfarrow-right"],F=["xMinYMin","xMaxYMin"];else if(z===3)Q=["brace-left","brace-center","brace-right"],F=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support + `+z+" children.");for(var U=0;U0&&(s.style.minWidth=Be(i)),s},_ce=function(e,n,r,s,i){var l,c=e.height+e.depth+r+s;if(/fbox|color|angl/.test(n)){if(l=ge.makeSpan(["stretchy",n],[],i),n==="fbox"){var d=i.color&&i.getColor();d&&(l.style.borderColor=d)}}else{var h=[];/^[bx]cancel$/.test(n)&&h.push(new O4({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&h.push(new O4({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var m=new gl(h,{width:"100%",height:Be(c)});l=ge.makeSvgSpan([],[m],i)}return l.height=c,l.style.height=Be(c),l},vl={encloseSpan:_ce,mathMLnode:Tce,svgSpan:Ece};function Nt(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function R5(t){var e=Ux(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function Ux(t){return t&&(t.type==="atom"||rce.hasOwnProperty(t.type))?t:null}var z5=(t,e)=>{var n,r,s;t&&t.type==="supsub"?(r=Nt(t.base,"accent"),n=r.base,t.base=n,s=tce(Xt(t,e)),t.base=r):(r=Nt(t,"accent"),n=r.base);var i=Xt(n,e.havingCrampedStyle()),l=r.isShifty&&tn.isCharacterBox(n),c=0;if(l){var d=tn.getBaseElem(n),h=Xt(d,e.havingCrampedStyle());c=aN(h).skew}var m=r.label==="\\c",p=m?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),x;if(r.isStretchy)x=vl.svgSpan(r,e),x=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:x,wrapperClasses:["svg-align"],wrapperStyle:c>0?{width:"calc(100% - "+Be(2*c)+")",marginLeft:Be(2*c)}:void 0}]},e);else{var v,b;r.label==="\\vec"?(v=ge.staticSvg("vec",e),b=ge.svgData.vec[1]):(v=ge.makeOrd({mode:r.mode,text:r.label},e,"textord"),v=aN(v),v.italic=0,b=v.width,m&&(p+=v.depth)),x=ge.makeSpan(["accent-body"],[v]);var k=r.label==="\\textcircled";k&&(x.classes.push("accent-full"),p=i.height);var O=c;k||(O-=b/2),x.style.left=Be(O),r.label==="\\textcircled"&&(x.style.top=".2em"),x=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-p},{type:"elem",elem:x}]},e)}var j=ge.makeSpan(["mord","accent"],[x],e);return s?(s.children[0]=j,s.height=Math.max(j.height,s.height),s.classes[0]="mord",s):j},wR=(t,e)=>{var n=t.isStretchy?vl.mathMLnode(t.label):new _e.MathNode("mo",[Mi(t.label,t.mode)]),r=new _e.MathNode("mover",[Rn(t.base,e),n]);return r.setAttribute("accent","true"),r},Dce=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));Qe({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(t,e)=>{var n=Zg(e[0]),r=!Dce.test(t.funcName),s=!r||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:r,isShifty:s,base:n}},htmlBuilder:z5,mathmlBuilder:wR});Qe({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(t,e)=>{var n=e[0],r=t.parser.mode;return r==="math"&&(t.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+t.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:t.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:z5,mathmlBuilder:wR});Qe({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"accentUnder",mode:n.mode,label:r,base:s}},htmlBuilder:(t,e)=>{var n=Xt(t.base,e),r=vl.svgSpan(t,e),s=t.label==="\\utilde"?.12:0,i=ge.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]},e);return ge.makeSpan(["mord","accentunder"],[i],e)},mathmlBuilder:(t,e)=>{var n=vl.mathMLnode(t.label),r=new _e.MathNode("munder",[Rn(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var Rp=t=>{var e=new _e.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Qe({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r,funcName:s}=t;return{type:"xArrow",mode:r.mode,label:s,body:e[0],below:n[0]}},htmlBuilder(t,e){var n=e.style,r=e.havingStyle(n.sup()),s=ge.wrapFragment(Xt(t.body,r,e),e),i=t.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var l;t.below&&(r=e.havingStyle(n.sub()),l=ge.wrapFragment(Xt(t.below,r,e),e),l.classes.push(i+"-arrow-pad"));var c=vl.svgSpan(t,e),d=-e.fontMetrics().axisHeight+.5*c.height,h=-e.fontMetrics().axisHeight-.5*c.height-.111;(s.depth>.25||t.label==="\\xleftequilibrium")&&(h-=s.depth);var m;if(l){var p=-e.fontMetrics().axisHeight+l.height+.5*c.height+.111;m=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:c,shift:d},{type:"elem",elem:l,shift:p}]},e)}else m=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:c,shift:d}]},e);return m.children[0].children[0].children[1].classes.push("svg-align"),ge.makeSpan(["mrel","x-arrow"],[m],e)},mathmlBuilder(t,e){var n=vl.mathMLnode(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var s=Rp(Rn(t.body,e));if(t.below){var i=Rp(Rn(t.below,e));r=new _e.MathNode("munderover",[n,i,s])}else r=new _e.MathNode("mover",[n,s])}else if(t.below){var l=Rp(Rn(t.below,e));r=new _e.MathNode("munder",[n,l])}else r=Rp(),r=new _e.MathNode("mover",[n,r]);return r}});var Rce=ge.makeSpan;function SR(t,e){var n=Mr(t.body,e,!0);return Rce([t.mclass],n,e)}function kR(t,e){var n,r=qs(t.body,e);return t.mclass==="minner"?n=new _e.MathNode("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new _e.MathNode("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new _e.MathNode("mo",r),t.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):t.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):t.mclass==="mopen"||t.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):t.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}Qe({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:ar(s),isCharacterBox:tn.isCharacterBox(s)}},htmlBuilder:SR,mathmlBuilder:kR});var Vx=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};Qe({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:Vx(e[0]),body:ar(e[1]),isCharacterBox:tn.isCharacterBox(e[1])}}});Qe({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,s=e[1],i=e[0],l;r!=="\\stackrel"?l=Vx(s):l="mrel";var c={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:ar(s)},d={type:"supsub",mode:i.mode,base:c,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:l,body:[d],isCharacterBox:tn.isCharacterBox(d)}},htmlBuilder:SR,mathmlBuilder:kR});Qe({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:Vx(e[0]),body:ar(e[0])}},htmlBuilder(t,e){var n=Mr(t.body,e,!0),r=ge.makeSpan([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=qs(t.body,e),r=new _e.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var zce={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},mN=()=>({type:"styling",body:[],mode:"math",style:"display"}),pN=t=>t.type==="textord"&&t.text==="@",Pce=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function Lce(t,e,n){var r=zce[t];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var s=n.callFunction("\\\\cdleft",[e[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},l=n.callFunction("\\Big",[i],[]),c=n.callFunction("\\\\cdright",[e[1]],[]),d={type:"ordgroup",mode:"math",body:[s,l,c]};return n.callFunction("\\\\cdparent",[d],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var h={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[h],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Bce(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var n=t.fetch().text;if(n==="&"||n==="\\\\")t.consume();else if(n==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new De("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],s=[r],i=0;i-1))if("<>AV".indexOf(h)>-1)for(var p=0;p<2;p++){for(var x=!0,v=d+1;vAV=|." after @',l[d]);var b=Lce(h,m,t),k={type:"styling",body:[b],mode:"math",style:"display"};r.push(k),c=mN()}i%2===0?r.push(c):r.shift(),r=[],s.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var O=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:O,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}Qe({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:e[0]}},htmlBuilder(t,e){var n=e.havingStyle(e.style.sup()),r=ge.wrapFragment(Xt(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=Be(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new _e.MathNode("mrow",[Rn(t.label,e)]);return n=new _e.MathNode("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new _e.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Qe({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(t,e){var{parser:n}=t;return{type:"cdlabelparent",mode:n.mode,fragment:e[0]}},htmlBuilder(t,e){var n=ge.wrapFragment(Xt(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new _e.MathNode("mrow",[Rn(t.fragment,e)])}});Qe({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=Nt(e[0],"ordgroup"),s=r.body,i="",l=0;l=1114111)throw new De("\\@char with invalid code point "+i);return d<=65535?h=String.fromCharCode(d):(d-=65536,h=String.fromCharCode((d>>10)+55296,(d&1023)+56320)),{type:"textord",mode:n.mode,text:h}}});var OR=(t,e)=>{var n=Mr(t.body,e.withColor(t.color),!1);return ge.makeFragment(n)},jR=(t,e)=>{var n=qs(t.body,e.withColor(t.color)),r=new _e.MathNode("mstyle",n);return r.setAttribute("mathcolor",t.color),r};Qe({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=Nt(e[0],"color-token").color,s=e[1];return{type:"color",mode:n.mode,color:r,body:ar(s)}},htmlBuilder:OR,mathmlBuilder:jR});Qe({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,s=Nt(e[0],"color-token").color;n.gullet.macros.set("\\current@color",s);var i=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:s,body:i}},htmlBuilder:OR,mathmlBuilder:jR});Qe({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(t,e,n){var{parser:r}=t,s=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,i=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:i,size:s&&Nt(s,"size").value}},htmlBuilder(t,e){var n=ge.makeSpan(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=Be(Kn(t.size,e)))),n},mathmlBuilder(t,e){var n=new _e.MathNode("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",Be(Kn(t.size,e)))),n}});var T4={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},NR=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new De("Expected a control sequence",t);return e},Ice=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},CR=(t,e,n,r)=>{var s=t.gullet.macros.get(n.text);s==null&&(n.noexpand=!0,s={tokens:[n],numArgs:0,unexpandable:!t.gullet.isExpandable(n.text)}),t.gullet.macros.set(e,s,r)};Qe({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(t){var{parser:e,funcName:n}=t;e.consumeSpaces();var r=e.fetch();if(T4[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=T4[r.text]),Nt(e.parseFunction(),"internal");throw new De("Invalid token after macro prefix",r)}});Qe({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=e.gullet.popToken(),s=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new De("Expected a control sequence",r);for(var i=0,l,c=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){l=e.gullet.future(),c[i].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new De('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new De('Argument number "'+r.text+'" out of order');i++,c.push([])}else{if(r.text==="EOF")throw new De("Expected a macro definition");c[i].push(r.text)}var{tokens:d}=e.gullet.consumeArg();return l&&d.unshift(l),(n==="\\edef"||n==="\\xdef")&&(d=e.gullet.expandTokens(d),d.reverse()),e.gullet.macros.set(s,{tokens:d,numArgs:i,delimiters:c},n===T4[n]),{type:"internal",mode:e.mode}}});Qe({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=NR(e.gullet.popToken());e.gullet.consumeSpaces();var s=Ice(e);return CR(e,r,s,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});Qe({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=NR(e.gullet.popToken()),s=e.gullet.popToken(),i=e.gullet.popToken();return CR(e,r,i,n==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});var Vh=function(e,n,r){var s=Ln.math[e]&&Ln.math[e].replace,i=M5(s||e,n,r);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return i},P5=function(e,n,r,s){var i=r.havingBaseStyle(n),l=ge.makeSpan(s.concat(i.sizingClasses(r)),[e],r),c=i.sizeMultiplier/r.sizeMultiplier;return l.height*=c,l.depth*=c,l.maxFontSize=i.sizeMultiplier,l},TR=function(e,n,r){var s=n.havingBaseStyle(r),i=(1-n.sizeMultiplier/s.sizeMultiplier)*n.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=Be(i),e.height-=i,e.depth+=i},qce=function(e,n,r,s,i,l){var c=ge.makeSymbol(e,"Main-Regular",i,s),d=P5(c,n,s,l);return r&&TR(d,s,n),d},Fce=function(e,n,r,s){return ge.makeSymbol(e,"Size"+n+"-Regular",r,s)},MR=function(e,n,r,s,i,l){var c=Fce(e,n,i,s),d=P5(ge.makeSpan(["delimsizing","size"+n],[c],s),at.TEXT,s,l);return r&&TR(d,s,at.TEXT),d},zb=function(e,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=ge.makeSpan(["delimsizinginner",s],[ge.makeSpan([],[ge.makeSymbol(e,n,r)])]);return{type:"elem",elem:i}},Pb=function(e,n,r){var s=ma["Size4-Regular"][e.charCodeAt(0)]?ma["Size4-Regular"][e.charCodeAt(0)][4]:ma["Size1-Regular"][e.charCodeAt(0)][4],i=new yo("inner",Voe(e,Math.round(1e3*n))),l=new gl([i],{width:Be(s),height:Be(n),style:"width:"+Be(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),c=ge.makeSvgSpan([],[l],r);return c.height=n,c.style.height=Be(n),c.style.width=Be(s),{type:"elem",elem:c}},M4=.008,zp={type:"kern",size:-1*M4},Qce=["|","\\lvert","\\rvert","\\vert"],$ce=["\\|","\\lVert","\\rVert","\\Vert"],AR=function(e,n,r,s,i,l){var c,d,h,m,p="",x=0;c=h=m=e,d=null;var v="Size1-Regular";e==="\\uparrow"?h=m="⏐":e==="\\Uparrow"?h=m="‖":e==="\\downarrow"?c=h="⏐":e==="\\Downarrow"?c=h="‖":e==="\\updownarrow"?(c="\\uparrow",h="⏐",m="\\downarrow"):e==="\\Updownarrow"?(c="\\Uparrow",h="‖",m="\\Downarrow"):Qce.includes(e)?(h="∣",p="vert",x=333):$ce.includes(e)?(h="∥",p="doublevert",x=556):e==="["||e==="\\lbrack"?(c="⎡",h="⎢",m="⎣",v="Size4-Regular",p="lbrack",x=667):e==="]"||e==="\\rbrack"?(c="⎤",h="⎥",m="⎦",v="Size4-Regular",p="rbrack",x=667):e==="\\lfloor"||e==="⌊"?(h=c="⎢",m="⎣",v="Size4-Regular",p="lfloor",x=667):e==="\\lceil"||e==="⌈"?(c="⎡",h=m="⎢",v="Size4-Regular",p="lceil",x=667):e==="\\rfloor"||e==="⌋"?(h=c="⎥",m="⎦",v="Size4-Regular",p="rfloor",x=667):e==="\\rceil"||e==="⌉"?(c="⎤",h=m="⎥",v="Size4-Regular",p="rceil",x=667):e==="("||e==="\\lparen"?(c="⎛",h="⎜",m="⎝",v="Size4-Regular",p="lparen",x=875):e===")"||e==="\\rparen"?(c="⎞",h="⎟",m="⎠",v="Size4-Regular",p="rparen",x=875):e==="\\{"||e==="\\lbrace"?(c="⎧",d="⎨",m="⎩",h="⎪",v="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(c="⎫",d="⎬",m="⎭",h="⎪",v="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(c="⎧",m="⎩",h="⎪",v="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(c="⎫",m="⎭",h="⎪",v="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(c="⎧",m="⎭",h="⎪",v="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(c="⎫",m="⎩",h="⎪",v="Size4-Regular");var b=Vh(c,v,i),k=b.height+b.depth,O=Vh(h,v,i),j=O.height+O.depth,T=Vh(m,v,i),M=T.height+T.depth,_=0,D=1;if(d!==null){var E=Vh(d,v,i);_=E.height+E.depth,D=2}var z=k+M+_,Q=Math.max(0,Math.ceil((n-z)/(D*j))),F=z+Q*D*j,B=s.fontMetrics().axisHeight;r&&(B*=s.sizeMultiplier);var U=F/2-B,V=[];if(p.length>0){var ce=F-k-M,W=Math.round(F*1e3),J=Woe(p,Math.round(ce*1e3)),H=new yo(p,J),ae=(x/1e3).toFixed(3)+"em",ne=(W/1e3).toFixed(3)+"em",ue=new gl([H],{width:ae,height:ne,viewBox:"0 0 "+x+" "+W}),R=ge.makeSvgSpan([],[ue],s);R.height=W/1e3,R.style.width=ae,R.style.height=ne,V.push({type:"elem",elem:R})}else{if(V.push(zb(m,v,i)),V.push(zp),d===null){var me=F-k-M+2*M4;V.push(Pb(h,me,s))}else{var Y=(F-k-M-_)/2+2*M4;V.push(Pb(h,Y,s)),V.push(zp),V.push(zb(d,v,i)),V.push(zp),V.push(Pb(h,Y,s))}V.push(zp),V.push(zb(c,v,i))}var P=s.havingBaseStyle(at.TEXT),K=ge.makeVList({positionType:"bottom",positionData:U,children:V},P);return P5(ge.makeSpan(["delimsizing","mult"],[K],P),at.TEXT,s,l)},Lb=80,Bb=.08,Ib=function(e,n,r,s,i){var l=Uoe(e,s,r),c=new yo(e,l),d=new gl([c],{width:"400em",height:Be(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return ge.makeSvgSpan(["hide-tail"],[d],i)},Hce=function(e,n){var r=n.havingBaseSizing(),s=RR("\\surd",e*r.sizeMultiplier,DR,r),i=r.sizeMultiplier,l=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),c,d=0,h=0,m=0,p;return s.type==="small"?(m=1e3+1e3*l+Lb,e<1?i=1:e<1.4&&(i=.7),d=(1+l+Bb)/i,h=(1+l)/i,c=Ib("sqrtMain",d,m,l,n),c.style.minWidth="0.853em",p=.833/i):s.type==="large"?(m=(1e3+Lb)*cf[s.size],h=(cf[s.size]+l)/i,d=(cf[s.size]+l+Bb)/i,c=Ib("sqrtSize"+s.size,d,m,l,n),c.style.minWidth="1.02em",p=1/i):(d=e+l+Bb,h=e+l,m=Math.floor(1e3*e+l)+Lb,c=Ib("sqrtTall",d,m,l,n),c.style.minWidth="0.742em",p=1.056),c.height=h,c.style.height=Be(d),{span:c,advanceWidth:p,ruleWidth:(n.fontMetrics().sqrtRuleThickness+l)*i}},ER=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Uce=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],_R=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],cf=[0,1.2,1.8,2.4,3],Vce=function(e,n,r,s,i){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),ER.includes(e)||_R.includes(e))return MR(e,n,!1,r,s,i);if(Uce.includes(e))return AR(e,cf[n],!1,r,s,i);throw new De("Illegal delimiter: '"+e+"'")},Wce=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Gce=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"stack"}],DR=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Xce=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},RR=function(e,n,r,s){for(var i=Math.min(2,3-s.style.size),l=i;ln)return r[l]}return r[r.length-1]},zR=function(e,n,r,s,i,l){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var c;_R.includes(e)?c=Wce:ER.includes(e)?c=DR:c=Gce;var d=RR(e,n,c,s);return d.type==="small"?qce(e,d.style,r,s,i,l):d.type==="large"?MR(e,d.size,r,s,i,l):AR(e,n,r,s,i,l)},Yce=function(e,n,r,s,i,l){var c=s.fontMetrics().axisHeight*s.sizeMultiplier,d=901,h=5/s.fontMetrics().ptPerEm,m=Math.max(n-c,r+c),p=Math.max(m/500*d,2*m-h);return zR(e,p,!0,s,i,l)},ul={sqrtImage:Hce,sizedDelim:Vce,sizeToMaxHeight:cf,customSizedDelim:zR,leftRightDelim:Yce},gN={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Kce=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function Wx(t,e){var n=Ux(t);if(n&&Kce.includes(n.text))return n;throw n?new De("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new De("Invalid delimiter type '"+t.type+"'",t)}Qe({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,e)=>{var n=Wx(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:gN[t.funcName].size,mclass:gN[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?ge.makeSpan([t.mclass]):ul.sizedDelim(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(Mi(t.delim,t.mode));var n=new _e.MathNode("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Be(ul.sizeToMaxHeight[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function xN(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Qe({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=t.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new De("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:Wx(e[0],t).text,color:n}}});Qe({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Wx(e[0],t),r=t.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=Nt(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(t,e)=>{xN(t);for(var n=Mr(t.body,e,!0,["mopen","mclose"]),r=0,s=0,i=!1,l=0;l{xN(t);var n=qs(t.body,e);if(t.left!=="."){var r=new _e.MathNode("mo",[Mi(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var s=new _e.MathNode("mo",[Mi(t.right,t.mode)]);s.setAttribute("fence","true"),t.rightColor&&s.setAttribute("mathcolor",t.rightColor),n.push(s)}return _5(n)}});Qe({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Wx(e[0],t);if(!t.parser.leftrightDepth)throw new De("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=qf(e,[]);else{n=ul.sizedDelim(t.delim,1,e,t.mode,[]);var r={delim:t.delim,options:e};n.isMiddle=r}return n},mathmlBuilder:(t,e)=>{var n=t.delim==="\\vert"||t.delim==="|"?Mi("|","text"):Mi(t.delim,t.mode),r=new _e.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var L5=(t,e)=>{var n=ge.wrapFragment(Xt(t.body,e),e),r=t.label.slice(1),s=e.sizeMultiplier,i,l=0,c=tn.isCharacterBox(t.body);if(r==="sout")i=ge.makeSpan(["stretchy","sout"]),i.height=e.fontMetrics().defaultRuleThickness/s,l=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var d=Kn({number:.6,unit:"pt"},e),h=Kn({number:.35,unit:"ex"},e),m=e.havingBaseSizing();s=s/m.sizeMultiplier;var p=n.height+n.depth+d+h;n.style.paddingLeft=Be(p/2+d);var x=Math.floor(1e3*p*s),v=$oe(x),b=new gl([new yo("phase",v)],{width:"400em",height:Be(x/1e3),viewBox:"0 0 400000 "+x,preserveAspectRatio:"xMinYMin slice"});i=ge.makeSvgSpan(["hide-tail"],[b],e),i.style.height=Be(p),l=n.depth+d+h}else{/cancel/.test(r)?c||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var k=0,O=0,j=0;/box/.test(r)?(j=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),k=e.fontMetrics().fboxsep+(r==="colorbox"?0:j),O=k):r==="angl"?(j=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),k=4*j,O=Math.max(0,.25-n.depth)):(k=c?.2:0,O=k),i=vl.encloseSpan(n,r,k,O,e),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Be(j)):r==="angl"&&j!==.049&&(i.style.borderTopWidth=Be(j),i.style.borderRightWidth=Be(j)),l=n.depth+O,t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor,t.borderColor&&(i.style.borderColor=t.borderColor))}var T;if(t.backgroundColor)T=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:l},{type:"elem",elem:n,shift:0}]},e);else{var M=/cancel|phase/.test(r)?["svg-align"]:[];T=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:l,wrapperClasses:M}]},e)}return/cancel/.test(r)&&(T.height=n.height,T.depth=n.depth),/cancel/.test(r)&&!c?ge.makeSpan(["mord","cancel-lap"],[T],e):ge.makeSpan(["mord"],[T],e)},B5=(t,e)=>{var n=0,r=new _e.MathNode(t.label.indexOf("colorbox")>-1?"mpadded":"menclose",[Rn(t.body,e)]);switch(t.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),t.label==="\\fcolorbox"){var s=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+s+"em solid "+String(t.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};Qe({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Nt(e[0],"color-token").color,l=e[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:l}},htmlBuilder:L5,mathmlBuilder:B5});Qe({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Nt(e[0],"color-token").color,l=Nt(e[1],"color-token").color,c=e[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:l,borderColor:i,body:c}},htmlBuilder:L5,mathmlBuilder:B5});Qe({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\fbox",body:e[0]}}});Qe({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"enclose",mode:n.mode,label:r,body:s}},htmlBuilder:L5,mathmlBuilder:B5});Qe({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\angl",body:e[0]}}});var PR={};function Na(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:l}=t,c={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},d=0;d{var e=t.parser.settings;if(!e.displayMode)throw new De("{"+t.envName+"} can be used only in display mode.")};function I5(t){if(t.indexOf("ed")===-1)return t.indexOf("*")===-1}function Mo(t,e,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:l,colSeparationType:c,autoTag:d,singleRow:h,emptySingleRow:m,maxNumCols:p,leqno:x}=e;if(t.gullet.beginGroup(),h||t.gullet.macros.set("\\cr","\\\\\\relax"),!l){var v=t.gullet.expandMacroAsText("\\arraystretch");if(v==null)l=1;else if(l=parseFloat(v),!l||l<0)throw new De("Invalid \\arraystretch: "+v)}t.gullet.beginGroup();var b=[],k=[b],O=[],j=[],T=d!=null?[]:void 0;function M(){d&&t.gullet.macros.set("\\@eqnsw","1",!0)}function _(){T&&(t.gullet.macros.get("\\df@tag")?(T.push(t.subparse([new si("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):T.push(!!d&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(M(),j.push(vN(t));;){var D=t.parseExpression(!1,h?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),D={type:"ordgroup",mode:t.mode,body:D},n&&(D={type:"styling",mode:t.mode,style:n,body:[D]}),b.push(D);var E=t.fetch().text;if(E==="&"){if(p&&b.length===p){if(h||c)throw new De("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(E==="\\end"){_(),b.length===1&&D.type==="styling"&&D.body[0].body.length===0&&(k.length>1||!m)&&k.pop(),j.length0&&(M+=.25),h.push({pos:M,isDashed:Jn[nn]})}for(_(l[0]),r=0;r0&&(U+=T,zJn))for(r=0;r=c)){var ve=void 0;(s>0||e.hskipBeforeAndAfter)&&(ve=tn.deflt(Y.pregap,x),ve!==0&&(J=ge.makeSpan(["arraycolsep"],[]),J.style.width=Be(ve),W.push(J)));var Re=[];for(r=0;r0){for(var Oe=ge.makeLineSpan("hline",n,m),nt=ge.makeLineSpan("hdashline",n,m),ut=[{type:"elem",elem:d,shift:0}];h.length>0;){var Ct=h.pop(),Bn=Ct.pos-V;Ct.isDashed?ut.push({type:"elem",elem:nt,shift:Bn}):ut.push({type:"elem",elem:Oe,shift:Bn})}d=ge.makeVList({positionType:"individualShift",children:ut},n)}if(ae.length===0)return ge.makeSpan(["mord"],[d],n);var Tn=ge.makeVList({positionType:"individualShift",children:ae},n);return Tn=ge.makeSpan(["tag"],[Tn],n),ge.makeFragment([d,Tn])},Zce={c:"center ",l:"left ",r:"right "},Ta=function(e,n){for(var r=[],s=new _e.MathNode("mtd",[],["mtr-glue"]),i=new _e.MathNode("mtd",[],["mml-eqn-num"]),l=0;l0){var b=e.cols,k="",O=!1,j=0,T=b.length;b[0].type==="separator"&&(x+="top ",j=1),b[b.length-1].type==="separator"&&(x+="bottom ",T-=1);for(var M=j;M0?"left ":"",x+=Q[Q.length-1].length>0?"right ":"";for(var F=1;F-1?"alignat":"align",i=e.envName==="split",l=Mo(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:I5(e.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),c,d=0,h={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var m="",p=0;p0&&v&&(O=1),r[b]={type:"align",align:k,pregap:O,postgap:0}}return l.colSeparationType=v?"align":"alignat",l};Na({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=Ux(e[0]),r=n?[e[0]]:Nt(e[0],"ordgroup").body,s=r.map(function(l){var c=R5(l),d=c.text;if("lcr".indexOf(d)!==-1)return{type:"align",align:d};if(d==="|")return{type:"separator",separator:"|"};if(d===":")return{type:"separator",separator:":"};throw new De("Unknown column alignment: "+d,l)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return Mo(t.parser,i,q5(t.envName))},htmlBuilder:Ca,mathmlBuilder:Ta});Na({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(t.envName.charAt(t.envName.length-1)==="*"){var s=t.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),n=s.fetch().text,"lcr".indexOf(n)===-1)throw new De("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=Mo(t.parser,r,q5(t.envName)),l=Math.max(0,...i.body.map(c=>c.length));return i.cols=new Array(l).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[i],left:e[0],right:e[1],rightColor:void 0}:i},htmlBuilder:Ca,mathmlBuilder:Ta});Na({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=Mo(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:Ca,mathmlBuilder:Ta});Na({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=Ux(e[0]),r=n?[e[0]]:Nt(e[0],"ordgroup").body,s=r.map(function(l){var c=R5(l),d=c.text;if("lc".indexOf(d)!==-1)return{type:"align",align:d};throw new De("Unknown column alignment: "+d,l)});if(s.length>1)throw new De("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5};if(i=Mo(t.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new De("{subarray} can contain only one column");return i},htmlBuilder:Ca,mathmlBuilder:Ta});Na({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=Mo(t.parser,e,q5(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.indexOf("r")>-1?".":"\\{",right:t.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:Ca,mathmlBuilder:Ta});Na({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:BR,htmlBuilder:Ca,mathmlBuilder:Ta});Na({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){["gather","gather*"].includes(t.envName)&&Gx(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:I5(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return Mo(t.parser,e,"display")},htmlBuilder:Ca,mathmlBuilder:Ta});Na({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:BR,htmlBuilder:Ca,mathmlBuilder:Ta});Na({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){Gx(t);var e={autoTag:I5(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return Mo(t.parser,e,"display")},htmlBuilder:Ca,mathmlBuilder:Ta});Na({type:"array",names:["CD"],props:{numArgs:0},handler(t){return Gx(t),Bce(t.parser)},htmlBuilder:Ca,mathmlBuilder:Ta});q("\\nonumber","\\gdef\\@eqnsw{0}");q("\\notag","\\nonumber");Qe({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new De(t.funcName+" valid only within array environment")}});var yN=PR;Qe({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];if(s.type!=="ordgroup")throw new De("Invalid environment name",s);for(var i="",l=0;l{var n=t.font,r=e.withFont(n);return Xt(t.body,r)},qR=(t,e)=>{var n=t.font,r=e.withFont(n);return Rn(t.body,r)},bN={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Qe({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=Zg(e[0]),i=r;return i in bN&&(i=bN[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:IR,mathmlBuilder:qR});Qe({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0],s=tn.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:Vx(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:s}}});Qe({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,breakOnTokenText:s}=t,{mode:i}=n,l=n.parseExpression(!0,s),c="math"+r.slice(1);return{type:"font",mode:i,font:c,body:{type:"ordgroup",mode:n.mode,body:l}}},htmlBuilder:IR,mathmlBuilder:qR});var FR=(t,e)=>{var n=e;return t==="display"?n=n.id>=at.SCRIPT.id?n.text():at.DISPLAY:t==="text"&&n.size===at.DISPLAY.size?n=at.TEXT:t==="script"?n=at.SCRIPT:t==="scriptscript"&&(n=at.SCRIPTSCRIPT),n},F5=(t,e)=>{var n=FR(t.size,e.style),r=n.fracNum(),s=n.fracDen(),i;i=e.havingStyle(r);var l=Xt(t.numer,i,e);if(t.continued){var c=8.5/e.fontMetrics().ptPerEm,d=3.5/e.fontMetrics().ptPerEm;l.height=l.height0?b=3*x:b=7*x,k=e.fontMetrics().denom1):(p>0?(v=e.fontMetrics().num2,b=x):(v=e.fontMetrics().num3,b=3*x),k=e.fontMetrics().denom2);var O;if(m){var T=e.fontMetrics().axisHeight;v-l.depth-(T+.5*p){var n=new _e.MathNode("mfrac",[Rn(t.numer,e),Rn(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=Kn(t.barSize,e);n.setAttribute("linethickness",Be(r))}var s=FR(t.size,e.style);if(s.size!==e.style.size){n=new _e.MathNode("mstyle",[n]);var i=s.size===at.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",i),n.setAttribute("scriptlevel","0")}if(t.leftDelim!=null||t.rightDelim!=null){var l=[];if(t.leftDelim!=null){var c=new _e.MathNode("mo",[new _e.TextNode(t.leftDelim.replace("\\",""))]);c.setAttribute("fence","true"),l.push(c)}if(l.push(n),t.rightDelim!=null){var d=new _e.MathNode("mo",[new _e.TextNode(t.rightDelim.replace("\\",""))]);d.setAttribute("fence","true"),l.push(d)}return _5(l)}return n};Qe({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1],l,c=null,d=null,h="auto";switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":l=!0;break;case"\\\\atopfrac":l=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":l=!1,c="(",d=")";break;case"\\\\bracefrac":l=!1,c="\\{",d="\\}";break;case"\\\\brackfrac":l=!1,c="[",d="]";break;default:throw new Error("Unrecognized genfrac command")}switch(r){case"\\dfrac":case"\\dbinom":h="display";break;case"\\tfrac":case"\\tbinom":h="text";break}return{type:"genfrac",mode:n.mode,continued:!1,numer:s,denom:i,hasBarLine:l,leftDelim:c,rightDelim:d,size:h,barSize:null}},htmlBuilder:F5,mathmlBuilder:Q5});Qe({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1];return{type:"genfrac",mode:n.mode,continued:!0,numer:s,denom:i,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});Qe({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(t){var{parser:e,funcName:n,token:r}=t,s;switch(n){case"\\over":s="\\frac";break;case"\\choose":s="\\binom";break;case"\\atop":s="\\\\atopfrac";break;case"\\brace":s="\\\\bracefrac";break;case"\\brack":s="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:s,token:r}}});var wN=["display","text","script","scriptscript"],SN=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};Qe({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(t,e){var{parser:n}=t,r=e[4],s=e[5],i=Zg(e[0]),l=i.type==="atom"&&i.family==="open"?SN(i.text):null,c=Zg(e[1]),d=c.type==="atom"&&c.family==="close"?SN(c.text):null,h=Nt(e[2],"size"),m,p=null;h.isBlank?m=!0:(p=h.value,m=p.number>0);var x="auto",v=e[3];if(v.type==="ordgroup"){if(v.body.length>0){var b=Nt(v.body[0],"textord");x=wN[Number(b.text)]}}else v=Nt(v,"textord"),x=wN[Number(v.text)];return{type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:m,barSize:p,leftDelim:l,rightDelim:d,size:x}},htmlBuilder:F5,mathmlBuilder:Q5});Qe({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(t,e){var{parser:n,funcName:r,token:s}=t;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:Nt(e[0],"size").value,token:s}}});Qe({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=Toe(Nt(e[1],"infix").size),l=e[2],c=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:l,continued:!1,hasBarLine:c,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:F5,mathmlBuilder:Q5});var QR=(t,e)=>{var n=e.style,r,s;t.type==="supsub"?(r=t.sup?Xt(t.sup,e.havingStyle(n.sup()),e):Xt(t.sub,e.havingStyle(n.sub()),e),s=Nt(t.base,"horizBrace")):s=Nt(t,"horizBrace");var i=Xt(s.base,e.havingBaseStyle(at.DISPLAY)),l=vl.svgSpan(s,e),c;if(s.isOver?(c=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:l}]},e),c.children[0].children[0].children[1].classes.push("svg-align")):(c=ge.makeVList({positionType:"bottom",positionData:i.depth+.1+l.height,children:[{type:"elem",elem:l},{type:"kern",size:.1},{type:"elem",elem:i}]},e),c.children[0].children[0].children[0].classes.push("svg-align")),r){var d=ge.makeSpan(["mord",s.isOver?"mover":"munder"],[c],e);s.isOver?c=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:d},{type:"kern",size:.2},{type:"elem",elem:r}]},e):c=ge.makeVList({positionType:"bottom",positionData:d.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:d}]},e)}return ge.makeSpan(["mord",s.isOver?"mover":"munder"],[c],e)},Jce=(t,e)=>{var n=vl.mathMLnode(t.label);return new _e.MathNode(t.isOver?"mover":"munder",[Rn(t.base,e),n])};Qe({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"horizBrace",mode:n.mode,label:r,isOver:/^\\over/.test(r),base:e[0]}},htmlBuilder:QR,mathmlBuilder:Jce});Qe({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],s=Nt(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:ar(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=Mr(t.body,e,!1);return ge.makeAnchor(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=bo(t.body,e);return n instanceof ti||(n=new ti("mrow",[n])),n.setAttribute("href",t.href),n}});Qe({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=Nt(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var s=[],i=0;i{var{parser:n,funcName:r,token:s}=t,i=Nt(e[0],"raw").string,l=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var c,d={};switch(r){case"\\htmlClass":d.class=i,c={command:"\\htmlClass",class:i};break;case"\\htmlId":d.id=i,c={command:"\\htmlId",id:i};break;case"\\htmlStyle":d.style=i,c={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var h=i.split(","),m=0;m{var n=Mr(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var s=ge.makeSpan(r,n,e);for(var i in t.attributes)i!=="class"&&t.attributes.hasOwnProperty(i)&&s.setAttribute(i,t.attributes[i]);return s},mathmlBuilder:(t,e)=>bo(t.body,e)});Qe({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:ar(e[0]),mathml:ar(e[1])}},htmlBuilder:(t,e)=>{var n=Mr(t.html,e,!1);return ge.makeFragment(n)},mathmlBuilder:(t,e)=>bo(t.mathml,e)});var qb=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!n)throw new De("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!lR(r))throw new De("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Qe({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(t,e,n)=>{var{parser:r}=t,s={number:0,unit:"em"},i={number:.9,unit:"em"},l={number:0,unit:"em"},c="";if(n[0])for(var d=Nt(n[0],"raw").string,h=d.split(","),m=0;m{var n=Kn(t.height,e),r=0;t.totalheight.number>0&&(r=Kn(t.totalheight,e)-n);var s=0;t.width.number>0&&(s=Kn(t.width,e));var i={height:Be(n+r)};s>0&&(i.width=Be(s)),r>0&&(i.verticalAlign=Be(-r));var l=new Joe(t.src,t.alt,i);return l.height=n,l.depth=r,l},mathmlBuilder:(t,e)=>{var n=new _e.MathNode("mglyph",[]);n.setAttribute("alt",t.alt);var r=Kn(t.height,e),s=0;if(t.totalheight.number>0&&(s=Kn(t.totalheight,e)-r,n.setAttribute("valign",Be(-s))),n.setAttribute("height",Be(r+s)),t.width.number>0){var i=Kn(t.width,e);n.setAttribute("width",Be(i))}return n.setAttribute("src",t.src),n}});Qe({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=Nt(e[0],"size");if(n.settings.strict){var i=r[1]==="m",l=s.value.unit==="mu";i?(l||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):l&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:s.value}},htmlBuilder(t,e){return ge.makeGlue(t.dimension,e)},mathmlBuilder(t,e){var n=Kn(t.dimension,e);return new _e.SpaceNode(n)}});Qe({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:s}},htmlBuilder:(t,e)=>{var n;t.alignment==="clap"?(n=ge.makeSpan([],[Xt(t.body,e)]),n=ge.makeSpan(["inner"],[n],e)):n=ge.makeSpan(["inner"],[Xt(t.body,e)]);var r=ge.makeSpan(["fix"],[]),s=ge.makeSpan([t.alignment],[n,r],e),i=ge.makeSpan(["strut"]);return i.style.height=Be(s.height+s.depth),s.depth&&(i.style.verticalAlign=Be(-s.depth)),s.children.unshift(i),s=ge.makeSpan(["thinbox"],[s],e),ge.makeSpan(["mord","vbox"],[s],e)},mathmlBuilder:(t,e)=>{var n=new _e.MathNode("mpadded",[Rn(t.body,e)]);if(t.alignment!=="rlap"){var r=t.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});Qe({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){var{funcName:n,parser:r}=t,s=r.mode;r.switchMode("math");var i=n==="\\("?"\\)":"$",l=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",body:l}}});Qe({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new De("Mismatched "+t.funcName)}});var kN=(t,e)=>{switch(e.style.size){case at.DISPLAY.size:return t.display;case at.TEXT.size:return t.text;case at.SCRIPT.size:return t.script;case at.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};Qe({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:ar(e[0]),text:ar(e[1]),script:ar(e[2]),scriptscript:ar(e[3])}},htmlBuilder:(t,e)=>{var n=kN(t,e),r=Mr(n,e,!1);return ge.makeFragment(r)},mathmlBuilder:(t,e)=>{var n=kN(t,e);return bo(n,e)}});var $R=(t,e,n,r,s,i,l)=>{t=ge.makeSpan([],[t]);var c=n&&tn.isCharacterBox(n),d,h;if(e){var m=Xt(e,r.havingStyle(s.sup()),r);h={elem:m,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-m.depth)}}if(n){var p=Xt(n,r.havingStyle(s.sub()),r);d={elem:p,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-p.height)}}var x;if(h&&d){var v=r.fontMetrics().bigOpSpacing5+d.elem.height+d.elem.depth+d.kern+t.depth+l;x=ge.makeVList({positionType:"bottom",positionData:v,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:d.elem,marginLeft:Be(-i)},{type:"kern",size:d.kern},{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Be(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(d){var b=t.height-l;x=ge.makeVList({positionType:"top",positionData:b,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:d.elem,marginLeft:Be(-i)},{type:"kern",size:d.kern},{type:"elem",elem:t}]},r)}else if(h){var k=t.depth+l;x=ge.makeVList({positionType:"bottom",positionData:k,children:[{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Be(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else return t;var O=[x];if(d&&i!==0&&!c){var j=ge.makeSpan(["mspace"],[],r);j.style.marginRight=Be(i),O.unshift(j)}return ge.makeSpan(["mop","op-limits"],O,r)},HR=["\\smallint"],zd=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Nt(t.base,"op"),s=!0):i=Nt(t,"op");var l=e.style,c=!1;l.size===at.DISPLAY.size&&i.symbol&&!HR.includes(i.name)&&(c=!0);var d;if(i.symbol){var h=c?"Size2-Regular":"Size1-Regular",m="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(m=i.name.slice(1),i.name=m==="oiint"?"\\iint":"\\iiint"),d=ge.makeSymbol(i.name,h,"math",e,["mop","op-symbol",c?"large-op":"small-op"]),m.length>0){var p=d.italic,x=ge.staticSvg(m+"Size"+(c?"2":"1"),e);d=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:d,shift:0},{type:"elem",elem:x,shift:c?.08:0}]},e),i.name="\\"+m,d.classes.unshift("mop"),d.italic=p}}else if(i.body){var v=Mr(i.body,e,!0);v.length===1&&v[0]instanceof Ti?(d=v[0],d.classes[0]="mop"):d=ge.makeSpan(["mop"],v,e)}else{for(var b=[],k=1;k{var n;if(t.symbol)n=new ti("mo",[Mi(t.name,t.mode)]),HR.includes(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new ti("mo",qs(t.body,e));else{n=new ti("mi",[new pa(t.name.slice(1))]);var r=new ti("mo",[Mi("⁡","text")]);t.parentIsSupSub?n=new ti("mrow",[n,r]):n=vR([n,r])}return n},eue={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Qe({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=r;return s.length===1&&(s=eue[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:zd,mathmlBuilder:k0});Qe({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:ar(r)}},htmlBuilder:zd,mathmlBuilder:k0});var tue={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Qe({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:zd,mathmlBuilder:k0});Qe({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:zd,mathmlBuilder:k0});Qe({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t,r=n;return r.length===1&&(r=tue[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:zd,mathmlBuilder:k0});var UR=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Nt(t.base,"operatorname"),s=!0):i=Nt(t,"operatorname");var l;if(i.body.length>0){for(var c=i.body.map(p=>{var x=p.text;return typeof x=="string"?{type:"textord",mode:p.mode,text:x}:p}),d=Mr(c,e.withFont("mathrm"),!0),h=0;h{for(var n=qs(t.body,e.withFont("mathrm")),r=!0,s=0;sm.toText()).join("");n=[new _e.TextNode(c)]}var d=new _e.MathNode("mi",n);d.setAttribute("mathvariant","normal");var h=new _e.MathNode("mo",[Mi("⁡","text")]);return t.parentIsSupSub?new _e.MathNode("mrow",[d,h]):_e.newDocumentFragment([d,h])};Qe({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"operatorname",mode:n.mode,body:ar(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:UR,mathmlBuilder:nue});q("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Rc({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?ge.makeFragment(Mr(t.body,e,!1)):ge.makeSpan(["mord"],Mr(t.body,e,!0),e)},mathmlBuilder(t,e){return bo(t.body,e,!0)}});Qe({type:"overline",names:["\\overline"],props:{numArgs:1},handler(t,e){var{parser:n}=t,r=e[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(t,e){var n=Xt(t.body,e.havingCrampedStyle()),r=ge.makeLineSpan("overline-line",e),s=e.fontMetrics().defaultRuleThickness,i=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]},e);return ge.makeSpan(["mord","overline"],[i],e)},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[new _e.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new _e.MathNode("mover",[Rn(t.body,e),n]);return r.setAttribute("accent","true"),r}});Qe({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"phantom",mode:n.mode,body:ar(r)}},htmlBuilder:(t,e)=>{var n=Mr(t.body,e.withPhantom(),!1);return ge.makeFragment(n)},mathmlBuilder:(t,e)=>{var n=qs(t.body,e);return new _e.MathNode("mphantom",n)}});Qe({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=ge.makeSpan([],[Xt(t.body,e.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r{var n=qs(ar(t.body),e),r=new _e.MathNode("mphantom",n),s=new _e.MathNode("mpadded",[r]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});Qe({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=ge.makeSpan(["inner"],[Xt(t.body,e.withPhantom())]),r=ge.makeSpan(["fix"],[]);return ge.makeSpan(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=qs(ar(t.body),e),r=new _e.MathNode("mphantom",n),s=new _e.MathNode("mpadded",[r]);return s.setAttribute("width","0px"),s}});Qe({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=Nt(e[0],"size").value,s=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(t,e){var n=Xt(t.body,e),r=Kn(t.dy,e);return ge.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){var n=new _e.MathNode("mpadded",[Rn(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});Qe({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});Qe({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(t,e,n){var{parser:r}=t,s=n[0],i=Nt(e[0],"size"),l=Nt(e[1],"size");return{type:"rule",mode:r.mode,shift:s&&Nt(s,"size").value,width:i.value,height:l.value}},htmlBuilder(t,e){var n=ge.makeSpan(["mord","rule"],[],e),r=Kn(t.width,e),s=Kn(t.height,e),i=t.shift?Kn(t.shift,e):0;return n.style.borderRightWidth=Be(r),n.style.borderTopWidth=Be(s),n.style.bottom=Be(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=Kn(t.width,e),r=Kn(t.height,e),s=t.shift?Kn(t.shift,e):0,i=e.color&&e.getColor()||"black",l=new _e.MathNode("mspace");l.setAttribute("mathbackground",i),l.setAttribute("width",Be(n)),l.setAttribute("height",Be(r));var c=new _e.MathNode("mpadded",[l]);return s>=0?c.setAttribute("height",Be(s)):(c.setAttribute("height",Be(s)),c.setAttribute("depth",Be(-s))),c.setAttribute("voffset",Be(s)),c}});function VR(t,e,n){for(var r=Mr(t,e,!1),s=e.sizeMultiplier/n.sizeMultiplier,i=0;i{var n=e.havingSize(t.size);return VR(t.body,n,e)};Qe({type:"sizing",names:ON,props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!1,n);return{type:"sizing",mode:s.mode,size:ON.indexOf(r)+1,body:i}},htmlBuilder:rue,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=qs(t.body,n),s=new _e.MathNode("mstyle",r);return s.setAttribute("mathsize",Be(n.sizeMultiplier)),s}});Qe({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,s=!1,i=!1,l=n[0]&&Nt(n[0],"ordgroup");if(l)for(var c="",d=0;d{var n=ge.makeSpan([],[Xt(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return n;if(t.smashHeight&&(n.height=0,n.children))for(var r=0;r{var n=new _e.MathNode("mpadded",[Rn(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});Qe({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r}=t,s=n[0],i=e[0];return{type:"sqrt",mode:r.mode,body:i,index:s}},htmlBuilder(t,e){var n=Xt(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=ge.wrapFragment(n,e);var r=e.fontMetrics(),s=r.defaultRuleThickness,i=s;e.style.idn.height+n.depth+l&&(l=(l+p-n.height-n.depth)/2);var x=d.height-n.height-l-h;n.style.paddingLeft=Be(m);var v=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+x)},{type:"elem",elem:d},{type:"kern",size:h}]},e);if(t.index){var b=e.havingStyle(at.SCRIPTSCRIPT),k=Xt(t.index,b,e),O=.6*(v.height-v.depth),j=ge.makeVList({positionType:"shift",positionData:-O,children:[{type:"elem",elem:k}]},e),T=ge.makeSpan(["root"],[j]);return ge.makeSpan(["mord","sqrt"],[T,v],e)}else return ge.makeSpan(["mord","sqrt"],[v],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new _e.MathNode("mroot",[Rn(n,e),Rn(r,e)]):new _e.MathNode("msqrt",[Rn(n,e)])}});var jN={display:at.DISPLAY,text:at.TEXT,script:at.SCRIPT,scriptscript:at.SCRIPTSCRIPT};Qe({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t,e){var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!0,n),l=r.slice(1,r.length-5);return{type:"styling",mode:s.mode,style:l,body:i}},htmlBuilder(t,e){var n=jN[t.style],r=e.havingStyle(n).withFont("");return VR(t.body,r,e)},mathmlBuilder(t,e){var n=jN[t.style],r=e.havingStyle(n),s=qs(t.body,r),i=new _e.MathNode("mstyle",s),l={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},c=l[t.style];return i.setAttribute("scriptlevel",c[0]),i.setAttribute("displaystyle",c[1]),i}});var sue=function(e,n){var r=e.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===at.DISPLAY.size||r.alwaysHandleSupSub);return s?zd:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===at.DISPLAY.size||r.limits);return i?UR:null}else{if(r.type==="accent")return tn.isCharacterBox(r.base)?z5:null;if(r.type==="horizBrace"){var l=!e.sub;return l===r.isOver?QR:null}else return null}else return null};Rc({type:"supsub",htmlBuilder(t,e){var n=sue(t,e);if(n)return n(t,e);var{base:r,sup:s,sub:i}=t,l=Xt(r,e),c,d,h=e.fontMetrics(),m=0,p=0,x=r&&tn.isCharacterBox(r);if(s){var v=e.havingStyle(e.style.sup());c=Xt(s,v,e),x||(m=l.height-v.fontMetrics().supDrop*v.sizeMultiplier/e.sizeMultiplier)}if(i){var b=e.havingStyle(e.style.sub());d=Xt(i,b,e),x||(p=l.depth+b.fontMetrics().subDrop*b.sizeMultiplier/e.sizeMultiplier)}var k;e.style===at.DISPLAY?k=h.sup1:e.style.cramped?k=h.sup3:k=h.sup2;var O=e.sizeMultiplier,j=Be(.5/h.ptPerEm/O),T=null;if(d){var M=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(l instanceof Ti||M)&&(T=Be(-l.italic))}var _;if(c&&d){m=Math.max(m,k,c.depth+.25*h.xHeight),p=Math.max(p,h.sub2);var D=h.defaultRuleThickness,E=4*D;if(m-c.depth-(d.height-p)0&&(m+=z,p-=z)}var Q=[{type:"elem",elem:d,shift:p,marginRight:j,marginLeft:T},{type:"elem",elem:c,shift:-m,marginRight:j}];_=ge.makeVList({positionType:"individualShift",children:Q},e)}else if(d){p=Math.max(p,h.sub1,d.height-.8*h.xHeight);var F=[{type:"elem",elem:d,marginLeft:T,marginRight:j}];_=ge.makeVList({positionType:"shift",positionData:p,children:F},e)}else if(c)m=Math.max(m,k,c.depth+.25*h.xHeight),_=ge.makeVList({positionType:"shift",positionData:-m,children:[{type:"elem",elem:c,marginRight:j}]},e);else throw new Error("supsub must have either sup or sub.");var B=N4(l,"right")||"mord";return ge.makeSpan([B],[l,ge.makeSpan(["msupsub"],[_])],e)},mathmlBuilder(t,e){var n=!1,r,s;t.base&&t.base.type==="horizBrace"&&(s=!!t.sup,s===t.base.isOver&&(n=!0,r=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var i=[Rn(t.base,e)];t.sub&&i.push(Rn(t.sub,e)),t.sup&&i.push(Rn(t.sup,e));var l;if(n)l=r?"mover":"munder";else if(t.sub)if(t.sup){var h=t.base;h&&h.type==="op"&&h.limits&&e.style===at.DISPLAY||h&&h.type==="operatorname"&&h.alwaysHandleSupSub&&(e.style===at.DISPLAY||h.limits)?l="munderover":l="msubsup"}else{var d=t.base;d&&d.type==="op"&&d.limits&&(e.style===at.DISPLAY||d.alwaysHandleSupSub)||d&&d.type==="operatorname"&&d.alwaysHandleSupSub&&(d.limits||e.style===at.DISPLAY)?l="munder":l="msub"}else{var c=t.base;c&&c.type==="op"&&c.limits&&(e.style===at.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||e.style===at.DISPLAY)?l="mover":l="msup"}return new _e.MathNode(l,i)}});Rc({type:"atom",htmlBuilder(t,e){return ge.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[Mi(t.text,t.mode)]);if(t.family==="bin"){var r=D5(t,e);r==="bold-italic"&&n.setAttribute("mathvariant",r)}else t.family==="punct"?n.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&n.setAttribute("stretchy","false");return n}});var WR={mi:"italic",mn:"normal",mtext:"normal"};Rc({type:"mathord",htmlBuilder(t,e){return ge.makeOrd(t,e,"mathord")},mathmlBuilder(t,e){var n=new _e.MathNode("mi",[Mi(t.text,t.mode,e)]),r=D5(t,e)||"italic";return r!==WR[n.type]&&n.setAttribute("mathvariant",r),n}});Rc({type:"textord",htmlBuilder(t,e){return ge.makeOrd(t,e,"textord")},mathmlBuilder(t,e){var n=Mi(t.text,t.mode,e),r=D5(t,e)||"normal",s;return t.mode==="text"?s=new _e.MathNode("mtext",[n]):/[0-9]/.test(t.text)?s=new _e.MathNode("mn",[n]):t.text==="\\prime"?s=new _e.MathNode("mo",[n]):s=new _e.MathNode("mi",[n]),r!==WR[s.type]&&s.setAttribute("mathvariant",r),s}});var Fb={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Qb={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Rc({type:"spacing",htmlBuilder(t,e){if(Qb.hasOwnProperty(t.text)){var n=Qb[t.text].className||"";if(t.mode==="text"){var r=ge.makeOrd(t,e,"textord");return r.classes.push(n),r}else return ge.makeSpan(["mspace",n],[ge.mathsym(t.text,t.mode,e)],e)}else{if(Fb.hasOwnProperty(t.text))return ge.makeSpan(["mspace",Fb[t.text]],[],e);throw new De('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(Qb.hasOwnProperty(t.text))n=new _e.MathNode("mtext",[new _e.TextNode(" ")]);else{if(Fb.hasOwnProperty(t.text))return new _e.MathNode("mspace");throw new De('Unknown type of space "'+t.text+'"')}return n}});var NN=()=>{var t=new _e.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};Rc({type:"tag",mathmlBuilder(t,e){var n=new _e.MathNode("mtable",[new _e.MathNode("mtr",[NN(),new _e.MathNode("mtd",[bo(t.body,e)]),NN(),new _e.MathNode("mtd",[bo(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var CN={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},TN={"\\textbf":"textbf","\\textmd":"textmd"},iue={"\\textit":"textit","\\textup":"textup"},MN=(t,e)=>{var n=t.font;if(n){if(CN[n])return e.withTextFontFamily(CN[n]);if(TN[n])return e.withTextFontWeight(TN[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(iue[n])};Qe({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"text",mode:n.mode,body:ar(s),font:r}},htmlBuilder(t,e){var n=MN(t,e),r=Mr(t.body,n,!0);return ge.makeSpan(["mord","text"],r,n)},mathmlBuilder(t,e){var n=MN(t,e);return bo(t.body,n)}});Qe({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"underline",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Xt(t.body,e),r=ge.makeLineSpan("underline-line",e),s=e.fontMetrics().defaultRuleThickness,i=ge.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]},e);return ge.makeSpan(["mord","underline"],[i],e)},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[new _e.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new _e.MathNode("munder",[Rn(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});Qe({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"vcenter",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Xt(t.body,e),r=e.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return ge.makeVList({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){return new _e.MathNode("mpadded",[Rn(t.body,e)],["vcenter"])}});Qe({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new De("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=AN(t),r=[],s=e.havingStyle(e.style.text()),i=0;it.body.replace(/ /g,t.star?"␣":" "),so=gR,GR=`[ \r + ]`,aue="\\\\[a-zA-Z@]+",lue="\\\\[^\uD800-\uDFFF]",oue="("+aue+")"+GR+"*",cue=`\\\\( +|[ \r ]+ +?)[ \r ]*`,A4="[̀-ͯ]",uue=new RegExp(A4+"+$"),due="("+GR+"+)|"+(cue+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(A4+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(A4+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+oue)+("|"+lue+")");class EN{constructor(e,n){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=n,this.tokenRegex=new RegExp(due,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,n){this.catcodes[e]=n}lex(){var e=this.input,n=this.tokenRegex.lastIndex;if(n===e.length)return new si("EOF",new Ts(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new De("Unexpected character: '"+e[n]+"'",new si(e[n],new Ts(this,n,n+1)));var s=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[s]===14){var i=e.indexOf(` +`,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new si(s,new Ts(this,n,this.tokenRegex.lastIndex))}}class hue{constructor(e,n){e===void 0&&(e={}),n===void 0&&(n={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=n,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new De("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var n in e)e.hasOwnProperty(n)&&(e[n]==null?delete this.current[n]:this.current[n]=e[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,n,r){if(r===void 0&&(r=!1),r){for(var s=0;s0&&(this.undefStack[this.undefStack.length-1][e]=n)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(e)&&(i[e]=this.current[e])}n==null?delete this.current[e]:this.current[e]=n}}var fue=LR;q("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});q("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});q("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});q("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});q("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var n=t.future();return e[0].length===1&&e[0][0].text===n.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});q("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");q("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var _N={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};q("\\char",function(t){var e=t.popToken(),n,r="";if(e.text==="'")n=8,e=t.popToken();else if(e.text==='"')n=16,e=t.popToken();else if(e.text==="`")if(e=t.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new De("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=_N[e.text],r==null||r>=n)throw new De("Invalid base-"+n+" digit "+e.text);for(var s;(s=_N[t.future().text])!=null&&s{var s=t.consumeArg().tokens;if(s.length!==1)throw new De("\\newcommand's first argument must be a macro name");var i=s[0].text,l=t.isDefined(i);if(l&&!e)throw new De("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!l&&!n)throw new De("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var c=0;if(s=t.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var d="",h=t.expandNextToken();h.text!=="]"&&h.text!=="EOF";)d+=h.text,h=t.expandNextToken();if(!d.match(/^\s*[0-9]+\s*$/))throw new De("Invalid number of arguments: "+d);c=parseInt(d),s=t.consumeArg().tokens}return l&&r||t.macros.set(i,{tokens:s,numArgs:c}),""};q("\\newcommand",t=>$5(t,!1,!0,!1));q("\\renewcommand",t=>$5(t,!0,!1,!1));q("\\providecommand",t=>$5(t,!0,!0,!0));q("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});q("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});q("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),so[n],Ln.math[n],Ln.text[n]),""});q("\\bgroup","{");q("\\egroup","}");q("~","\\nobreakspace");q("\\lq","`");q("\\rq","'");q("\\aa","\\r a");q("\\AA","\\r A");q("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");q("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");q("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");q("ℬ","\\mathscr{B}");q("ℰ","\\mathscr{E}");q("ℱ","\\mathscr{F}");q("ℋ","\\mathscr{H}");q("ℐ","\\mathscr{I}");q("ℒ","\\mathscr{L}");q("ℳ","\\mathscr{M}");q("ℛ","\\mathscr{R}");q("ℭ","\\mathfrak{C}");q("ℌ","\\mathfrak{H}");q("ℨ","\\mathfrak{Z}");q("\\Bbbk","\\Bbb{k}");q("·","\\cdotp");q("\\llap","\\mathllap{\\textrm{#1}}");q("\\rlap","\\mathrlap{\\textrm{#1}}");q("\\clap","\\mathclap{\\textrm{#1}}");q("\\mathstrut","\\vphantom{(}");q("\\underbar","\\underline{\\text{#1}}");q("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');q("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");q("\\ne","\\neq");q("≠","\\neq");q("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");q("∉","\\notin");q("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");q("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");q("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");q("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");q("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");q("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");q("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");q("⟂","\\perp");q("‼","\\mathclose{!\\mkern-0.8mu!}");q("∌","\\notni");q("⌜","\\ulcorner");q("⌝","\\urcorner");q("⌞","\\llcorner");q("⌟","\\lrcorner");q("©","\\copyright");q("®","\\textregistered");q("️","\\textregistered");q("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');q("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');q("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');q("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');q("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");q("⋮","\\vdots");q("\\varGamma","\\mathit{\\Gamma}");q("\\varDelta","\\mathit{\\Delta}");q("\\varTheta","\\mathit{\\Theta}");q("\\varLambda","\\mathit{\\Lambda}");q("\\varXi","\\mathit{\\Xi}");q("\\varPi","\\mathit{\\Pi}");q("\\varSigma","\\mathit{\\Sigma}");q("\\varUpsilon","\\mathit{\\Upsilon}");q("\\varPhi","\\mathit{\\Phi}");q("\\varPsi","\\mathit{\\Psi}");q("\\varOmega","\\mathit{\\Omega}");q("\\substack","\\begin{subarray}{c}#1\\end{subarray}");q("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");q("\\boxed","\\fbox{$\\displaystyle{#1}$}");q("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");q("\\implies","\\DOTSB\\;\\Longrightarrow\\;");q("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");q("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");q("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var DN={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};q("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in DN?e=DN[n]:(n.slice(0,4)==="\\not"||n in Ln.math&&["bin","rel"].includes(Ln.math[n].group))&&(e="\\dotsb"),e});var H5={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};q("\\dotso",function(t){var e=t.future().text;return e in H5?"\\ldots\\,":"\\ldots"});q("\\dotsc",function(t){var e=t.future().text;return e in H5&&e!==","?"\\ldots\\,":"\\ldots"});q("\\cdots",function(t){var e=t.future().text;return e in H5?"\\@cdots\\,":"\\@cdots"});q("\\dotsb","\\cdots");q("\\dotsm","\\cdots");q("\\dotsi","\\!\\cdots");q("\\dotsx","\\ldots\\,");q("\\DOTSI","\\relax");q("\\DOTSB","\\relax");q("\\DOTSX","\\relax");q("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");q("\\,","\\tmspace+{3mu}{.1667em}");q("\\thinspace","\\,");q("\\>","\\mskip{4mu}");q("\\:","\\tmspace+{4mu}{.2222em}");q("\\medspace","\\:");q("\\;","\\tmspace+{5mu}{.2777em}");q("\\thickspace","\\;");q("\\!","\\tmspace-{3mu}{.1667em}");q("\\negthinspace","\\!");q("\\negmedspace","\\tmspace-{4mu}{.2222em}");q("\\negthickspace","\\tmspace-{5mu}{.277em}");q("\\enspace","\\kern.5em ");q("\\enskip","\\hskip.5em\\relax");q("\\quad","\\hskip1em\\relax");q("\\qquad","\\hskip2em\\relax");q("\\tag","\\@ifstar\\tag@literal\\tag@paren");q("\\tag@paren","\\tag@literal{({#1})}");q("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new De("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});q("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");q("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");q("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");q("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");q("\\newline","\\\\\\relax");q("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var XR=Be(ma["Main-Regular"][84][1]-.7*ma["Main-Regular"][65][1]);q("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+XR+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");q("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+XR+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");q("\\hspace","\\@ifstar\\@hspacer\\@hspace");q("\\@hspace","\\hskip #1\\relax");q("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");q("\\ordinarycolon",":");q("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");q("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');q("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');q("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');q("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');q("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');q("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');q("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');q("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');q("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');q("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');q("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');q("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');q("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');q("∷","\\dblcolon");q("∹","\\eqcolon");q("≔","\\coloneqq");q("≕","\\eqqcolon");q("⩴","\\Coloneqq");q("\\ratio","\\vcentcolon");q("\\coloncolon","\\dblcolon");q("\\colonequals","\\coloneqq");q("\\coloncolonequals","\\Coloneqq");q("\\equalscolon","\\eqqcolon");q("\\equalscoloncolon","\\Eqqcolon");q("\\colonminus","\\coloneq");q("\\coloncolonminus","\\Coloneq");q("\\minuscolon","\\eqcolon");q("\\minuscoloncolon","\\Eqcolon");q("\\coloncolonapprox","\\Colonapprox");q("\\coloncolonsim","\\Colonsim");q("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");q("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");q("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");q("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");q("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");q("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");q("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");q("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");q("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");q("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");q("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");q("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");q("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");q("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");q("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");q("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");q("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");q("\\nleqq","\\html@mathml{\\@nleqq}{≰}");q("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");q("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");q("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");q("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");q("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");q("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");q("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");q("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");q("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");q("\\imath","\\html@mathml{\\@imath}{ı}");q("\\jmath","\\html@mathml{\\@jmath}{ȷ}");q("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");q("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");q("⟦","\\llbracket");q("⟧","\\rrbracket");q("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");q("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");q("⦃","\\lBrace");q("⦄","\\rBrace");q("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");q("⦵","\\minuso");q("\\darr","\\downarrow");q("\\dArr","\\Downarrow");q("\\Darr","\\Downarrow");q("\\lang","\\langle");q("\\rang","\\rangle");q("\\uarr","\\uparrow");q("\\uArr","\\Uparrow");q("\\Uarr","\\Uparrow");q("\\N","\\mathbb{N}");q("\\R","\\mathbb{R}");q("\\Z","\\mathbb{Z}");q("\\alef","\\aleph");q("\\alefsym","\\aleph");q("\\Alpha","\\mathrm{A}");q("\\Beta","\\mathrm{B}");q("\\bull","\\bullet");q("\\Chi","\\mathrm{X}");q("\\clubs","\\clubsuit");q("\\cnums","\\mathbb{C}");q("\\Complex","\\mathbb{C}");q("\\Dagger","\\ddagger");q("\\diamonds","\\diamondsuit");q("\\empty","\\emptyset");q("\\Epsilon","\\mathrm{E}");q("\\Eta","\\mathrm{H}");q("\\exist","\\exists");q("\\harr","\\leftrightarrow");q("\\hArr","\\Leftrightarrow");q("\\Harr","\\Leftrightarrow");q("\\hearts","\\heartsuit");q("\\image","\\Im");q("\\infin","\\infty");q("\\Iota","\\mathrm{I}");q("\\isin","\\in");q("\\Kappa","\\mathrm{K}");q("\\larr","\\leftarrow");q("\\lArr","\\Leftarrow");q("\\Larr","\\Leftarrow");q("\\lrarr","\\leftrightarrow");q("\\lrArr","\\Leftrightarrow");q("\\Lrarr","\\Leftrightarrow");q("\\Mu","\\mathrm{M}");q("\\natnums","\\mathbb{N}");q("\\Nu","\\mathrm{N}");q("\\Omicron","\\mathrm{O}");q("\\plusmn","\\pm");q("\\rarr","\\rightarrow");q("\\rArr","\\Rightarrow");q("\\Rarr","\\Rightarrow");q("\\real","\\Re");q("\\reals","\\mathbb{R}");q("\\Reals","\\mathbb{R}");q("\\Rho","\\mathrm{P}");q("\\sdot","\\cdot");q("\\sect","\\S");q("\\spades","\\spadesuit");q("\\sub","\\subset");q("\\sube","\\subseteq");q("\\supe","\\supseteq");q("\\Tau","\\mathrm{T}");q("\\thetasym","\\vartheta");q("\\weierp","\\wp");q("\\Zeta","\\mathrm{Z}");q("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");q("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");q("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");q("\\bra","\\mathinner{\\langle{#1}|}");q("\\ket","\\mathinner{|{#1}\\rangle}");q("\\braket","\\mathinner{\\langle{#1}\\rangle}");q("\\Bra","\\left\\langle#1\\right|");q("\\Ket","\\left|#1\\right\\rangle");var YR=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,s=e.consumeArg().tokens,i=e.consumeArg().tokens,l=e.macros.get("|"),c=e.macros.get("\\|");e.macros.beginGroup();var d=p=>x=>{t&&(x.macros.set("|",l),s.length&&x.macros.set("\\|",c));var v=p;if(!p&&s.length){var b=x.future();b.text==="|"&&(x.popToken(),v=!0)}return{tokens:v?s:r,numArgs:0}};e.macros.set("|",d(!1)),s.length&&e.macros.set("\\|",d(!0));var h=e.consumeArg().tokens,m=e.expandTokens([...i,...h,...n]);return e.macros.endGroup(),{tokens:m.reverse(),numArgs:0}};q("\\bra@ket",YR(!1));q("\\bra@set",YR(!0));q("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");q("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");q("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");q("\\angln","{\\angl n}");q("\\blue","\\textcolor{##6495ed}{#1}");q("\\orange","\\textcolor{##ffa500}{#1}");q("\\pink","\\textcolor{##ff00af}{#1}");q("\\red","\\textcolor{##df0030}{#1}");q("\\green","\\textcolor{##28ae7b}{#1}");q("\\gray","\\textcolor{gray}{#1}");q("\\purple","\\textcolor{##9d38bd}{#1}");q("\\blueA","\\textcolor{##ccfaff}{#1}");q("\\blueB","\\textcolor{##80f6ff}{#1}");q("\\blueC","\\textcolor{##63d9ea}{#1}");q("\\blueD","\\textcolor{##11accd}{#1}");q("\\blueE","\\textcolor{##0c7f99}{#1}");q("\\tealA","\\textcolor{##94fff5}{#1}");q("\\tealB","\\textcolor{##26edd5}{#1}");q("\\tealC","\\textcolor{##01d1c1}{#1}");q("\\tealD","\\textcolor{##01a995}{#1}");q("\\tealE","\\textcolor{##208170}{#1}");q("\\greenA","\\textcolor{##b6ffb0}{#1}");q("\\greenB","\\textcolor{##8af281}{#1}");q("\\greenC","\\textcolor{##74cf70}{#1}");q("\\greenD","\\textcolor{##1fab54}{#1}");q("\\greenE","\\textcolor{##0d923f}{#1}");q("\\goldA","\\textcolor{##ffd0a9}{#1}");q("\\goldB","\\textcolor{##ffbb71}{#1}");q("\\goldC","\\textcolor{##ff9c39}{#1}");q("\\goldD","\\textcolor{##e07d10}{#1}");q("\\goldE","\\textcolor{##a75a05}{#1}");q("\\redA","\\textcolor{##fca9a9}{#1}");q("\\redB","\\textcolor{##ff8482}{#1}");q("\\redC","\\textcolor{##f9685d}{#1}");q("\\redD","\\textcolor{##e84d39}{#1}");q("\\redE","\\textcolor{##bc2612}{#1}");q("\\maroonA","\\textcolor{##ffbde0}{#1}");q("\\maroonB","\\textcolor{##ff92c6}{#1}");q("\\maroonC","\\textcolor{##ed5fa6}{#1}");q("\\maroonD","\\textcolor{##ca337c}{#1}");q("\\maroonE","\\textcolor{##9e034e}{#1}");q("\\purpleA","\\textcolor{##ddd7ff}{#1}");q("\\purpleB","\\textcolor{##c6b9fc}{#1}");q("\\purpleC","\\textcolor{##aa87ff}{#1}");q("\\purpleD","\\textcolor{##7854ab}{#1}");q("\\purpleE","\\textcolor{##543b78}{#1}");q("\\mintA","\\textcolor{##f5f9e8}{#1}");q("\\mintB","\\textcolor{##edf2df}{#1}");q("\\mintC","\\textcolor{##e0e5cc}{#1}");q("\\grayA","\\textcolor{##f6f7f7}{#1}");q("\\grayB","\\textcolor{##f0f1f2}{#1}");q("\\grayC","\\textcolor{##e3e5e6}{#1}");q("\\grayD","\\textcolor{##d6d8da}{#1}");q("\\grayE","\\textcolor{##babec2}{#1}");q("\\grayF","\\textcolor{##888d93}{#1}");q("\\grayG","\\textcolor{##626569}{#1}");q("\\grayH","\\textcolor{##3b3e40}{#1}");q("\\grayI","\\textcolor{##21242c}{#1}");q("\\kaBlue","\\textcolor{##314453}{#1}");q("\\kaGreen","\\textcolor{##71B307}{#1}");var KR={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class mue{constructor(e,n,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(e),this.macros=new hue(fue,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new EN(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var n,r,s;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:s,end:r}=this.consumeArg(["]"])}else({tokens:s,start:n,end:r}=this.consumeArg());return this.pushToken(new si("EOF",r.loc)),this.pushTokens(s),new si("",Ts.range(n,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var n=[],r=e&&e.length>0;r||this.consumeSpaces();var s=this.future(),i,l=0,c=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++l;else if(i.text==="}"){if(--l,l===-1)throw new De("Extra }",i)}else if(i.text==="EOF")throw new De("Unexpected end of input in a macro argument, expected '"+(e&&r?e[c]:"}")+"'",i);if(e&&r)if((l===0||l===1&&e[c]==="{")&&i.text===e[c]){if(++c,c===e.length){n.splice(-c,c);break}}else c=0}while(l!==0||r);return s.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:s,end:i}}consumeArgs(e,n){if(n){if(n.length!==e+1)throw new De("The length of delimiters doesn't match the number of args!");for(var r=n[0],s=0;sthis.settings.maxExpand)throw new De("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var n=this.popToken(),r=n.text,s=n.noexpand?null:this._getExpansion(r);if(s==null||e&&s.unexpandable){if(e&&s==null&&r[0]==="\\"&&!this.isDefined(r))throw new De("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var i=s.tokens,l=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var c=i.length-1;c>=0;--c){var d=i[c];if(d.text==="#"){if(c===0)throw new De("Incomplete placeholder at end of macro body",d);if(d=i[--c],d.text==="#")i.splice(c+1,1);else if(/^[1-9]$/.test(d.text))i.splice(c,2,...l[+d.text-1]);else throw new De("Not a valid argument number",d)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new si(e)]):void 0}expandTokens(e){var n=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),n.push(s)}return this.countExpansion(n.length),n}expandMacroAsText(e){var n=this.expandMacro(e);return n&&n.map(r=>r.text).join("")}_getExpansion(e){var n=this.macros.get(e);if(n==null)return n;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var s=typeof n=="function"?n(this):n;if(typeof s=="string"){var i=0;if(s.indexOf("#")!==-1)for(var l=s.replace(/##/g,"");l.indexOf("#"+(i+1))!==-1;)++i;for(var c=new EN(s,this.settings),d=[],h=c.lex();h.text!=="EOF";)d.push(h),h=c.lex();d.reverse();var m={tokens:d,numArgs:i};return m}return s}isDefined(e){return this.macros.has(e)||so.hasOwnProperty(e)||Ln.math.hasOwnProperty(e)||Ln.text.hasOwnProperty(e)||KR.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:so.hasOwnProperty(e)&&!so[e].primitive}}var RN=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Pp=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),$b={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},zN={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Xx{constructor(e,n){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new mue(e,n,this.mode),this.settings=n,this.leftrightDepth=0}expect(e,n){if(n===void 0&&(n=!0),this.fetch().text!==e)throw new De("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var n=this.nextToken;this.consume(),this.gullet.pushToken(new si("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,r}parseExpression(e,n){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var s=this.fetch();if(Xx.endOfExpression.indexOf(s.text)!==-1||n&&s.text===n||e&&so[s.text]&&so[s.text].infix)break;var i=this.parseAtom(n);if(i){if(i.type==="internal")continue}else break;r.push(i)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var n=-1,r,s=0;s=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var c=Ln[this.mode][n].group,d=Ts.range(e),h;if(nce.hasOwnProperty(c)){var m=c;h={type:"atom",mode:this.mode,family:m,loc:d,text:n}}else h={type:c,mode:this.mode,loc:d,text:n};l=h}else if(n.charCodeAt(0)>=128)this.settings.strict&&(aR(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),e)),l={type:"textord",mode:"text",loc:Ts.range(e),text:n};else return null;if(this.consume(),i)for(var p=0;ph&&(h=m):m&&(h!==void 0&&h>-1&&d.push(` +`.repeat(h)||" "),h=-1,d.push(m))}return d.join("")}function sz(t,e,n){return t.type==="element"?Uue(t,e,n):t.type==="text"?n.whitespace==="normal"?iz(t,n):Vue(t):[]}function Uue(t,e,n){const r=az(t,n),s=t.children||[];let i=-1,l=[];if($ue(t))return l;let c,d;for(_4(t)||HN(t)&&qN(e,t,HN)?d=` +`:Que(t)?(c=2,d=2):rz(t)&&(c=1,d=1);++i{try{i(!0);const Oe=await nde({page:l,page_size:m,search:x||void 0,is_registered:b==="all"?void 0:b==="registered",is_banned:O==="all"?void 0:O==="banned",format:T==="all"?void 0:T,sort_by:"usage_count",sort_order:"desc"});e(Oe.data),h(Oe.total)}catch(Oe){const nt=Oe instanceof Error?Oe.message:"加载表情包列表失败";ne({title:"错误",description:nt,variant:"destructive"})}finally{i(!1)}},[l,m,x,b,O,T,ne]),R=async()=>{try{const Oe=await ade();r(Oe.data)}catch(Oe){console.error("加载统计数据失败:",Oe)}};S.useEffect(()=>{ue()},[ue]),S.useEffect(()=>{R()},[]);const me=async Oe=>{try{const nt=await rde(Oe.id);D(nt.data),z(!0)}catch(nt){const ut=nt instanceof Error?nt.message:"加载详情失败";ne({title:"错误",description:ut,variant:"destructive"})}},Y=Oe=>{D(Oe),F(!0)},P=Oe=>{D(Oe),U(!0)},K=async()=>{if(_)try{await ide(_.id),ne({title:"成功",description:"表情包已删除"}),U(!1),D(null),ue(),R()}catch(Oe){const nt=Oe instanceof Error?Oe.message:"删除失败";ne({title:"错误",description:nt,variant:"destructive"})}},$=async Oe=>{try{await lde(Oe.id),ne({title:"成功",description:"表情包已注册"}),ue(),R()}catch(nt){const ut=nt instanceof Error?nt.message:"注册失败";ne({title:"错误",description:ut,variant:"destructive"})}},fe=async Oe=>{try{await ode(Oe.id),ne({title:"成功",description:"表情包已封禁"}),ue(),R()}catch(nt){const ut=nt instanceof Error?nt.message:"封禁失败";ne({title:"错误",description:ut,variant:"destructive"})}},ve=Oe=>{const nt=new Set(V);nt.has(Oe)?nt.delete(Oe):nt.add(Oe),ce(nt)},Re=()=>{V.size===t.length&&t.length>0?ce(new Set):ce(new Set(t.map(Oe=>Oe.id)))},de=async()=>{try{const Oe=await cde(Array.from(V));ne({title:"批量删除完成",description:Oe.message}),ce(new Set),J(!1),ue(),R()}catch(Oe){ne({title:"批量删除失败",description:Oe instanceof Error?Oe.message:"批量删除失败",variant:"destructive"})}},We=()=>{const Oe=parseInt(H),nt=Math.ceil(d/m);Oe>=1&&Oe<=nt?(c(Oe),ae("")):ne({title:"无效的页码",description:`请输入1-${nt}之间的页码`,variant:"destructive"})},ct=n?.formats?Object.keys(n.formats):[];return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsxs("div",{className:"mb-4 sm:mb-6",children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),a.jsx(fn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&a.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[a.jsx(yt,{children:a.jsxs(Jt,{className:"pb-2",children:[a.jsx(Sr,{children:"总数"}),a.jsx(en,{className:"text-2xl",children:n.total})]})}),a.jsx(yt,{children:a.jsxs(Jt,{className:"pb-2",children:[a.jsx(Sr,{children:"已注册"}),a.jsx(en,{className:"text-2xl text-green-600",children:n.registered})]})}),a.jsx(yt,{children:a.jsxs(Jt,{className:"pb-2",children:[a.jsx(Sr,{children:"已封禁"}),a.jsx(en,{className:"text-2xl text-red-600",children:n.banned})]})}),a.jsx(yt,{children:a.jsxs(Jt,{className:"pb-2",children:[a.jsx(Sr,{children:"未注册"}),a.jsx(en,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),a.jsxs(yt,{children:[a.jsx(Jt,{children:a.jsxs(en,{className:"flex items-center gap-2",children:[a.jsx(t2,{className:"h-5 w-5"}),"搜索和筛选"]})}),a.jsxs(vn,{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"搜索"}),a.jsxs("div",{className:"relative",children:[a.jsx(Ps,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Ae,{placeholder:"描述或哈希值...",value:x,onChange:Oe=>{v(Oe.target.value),c(1)},className:"pl-8"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"注册状态"}),a.jsxs(Bt,{value:b,onValueChange:Oe=>{k(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"registered",children:"已注册"}),a.jsx(Pe,{value:"unregistered",children:"未注册"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"封禁状态"}),a.jsxs(Bt,{value:O,onValueChange:Oe=>{j(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"banned",children:"已封禁"}),a.jsx(Pe,{value:"unbanned",children:"未封禁"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"格式"}),a.jsxs(Bt,{value:T,onValueChange:Oe=>{M(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),ct.map(Oe=>a.jsxs(Pe,{value:Oe,children:[Oe.toUpperCase()," (",n?.formats[Oe],")"]},Oe))]})]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:V.size>0&&a.jsxs("span",{children:["已选择 ",V.size," 个表情包"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Bt,{value:m.toString(),onValueChange:Oe=>{p(parseInt(Oe)),c(1),ce(new Set)},children:[a.jsx(Dt,{id:"emoji-page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),V.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ce(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:()=>J(!0),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),a.jsx("div",{className:"flex justify-end pt-4 border-t",children:a.jsxs(ie,{variant:"outline",size:"sm",onClick:ue,disabled:s,children:[a.jsx(Ii,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})})]})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"表情包列表"}),a.jsxs(Sr,{children:["共 ",d," 个表情包,当前第 ",l," 页"]})]}),a.jsxs(vn,{children:[a.jsx("div",{className:"hidden md:block rounded-md border overflow-hidden",children:a.jsxs(Ac,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(gt,{className:"w-12",children:a.jsx(ss,{checked:t.length>0&&V.size===t.length,onCheckedChange:Re,"aria-label":"全选"})}),a.jsx(gt,{className:"w-16",children:"预览"}),a.jsx(gt,{children:"描述"}),a.jsx(gt,{children:"格式"}),a.jsx(gt,{children:"情绪"}),a.jsx(gt,{className:"text-center",children:"状态"}),a.jsx(gt,{className:"text-right",children:"使用次数"}),a.jsx(gt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(Oe=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:V.has(Oe.id),onCheckedChange:()=>ve(Oe.id),"aria-label":`选择 ${Oe.description}`})}),a.jsx(it,{children:a.jsx("div",{className:"w-20 h-20 bg-muted rounded flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(Oe.id),alt:Oe.description||"表情包",className:"w-full h-full object-cover",onError:nt=>{const ut=nt.target;ut.style.display="none";const Ct=ut.parentElement;Ct&&(Ct.innerHTML='')}})})}),a.jsx(it,{children:a.jsxs("div",{className:"space-y-1 max-w-xs",children:[a.jsx("div",{className:"font-medium truncate",title:Oe.description||"无描述",children:Oe.description||"无描述"}),a.jsxs("div",{className:"text-xs text-muted-foreground font-mono",children:[Oe.emoji_hash.slice(0,16),"..."]})]})}),a.jsx(it,{children:a.jsx($n,{variant:"outline",children:Oe.format.toUpperCase()})}),a.jsx(it,{children:a.jsx(UN,{emotions:Oe.emotion})}),a.jsx(it,{className:"align-middle",children:a.jsxs("div",{className:"flex gap-2 justify-center",children:[Oe.is_registered&&a.jsxs($n,{variant:"default",className:"bg-green-600",children:[a.jsx(ua,{className:"h-3 w-3 mr-1"}),"已注册"]}),Oe.is_banned&&a.jsxs($n,{variant:"destructive",children:[a.jsx(Kb,{className:"h-3 w-3 mr-1"}),"已封禁"]})]})}),a.jsx(it,{className:"text-right font-mono",children:Oe.usage_count}),a.jsx(it,{children:a.jsxs("div",{className:"flex items-center justify-end gap-1 flex-wrap",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>me(Oe),children:[a.jsx(oo,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Y(Oe),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),!Oe.is_registered&&a.jsxs(ie,{size:"sm",onClick:()=>$(Oe),className:"bg-green-600 hover:bg-green-700 text-white",children:[a.jsx(ua,{className:"h-4 w-4 mr-1"}),"注册"]}),!Oe.is_banned&&a.jsxs(ie,{size:"sm",onClick:()=>fe(Oe),className:"bg-orange-600 hover:bg-orange-700 text-white",children:[a.jsx(cO,{className:"h-4 w-4 mr-1"}),"封禁"]}),a.jsxs(ie,{size:"sm",onClick:()=>P(Oe),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},Oe.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3",children:t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(Oe=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex gap-3",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("div",{className:"w-16 h-16 bg-muted rounded flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(Oe.id),alt:Oe.description||"表情包",className:"w-full h-full object-cover",onError:nt=>{const ut=nt.target;ut.style.display="none";const Ct=ut.parentElement;Ct&&(Ct.innerHTML='')}})})}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[a.jsxs("div",{className:"min-w-0 w-full overflow-hidden",children:[a.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",title:Oe.description||"无描述",children:Oe.description||"无描述"}),a.jsxs("p",{className:"text-xs text-muted-foreground font-mono line-clamp-1 w-full break-all",children:[Oe.emoji_hash.slice(0,16),"..."]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 items-center min-w-0",children:[a.jsx($n,{variant:"outline",className:"text-xs flex-shrink-0",children:Oe.format.toUpperCase()}),Oe.is_registered&&a.jsxs($n,{variant:"default",className:"bg-green-600 text-xs flex-shrink-0",children:[a.jsx(ua,{className:"h-3 w-3 mr-1"}),"已注册"]}),Oe.is_banned&&a.jsxs($n,{variant:"destructive",className:"text-xs flex-shrink-0",children:[a.jsx(Kb,{className:"h-3 w-3 mr-1"}),"已封禁"]}),a.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:["使用: ",Oe.usage_count]})]}),Oe.emotion&&Oe.emotion.trim()&&a.jsx("div",{className:"min-w-0 overflow-hidden",children:a.jsx(UN,{emotions:Oe.emotion})})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>me(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(oo,{className:"h-3 w-3 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Y(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),!Oe.is_registered&&a.jsxs(ie,{size:"sm",onClick:()=>$(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-green-600 hover:bg-green-700 text-white",children:[a.jsx(ua,{className:"h-3 w-3 mr-1"}),"注册"]}),!Oe.is_banned&&a.jsxs(ie,{size:"sm",onClick:()=>fe(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-orange-600 hover:bg-orange-700 text-white",children:[a.jsx(cO,{className:"h-3 w-3 mr-1"}),"封禁"]}),a.jsxs(ie,{size:"sm",onClick:()=>P(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},Oe.id))}),d>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(l-1)*m+1," 到"," ",Math.min(l*m,d)," 条,共 ",d," 条"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(Oe=>Math.max(1,Oe-1)),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ae,{type:"number",value:H,onChange:Oe=>ae(Oe.target.value),onKeyDown:Oe=>Oe.key==="Enter"&&We(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/m)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:We,disabled:!H,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(Oe=>Oe+1),disabled:l>=Math.ceil(d/m),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Mc,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(d/m)),disabled:l>=Math.ceil(d/m),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]}),a.jsx(dde,{emoji:_,open:E,onOpenChange:z}),a.jsx(hde,{emoji:_,open:Q,onOpenChange:F,onSuccess:()=>{ue(),R()}})]})}),a.jsx(mn,{open:W,onOpenChange:J,children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认批量删除"}),a.jsxs(un,{children:["你确定要删除选中的 ",V.size," 个表情包吗?此操作不可撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:de,children:"确认删除"})]})]})}),a.jsx(Rr,{open:B,onOpenChange:U,children:a.jsxs(Nr,{children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"确认删除"}),a.jsx(Gr,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>U(!1),children:"取消"}),a.jsx(ie,{variant:"destructive",onClick:K,children:"删除"})]})]})})]})}function dde({emoji:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[90vh]",children:[a.jsx(Cr,{children:a.jsx(Tr,{children:"表情包详情"})}),a.jsx(fn,{className:"max-h-[calc(90vh-8rem)] pr-4",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex justify-center",children:a.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(t.id),alt:t.description||"表情包",className:"w-full h-full object-cover",onError:s=>{const i=s.target;i.style.display="none";const l=i.parentElement;l&&(l.innerHTML='')}})})}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"ID"}),a.jsx("div",{className:"mt-1 font-mono",children:t.id})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"格式"}),a.jsx("div",{className:"mt-1",children:a.jsx($n,{variant:"outline",children:t.format.toUpperCase()})})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"文件路径"}),a.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.full_path})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"哈希值"}),a.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.emoji_hash})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"描述"}),t.description?a.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:a.jsx(tde,{className:"prose-sm",children:t.description})}):a.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"情绪"}),a.jsx("div",{className:"mt-1",children:t.emotion?a.jsx("span",{className:"text-sm",children:t.emotion}):a.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"状态"}),a.jsxs("div",{className:"mt-2 flex gap-2",children:[t.is_registered&&a.jsx($n,{variant:"default",className:"bg-green-600",children:"已注册"}),t.is_banned&&a.jsx($n,{variant:"destructive",children:"已封禁"}),!t.is_registered&&!t.is_banned&&a.jsx($n,{variant:"outline",children:"未注册"})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"使用次数"}),a.jsx("div",{className:"mt-1 font-mono text-lg",children:t.usage_count})]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"记录时间"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.record_time)})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"注册时间"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.register_time)})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"最后使用"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.last_used_time)})]})]})})]})})}function hde({emoji:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState(""),[l,c]=S.useState(""),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState(!1),{toast:b}=Pr();S.useEffect(()=>{t&&(i(t.description||""),c(t.emotion||""),h(t.is_registered),p(t.is_banned))},[t]);const k=async()=>{if(t)try{v(!0);const O=l.split(/[,,]/).map(j=>j.trim()).filter(Boolean).join(",");await sde(t.id,{description:s||void 0,emotion:O||void 0,is_registered:d,is_banned:m}),b({title:"成功",description:"表情包信息已更新"}),n(!1),r()}catch(O){const j=O instanceof Error?O.message:"保存失败";b({title:"错误",description:j,variant:"destructive"})}finally{v(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑表情包"}),a.jsx(Gr,{children:"修改表情包的描述和标签信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(te,{children:"描述"}),a.jsx(On,{value:s,onChange:O=>i(O.target.value),placeholder:"输入表情包描述...",rows:3,className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(te,{children:"情绪"}),a.jsx(On,{value:l,onChange:O=>c(O.target.value),placeholder:"输入情绪描述...",rows:2,className:"mt-1"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入情绪相关的文本描述"})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"is_registered",checked:d,onCheckedChange:O=>h(O===!0)}),a.jsx(te,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"is_banned",checked:m,onCheckedChange:O=>p(O===!0)}),a.jsx(te,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:k,disabled:x,children:x?"保存中...":"保存"})]})]})}):null}function UN({emotions:t}){if(!t||t.trim()==="")return a.jsx("span",{className:"text-xs text-muted-foreground",children:"-"});const e=20,n=t.length>e?t.slice(0,e)+"...":t;return a.jsx("div",{className:"text-sm break-words max-w-xs",title:t,children:n})}const Pc="/api/webui/expression";async function fde(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.chat_id&&e.append("chat_id",t.chat_id);const n=await ot(`${Pc}/list?${e}`,{headers:bt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取表达方式列表失败")}return n.json()}async function mde(t){const e=await ot(`${Pc}/${t}`,{headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取表达方式详情失败")}return e.json()}async function pde(t){const e=await ot(`${Pc}/`,{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"创建表达方式失败")}return e.json()}async function gde(t,e){const n=await ot(`${Pc}/${t}`,{method:"PATCH",headers:bt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新表达方式失败")}return n.json()}async function xde(t){const e=await ot(`${Pc}/${t}`,{method:"DELETE",headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除表达方式失败")}return e.json()}async function vde(t){const e=await ot(`${Pc}/batch/delete`,{method:"POST",headers:bt(),body:JSON.stringify({ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除表达方式失败")}return e.json()}async function yde(){const t=await ot(`${Pc}/stats/summary`,{headers:bt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}function bde(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(1),[d,h]=S.useState(20),[m,p]=S.useState(""),[x,v]=S.useState(null),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,M]=S.useState(!1),[_,D]=S.useState(null),[E,z]=S.useState(new Set),[Q,F]=S.useState(!1),[B,U]=S.useState(""),[V,ce]=S.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),{toast:W}=Pr(),J=async()=>{try{r(!0);const $=await fde({page:l,page_size:d,search:m||void 0});e($.data),i($.total)}catch($){W({title:"加载失败",description:$ instanceof Error?$.message:"无法加载表达方式",variant:"destructive"})}finally{r(!1)}},H=async()=>{try{const $=await yde();$?.data&&ce($.data)}catch($){console.error("加载统计数据失败:",$)}};S.useEffect(()=>{J(),H()},[l,d,m]);const ae=async $=>{try{const fe=await mde($.id);v(fe.data),k(!0)}catch(fe){W({title:"加载详情失败",description:fe instanceof Error?fe.message:"无法加载表达方式详情",variant:"destructive"})}},ne=$=>{v($),j(!0)},ue=async $=>{try{await xde($.id),W({title:"删除成功",description:`已删除表达方式: ${$.situation}`}),D(null),J(),H()}catch(fe){W({title:"删除失败",description:fe instanceof Error?fe.message:"无法删除表达方式",variant:"destructive"})}},R=$=>{const fe=new Set(E);fe.has($)?fe.delete($):fe.add($),z(fe)},me=()=>{E.size===t.length&&t.length>0?z(new Set):z(new Set(t.map($=>$.id)))},Y=async()=>{try{await vde(Array.from(E)),W({title:"批量删除成功",description:`已删除 ${E.size} 个表达方式`}),z(new Set),F(!1),J(),H()}catch($){W({title:"批量删除失败",description:$ instanceof Error?$.message:"无法批量删除表达方式",variant:"destructive"})}},P=()=>{const $=parseInt(B),fe=Math.ceil(s/d);$>=1&&$<=fe?(c($),U("")):W({title:"无效的页码",description:`请输入1-${fe}之间的页码`,variant:"destructive"})},K=$=>$?new Date($*1e3).toLocaleString("zh-CN"):"-";return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsx("div",{className:"mb-4 sm:mb-6",children:a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[a.jsx(Wf,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),a.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),a.jsxs(ie,{onClick:()=>M(!0),className:"gap-2",children:[a.jsx(Wr,{className:"h-4 w-4"}),"新增表达方式"]})]})}),a.jsx(fn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),a.jsx("div",{className:"text-2xl font-bold mt-1",children:V.total})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:V.recent_7days})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:V.chat_count})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx(te,{htmlFor:"search",children:"搜索"}),a.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Ps,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Ae,{id:"search",placeholder:"搜索情境、风格或上下文...",value:m,onChange:$=>p($.target.value),className:"pl-9"})]})}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:E.size>0&&a.jsxs("span",{children:["已选择 ",E.size," 个表达方式"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Bt,{value:d.toString(),onValueChange:$=>{h(parseInt($)),c(1),z(new Set)},children:[a.jsx(Dt,{id:"page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),E.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>z(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:()=>F(!0),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card",children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Ac,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(gt,{className:"w-12",children:a.jsx(ss,{checked:E.size===t.length&&t.length>0,onCheckedChange:me})}),a.jsx(gt,{children:"情境"}),a.jsx(gt,{children:"风格"}),a.jsx(gt,{children:"聊天ID"}),a.jsx(gt,{children:"最后活跃"}),a.jsx(gt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n?a.jsx(xr,{children:a.jsx(it,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map($=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:E.has($.id),onCheckedChange:()=>R($.id)})}),a.jsx(it,{className:"font-medium max-w-xs truncate",children:$.situation}),a.jsx(it,{className:"max-w-xs truncate",children:$.style}),a.jsx(it,{className:"font-mono text-sm",children:$.chat_id}),a.jsx(it,{className:"text-sm text-muted-foreground",children:K($.last_active_time)}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ae($),children:[a.jsx(Fi,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ne($),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>D($),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},$.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map($=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ss,{checked:E.has($.id),onCheckedChange:()=>R($.id),className:"mt-1"}),a.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),a.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:$.situation,children:$.situation})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),a.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:$.style,children:$.style})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天ID"}),a.jsx("p",{className:"font-mono text-xs truncate",children:$.chat_id})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后活跃"}),a.jsx("p",{className:"text-xs",children:K($.last_active_time)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae($),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(Fi,{className:"h-3 w-3 mr-1"}),"查看"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ne($),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>D($),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},$.id))}),s>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",l," / ",Math.ceil(s/d)," 页"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l-1),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ae,{type:"number",value:B,onChange:$=>U($.target.value),onKeyDown:$=>$.key==="Enter"&&P(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/d)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:P,disabled:!B,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l+1),disabled:l>=Math.ceil(s/d),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Mc,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(s/d)),disabled:l>=Math.ceil(s/d),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]})}),a.jsx(wde,{expression:x,open:b,onOpenChange:k}),a.jsx(Sde,{open:T,onOpenChange:M,onSuccess:()=>{J(),H(),M(!1)}}),a.jsx(kde,{expression:x,open:O,onOpenChange:j,onSuccess:()=>{J(),H(),j(!1)}}),a.jsx(mn,{open:!!_,onOpenChange:()=>D(null),children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:['确定要删除表达方式 "',_?.situation,'" 吗? 此操作不可撤销。']})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>_&&ue(_),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),a.jsx(Ode,{open:Q,onOpenChange:F,onConfirm:Y,count:E.size})]})}function wde({expression:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"表达方式详情"}),a.jsx(Gr,{children:"查看表达方式的完整信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Mu,{label:"情境",value:t.situation}),a.jsx(Mu,{label:"风格",value:t.style}),a.jsx(Mu,{icon:mg,label:"聊天ID",value:t.chat_id,mono:!0}),a.jsx(Mu,{icon:mg,label:"记录ID",value:t.id.toString(),mono:!0})]}),t.context&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"上下文"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.context})]}),t.up_content&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"上文内容"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.up_content})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Mu,{icon:uc,label:"最后活跃",value:r(t.last_active_time)}),a.jsx(Mu,{icon:uc,label:"创建时间",value:r(t.create_date)})]})]}),a.jsx(ps,{children:a.jsx(ie,{onClick:()=>n(!1),children:"关闭"})})]})})}function Mu({icon:t,label:e,value:n,mono:r=!1}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs(te,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&a.jsx(t,{className:"h-3 w-3"}),e]}),a.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Sde({open:t,onOpenChange:e,onSuccess:n}){const[r,s]=S.useState({situation:"",style:"",context:"",up_content:"",chat_id:""}),[i,l]=S.useState(!1),{toast:c}=Pr(),d=async()=>{if(!r.situation||!r.style||!r.chat_id){c({title:"验证失败",description:"请填写必填字段:情境、风格和聊天ID",variant:"destructive"});return}try{l(!0),await pde(r),c({title:"创建成功",description:"表达方式已创建"}),s({situation:"",style:"",context:"",up_content:"",chat_id:""}),n()}catch(h){c({title:"创建失败",description:h instanceof Error?h.message:"无法创建表达方式",variant:"destructive"})}finally{l(!1)}};return a.jsx(Rr,{open:t,onOpenChange:e,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"新增表达方式"}),a.jsx(Gr,{children:"创建新的表达方式记录"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"situation",children:["情境 ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Ae,{id:"situation",value:r.situation,onChange:h=>s({...r,situation:h.target.value}),placeholder:"描述使用场景"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"style",children:["风格 ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Ae,{id:"style",value:r.style,onChange:h=>s({...r,style:h.target.value}),placeholder:"描述表达风格"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"chat_id",children:["聊天ID ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Ae,{id:"chat_id",value:r.chat_id,onChange:h=>s({...r,chat_id:h.target.value}),placeholder:"关联的聊天ID"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"context",children:"上下文"}),a.jsx(On,{id:"context",value:r.context,onChange:h=>s({...r,context:h.target.value}),placeholder:"上下文信息(可选)",rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"up_content",children:"上文内容"}),a.jsx(On,{id:"up_content",value:r.up_content,onChange:h=>s({...r,up_content:h.target.value}),placeholder:"上文内容(可选)",rows:3})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>e(!1),children:"取消"}),a.jsx(ie,{onClick:d,disabled:i,children:i?"创建中...":"创建"})]})]})})}function kde({expression:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState({}),[l,c]=S.useState(!1),{toast:d}=Pr();S.useEffect(()=>{t&&i({situation:t.situation,style:t.style,context:t.context||"",up_content:t.up_content||"",chat_id:t.chat_id})},[t]);const h=async()=>{if(t)try{c(!0),await gde(t.id,s),d({title:"保存成功",description:"表达方式已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新表达方式",variant:"destructive"})}finally{c(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑表达方式"}),a.jsx(Gr,{children:"修改表达方式的信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_situation",children:"情境"}),a.jsx(Ae,{id:"edit_situation",value:s.situation||"",onChange:m=>i({...s,situation:m.target.value}),placeholder:"描述使用场景"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_style",children:"风格"}),a.jsx(Ae,{id:"edit_style",value:s.style||"",onChange:m=>i({...s,style:m.target.value}),placeholder:"描述表达风格"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_chat_id",children:"聊天ID"}),a.jsx(Ae,{id:"edit_chat_id",value:s.chat_id||"",onChange:m=>i({...s,chat_id:m.target.value}),placeholder:"关联的聊天ID"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_context",children:"上下文"}),a.jsx(On,{id:"edit_context",value:s.context||"",onChange:m=>i({...s,context:m.target.value}),placeholder:"上下文信息",rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_up_content",children:"上文内容"}),a.jsx(On,{id:"edit_up_content",value:s.up_content||"",onChange:m=>i({...s,up_content:m.target.value}),placeholder:"上文内容",rows:3})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:h,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function Ode({open:t,onOpenChange:e,onConfirm:n,count:r}){return a.jsx(mn,{open:t,onOpenChange:e,children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认批量删除"}),a.jsxs(un,{children:["您即将删除 ",r," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const Pd="/api/webui/person";async function jde(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.is_known!==void 0&&e.append("is_known",t.is_known.toString()),t.platform&&e.append("platform",t.platform);const n=await ot(`${Pd}/list?${e}`,{headers:bt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取人物列表失败")}return n.json()}async function Nde(t){const e=await ot(`${Pd}/${t}`,{headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取人物详情失败")}return e.json()}async function Cde(t,e){const n=await ot(`${Pd}/${t}`,{method:"PATCH",headers:bt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新人物信息失败")}return n.json()}async function Tde(t){const e=await ot(`${Pd}/${t}`,{method:"DELETE",headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除人物信息失败")}return e.json()}async function Mde(){const t=await ot(`${Pd}/stats/summary`,{headers:bt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}async function Ade(t){const e=await ot(`${Pd}/batch/delete`,{method:"POST",headers:bt(),body:JSON.stringify({person_ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除失败")}return e.json()}function Ede(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(1),[d,h]=S.useState(20),[m,p]=S.useState(""),[x,v]=S.useState(void 0),[b,k]=S.useState(void 0),[O,j]=S.useState(null),[T,M]=S.useState(!1),[_,D]=S.useState(!1),[E,z]=S.useState(null),[Q,F]=S.useState({total:0,known:0,unknown:0,platforms:{}}),[B,U]=S.useState(new Set),[V,ce]=S.useState(!1),[W,J]=S.useState(""),{toast:H}=Pr(),ae=async()=>{try{r(!0);const de=await jde({page:l,page_size:d,search:m||void 0,is_known:x,platform:b});e(de.data),i(de.total)}catch(de){H({title:"加载失败",description:de instanceof Error?de.message:"无法加载人物信息",variant:"destructive"})}finally{r(!1)}},ne=async()=>{try{const de=await Mde();de?.data&&F(de.data)}catch(de){console.error("加载统计数据失败:",de)}};S.useEffect(()=>{ae(),ne()},[l,d,m,x,b]);const ue=async de=>{try{const We=await Nde(de.person_id);j(We.data),M(!0)}catch(We){H({title:"加载详情失败",description:We instanceof Error?We.message:"无法加载人物详情",variant:"destructive"})}},R=de=>{j(de),D(!0)},me=async de=>{try{await Tde(de.person_id),H({title:"删除成功",description:`已删除人物信息: ${de.person_name||de.nickname||de.user_id}`}),z(null),ae(),ne()}catch(We){H({title:"删除失败",description:We instanceof Error?We.message:"无法删除人物信息",variant:"destructive"})}},Y=S.useMemo(()=>Object.keys(Q.platforms),[Q.platforms]),P=de=>{const We=new Set(B);We.has(de)?We.delete(de):We.add(de),U(We)},K=()=>{B.size===t.length&&t.length>0?U(new Set):U(new Set(t.map(de=>de.person_id)))},$=()=>{if(B.size===0){H({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}ce(!0)},fe=async()=>{try{const de=await Ade(Array.from(B));H({title:"批量删除完成",description:de.message}),U(new Set),ce(!1),ae(),ne()}catch(de){H({title:"批量删除失败",description:de instanceof Error?de.message:"批量删除失败",variant:"destructive"})}},ve=()=>{const de=parseInt(W),We=Math.ceil(s/d);de>=1&&de<=We?(c(de),J("")):H({title:"无效的页码",description:`请输入1-${We}之间的页码`,variant:"destructive"})},Re=de=>de?new Date(de*1e3).toLocaleString("zh-CN"):"-";return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsx("div",{className:"mb-4 sm:mb-6",children:a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[a.jsx(Oq,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),a.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),a.jsx(fn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),a.jsx("div",{className:"text-2xl font-bold mt-1",children:Q.total})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:Q.known})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:Q.unknown})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"sm:col-span-2",children:[a.jsx(te,{htmlFor:"search",children:"搜索"}),a.jsxs("div",{className:"relative mt-1.5",children:[a.jsx(Ps,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Ae,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:m,onChange:de=>p(de.target.value),className:"pl-9"})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"filter-known",children:"认识状态"}),a.jsxs(Bt,{value:x===void 0?"all":x.toString(),onValueChange:de=>{v(de==="all"?void 0:de==="true"),c(1)},children:[a.jsx(Dt,{id:"filter-known",className:"mt-1.5",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"true",children:"已认识"}),a.jsx(Pe,{value:"false",children:"未认识"})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"filter-platform",children:"平台"}),a.jsxs(Bt,{value:b||"all",onValueChange:de=>{k(de==="all"?void 0:de),c(1)},children:[a.jsx(Dt,{id:"filter-platform",className:"mt-1.5",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部平台"}),Y.map(de=>a.jsxs(Pe,{value:de,children:[de," (",Q.platforms[de],")"]},de))]})]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:B.size>0&&a.jsxs("span",{children:["已选择 ",B.size," 个人物"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Bt,{value:d.toString(),onValueChange:de=>{h(parseInt(de)),c(1),U(new Set)},children:[a.jsx(Dt,{id:"page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),B.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>U(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:$,children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card",children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Ac,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(gt,{className:"w-12",children:a.jsx(ss,{checked:t.length>0&&B.size===t.length,onCheckedChange:K,"aria-label":"全选"})}),a.jsx(gt,{children:"状态"}),a.jsx(gt,{children:"名称"}),a.jsx(gt,{children:"昵称"}),a.jsx(gt,{children:"平台"}),a.jsx(gt,{children:"用户ID"}),a.jsx(gt,{children:"最后更新"}),a.jsx(gt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(de=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:B.has(de.person_id),onCheckedChange:()=>P(de.person_id),"aria-label":`选择 ${de.person_name||de.nickname||de.user_id}`})}),a.jsx(it,{children:a.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",de.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:de.is_known?"已认识":"未认识"})}),a.jsx(it,{className:"font-medium",children:de.person_name||a.jsx("span",{className:"text-muted-foreground",children:"-"})}),a.jsx(it,{children:de.nickname||"-"}),a.jsx(it,{children:de.platform}),a.jsx(it,{className:"font-mono text-sm",children:de.user_id}),a.jsx(it,{className:"text-sm text-muted-foreground",children:Re(de.last_know)}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ue(de),children:[a.jsx(Fi,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>R(de),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>z(de),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},de.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(de=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ss,{checked:B.has(de.person_id),onCheckedChange:()=>P(de.person_id),className:"mt-1"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",de.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:de.is_known?"已认识":"未认识"}),a.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:de.person_name||a.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),de.nickname&&a.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",de.nickname]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),a.jsx("p",{className:"font-medium text-xs",children:de.platform})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),a.jsx("p",{className:"font-mono text-xs truncate",title:de.user_id,children:de.user_id})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),a.jsx("p",{className:"text-xs",children:Re(de.last_know)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ue(de),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(Fi,{className:"h-3 w-3 mr-1"}),"查看"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>R(de),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>z(de),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},de.id))}),s>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",l," / ",Math.ceil(s/d)," 页"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l-1),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ae,{type:"number",value:W,onChange:de=>J(de.target.value),onKeyDown:de=>de.key==="Enter"&&ve(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/d)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:ve,disabled:!W,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l+1),disabled:l>=Math.ceil(s/d),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Mc,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(s/d)),disabled:l>=Math.ceil(s/d),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]})}),a.jsx(_de,{person:O,open:T,onOpenChange:M}),a.jsx(Dde,{person:O,open:_,onOpenChange:D,onSuccess:()=>{ae(),ne(),D(!1)}}),a.jsx(mn,{open:!!E,onOpenChange:()=>z(null),children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:['确定要删除人物信息 "',E?.person_name||E?.nickname||E?.user_id,'" 吗? 此操作不可撤销。']})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>E&&me(E),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),a.jsx(mn,{open:V,onOpenChange:ce,children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认批量删除"}),a.jsxs(un,{children:["确定要删除选中的 ",B.size," 个人物信息吗? 此操作不可撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:fe,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function _de({person:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"人物详情"}),a.jsxs(Gr,{children:["查看 ",t.person_name||t.nickname||t.user_id," 的完整信息"]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Ka,{icon:D9,label:"人物名称",value:t.person_name}),a.jsx(Ka,{icon:Wf,label:"昵称",value:t.nickname}),a.jsx(Ka,{icon:mg,label:"用户ID",value:t.user_id,mono:!0}),a.jsx(Ka,{icon:mg,label:"人物ID",value:t.person_id,mono:!0}),a.jsx(Ka,{label:"平台",value:t.platform}),a.jsx(Ka,{label:"状态",value:t.is_known?"已认识":"未认识"})]}),t.name_reason&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),a.jsx("p",{className:"mt-1 text-sm",children:t.name_reason})]}),t.memory_points&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"个人印象"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.memory_points})]}),t.group_nick_name&&t.group_nick_name.length>0&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"群昵称"}),a.jsx("div",{className:"mt-2 space-y-1",children:t.group_nick_name.map((s,i)=>a.jsxs("div",{className:"text-sm flex items-center gap-2",children:[a.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:s.group_id}),a.jsx("span",{children:"→"}),a.jsx("span",{children:s.group_nick_name})]},i))})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsx(Ka,{icon:uc,label:"认识时间",value:r(t.know_times)}),a.jsx(Ka,{icon:uc,label:"首次记录",value:r(t.know_since)}),a.jsx(Ka,{icon:uc,label:"最后更新",value:r(t.last_know)})]})]}),a.jsx(ps,{children:a.jsx(ie,{onClick:()=>n(!1),children:"关闭"})})]})})}function Ka({icon:t,label:e,value:n,mono:r=!1}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs(te,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&a.jsx(t,{className:"h-3 w-3"}),e]}),a.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Dde({person:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState({}),[l,c]=S.useState(!1),{toast:d}=Pr();S.useEffect(()=>{t&&i({person_name:t.person_name||"",name_reason:t.name_reason||"",nickname:t.nickname||"",memory_points:t.memory_points||"",is_known:t.is_known})},[t]);const h=async()=>{if(t)try{c(!0),await Cde(t.person_id,s),d({title:"保存成功",description:"人物信息已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新人物信息",variant:"destructive"})}finally{c(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑人物信息"}),a.jsxs(Gr,{children:["修改 ",t.person_name||t.nickname||t.user_id," 的信息"]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"person_name",children:"人物名称"}),a.jsx(Ae,{id:"person_name",value:s.person_name||"",onChange:m=>i({...s,person_name:m.target.value}),placeholder:"为这个人设置一个名称"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称"}),a.jsx(Ae,{id:"nickname",value:s.nickname||"",onChange:m=>i({...s,nickname:m.target.value}),placeholder:"昵称"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"name_reason",children:"名称设定原因"}),a.jsx(On,{id:"name_reason",value:s.name_reason||"",onChange:m=>i({...s,name_reason:m.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"memory_points",children:"个人印象"}),a.jsx(On,{id:"memory_points",value:s.memory_points||"",onChange:m=>i({...s,memory_points:m.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),a.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[a.jsxs("div",{children:[a.jsx(te,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),a.jsx(jt,{id:"is_known",checked:s.is_known,onCheckedChange:m=>i({...s,is_known:m})})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:h,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function Rde(t,e,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:n}).format(e).split(/\s/g).slice(2).join(" ")}const zde={},Wh={};function cc(t,e){try{const r=(zde[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in Wh?Wh[r]:VN(r,r.split(":"))}catch{if(t in Wh)return Wh[t];const n=t?.match(Pde);return n?VN(t,n.slice(1)):NaN}}const Pde=/([+-]\d\d):?(\d\d)?/;function VN(t,e){const n=+(e[0]||0),r=+(e[1]||0),s=+(e[2]||0)/60;return Wh[t]=n*60+r>0?n*60+r+s:n*60-r-s}class ga extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(cc(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),lz(this),R4(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new ga(...n,e):new ga(Date.now(),e)}withTimeZone(e){return new ga(+this,e)}getTimezoneOffset(){const e=-cc(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),R4(this),+this}[Symbol.for("constructDateFrom")](e){return new ga(+new Date(e),this.timeZone)}}const WN=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!WN.test(t))return;const e=t.replace(WN,"$1UTC");ga.prototype[e]&&(t.startsWith("get")?ga.prototype[t]=function(){return this.internal[e]()}:(ga.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),Lde(this),+this},ga.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),R4(this),+this}))});function R4(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-cc(t.timeZone,t)*60))}function Lde(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),lz(t)}function lz(t){const e=cc(t.timeZone,t),n=e>0?Math.floor(e):Math.ceil(e),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const s=-new Date(+t).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),l=s-i,c=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();l&&c&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+l);const d=s-n;d&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+d);const h=new Date(+t);h.setUTCSeconds(0);const m=s>0?h.getSeconds():(h.getSeconds()-60)%60,p=Math.round(-(cc(t.timeZone,t)*60))%60;(p||m)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+p),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+p+m));const x=cc(t.timeZone,t),v=x>0?Math.floor(x):Math.ceil(x),k=-new Date(+t).getTimezoneOffset()-v,O=v!==n,j=k-d;if(O&&j){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+j);const T=cc(t.timeZone,t),M=T>0?Math.floor(T):Math.ceil(T),_=v-M;_&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+_),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+_))}}class Zr extends ga{static tz(e,...n){return n.length?new Zr(...n,e):new Zr(Date.now(),e)}toISOString(){const[e,n,r]=this.tzComponents(),s=`${e}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,n,r,s]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${r} ${n} ${s}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[n,r,s]=this.tzComponents();return`${e} GMT${n}${r}${s} (${Rde(this.timeZone,this)})`}toLocaleString(e,n){return Date.prototype.toLocaleString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(e,n){return Date.prototype.toLocaleDateString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(e,n){return Date.prototype.toLocaleTimeString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),n=e>0?"-":"+",r=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),s=String(Math.abs(e)%60).padStart(2,"0");return[n,r,s]}withTimeZone(e){return new Zr(+this,e)}[Symbol.for("constructDateFrom")](e){return new Zr(+new Date(e),this.timeZone)}}const oz=6048e5,Bde=864e5,GN=Symbol.for("constructDateFrom");function vr(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&GN in t?t[GN](e):t instanceof Date?new t.constructor(e):new Date(e)}function Nn(t,e){return vr(e||t,t)}function cz(t,e,n){const r=Nn(t,n?.in);return isNaN(e)?vr(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function uz(t,e,n){const r=Nn(t,n?.in);if(isNaN(e))return vr(t,NaN);if(!e)return r;const s=r.getDate(),i=vr(t,r.getTime());i.setMonth(r.getMonth()+e+1,0);const l=i.getDate();return s>=l?i:(r.setFullYear(i.getFullYear(),i.getMonth(),s),r)}let Ide={};function O0(){return Ide}function wo(t,e){const n=O0(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Nn(t,e?.in),i=s.getDay(),l=(i=i.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function XN(t){const e=Nn(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Lc(t,...e){const n=vr.bind(null,t||e.find(r=>typeof r=="object"));return e.map(n)}function Qf(t,e){const n=Nn(t,e?.in);return n.setHours(0,0,0,0),n}function hz(t,e,n){const[r,s]=Lc(n?.in,t,e),i=Qf(r),l=Qf(s),c=+i-XN(i),d=+l-XN(l);return Math.round((c-d)/Bde)}function qde(t,e){const n=dz(t,e),r=vr(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Ff(r)}function Fde(t,e,n){return cz(t,e*7,n)}function Qde(t,e,n){return uz(t,e*12,n)}function $de(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=vr.bind(null,s));const i=Nn(s,r);(!n||n{!r&&typeof s=="object"&&(r=vr.bind(null,s));const i=Nn(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),vr(r,n||NaN)}function Ude(t,e,n){const[r,s]=Lc(n?.in,t,e);return+Qf(r)==+Qf(s)}function fz(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Vde(t){return!(!fz(t)&&typeof t!="number"||isNaN(+Nn(t)))}function Wde(t,e,n){const[r,s]=Lc(n?.in,t,e),i=r.getFullYear()-s.getFullYear(),l=r.getMonth()-s.getMonth();return i*12+l}function Gde(t,e){const n=Nn(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function mz(t,e){const[n,r]=Lc(t,e.start,e.end);return{start:n,end:r}}function Xde(t,e){const{start:n,end:r}=mz(e?.in,t);let s=+n>+r;const i=s?+n:+r,l=s?r:n;l.setHours(0,0,0,0),l.setDate(1);let c=1;const d=[];for(;+l<=i;)d.push(vr(n,l)),l.setMonth(l.getMonth()+c);return s?d.reverse():d}function Yde(t,e){const n=Nn(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Kde(t,e){const n=Nn(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function pz(t,e){const n=Nn(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Zde(t,e){const{start:n,end:r}=mz(e?.in,t);let s=+n>+r;const i=s?+n:+r,l=s?r:n;l.setHours(0,0,0,0),l.setMonth(0,1);let c=1;const d=[];for(;+l<=i;)d.push(vr(n,l)),l.setFullYear(l.getFullYear()+c);return s?d.reverse():d}function gz(t,e){const n=O0(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Nn(t,e?.in),i=s.getDay(),l=(i{let r;const s=ehe[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function td(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const nhe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},rhe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},she={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ihe={date:td({formats:nhe,defaultWidth:"full"}),time:td({formats:rhe,defaultWidth:"full"}),dateTime:td({formats:she,defaultWidth:"full"})},ahe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},lhe=(t,e,n,r)=>ahe[t];function oa(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const l=t.defaultFormattingWidth||t.defaultWidth,c=n?.width?String(n.width):l;s=t.formattingValues[c]||t.formattingValues[l]}else{const l=t.defaultWidth,c=n?.width?String(n.width):t.defaultWidth;s=t.values[c]||t.values[l]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const ohe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},che={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},uhe={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},dhe={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},hhe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},fhe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},mhe=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},phe={ordinalNumber:mhe,era:oa({values:ohe,defaultWidth:"wide"}),quarter:oa({values:che,defaultWidth:"wide",argumentCallback:t=>t-1}),month:oa({values:uhe,defaultWidth:"wide"}),day:oa({values:dhe,defaultWidth:"wide"}),dayPeriod:oa({values:hhe,defaultWidth:"wide",formattingValues:fhe,defaultFormattingWidth:"wide"})};function ca(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const l=i[0],c=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],d=Array.isArray(c)?xhe(c,p=>p.test(l)):ghe(c,p=>p.test(l));let h;h=t.valueCallback?t.valueCallback(d):d,h=n.valueCallback?n.valueCallback(h):h;const m=e.slice(l.length);return{value:h,rest:m}}}function ghe(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function xhe(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let l=t.valueCallback?t.valueCallback(i[0]):i[0];l=n.valueCallback?n.valueCallback(l):l;const c=e.slice(s.length);return{value:l,rest:c}}}const vhe=/^(\d+)(th|st|nd|rd)?/i,yhe=/\d+/i,bhe={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},whe={any:[/^b/i,/^(a|c)/i]},She={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},khe={any:[/1/i,/2/i,/3/i,/4/i]},Ohe={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},jhe={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Nhe={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Che={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},The={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Mhe={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Ahe={ordinalNumber:xz({matchPattern:vhe,parsePattern:yhe,valueCallback:t=>parseInt(t,10)}),era:ca({matchPatterns:bhe,defaultMatchWidth:"wide",parsePatterns:whe,defaultParseWidth:"any"}),quarter:ca({matchPatterns:She,defaultMatchWidth:"wide",parsePatterns:khe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:ca({matchPatterns:Ohe,defaultMatchWidth:"wide",parsePatterns:jhe,defaultParseWidth:"any"}),day:ca({matchPatterns:Nhe,defaultMatchWidth:"wide",parsePatterns:Che,defaultParseWidth:"any"}),dayPeriod:ca({matchPatterns:The,defaultMatchWidth:"any",parsePatterns:Mhe,defaultParseWidth:"any"})},G5={code:"en-US",formatDistance:the,formatLong:ihe,formatRelative:lhe,localize:phe,match:Ahe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ehe(t,e){const n=Nn(t,e?.in);return hz(n,pz(n))+1}function vz(t,e){const n=Nn(t,e?.in),r=+Ff(n)-+qde(n);return Math.round(r/oz)+1}function yz(t,e){const n=Nn(t,e?.in),r=n.getFullYear(),s=O0(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,l=vr(e?.in||t,0);l.setFullYear(r+1,0,i),l.setHours(0,0,0,0);const c=wo(l,e),d=vr(e?.in||t,0);d.setFullYear(r,0,i),d.setHours(0,0,0,0);const h=wo(d,e);return+n>=+c?r+1:+n>=+h?r:r-1}function _he(t,e){const n=O0(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=yz(t,e),i=vr(e?.in||t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),wo(i,e)}function bz(t,e){const n=Nn(t,e?.in),r=+wo(n,e)-+_he(n,e);return Math.round(r/oz)+1}function xn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const Kl={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return xn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):xn(n+1,2)},d(t,e){return xn(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return xn(t.getHours()%12||12,e.length)},H(t,e){return xn(t.getHours(),e.length)},m(t,e){return xn(t.getMinutes(),e.length)},s(t,e){return xn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return xn(s,e.length)}},Au={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},YN={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return Kl.y(t,e)},Y:function(t,e,n,r){const s=yz(t,r),i=s>0?s:1-s;if(e==="YY"){const l=i%100;return xn(l,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):xn(i,e.length)},R:function(t,e){const n=dz(t);return xn(n,e.length)},u:function(t,e){const n=t.getFullYear();return xn(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return xn(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return xn(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return Kl.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return xn(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const s=bz(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):xn(s,e.length)},I:function(t,e,n){const r=vz(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):xn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Kl.d(t,e)},D:function(t,e,n){const r=Ehe(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):xn(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return xn(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return xn(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return xn(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let s;switch(r===12?s=Au.noon:r===0?s=Au.midnight:s=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let s;switch(r>=17?s=Au.evening:r>=12?s=Au.afternoon:r>=4?s=Au.morning:s=Au.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Kl.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Kl.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):xn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):xn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Kl.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Kl.s(t,e)},S:function(t,e){return Kl.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return ZN(r);case"XXXX":case"XX":return nc(r);case"XXXXX":case"XXX":default:return nc(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return ZN(r);case"xxxx":case"xx":return nc(r);case"xxxxx":case"xxx":default:return nc(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+KN(r,":");case"OOOO":default:return"GMT"+nc(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+KN(r,":");case"zzzz":default:return"GMT"+nc(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return xn(r,e.length)},T:function(t,e,n){return xn(+t,e.length)}};function KN(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+e+xn(i,2)}function ZN(t,e){return t%60===0?(t>0?"-":"+")+xn(Math.abs(t)/60,2):nc(t,e)}function nc(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=xn(Math.trunc(r/60),2),i=xn(r%60,2);return n+s+e+i}const JN=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},wz=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Dhe=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return JN(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",JN(r,e)).replace("{{time}}",wz(s,e))},Rhe={p:wz,P:Dhe},zhe=/^D+$/,Phe=/^Y+$/,Lhe=["D","DD","YY","YYYY"];function Bhe(t){return zhe.test(t)}function Ihe(t){return Phe.test(t)}function qhe(t,e,n){const r=Fhe(t,e,n);if(console.warn(r),Lhe.includes(t))throw new RangeError(r)}function Fhe(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Qhe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,$he=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Hhe=/^'([^]*?)'?$/,Uhe=/''/g,Vhe=/[a-zA-Z]/;function dg(t,e,n){const r=O0(),s=n?.locale??r.locale??G5,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,l=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,c=Nn(t,n?.in);if(!Vde(c))throw new RangeError("Invalid time value");let d=e.match($he).map(m=>{const p=m[0];if(p==="p"||p==="P"){const x=Rhe[p];return x(m,s.formatLong)}return m}).join("").match(Qhe).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const p=m[0];if(p==="'")return{isToken:!1,value:Whe(m)};if(YN[p])return{isToken:!0,value:m};if(p.match(Vhe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+p+"`");return{isToken:!1,value:m}});s.localize.preprocessor&&(d=s.localize.preprocessor(c,d));const h={firstWeekContainsDate:i,weekStartsOn:l,locale:s};return d.map(m=>{if(!m.isToken)return m.value;const p=m.value;(!n?.useAdditionalWeekYearTokens&&Ihe(p)||!n?.useAdditionalDayOfYearTokens&&Bhe(p))&&qhe(p,e,String(t));const x=YN[p[0]];return x(c,p,s.localize,h)}).join("")}function Whe(t){const e=t.match(Hhe);return e?e[1].replace(Uhe,"'"):t}function Ghe(t,e){const n=Nn(t,e?.in),r=n.getFullYear(),s=n.getMonth(),i=vr(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function Xhe(t,e){return Nn(t,e?.in).getMonth()}function Yhe(t,e){return Nn(t,e?.in).getFullYear()}function Khe(t,e){return+Nn(t)>+Nn(e)}function Zhe(t,e){return+Nn(t)<+Nn(e)}function Jhe(t,e,n){const[r,s]=Lc(n?.in,t,e);return+wo(r,n)==+wo(s,n)}function efe(t,e,n){const[r,s]=Lc(n?.in,t,e);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function tfe(t,e,n){const[r,s]=Lc(n?.in,t,e);return r.getFullYear()===s.getFullYear()}function nfe(t,e,n){const r=Nn(t,n?.in),s=r.getFullYear(),i=r.getDate(),l=vr(t,0);l.setFullYear(s,e,15),l.setHours(0,0,0,0);const c=Ghe(l);return r.setMonth(e,Math.min(i,c)),r}function rfe(t,e,n){const r=Nn(t,n?.in);return isNaN(+r)?vr(t,NaN):(r.setFullYear(e),r)}const e9=5,sfe=4;function ife(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,s=e.addDays(t,-r+1),i=e.addDays(s,e9*7-1);return e.getMonth(t)===e.getMonth(i)?e9:sfe}function Sz(t,e){const n=e.startOfMonth(t),r=n.getDay();return r===1?n:r===0?e.addDays(n,-6):e.addDays(n,-1*(r-1))}function afe(t,e){const n=Sz(t,e),r=ife(t,e);return e.addDays(n,r*7-1)}class ii{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Zr.tz(this.options.timeZone):new this.Date,this.newDate=(r,s,i)=>this.overrides?.newDate?this.overrides.newDate(r,s,i):this.options.timeZone?new Zr(r,s,i,this.options.timeZone):new Date(r,s,i),this.addDays=(r,s)=>this.overrides?.addDays?this.overrides.addDays(r,s):cz(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):uz(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):Fde(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):Qde(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):hz(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):Wde(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Xde(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):Zde(r),i=new Set(s.map(c=>this.getYear(c)));if(i.size===s.length)return s;const l=[];return i.forEach(c=>{l.push(new Date(c,0,1))}),l},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):afe(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):Jde(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):Gde(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):gz(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):Kde(r),this.format=(r,s,i)=>{const l=this.overrides?.format?this.overrides.format(r,s,this.options):dg(r,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(l):l},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):vz(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):Xhe(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):Yhe(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):bz(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):Khe(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):Zhe(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):fz(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):Ude(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):efe(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):tfe(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):$de(r),this.min=r=>this.overrides?.min?this.overrides.min(r):Hde(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):nfe(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):rfe(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):Sz(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):Qf(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Ff(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):Yde(r),this.startOfWeek=(r,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):wo(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):pz(r),this.options={locale:G5,...e},this.overrides=n}getDigitMap(){const{numerals:e="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:e}),r={};for(let s=0;s<10;s++)r[s.toString()]=n.format(s);return r}replaceDigits(e){const n=this.getDigitMap();return e.replace(/\d/g,r=>n[r]||r)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&ii.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:s}=this.options,i=n?.code;if(i&&ii.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:s}).format(e)}catch{}const l=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,l)}}ii.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Ma=new ii;class kz{constructor(e,n,r=Ma){this.date=e,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(e,n)),this.dateLib=r}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class lfe{constructor(e,n){this.date=e,this.weeks=n}}class ofe{constructor(e,n){this.days=n,this.weekNumber=e}}function cfe(t){return Ue.createElement("button",{...t})}function ufe(t){return Ue.createElement("span",{...t})}function dfe(t){const{size:e=24,orientation:n="left",className:r}=t;return Ue.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&Ue.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&Ue.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&Ue.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&Ue.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function hfe(t){const{day:e,modifiers:n,...r}=t;return Ue.createElement("td",{...r})}function ffe(t){const{day:e,modifiers:n,...r}=t,s=Ue.useRef(null);return Ue.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),Ue.createElement("button",{ref:s,...r})}var et;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})(et||(et={}));var Yn;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(Yn||(Yn={}));var Bi;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(Bi||(Bi={}));var ei;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(ei||(ei={}));function mfe(t){const{options:e,className:n,components:r,classNames:s,...i}=t,l=[s[et.Dropdown],n].join(" "),c=e?.find(({value:d})=>d===i.value);return Ue.createElement("span",{"data-disabled":i.disabled,className:s[et.DropdownRoot]},Ue.createElement(r.Select,{className:l,...i},e?.map(({value:d,label:h,disabled:m})=>Ue.createElement(r.Option,{key:d,value:d,disabled:m},h))),Ue.createElement("span",{className:s[et.CaptionLabel],"aria-hidden":!0},c?.label,Ue.createElement(r.Chevron,{orientation:"down",size:18,className:s[et.Chevron]})))}function pfe(t){return Ue.createElement("div",{...t})}function gfe(t){return Ue.createElement("div",{...t})}function xfe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return Ue.createElement("div",{...r},t.children)}function vfe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return Ue.createElement("div",{...r})}function yfe(t){return Ue.createElement("table",{...t})}function bfe(t){return Ue.createElement("div",{...t})}const Oz=S.createContext(void 0);function j0(){const t=S.useContext(Oz);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function wfe(t){const{components:e}=j0();return Ue.createElement(e.Dropdown,{...t})}function Sfe(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:s,...i}=t,{components:l,classNames:c,labels:{labelPrevious:d,labelNext:h}}=j0(),m=S.useCallback(x=>{s&&n?.(x)},[s,n]),p=S.useCallback(x=>{r&&e?.(x)},[r,e]);return Ue.createElement("nav",{...i},Ue.createElement(l.PreviousMonthButton,{type:"button",className:c[et.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":d(r),onClick:p},Ue.createElement(l.Chevron,{disabled:r?void 0:!0,className:c[et.Chevron],orientation:"left"})),Ue.createElement(l.NextMonthButton,{type:"button",className:c[et.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":h(s),onClick:m},Ue.createElement(l.Chevron,{disabled:s?void 0:!0,orientation:"right",className:c[et.Chevron]})))}function kfe(t){const{components:e}=j0();return Ue.createElement(e.Button,{...t})}function Ofe(t){return Ue.createElement("option",{...t})}function jfe(t){const{components:e}=j0();return Ue.createElement(e.Button,{...t})}function Nfe(t){const{rootRef:e,...n}=t;return Ue.createElement("div",{...n,ref:e})}function Cfe(t){return Ue.createElement("select",{...t})}function Tfe(t){const{week:e,...n}=t;return Ue.createElement("tr",{...n})}function Mfe(t){return Ue.createElement("th",{...t})}function Afe(t){return Ue.createElement("thead",{"aria-hidden":!0},Ue.createElement("tr",{...t}))}function Efe(t){const{week:e,...n}=t;return Ue.createElement("th",{...n})}function _fe(t){return Ue.createElement("th",{...t})}function Dfe(t){return Ue.createElement("tbody",{...t})}function Rfe(t){const{components:e}=j0();return Ue.createElement(e.Dropdown,{...t})}const zfe=Object.freeze(Object.defineProperty({__proto__:null,Button:cfe,CaptionLabel:ufe,Chevron:dfe,Day:hfe,DayButton:ffe,Dropdown:mfe,DropdownNav:pfe,Footer:gfe,Month:xfe,MonthCaption:vfe,MonthGrid:yfe,Months:bfe,MonthsDropdown:wfe,Nav:Sfe,NextMonthButton:kfe,Option:Ofe,PreviousMonthButton:jfe,Root:Nfe,Select:Cfe,Week:Tfe,WeekNumber:Efe,WeekNumberHeader:_fe,Weekday:Mfe,Weekdays:Afe,Weeks:Dfe,YearsDropdown:Rfe},Symbol.toStringTag,{value:"Module"}));function al(t,e,n=!1,r=Ma){let{from:s,to:i}=t;const{differenceInCalendarDays:l,isSameDay:c}=r;return s&&i?(l(i,s)<0&&([s,i]=[i,s]),l(e,s)>=(n?1:0)&&l(i,e)>=(n?1:0)):!n&&i?c(i,e):!n&&s?c(s,e):!1}function jz(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function X5(t){return!!(t&&typeof t=="object"&&"from"in t)}function Nz(t){return!!(t&&typeof t=="object"&&"after"in t)}function Cz(t){return!!(t&&typeof t=="object"&&"before"in t)}function Tz(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function Mz(t,e){return Array.isArray(t)&&t.every(e.isDate)}function ll(t,e,n=Ma){const r=Array.isArray(e)?e:[e],{isSameDay:s,differenceInCalendarDays:i,isAfter:l}=n;return r.some(c=>{if(typeof c=="boolean")return c;if(n.isDate(c))return s(t,c);if(Mz(c,n))return c.includes(t);if(X5(c))return al(c,t,!1,n);if(Tz(c))return Array.isArray(c.dayOfWeek)?c.dayOfWeek.includes(t.getDay()):c.dayOfWeek===t.getDay();if(jz(c)){const d=i(c.before,t),h=i(c.after,t),m=d>0,p=h<0;return l(c.before,c.after)?p&&m:m||p}return Nz(c)?i(t,c.after)>0:Cz(c)?i(c.before,t)>0:typeof c=="function"?c(t):!1})}function Pfe(t,e,n,r,s){const{disabled:i,hidden:l,modifiers:c,showOutsideDays:d,broadcastCalendar:h,today:m}=e,{isSameDay:p,isSameMonth:x,startOfMonth:v,isBefore:b,endOfMonth:k,isAfter:O}=s,j=n&&v(n),T=r&&k(r),M={[Yn.focused]:[],[Yn.outside]:[],[Yn.disabled]:[],[Yn.hidden]:[],[Yn.today]:[]},_={};for(const D of t){const{date:E,displayMonth:z}=D,Q=!!(z&&!x(E,z)),F=!!(j&&b(E,j)),B=!!(T&&O(E,T)),U=!!(i&&ll(E,i,s)),V=!!(l&&ll(E,l,s))||F||B||!h&&!d&&Q||h&&d===!1&&Q,ce=p(E,m??s.today());Q&&M.outside.push(D),U&&M.disabled.push(D),V&&M.hidden.push(D),ce&&M.today.push(D),c&&Object.keys(c).forEach(W=>{const J=c?.[W];J&&ll(E,J,s)&&(_[W]?_[W].push(D):_[W]=[D])})}return D=>{const E={[Yn.focused]:!1,[Yn.disabled]:!1,[Yn.hidden]:!1,[Yn.outside]:!1,[Yn.today]:!1},z={};for(const Q in M){const F=M[Q];E[Q]=F.some(B=>B===D)}for(const Q in _)z[Q]=_[Q].some(F=>F===D);return{...E,...z}}}function Lfe(t,e,n={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):e[Yn[i]]?s.push(e[Yn[i]]):e[Bi[i]]&&s.push(e[Bi[i]]),s),[e[et.Day]])}function Bfe(t){return{...zfe,...t}}function Ife(t){const e={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([n,r])=>{n.startsWith("data-")&&(e[n]=r)}),e}function Y5(){const t={};for(const e in et)t[et[e]]=`rdp-${et[e]}`;for(const e in Yn)t[Yn[e]]=`rdp-${Yn[e]}`;for(const e in Bi)t[Bi[e]]=`rdp-${Bi[e]}`;for(const e in ei)t[ei[e]]=`rdp-${ei[e]}`;return t}function Az(t,e,n){return(n??new ii(e)).formatMonthYear(t)}const qfe=Az;function Ffe(t,e,n){return(n??new ii(e)).format(t,"d")}function Qfe(t,e=Ma){return e.format(t,"LLLL")}function $fe(t,e,n){return(n??new ii(e)).format(t,"cccccc")}function Hfe(t,e=Ma){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function Ufe(){return""}function Ez(t,e=Ma){return e.format(t,"yyyy")}const Vfe=Ez,Wfe=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:Az,formatDay:Ffe,formatMonthCaption:qfe,formatMonthDropdown:Qfe,formatWeekNumber:Hfe,formatWeekNumberHeader:Ufe,formatWeekdayName:$fe,formatYearCaption:Vfe,formatYearDropdown:Ez},Symbol.toStringTag,{value:"Module"}));function Gfe(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...Wfe,...t}}function Xfe(t,e,n,r,s){const{startOfMonth:i,startOfYear:l,endOfYear:c,eachMonthOfInterval:d,getMonth:h}=s;return d({start:l(t),end:c(t)}).map(x=>{const v=r.formatMonthDropdown(x,s),b=h(x),k=e&&xi(n)||!1;return{value:b,label:v,disabled:k}})}function Yfe(t,e={},n={}){let r={...e?.[et.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function Kfe(t,e,n){const r=t.today(),s=e?t.startOfISOWeek(r):t.startOfWeek(r),i=[];for(let l=0;l<7;l++){const c=t.addDays(s,l);i.push(c)}return i}function Zfe(t,e,n,r,s=!1){if(!t||!e)return;const{startOfYear:i,endOfYear:l,eachYearOfInterval:c,getYear:d}=r,h=i(t),m=l(e),p=c({start:h,end:m});return s&&p.reverse(),p.map(x=>{const v=n.formatYearDropdown(x,r);return{value:d(x),label:v,disabled:!1}})}function _z(t,e,n,r){let s=(r??new ii(n)).format(t,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s}const Jfe=_z;function Dz(t,e,n){return(n??new ii(e)).formatMonthYear(t)}const e0e=Dz;function t0e(t,e,n,r){let s=(r??new ii(n)).format(t,"PPPP");return e?.today&&(s=`Today, ${s}`),s}function n0e(t){return"Choose the Month"}function r0e(){return""}function s0e(t){return"Go to the Next Month"}function i0e(t){return"Go to the Previous Month"}function a0e(t,e,n){return(n??new ii(e)).format(t,"cccc")}function l0e(t,e){return`Week ${t}`}function o0e(t){return"Week Number"}function c0e(t){return"Choose the Year"}const u0e=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:e0e,labelDay:Jfe,labelDayButton:_z,labelGrid:Dz,labelGridcell:t0e,labelMonthDropdown:n0e,labelNav:r0e,labelNext:s0e,labelPrevious:i0e,labelWeekNumber:l0e,labelWeekNumberHeader:o0e,labelWeekday:a0e,labelYearDropdown:c0e},Symbol.toStringTag,{value:"Module"})),N0=t=>t instanceof HTMLElement?t:null,Ub=t=>[...t.querySelectorAll("[data-animated-month]")??[]],d0e=t=>N0(t.querySelector("[data-animated-month]")),Vb=t=>N0(t.querySelector("[data-animated-caption]")),Wb=t=>N0(t.querySelector("[data-animated-weeks]")),h0e=t=>N0(t.querySelector("[data-animated-nav]")),f0e=t=>N0(t.querySelector("[data-animated-weekdays]"));function m0e(t,e,{classNames:n,months:r,focused:s,dateLib:i}){const l=S.useRef(null),c=S.useRef(r),d=S.useRef(!1);S.useLayoutEffect(()=>{const h=c.current;if(c.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||h.length===0||r.length!==h.length)return;const m=i.isSameMonth(r[0].date,h[0].date),p=i.isAfter(r[0].date,h[0].date),x=p?n[ei.caption_after_enter]:n[ei.caption_before_enter],v=p?n[ei.weeks_after_enter]:n[ei.weeks_before_enter],b=l.current,k=t.current.cloneNode(!0);if(k instanceof HTMLElement?(Ub(k).forEach(M=>{if(!(M instanceof HTMLElement))return;const _=d0e(M);_&&M.contains(_)&&M.removeChild(_);const D=Vb(M);D&&D.classList.remove(x);const E=Wb(M);E&&E.classList.remove(v)}),l.current=k):l.current=null,d.current||m||s)return;const O=b instanceof HTMLElement?Ub(b):[],j=Ub(t.current);if(j?.every(T=>T instanceof HTMLElement)&&O&&O.every(T=>T instanceof HTMLElement)){d.current=!0,t.current.style.isolation="isolate";const T=h0e(t.current);T&&(T.style.zIndex="1"),j.forEach((M,_)=>{const D=O[_];if(!D)return;M.style.position="relative",M.style.overflow="hidden";const E=Vb(M);E&&E.classList.add(x);const z=Wb(M);z&&z.classList.add(v);const Q=()=>{d.current=!1,t.current&&(t.current.style.isolation=""),T&&(T.style.zIndex=""),E&&E.classList.remove(x),z&&z.classList.remove(v),M.style.position="",M.style.overflow="",M.contains(D)&&M.removeChild(D)};D.style.pointerEvents="none",D.style.position="absolute",D.style.overflow="hidden",D.setAttribute("aria-hidden","true");const F=f0e(D);F&&(F.style.opacity="0");const B=Vb(D);B&&(B.classList.add(p?n[ei.caption_before_exit]:n[ei.caption_after_exit]),B.addEventListener("animationend",Q));const U=Wb(D);U&&U.classList.add(p?n[ei.weeks_before_exit]:n[ei.weeks_after_exit]),M.insertBefore(D,M.firstChild)})}})}function p0e(t,e,n,r){const s=t[0],i=t[t.length-1],{ISOWeek:l,fixedWeeks:c,broadcastCalendar:d}=n??{},{addDays:h,differenceInCalendarDays:m,differenceInCalendarMonths:p,endOfBroadcastWeek:x,endOfISOWeek:v,endOfMonth:b,endOfWeek:k,isAfter:O,startOfBroadcastWeek:j,startOfISOWeek:T,startOfWeek:M}=r,_=d?j(s,r):l?T(s):M(s),D=d?x(i):l?v(b(i)):k(b(i)),E=m(D,_),z=p(i,s)+1,Q=[];for(let U=0;U<=E;U++){const V=h(_,U);if(e&&O(V,e))break;Q.push(V)}const B=(d?35:42)*z;if(c&&Q.length{const s=r.weeks.reduce((i,l)=>i.concat(l.days.slice()),e.slice());return n.concat(s.slice())},e.slice())}function x0e(t,e,n,r){const{numberOfMonths:s=1}=n,i=[];for(let l=0;le)break;i.push(c)}return i}function t9(t,e,n,r){const{month:s,defaultMonth:i,today:l=r.today(),numberOfMonths:c=1}=t;let d=s||i||l;const{differenceInCalendarMonths:h,addMonths:m,startOfMonth:p}=r;if(n&&h(n,d){const j=n.broadcastCalendar?p(O,r):n.ISOWeek?x(O):v(O),T=n.broadcastCalendar?i(O):n.ISOWeek?l(c(O)):d(c(O)),M=e.filter(z=>z>=j&&z<=T),_=n.broadcastCalendar?35:42;if(n.fixedWeeks&&M.length<_){const z=e.filter(Q=>{const F=_-M.length;return Q>T&&Q<=s(T,F)});M.push(...z)}const D=M.reduce((z,Q)=>{const F=n.ISOWeek?h(Q):m(Q),B=z.find(V=>V.weekNumber===F),U=new kz(Q,O,r);return B?B.days.push(U):z.push(new ofe(F,[U])),z},[]),E=new lfe(O,D);return k.push(E),k},[]);return n.reverseMonths?b.reverse():b}function y0e(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:s,startOfDay:i,startOfMonth:l,endOfMonth:c,addYears:d,endOfYear:h,newDate:m,today:p}=e,{fromYear:x,toYear:v,fromMonth:b,toMonth:k}=t;!n&&b&&(n=b),!n&&x&&(n=e.newDate(x,0,1)),!r&&k&&(r=k),!r&&v&&(r=m(v,11,31));const O=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=l(n):x?n=m(x,0,1):!n&&O&&(n=s(d(t.today??p(),-100))),r?r=c(r):v?r=m(v,11,31):!r&&O&&(r=h(t.today??p())),[n&&i(n),r&&i(r)]}function b0e(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:l,addMonths:c,differenceInCalendarMonths:d}=r,h=s?i:1,m=l(t);if(!e)return c(m,h);if(!(d(e,t)n.concat(r.weeks.slice()),e.slice())}function Yx(t,e){const[n,r]=S.useState(t);return[e===void 0?n:e,r]}function k0e(t,e){const[n,r]=y0e(t,e),{startOfMonth:s,endOfMonth:i}=e,l=t9(t,n,r,e),[c,d]=Yx(l,t.month?l:void 0);S.useEffect(()=>{const E=t9(t,n,r,e);d(E)},[t.timeZone]);const h=x0e(c,r,t,e),m=p0e(h,t.endMonth?i(t.endMonth):void 0,t,e),p=v0e(h,m,t,e),x=S0e(p),v=g0e(p),b=w0e(c,n,t,e),k=b0e(c,r,t,e),{disableNavigation:O,onMonthChange:j}=t,T=E=>x.some(z=>z.days.some(Q=>Q.isEqualTo(E))),M=E=>{if(O)return;let z=s(E);n&&zs(r)&&(z=s(r)),d(z),j?.(z)};return{months:p,weeks:x,days:v,navStart:n,navEnd:r,previousMonth:b,nextMonth:k,goToMonth:M,goToDay:E=>{T(E)||M(E.date)}}}var sa;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(sa||(sa={}));function n9(t){return!t[Yn.disabled]&&!t[Yn.hidden]&&!t[Yn.outside]}function O0e(t,e,n,r){let s,i=-1;for(const l of t){const c=e(l);n9(c)&&(c[Yn.focused]&&in9(e(l)))),s}function j0e(t,e,n,r,s,i,l){const{ISOWeek:c,broadcastCalendar:d}=i,{addDays:h,addMonths:m,addWeeks:p,addYears:x,endOfBroadcastWeek:v,endOfISOWeek:b,endOfWeek:k,max:O,min:j,startOfBroadcastWeek:T,startOfISOWeek:M,startOfWeek:_}=l;let E={day:h,week:p,month:m,year:x,startOfWeek:z=>d?T(z,l):c?M(z):_(z),endOfWeek:z=>d?v(z):c?b(z):k(z)}[t](n,e==="after"?1:-1);return e==="before"&&r?E=O([r,E]):e==="after"&&s&&(E=j([s,E])),E}function Rz(t,e,n,r,s,i,l,c=0){if(c>365)return;const d=j0e(t,e,n.date,r,s,i,l),h=!!(i.disabled&&ll(d,i.disabled,l)),m=!!(i.hidden&&ll(d,i.hidden,l)),p=d,x=new kz(d,p,l);return!h&&!m?x:Rz(t,e,x,r,s,i,l,c+1)}function N0e(t,e,n,r,s){const{autoFocus:i}=t,[l,c]=S.useState(),d=O0e(e.days,n,r||(()=>!1),l),[h,m]=S.useState(i?d:void 0);return{isFocusTarget:k=>!!d?.isEqualTo(k),setFocused:m,focused:h,blur:()=>{c(h),m(void 0)},moveFocus:(k,O)=>{if(!h)return;const j=Rz(k,O,h,e.navStart,e.navEnd,t,s);j&&(t.disableNavigation&&!e.days.some(M=>M.isEqualTo(j))||(e.goToDay(j),m(j)))}}}function C0e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,l]=Yx(n,s?n:void 0),c=s?n:i,{isSameDay:d}=e,h=v=>c?.some(b=>d(b,v))??!1,{min:m,max:p}=t;return{selected:c,select:(v,b,k)=>{let O=[...c??[]];if(h(v)){if(c?.length===m||r&&c?.length===1)return;O=c?.filter(j=>!d(j,v))}else c?.length===p?O=[v]:O=[...O,v];return s||l(O),s?.(O,v,b,k),O},isSelected:h}}function T0e(t,e,n=0,r=0,s=!1,i=Ma){const{from:l,to:c}=e||{},{isSameDay:d,isAfter:h,isBefore:m}=i;let p;if(!l&&!c)p={from:t,to:n>0?void 0:t};else if(l&&!c)d(l,t)?n===0?p={from:l,to:t}:s?p={from:l,to:void 0}:p=void 0:m(t,l)?p={from:t,to:l}:p={from:l,to:t};else if(l&&c)if(d(l,t)&&d(c,t))s?p={from:l,to:c}:p=void 0;else if(d(l,t))p={from:l,to:n>0?void 0:t};else if(d(c,t))p={from:t,to:n>0?void 0:t};else if(m(t,l))p={from:t,to:c};else if(h(t,l))p={from:l,to:t};else if(h(t,c))p={from:l,to:t};else throw new Error("Invalid range");if(p?.from&&p?.to){const x=i.differenceInCalendarDays(p.to,p.from);r>0&&x>r?p={from:t,to:void 0}:n>1&&xtypeof c!="function").some(c=>typeof c=="boolean"?c:n.isDate(c)?al(t,c,!1,n):Mz(c,n)?c.some(d=>al(t,d,!1,n)):X5(c)?c.from&&c.to?r9(t,{from:c.from,to:c.to},n):!1:Tz(c)?M0e(t,c.dayOfWeek,n):jz(c)?n.isAfter(c.before,c.after)?r9(t,{from:n.addDays(c.after,1),to:n.addDays(c.before,-1)},n):ll(t.from,c,n)||ll(t.to,c,n):Nz(c)||Cz(c)?ll(t.from,c,n)||ll(t.to,c,n):!1))return!0;const l=r.filter(c=>typeof c=="function");if(l.length){let c=t.from;const d=n.differenceInCalendarDays(t.to,t.from);for(let h=0;h<=d;h++){if(l.some(m=>m(c)))return!0;c=n.addDays(c,1)}}return!1}function E0e(t,e){const{disabled:n,excludeDisabled:r,selected:s,required:i,onSelect:l}=t,[c,d]=Yx(s,l?s:void 0),h=l?s:c;return{selected:h,select:(x,v,b)=>{const{min:k,max:O}=t,j=x?T0e(x,h,k,O,i,e):void 0;return r&&n&&j?.from&&j.to&&A0e({from:j.from,to:j.to},n,e)&&(j.from=x,j.to=void 0),l||d(j),l?.(j,x,v,b),j},isSelected:x=>h&&al(h,x,!1,e)}}function _0e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,l]=Yx(n,s?n:void 0),c=s?n:i,{isSameDay:d}=e;return{selected:c,select:(p,x,v)=>{let b=p;return!r&&c&&c&&d(p,c)&&(b=void 0),s||l(b),s?.(b,p,x,v),b},isSelected:p=>c?d(c,p):!1}}function D0e(t,e){const n=_0e(t,e),r=C0e(t,e),s=E0e(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function R0e(t){let e=t;e.timeZone&&(e={...t},e.today&&(e.today=new Zr(e.today,e.timeZone)),e.month&&(e.month=new Zr(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new Zr(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new Zr(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new Zr(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new Zr(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(dt=>new Zr(dt,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new Zr(e.selected.from,e.timeZone):void 0,to:e.selected.to?new Zr(e.selected.to,e.timeZone):void 0}));const{components:n,formatters:r,labels:s,dateLib:i,locale:l,classNames:c}=S.useMemo(()=>{const dt={...G5,...e.locale};return{dateLib:new ii({locale:dt,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib),components:Bfe(e.components),formatters:Gfe(e.formatters),labels:{...u0e,...e.labels},locale:dt,classNames:{...Y5(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]),{captionLayout:d,mode:h,navLayout:m,numberOfMonths:p=1,onDayBlur:x,onDayClick:v,onDayFocus:b,onDayKeyDown:k,onDayMouseEnter:O,onDayMouseLeave:j,onNextClick:T,onPrevClick:M,showWeekNumber:_,styles:D}=e,{formatCaption:E,formatDay:z,formatMonthDropdown:Q,formatWeekNumber:F,formatWeekNumberHeader:B,formatWeekdayName:U,formatYearDropdown:V}=r,ce=k0e(e,i),{days:W,months:J,navStart:H,navEnd:ae,previousMonth:ne,nextMonth:ue,goToMonth:R}=ce,me=Pfe(W,e,H,ae,i),{isSelected:Y,select:P,selected:K}=D0e(e,i)??{},{blur:$,focused:fe,isFocusTarget:ve,moveFocus:Re,setFocused:de}=N0e(e,ce,me,Y??(()=>!1),i),{labelDayButton:We,labelGridcell:ct,labelGrid:Oe,labelMonthDropdown:nt,labelNav:ut,labelPrevious:Ct,labelNext:Bn,labelWeekday:Tn,labelWeekNumber:Jn,labelWeekNumberHeader:nn,labelYearDropdown:_t}=s,Yr=S.useMemo(()=>Kfe(i,e.ISOWeek),[i,e.ISOWeek]),In=h!==void 0||v!==void 0,or=S.useCallback(()=>{ne&&(R(ne),M?.(ne))},[ne,R,M]),yn=S.useCallback(()=>{ue&&(R(ue),T?.(ue))},[R,ue,T]),ft=S.useCallback((dt,zn)=>mt=>{mt.preventDefault(),mt.stopPropagation(),de(dt),P?.(dt.date,zn,mt),v?.(dt.date,zn,mt)},[P,v,de]),ee=S.useCallback((dt,zn)=>mt=>{de(dt),b?.(dt.date,zn,mt)},[b,de]),Se=S.useCallback((dt,zn)=>mt=>{$(),x?.(dt.date,zn,mt)},[$,x]),Le=S.useCallback((dt,zn)=>mt=>{const rn={ArrowLeft:[mt.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[mt.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[mt.shiftKey?"year":"week","after"],ArrowUp:[mt.shiftKey?"year":"week","before"],PageUp:[mt.shiftKey?"year":"month","before"],PageDown:[mt.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(rn[mt.key]){mt.preventDefault(),mt.stopPropagation();const[Ar,Mt]=rn[mt.key];Re(Ar,Mt)}k?.(dt.date,zn,mt)},[Re,k,e.dir]),rt=S.useCallback((dt,zn)=>mt=>{O?.(dt.date,zn,mt)},[O]),Tt=S.useCallback((dt,zn)=>mt=>{j?.(dt.date,zn,mt)},[j]),cr=S.useCallback(dt=>zn=>{const mt=Number(zn.target.value),rn=i.setMonth(i.startOfMonth(dt),mt);R(rn)},[i,R]),Kr=S.useCallback(dt=>zn=>{const mt=Number(zn.target.value),rn=i.setYear(i.startOfMonth(dt),mt);R(rn)},[i,R]),{className:re,style:Me}=S.useMemo(()=>({className:[c[et.Root],e.className].filter(Boolean).join(" "),style:{...D?.[et.Root],...e.style}}),[c,e.className,e.style,D]),pt=Ife(e),vt=S.useRef(null);m0e(vt,!!e.animate,{classNames:c,months:J,focused:fe,dateLib:i});const vs={dayPickerProps:e,selected:K,select:P,isSelected:Y,months:J,nextMonth:ue,previousMonth:ne,goToMonth:R,getModifiers:me,components:n,classNames:c,styles:D,labels:s,formatters:r};return Ue.createElement(Oz.Provider,{value:vs},Ue.createElement(n.Root,{rootRef:e.animate?vt:void 0,className:re,style:Me,dir:e.dir,id:e.id,lang:e.lang,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...pt},Ue.createElement(n.Months,{className:c[et.Months],style:D?.[et.Months]},!e.hideNavigation&&!m&&Ue.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[et.Nav],style:D?.[et.Nav],"aria-label":ut(),onPreviousClick:or,onNextClick:yn,previousMonth:ne,nextMonth:ue}),J.map((dt,zn)=>Ue.createElement(n.Month,{"data-animated-month":e.animate?"true":void 0,className:c[et.Month],style:D?.[et.Month],key:zn,displayIndex:zn,calendarMonth:dt},m==="around"&&!e.hideNavigation&&zn===0&&Ue.createElement(n.PreviousMonthButton,{type:"button",className:c[et.PreviousMonthButton],tabIndex:ne?void 0:-1,"aria-disabled":ne?void 0:!0,"aria-label":Ct(ne),onClick:or,"data-animated-button":e.animate?"true":void 0},Ue.createElement(n.Chevron,{disabled:ne?void 0:!0,className:c[et.Chevron],orientation:e.dir==="rtl"?"right":"left"})),Ue.createElement(n.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:c[et.MonthCaption],style:D?.[et.MonthCaption],calendarMonth:dt,displayIndex:zn},d?.startsWith("dropdown")?Ue.createElement(n.DropdownNav,{className:c[et.Dropdowns],style:D?.[et.Dropdowns]},(()=>{const mt=d==="dropdown"||d==="dropdown-months"?Ue.createElement(n.MonthsDropdown,{key:"month",className:c[et.MonthsDropdown],"aria-label":nt(),classNames:c,components:n,disabled:!!e.disableNavigation,onChange:cr(dt.date),options:Xfe(dt.date,H,ae,r,i),style:D?.[et.Dropdown],value:i.getMonth(dt.date)}):Ue.createElement("span",{key:"month"},Q(dt.date,i)),rn=d==="dropdown"||d==="dropdown-years"?Ue.createElement(n.YearsDropdown,{key:"year",className:c[et.YearsDropdown],"aria-label":_t(i.options),classNames:c,components:n,disabled:!!e.disableNavigation,onChange:Kr(dt.date),options:Zfe(H,ae,r,i,!!e.reverseYears),style:D?.[et.Dropdown],value:i.getYear(dt.date)}):Ue.createElement("span",{key:"year"},V(dt.date,i));return i.getMonthYearOrder()==="year-first"?[rn,mt]:[mt,rn]})(),Ue.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},E(dt.date,i.options,i))):Ue.createElement(n.CaptionLabel,{className:c[et.CaptionLabel],role:"status","aria-live":"polite"},E(dt.date,i.options,i))),m==="around"&&!e.hideNavigation&&zn===p-1&&Ue.createElement(n.NextMonthButton,{type:"button",className:c[et.NextMonthButton],tabIndex:ue?void 0:-1,"aria-disabled":ue?void 0:!0,"aria-label":Bn(ue),onClick:yn,"data-animated-button":e.animate?"true":void 0},Ue.createElement(n.Chevron,{disabled:ue?void 0:!0,className:c[et.Chevron],orientation:e.dir==="rtl"?"left":"right"})),zn===p-1&&m==="after"&&!e.hideNavigation&&Ue.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[et.Nav],style:D?.[et.Nav],"aria-label":ut(),onPreviousClick:or,onNextClick:yn,previousMonth:ne,nextMonth:ue}),Ue.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":h==="multiple"||h==="range","aria-label":Oe(dt.date,i.options,i)||void 0,className:c[et.MonthGrid],style:D?.[et.MonthGrid]},!e.hideWeekdays&&Ue.createElement(n.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:c[et.Weekdays],style:D?.[et.Weekdays]},_&&Ue.createElement(n.WeekNumberHeader,{"aria-label":nn(i.options),className:c[et.WeekNumberHeader],style:D?.[et.WeekNumberHeader],scope:"col"},B()),Yr.map(mt=>Ue.createElement(n.Weekday,{"aria-label":Tn(mt,i.options,i),className:c[et.Weekday],key:String(mt),style:D?.[et.Weekday],scope:"col"},U(mt,i.options,i)))),Ue.createElement(n.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:c[et.Weeks],style:D?.[et.Weeks]},dt.weeks.map(mt=>Ue.createElement(n.Week,{className:c[et.Week],key:mt.weekNumber,style:D?.[et.Week],week:mt},_&&Ue.createElement(n.WeekNumber,{week:mt,style:D?.[et.WeekNumber],"aria-label":Jn(mt.weekNumber,{locale:l}),className:c[et.WeekNumber],scope:"row",role:"rowheader"},F(mt.weekNumber,i)),mt.days.map(rn=>{const{date:Ar}=rn,Mt=me(rn);if(Mt[Yn.focused]=!Mt.hidden&&!!fe?.isEqualTo(rn),Mt[Bi.selected]=Y?.(Ar)||Mt.selected,X5(K)){const{from:qc,to:_o}=K;Mt[Bi.range_start]=!!(qc&&_o&&i.isSameDay(Ar,qc)),Mt[Bi.range_end]=!!(qc&&_o&&i.isSameDay(Ar,_o)),Mt[Bi.range_middle]=al(K,Ar,!0,i)}const Ic=Yfe(Mt,D,e.modifiersStyles),Eo=Lfe(Mt,c,e.modifiersClassNames),t1=!In&&!Mt.hidden?ct(Ar,Mt,i.options,i):void 0;return Ue.createElement(n.Day,{key:`${i.format(Ar,"yyyy-MM-dd")}_${i.format(rn.displayMonth,"yyyy-MM")}`,day:rn,modifiers:Mt,className:Eo.join(" "),style:Ic,role:"gridcell","aria-selected":Mt.selected||void 0,"aria-label":t1,"data-day":i.format(Ar,"yyyy-MM-dd"),"data-month":rn.outside?i.format(Ar,"yyyy-MM"):void 0,"data-selected":Mt.selected||void 0,"data-disabled":Mt.disabled||void 0,"data-hidden":Mt.hidden||void 0,"data-outside":rn.outside||void 0,"data-focused":Mt.focused||void 0,"data-today":Mt.today||void 0},!Mt.hidden&&In?Ue.createElement(n.DayButton,{className:c[et.DayButton],style:D?.[et.DayButton],type:"button",day:rn,modifiers:Mt,disabled:Mt.disabled||void 0,tabIndex:ve(rn)?0:-1,"aria-label":We(Ar,Mt,i.options,i),onClick:ft(rn,Mt),onBlur:Se(rn,Mt),onFocus:ee(rn,Mt),onKeyDown:Le(rn,Mt),onMouseEnter:rt(rn,Mt),onMouseLeave:Tt(rn,Mt)},z(Ar,i.options,i)):!Mt.hidden&&z(rn.date,i.options,i))})))))))),e.footer&&Ue.createElement(n.Footer,{className:c[et.Footer],style:D?.[et.Footer],role:"status","aria-live":"polite"},e.footer)))}function s9({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:l,...c}){const d=Y5();return a.jsx(R0e,{showOutsideDays:n,className:ye("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,t),captionLayout:r,formatters:{formatMonthDropdown:h=>h.toLocaleString("default",{month:"short"}),...i},classNames:{root:ye("w-fit",d.root),months:ye("relative flex flex-col gap-4 md:flex-row",d.months),month:ye("flex w-full flex-col gap-4",d.month),nav:ye("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",d.nav),button_previous:ye(ff({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_previous),button_next:ye(ff({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_next),month_caption:ye("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",d.month_caption),dropdowns:ye("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",d.dropdowns),dropdown_root:ye("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",d.dropdown_root),dropdown:ye("bg-popover absolute inset-0 opacity-0",d.dropdown),caption_label:ye("select-none font-medium",r==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",d.caption_label),table:"w-full border-collapse",weekdays:ye("flex",d.weekdays),weekday:ye("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",d.weekday),week:ye("mt-2 flex w-full",d.week),week_number_header:ye("w-[--cell-size] select-none",d.week_number_header),week_number:ye("text-muted-foreground select-none text-[0.8rem]",d.week_number),day:ye("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",d.day),range_start:ye("bg-accent rounded-l-md",d.range_start),range_middle:ye("rounded-none",d.range_middle),range_end:ye("bg-accent rounded-r-md",d.range_end),today:ye("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",d.today),outside:ye("text-muted-foreground aria-selected:text-muted-foreground",d.outside),disabled:ye("text-muted-foreground opacity-50",d.disabled),hidden:ye("invisible",d.hidden),...e},components:{Root:({className:h,rootRef:m,...p})=>a.jsx("div",{"data-slot":"calendar",ref:m,className:ye(h),...p}),Chevron:({className:h,orientation:m,...p})=>m==="left"?a.jsx(Tc,{className:ye("size-4",h),...p}):m==="right"?a.jsx(Mc,{className:ye("size-4",h),...p}):a.jsx(df,{className:ye("size-4",h),...p}),DayButton:z0e,WeekNumber:({children:h,...m})=>a.jsx("td",{...m,children:a.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:h})}),...l},...c})}function z0e({className:t,day:e,modifiers:n,...r}){const s=Y5(),i=S.useRef(null);return S.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),a.jsx(ie,{ref:i,variant:"ghost",size:"icon","data-day":e.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:ye("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",s.day,t),...r})}class P0e{ws=null;reconnectTimeout=null;reconnectAttempts=0;maxReconnectAttempts=10;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];maxCacheSize=1e3;getWebSocketUrl(){{const e=window.location.protocol==="https:"?"wss:":"ws:",n=window.location.host;return`${e}//${n}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const e=this.getWebSocketUrl();try{this.ws=new WebSocket(e),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=n=>{try{if(n.data==="pong")return;const r=JSON.parse(n.data);this.notifyLog(r)}catch(r){console.error("解析日志消息失败:",r)}},this.ws.onerror=n=>{console.error("❌ WebSocket 错误:",n),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(n){console.error("创建 WebSocket 连接失败:",n),this.attemptReconnect()}}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return;this.reconnectAttempts+=1;const e=Math.min(1e3*this.reconnectAttempts,1e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},e)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(e){return this.logCallbacks.add(e),()=>this.logCallbacks.delete(e)}onConnectionChange(e){return this.connectionCallbacks.add(e),e(this.isConnected),()=>this.connectionCallbacks.delete(e)}notifyLog(e){this.logCache.some(r=>r.id===e.id)||(this.logCache.push(e),this.logCache.length>this.maxCacheSize&&(this.logCache=this.logCache.slice(-this.maxCacheSize)),this.logCallbacks.forEach(r=>{try{r(e)}catch(s){console.error("日志回调执行失败:",s)}}))}notifyConnection(e){this.connectionCallbacks.forEach(n=>{try{n(e)}catch(r){console.error("连接状态回调执行失败:",r)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const Iu=new P0e;typeof window<"u"&&Iu.connect();const L0e={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},B0e=(t,e,n)=>{let r;const s=L0e[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",String(e)),n?.addSuffix?n.comparison&&n.comparison>0?r+"内":r+"前":r},I0e={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},q0e={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},F0e={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Q0e={date:td({formats:I0e,defaultWidth:"full"}),time:td({formats:q0e,defaultWidth:"full"}),dateTime:td({formats:F0e,defaultWidth:"full"})};function i9(t,e,n){const r="eeee p";return Jhe(t,e,n)?r:t.getTime()>e.getTime()?"'下个'"+r:"'上个'"+r}const $0e={lastWeek:i9,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:i9,other:"PP p"},H0e=(t,e,n,r)=>{const s=$0e[t];return typeof s=="function"?s(e,n,r):s},U0e={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},V0e={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},W0e={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},G0e={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},X0e={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},Y0e={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},K0e=(t,e)=>{const n=Number(t);switch(e?.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},Z0e={ordinalNumber:K0e,era:oa({values:U0e,defaultWidth:"wide"}),quarter:oa({values:V0e,defaultWidth:"wide",argumentCallback:t=>t-1}),month:oa({values:W0e,defaultWidth:"wide"}),day:oa({values:G0e,defaultWidth:"wide"}),dayPeriod:oa({values:X0e,defaultWidth:"wide",formattingValues:Y0e,defaultFormattingWidth:"wide"})},J0e=/^(第\s*)?\d+(日|时|分|秒)?/i,eme=/\d+/i,tme={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},nme={any:[/^(前)/i,/^(公元)/i]},rme={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},sme={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},ime={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},ame={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},lme={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},ome={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},cme={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},ume={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},dme={ordinalNumber:xz({matchPattern:J0e,parsePattern:eme,valueCallback:t=>parseInt(t,10)}),era:ca({matchPatterns:tme,defaultMatchWidth:"wide",parsePatterns:nme,defaultParseWidth:"any"}),quarter:ca({matchPatterns:rme,defaultMatchWidth:"wide",parsePatterns:sme,defaultParseWidth:"any",valueCallback:t=>t+1}),month:ca({matchPatterns:ime,defaultMatchWidth:"wide",parsePatterns:ame,defaultParseWidth:"any"}),day:ca({matchPatterns:lme,defaultMatchWidth:"wide",parsePatterns:ome,defaultParseWidth:"any"}),dayPeriod:ca({matchPatterns:cme,defaultMatchWidth:"any",parsePatterns:ume,defaultParseWidth:"any"})},Lp={code:"zh-CN",formatDistance:B0e,formatLong:Q0e,formatRelative:H0e,localize:Z0e,match:dme,options:{weekStartsOn:1,firstWeekContainsDate:4}};function hme(){const[t,e]=S.useState([]),[n,r]=S.useState(""),[s,i]=S.useState("all"),[l,c]=S.useState("all"),[d,h]=S.useState(void 0),[m,p]=S.useState(void 0),[x,v]=S.useState(!0),[b,k]=S.useState(!1),O=S.useRef(null),j=S.useRef(null);S.useEffect(()=>{const U=Iu.getAllLogs();e(U);const V=Iu.onLog(()=>{e(Iu.getAllLogs())}),ce=Iu.onConnectionChange(W=>{k(W)});return()=>{V(),ce()}},[]),S.useEffect(()=>{x&&j.current&&j.current.scrollIntoView({behavior:"smooth",block:"end"})},[t,x]);const T=S.useMemo(()=>{const U=new Set(t.map(V=>V.module));return Array.from(U).sort()},[t]),M=U=>{switch(U){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},_=U=>{switch(U){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},D=()=>{window.location.reload()},E=()=>{Iu.clearLogs(),e([])},z=()=>{const U=B.map(J=>`${J.timestamp} [${J.level.padEnd(8)}] [${J.module}] ${J.message}`).join(` +`),V=new Blob([U],{type:"text/plain;charset=utf-8"}),ce=URL.createObjectURL(V),W=document.createElement("a");W.href=ce,W.download=`logs-${dg(new Date,"yyyy-MM-dd-HHmmss")}.txt`,W.click(),URL.revokeObjectURL(ce)},Q=()=>{v(!x)},F=()=>{h(void 0),p(void 0)},B=S.useMemo(()=>t.filter(U=>{const V=n===""||U.message.toLowerCase().includes(n.toLowerCase())||U.module.toLowerCase().includes(n.toLowerCase()),ce=s==="all"||U.level===s,W=l==="all"||U.module===l;let J=!0;if(d||m){const H=new Date(U.timestamp);if(d){const ae=new Date(d);ae.setHours(0,0,0,0),J=J&&H>=ae}if(m){const ae=new Date(m);ae.setHours(23,59,59,999),J=J&&H<=ae}}return V&&ce&&W&&J}),[t,n,s,l,d,m]);return a.jsx(fn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 p-3 sm:p-4 lg:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:ye("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",b?"bg-green-500 animate-pulse":"bg-red-500")}),a.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:b?"已连接":"未连接"})]})]}),a.jsx(yt,{className:"p-3 sm:p-4",children:a.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Ps,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Ae,{placeholder:"搜索日志...",value:n,onChange:U=>r(U.target.value),className:"pl-9 h-9 text-sm"})]}),a.jsxs(Bt,{value:s,onValueChange:i,children:[a.jsxs(Dt,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[a.jsx(t2,{className:"h-4 w-4 mr-2"}),a.jsx(It,{placeholder:"级别"})]}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部级别"}),a.jsx(Pe,{value:"DEBUG",children:"DEBUG"}),a.jsx(Pe,{value:"INFO",children:"INFO"}),a.jsx(Pe,{value:"WARNING",children:"WARNING"}),a.jsx(Pe,{value:"ERROR",children:"ERROR"}),a.jsx(Pe,{value:"CRITICAL",children:"CRITICAL"})]})]}),a.jsxs(Bt,{value:l,onValueChange:c,children:[a.jsxs(Dt,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[a.jsx(t2,{className:"h-4 w-4 mr-2"}),a.jsx(It,{placeholder:"模块"})]}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部模块"}),T.map(U=>a.jsx(Pe,{value:U,children:U},U))]})]})]}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[a.jsxs(co,{children:[a.jsx(uo,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!d&&"text-muted-foreground"),children:[a.jsx(uO,{className:"mr-2 h-4 w-4"}),a.jsx("span",{className:"text-xs sm:text-sm",children:d?dg(d,"PPP",{locale:Lp}):"开始日期"})]})}),a.jsx(hl,{className:"w-auto p-0",align:"start",children:a.jsx(s9,{mode:"single",selected:d,onSelect:h,initialFocus:!0,locale:Lp})})]}),a.jsxs(co,{children:[a.jsx(uo,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!m&&"text-muted-foreground"),children:[a.jsx(uO,{className:"mr-2 h-4 w-4"}),a.jsx("span",{className:"text-xs sm:text-sm",children:m?dg(m,"PPP",{locale:Lp}):"结束日期"})]})}),a.jsx(hl,{className:"w-auto p-0",align:"start",children:a.jsx(s9,{mode:"single",selected:m,onSelect:p,initialFocus:!0,locale:Lp})})]}),(d||m)&&a.jsxs(ie,{variant:"outline",size:"sm",onClick:F,className:"w-full sm:w-auto h-9",children:[a.jsx(Gf,{className:"h-4 w-4 sm:mr-2"}),a.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),a.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[a.jsxs(ie,{variant:x?"default":"outline",size:"sm",onClick:Q,className:"flex-1 sm:flex-none h-9",children:[x?a.jsx(jq,{className:"h-4 w-4"}):a.jsx(Nq,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:x?"自动滚动":"已暂停"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:D,className:"flex-1 sm:flex-none h-9",children:[a.jsx(Ii,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:E,className:"flex-1 sm:flex-none h-9",children:[a.jsx(Ht,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:z,className:"flex-1 sm:flex-none h-9",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),a.jsx("div",{className:"flex-1 hidden sm:block"}),a.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[a.jsxs("span",{className:"font-mono",children:[B.length," / ",t.length]}),a.jsx("span",{className:"ml-1",children:"条日志"})]})]})]})}),a.jsx(yt,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900",children:a.jsx(fn,{className:"h-[calc(100vh-280px)] sm:h-[calc(100vh-320px)] lg:h-[calc(100vh-400px)]",children:a.jsxs("div",{ref:O,className:"p-2 sm:p-3 lg:p-4 font-mono text-xs sm:text-sm space-y-1",children:[B.length===0?a.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):B.map(U=>a.jsxs("div",{className:ye("py-2 px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",_(U.level)),children:[a.jsxs("div",{className:"flex flex-col gap-1 sm:hidden",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-600 text-xs",children:U.timestamp}),a.jsxs("span",{className:ye("text-xs font-semibold",M(U.level)),children:["[",U.level,"]"]})]}),a.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 text-xs truncate",children:U.module}),a.jsx("div",{className:"text-gray-300 dark:text-gray-400 text-xs whitespace-pre-wrap break-words",children:U.message})]}),a.jsxs("div",{className:"hidden sm:flex gap-3 items-start",children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[140px] lg:w-[180px] text-xs lg:text-sm",children:U.timestamp}),a.jsxs("span",{className:ye("flex-shrink-0 w-[70px] lg:w-[80px] font-semibold text-xs lg:text-sm",M(U.level)),children:["[",U.level,"]"]}),a.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[120px] lg:w-[150px] truncate text-xs lg:text-sm",children:U.module}),a.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words text-xs lg:text-sm",children:U.message})]})]},U.id)),a.jsx("div",{ref:j,className:"h-4"})]})})})]})})}const fme="Mai-with-u",mme="plugin-repo",pme="main",gme="plugin_details.json";async function xme(){try{const t=await ot("/api/webui/plugins/fetch-raw",{method:"POST",headers:bt(),body:JSON.stringify({owner:fme,repo:mme,branch:pme,file_path:gme})});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success||!e.data)throw new Error(e.error||"获取插件列表失败");return JSON.parse(e.data).filter(s=>!s?.id||!s?.manifest?(console.warn("跳过无效插件数据:",s),!1):!s.manifest.name||!s.manifest.version?(console.warn("跳过缺少必需字段的插件:",s.id),!1):!0).map(s=>({id:s.id,manifest:{manifest_version:s.manifest.manifest_version||1,name:s.manifest.name,version:s.manifest.version,description:s.manifest.description||"",author:s.manifest.author||{name:"Unknown"},license:s.manifest.license||"Unknown",host_application:s.manifest.host_application||{min_version:"0.0.0"},homepage_url:s.manifest.homepage_url,repository_url:s.manifest.repository_url,keywords:s.manifest.keywords||[],categories:s.manifest.categories||[],default_locale:s.manifest.default_locale||"zh-CN",locales_path:s.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(t){throw console.error("Failed to fetch plugin list:",t),t}}async function vme(){try{const t=await ot("/api/webui/plugins/git-status");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to check Git status:",t),{installed:!1,error:"无法检测 Git 安装状态"}}}async function yme(){try{const t=await ot("/api/webui/plugins/version");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to get Maimai version:",t),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function bme(t,e,n){const r=t.split(".").map(c=>parseInt(c)||0),s=r[0]||0,i=r[1]||0,l=r[2]||0;if(n.version_majorparseInt(p)||0),d=c[0]||0,h=c[1]||0,m=c[2]||0;if(n.version_major>d||n.version_major===d&&n.version_minor>h||n.version_major===d&&n.version_minor===h&&n.version_patch>m)return!1}return!0}function wme(t,e){const n=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host,s=new WebSocket(`${n}//${r}/api/webui/ws/plugin-progress`);return s.onopen=()=>{console.log("Plugin progress WebSocket connected");const i=setInterval(()=>{s.readyState===WebSocket.OPEN?s.send("ping"):clearInterval(i)},3e4)},s.onmessage=i=>{try{if(i.data==="pong")return;const l=JSON.parse(i.data);t(l)}catch(l){console.error("Failed to parse progress data:",l)}},s.onerror=i=>{console.error("Plugin progress WebSocket error:",i),e?.(i)},s.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},s}async function Bp(){try{const t=await ot("/api/webui/plugins/installed",{headers:bt()});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success)throw new Error(e.message||"获取已安装插件列表失败");return e.plugins||[]}catch(t){return console.error("Failed to get installed plugins:",t),[]}}function Ip(t,e){return e.some(n=>n.id===t)}function qp(t,e){const n=e.find(r=>r.id===t);if(n)return n.manifest?.version||n.version}async function Sme(t,e,n="main"){const r=await ot("/api/webui/plugins/install",{method:"POST",headers:bt(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"安装失败")}return await r.json()}async function kme(t){const e=await ot("/api/webui/plugins/uninstall",{method:"POST",headers:bt(),body:JSON.stringify({plugin_id:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"卸载失败")}return await e.json()}async function Ome(t,e,n="main"){const r=await ot("/api/webui/plugins/update",{method:"POST",headers:bt(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"更新失败")}return await r.json()}const C0="https://maibot-plugin-stats.maibot-webui.workers.dev";async function zz(t){try{const e=await fetch(`${C0}/stats/${t}`);return e.ok?await e.json():(console.error("Failed to fetch plugin stats:",e.statusText),null)}catch(e){return console.error("Error fetching plugin stats:",e),null}}async function jme(t,e){try{const n=e||K5(),r=await fetch(`${C0}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点赞失败"}}catch(n){return console.error("Error liking plugin:",n),{success:!1,error:"网络错误"}}}async function Nme(t,e){try{const n=e||K5(),r=await fetch(`${C0}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点踩失败"}}catch(n){return console.error("Error disliking plugin:",n),{success:!1,error:"网络错误"}}}async function Cme(t,e,n,r){if(e<1||e>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const s=r||K5(),i=await fetch(`${C0}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,rating:e,comment:n,user_id:s})}),l=await i.json();return i.status===429?{success:!1,error:"每天最多评分 3 次"}:i.ok?{success:!0,...l}:{success:!1,error:l.error||"评分失败"}}catch(s){return console.error("Error rating plugin:",s),{success:!1,error:"网络错误"}}}async function Tme(t){try{const e=await fetch(`${C0}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t})}),n=await e.json();return e.status===429?(console.warn("Download recording rate limited"),{success:!0}):e.ok?{success:!0,...n}:(console.error("Failed to record download:",n.error),{success:!1,error:n.error})}catch(e){return console.error("Error recording download:",e),{success:!1,error:"网络错误"}}}function Mme(){const t=navigator,e=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,t.deviceMemory||0].join("|");let n=0;for(let r=0;r{i(!0);const j=await zz(t);j&&r(j),i(!1)};S.useEffect(()=>{v()},[t]);const b=async()=>{const j=await jme(t);j.success?(x({title:"已点赞",description:"感谢你的支持!"}),v()):x({title:"点赞失败",description:j.error||"未知错误",variant:"destructive"})},k=async()=>{const j=await Nme(t);j.success?(x({title:"已反馈",description:"感谢你的反馈!"}),v()):x({title:"操作失败",description:j.error||"未知错误",variant:"destructive"})},O=async()=>{if(l===0){x({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const j=await Cme(t,l,d||void 0);j.success?(x({title:"评分成功",description:"感谢你的评价!"}),p(!1),c(0),h(""),v()):x({title:"评分失败",description:j.error||"未知错误",variant:"destructive"})};return s?a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:"-"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Zl,{className:"h-4 w-4"}),a.jsx("span",{children:"-"})]})]}):n?e?a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${n.downloads.toLocaleString()}`,children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:n.downloads.toLocaleString()})]}),a.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${n.rating.toFixed(1)} (${n.rating_count} 条评价)`,children:[a.jsx(Zl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsx("span",{children:n.rating.toFixed(1)})]}),a.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${n.likes}`,children:[a.jsx(my,{className:"h-4 w-4"}),a.jsx("span",{children:n.likes})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(fc,{className:"h-5 w-5 text-muted-foreground mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.downloads.toLocaleString()}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(Zl,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),a.jsx("span",{className:"text-2xl font-bold",children:n.rating.toFixed(1)}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.rating_count," 条评价"]})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(my,{className:"h-5 w-5 text-green-500 mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.likes}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(dO,{className:"h-5 w-5 text-red-500 mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.dislikes}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:b,children:[a.jsx(my,{className:"h-4 w-4 mr-1"}),"点赞"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:k,children:[a.jsx(dO,{className:"h-4 w-4 mr-1"}),"点踩"]}),a.jsxs(Rr,{open:m,onOpenChange:p,children:[a.jsx(mw,{asChild:!0,children:a.jsxs(ie,{variant:"default",size:"sm",children:[a.jsx(Zl,{className:"h-4 w-4 mr-1"}),"评分"]})}),a.jsxs(Nr,{children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"为插件评分"}),a.jsx(Gr,{children:"分享你的使用体验,帮助其他用户"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(j=>a.jsx("button",{onClick:()=>c(j),className:"focus:outline-none",children:a.jsx(Zl,{className:`h-8 w-8 transition-colors ${j<=l?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},j))}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[l===0&&"点击星星进行评分",l===1&&"很差",l===2&&"一般",l===3&&"还行",l===4&&"不错",l===5&&"非常好"]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),a.jsx(On,{value:d,onChange:j=>h(j.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[d.length," / 500"]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>p(!1),children:"取消"}),a.jsx(ie,{onClick:O,disabled:l===0,children:"提交评分"})]})]})]})]}),n.recent_ratings&&n.recent_ratings.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),a.jsx("div",{className:"space-y-3",children:n.recent_ratings.map((j,T)=>a.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(M=>a.jsx(Zl,{className:`h-3 w-3 ${M<=j.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},M))}),a.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(j.created_at).toLocaleDateString()})]}),j.comment&&a.jsx("p",{className:"text-sm text-muted-foreground",children:j.comment})]},T))})]})]}):null}const a9={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function Eme(){const t=ba(),[e,n]=S.useState(null),[r,s]=S.useState(""),[i,l]=S.useState("all"),[c,d]=S.useState("all"),[h,m]=S.useState(!0),[p,x]=S.useState([]),[v,b]=S.useState(!0),[k,O]=S.useState(null),[j,T]=S.useState(null),[M,_]=S.useState(null),[D,E]=S.useState(null),[,z]=S.useState([]),[Q,F]=S.useState({}),{toast:B}=Pr(),U=async R=>{const me=R.map(async K=>{try{const $=await zz(K.id);return{id:K.id,stats:$}}catch($){return console.warn(`Failed to load stats for ${K.id}:`,$),{id:K.id,stats:null}}}),Y=await Promise.all(me),P={};Y.forEach(({id:K,stats:$})=>{$&&(P[K]=$)}),F(P)};S.useEffect(()=>{let R=null,me=!1;return(async()=>{if(R=wme(P=>{me||(_(P),P.stage==="success"?setTimeout(()=>{me||_(null)},2e3):P.stage==="error"&&(b(!1),O(P.error||"加载失败")))},P=>{console.error("WebSocket error:",P),me||B({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(P=>{if(!R){P();return}const K=()=>{R&&R.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),P()):R&&R.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),P()):setTimeout(K,100)};K()}),!me){const P=await vme();T(P),P.installed||B({title:"Git 未安装",description:P.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!me){const P=await yme();E(P)}if(!me)try{b(!0),O(null);const P=await xme();if(!me){const K=await Bp();z(K);const $=P.map(fe=>{const ve=Ip(fe.id,K),Re=qp(fe.id,K);return{...fe,installed:ve,installed_version:Re}});for(const fe of K)!$.some(Re=>Re.id===fe.id)&&fe.manifest&&$.push({id:fe.id,manifest:{manifest_version:fe.manifest.manifest_version||1,name:fe.manifest.name,version:fe.manifest.version,description:fe.manifest.description||"",author:fe.manifest.author,license:fe.manifest.license||"Unknown",host_application:fe.manifest.host_application,homepage_url:fe.manifest.homepage_url,repository_url:fe.manifest.repository_url,keywords:fe.manifest.keywords||[],categories:fe.manifest.categories||[],default_locale:fe.manifest.default_locale||"zh-CN",locales_path:fe.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:fe.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});x($),U($)}}catch(P){if(!me){const K=P instanceof Error?P.message:"加载插件列表失败";O(K),B({title:"加载失败",description:K,variant:"destructive"})}}finally{me||b(!1)}})(),()=>{me=!0,R&&R.close()}},[B]);const V=R=>{if(!R.installed&&D&&!ce(R))return a.jsxs($n,{variant:"destructive",className:"gap-1",children:[a.jsx(xc,{className:"h-3 w-3"}),"不兼容"]});if(R.installed){const me=R.installed_version?.trim(),Y=R.manifest.version?.trim();if(me!==Y){const P=me?.split(".").map(Number)||[0,0,0],K=Y?.split(".").map(Number)||[0,0,0];for(let $=0;$<3;$++){if((K[$]||0)>(P[$]||0))return a.jsxs($n,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[a.jsx(xc,{className:"h-3 w-3"}),"可更新"]});if((K[$]||0)<(P[$]||0))break}}return a.jsxs($n,{variant:"default",className:"gap-1",children:[a.jsx(ua,{className:"h-3 w-3"}),"已安装"]})}return null},ce=R=>!D||!R.manifest?.host_application?!0:bme(R.manifest.host_application.min_version,R.manifest.host_application.max_version,D),W=R=>{if(!R.installed||!R.installed_version||!R.manifest?.version)return!1;const me=R.installed_version.trim(),Y=R.manifest.version.trim();if(me===Y)return!1;const P=me.split(".").map(Number),K=Y.split(".").map(Number);for(let $=0;$<3;$++){if((K[$]||0)>(P[$]||0))return!0;if((K[$]||0)<(P[$]||0))return!1}return!1},J=p.filter(R=>{if(!R.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",R.id),!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some($=>$.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i);let P=!0;c==="installed"?P=R.installed===!0:c==="updates"&&(P=R.installed===!0&&W(R));const K=!h||!D||ce(R);return me&&Y&&P&&K}),H=()=>{n(null)},ae=async R=>{if(!j?.installed){B({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(D&&!ce(R)){B({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await Sme(R.id,R.manifest.repository_url||"","main"),Tme(R.id).catch(Y=>{console.warn("Failed to record download:",Y)}),B({title:"安装成功",description:`${R.manifest.name} 已成功安装`});const me=await Bp();z(me),x(Y=>Y.map(P=>{if(P.id===R.id){const K=Ip(P.id,me),$=qp(P.id,me);return{...P,installed:K,installed_version:$}}return P}))}catch(me){B({title:"安装失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}},ne=async R=>{try{await kme(R.id),B({title:"卸载成功",description:`${R.manifest.name} 已成功卸载`});const me=await Bp();z(me),x(Y=>Y.map(P=>{if(P.id===R.id){const K=Ip(P.id,me),$=qp(P.id,me);return{...P,installed:K,installed_version:$}}return P}))}catch(me){B({title:"卸载失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}},ue=async R=>{if(!j?.installed){B({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const me=await Ome(R.id,R.manifest.repository_url||"","main");B({title:"更新成功",description:`${R.manifest.name} 已从 ${me.old_version} 更新到 ${me.new_version}`});const Y=await Bp();z(Y),x(P=>P.map(K=>{if(K.id===R.id){const $=Ip(K.id,Y),fe=qp(K.id,Y);return{...K,installed:$,installed_version:fe}}return K}))}catch(me){B({title:"更新失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}};return a.jsx(fn,{className:"h-full",children:a.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),a.jsxs(ie,{onClick:()=>t({to:"/plugin-mirrors"}),children:[a.jsx(Cq,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),j&&!j.installed&&a.jsxs(yt,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[a.jsx(Jt,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Hu,{className:"h-5 w-5 text-orange-600"}),a.jsxs("div",{children:[a.jsx(en,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),a.jsx(Sr,{className:"text-orange-800 dark:text-orange-200",children:j.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),a.jsx(vn,{children:a.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",a.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),a.jsx(yt,{className:"p-4",children:a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Ps,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Ae,{placeholder:"搜索插件...",value:r,onChange:R=>s(R.target.value),className:"pl-9"})]}),a.jsxs(Bt,{value:i,onValueChange:l,children:[a.jsx(Dt,{className:"w-full sm:w-[200px]",children:a.jsx(It,{placeholder:"选择分类"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部分类"}),a.jsx(Pe,{value:"Group Management",children:"群组管理"}),a.jsx(Pe,{value:"Entertainment & Interaction",children:"娱乐互动"}),a.jsx(Pe,{value:"Utility Tools",children:"实用工具"}),a.jsx(Pe,{value:"Content Generation",children:"内容生成"}),a.jsx(Pe,{value:"Multimedia",children:"多媒体"}),a.jsx(Pe,{value:"External Integration",children:"外部集成"}),a.jsx(Pe,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),a.jsx(Pe,{value:"Other",children:"其他"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"compatible-only",checked:h,onCheckedChange:R=>m(R===!0)}),a.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),a.jsx(dl,{value:c,onValueChange:d,className:"w-full",children:a.jsxs(va,{className:"grid w-full grid-cols-3",children:[a.jsxs($t,{value:"all",children:["全部插件 (",p.filter(R=>{if(!R.manifest)return!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(K=>K.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),P=!h||!D||ce(R);return me&&Y&&P}).length,")"]}),a.jsxs($t,{value:"installed",children:["已安装 (",p.filter(R=>{if(!R.manifest)return!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(K=>K.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),P=!h||!D||ce(R);return R.installed&&me&&Y&&P}).length,")"]}),a.jsxs($t,{value:"updates",children:["可更新 (",p.filter(R=>{if(!R.manifest)return!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(K=>K.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),P=!h||!D||ce(R);return R.installed&&W(R)&&me&&Y&&P}).length,")"]})]})}),M&&M.stage==="loading"&&a.jsx(yt,{className:"p-4",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(hf,{className:"h-4 w-4 animate-spin"}),a.jsxs("span",{className:"text-sm font-medium",children:[M.operation==="fetch"&&"加载插件列表",M.operation==="install"&&`安装插件${M.plugin_id?`: ${M.plugin_id}`:""}`,M.operation==="uninstall"&&`卸载插件${M.plugin_id?`: ${M.plugin_id}`:""}`,M.operation==="update"&&`更新插件${M.plugin_id?`: ${M.plugin_id}`:""}`]})]}),a.jsxs("span",{className:"text-sm font-medium",children:[M.progress,"%"]})]}),a.jsx(n0,{value:M.progress,className:"h-2"}),a.jsx("div",{className:"text-xs text-muted-foreground",children:M.message}),M.operation==="fetch"&&M.total_plugins>0&&a.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",M.loaded_plugins," / ",M.total_plugins," 个插件"]})]})}),M&&M.stage==="error"&&M.error&&a.jsx(yt,{className:"border-destructive bg-destructive/10",children:a.jsx(Jt,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Hu,{className:"h-5 w-5 text-destructive"}),a.jsxs("div",{children:[a.jsx(en,{className:"text-lg text-destructive",children:"加载失败"}),a.jsx(Sr,{className:"text-destructive/80",children:M.error})]})]})})}),v?a.jsxs("div",{className:"flex items-center justify-center py-12",children:[a.jsx(hf,{className:"h-8 w-8 animate-spin text-muted-foreground"}),a.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):k?a.jsx(yt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Hu,{className:"h-12 w-12 text-destructive mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:k}),a.jsx(ie,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):J.length===0?a.jsx(yt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Ps,{className:"h-12 w-12 text-muted-foreground mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:r||i!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:J.map(R=>a.jsxs(yt,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[a.jsxs(Jt,{children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx(en,{className:"text-xl",children:R.manifest?.name||R.id}),a.jsxs("div",{className:"flex flex-col gap-1",children:[R.manifest?.categories&&R.manifest.categories[0]&&a.jsx($n,{variant:"secondary",className:"text-xs whitespace-nowrap",children:a9[R.manifest.categories[0]]||R.manifest.categories[0]}),V(R)]})]}),a.jsx(Sr,{className:"line-clamp-2",children:R.manifest?.description||"无描述"})]}),a.jsx(vn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:(Q[R.id]?.downloads??R.downloads??0).toLocaleString()})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Zl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsx("span",{children:(Q[R.id]?.rating??R.rating??0).toFixed(1)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[R.manifest?.keywords&&R.manifest.keywords.slice(0,3).map(me=>a.jsx($n,{variant:"outline",className:"text-xs",children:me},me)),R.manifest?.keywords&&R.manifest.keywords.length>3&&a.jsxs($n,{variant:"outline",className:"text-xs",children:["+",R.manifest.keywords.length-3]})]}),a.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[a.jsxs("div",{children:["v",R.manifest?.version||"unknown"," · ",R.manifest?.author?.name||"Unknown"]}),R.manifest?.host_application&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{children:"支持:"}),a.jsxs("span",{className:"font-medium",children:[R.manifest.host_application.min_version,R.manifest.host_application.max_version?` - ${R.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),a.jsx(bC,{className:"pt-4",children:a.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>n(R),children:"查看详情"}),R.installed?W(R)?a.jsxs(ie,{size:"sm",disabled:!j?.installed,title:j?.installed?void 0:"Git 未安装",onClick:()=>ue(R),children:[a.jsx(Ii,{className:"h-4 w-4 mr-1"}),"更新"]}):a.jsxs(ie,{variant:"destructive",size:"sm",disabled:!j?.installed,title:j?.installed?void 0:"Git 未安装",onClick:()=>ne(R),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"卸载"]}):a.jsxs(ie,{size:"sm",disabled:!j?.installed||M?.operation==="install"||D!==null&&!ce(R),title:j?.installed?D!==null&&!ce(R)?`不兼容当前版本 (需要 ${R.manifest?.host_application?.min_version||"未知"}${R.manifest?.host_application?.max_version?` - ${R.manifest.host_application.max_version}`:"+"},当前 ${D?.version})`:void 0:"Git 未安装",onClick:()=>ae(R),children:[a.jsx(fc,{className:"h-4 w-4 mr-1"}),M?.operation==="install"&&M?.plugin_id===R.id?"安装中...":"安装"]})]})})]},R.id))}),a.jsx(Rr,{open:e!==null,onOpenChange:H,children:e&&e.manifest&&a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsx(Cr,{children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"space-y-2 flex-1",children:[a.jsx(Tr,{className:"text-2xl",children:e.manifest.name}),a.jsxs(Gr,{children:["作者: ",e.manifest.author?.name||"Unknown",e.manifest.author?.url&&a.jsx("a",{href:e.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:a.jsx(Yh,{className:"h-3 w-3 inline"})})]})]}),a.jsxs("div",{className:"flex flex-col gap-2",children:[e.manifest.categories&&e.manifest.categories[0]&&a.jsx($n,{variant:"secondary",children:a9[e.manifest.categories[0]]||e.manifest.categories[0]}),V(e)]})]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(Ame,{pluginId:e.id}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"版本"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",e.manifest?.version||"unknown"]}),e.installed&&e.installed_version&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",e.installed_version]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"下载量"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:(Q[e.id]?.downloads??e.downloads??0).toLocaleString()})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"评分"}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Zl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[(Q[e.id]?.rating??e.rating??0).toFixed(1)," (",Q[e.id]?.rating_count??e.review_count??0,")"]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"许可证"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.license||"Unknown"})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.manifest.host_application?.min_version||"未知",e.manifest.host_application?.max_version?` - ${e.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:e.manifest.keywords&&e.manifest.keywords.map(R=>a.jsx($n,{variant:"outline",children:R},R))})]}),e.detailed_description&&a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),a.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:e.detailed_description})]}),!e.detailed_description&&a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.description||"无描述"})]}),a.jsxs("div",{className:"space-y-2",children:[e.manifest.homepage_url&&a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium",children:"主页: "}),a.jsx("a",{href:e.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.homepage_url})]}),e.manifest.repository_url&&a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium",children:"仓库: "}),a.jsx("a",{href:e.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.repository_url})]})]})]}),a.jsxs(ps,{children:[e.manifest.homepage_url&&a.jsxs(ie,{onClick:()=>window.open(e.manifest.homepage_url,"_blank"),children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"访问主页"]}),e.manifest.repository_url&&a.jsxs(ie,{variant:"outline",onClick:()=>window.open(e.manifest.repository_url,"_blank"),children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function _me(){return a.jsx(fn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(Ii,{className:"h-4 w-4 mr-2"}),"刷新"]}),a.jsxs(ie,{size:"sm",children:[a.jsx(dc,{className:"h-4 w-4 mr-2"}),"全局设置"]})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"已安装插件"}),a.jsx(pg,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(vn,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"正在加载..."})]})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"已启用"}),a.jsx(ua,{className:"h-4 w-4 text-green-600"})]}),a.jsxs(vn,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"已禁用"}),a.jsx(xc,{className:"h-4 w-4 text-orange-600"})]}),a.jsxs(vn,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"可更新"}),a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})]}),a.jsxs(vn,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"有新版本可用"})]})]})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"已安装的插件"}),a.jsx(Sr,{children:"查看和管理已安装插件的配置"})]}),a.jsx(vn,{children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[a.jsx(pg,{className:"h-16 w-16 text-muted-foreground/50"}),a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"插件配置功能开发中"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"即将支持插件的启用/禁用、参数配置等功能"})]}),a.jsx("div",{className:"flex gap-2",children:a.jsx(ie,{variant:"outline",asChild:!0,children:a.jsxs("a",{href:"/plugins",children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"前往插件市场"]})})})]})})]}),a.jsx(yt,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:a.jsx(vn,{className:"pt-6",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(xc,{className:"h-5 w-5 text-blue-600 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"开发进行中"}),a.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["插件配置功能正在积极开发中。目前您可以通过",a.jsx("strong",{children:"插件市场"}),"安装和卸载插件,完整的配置管理功能即将推出。"]})]})]})})})]})})}function Dme(){const t=ba(),{toast:e}=Pr(),[n,r]=S.useState([]),[s,i]=S.useState(!0),[l,c]=S.useState(null),[d,h]=S.useState(null),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O=S.useCallback(async()=>{try{i(!0),c(null);const z=localStorage.getItem("access-token"),Q=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${z}`}});if(!Q.ok)throw new Error("获取镜像源列表失败");const F=await Q.json();r(F.mirrors||[])}catch(z){const Q=z instanceof Error?z.message:"加载镜像源失败";c(Q),e({title:"加载失败",description:Q,variant:"destructive"})}finally{i(!1)}},[e]);S.useEffect(()=>{O()},[O]);const j=async()=>{try{const z=localStorage.getItem("access-token"),Q=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${z}`,"Content-Type":"application/json"},body:JSON.stringify(b)});if(!Q.ok){const F=await Q.json();throw new Error(F.detail||"添加镜像源失败")}e({title:"添加成功",description:"镜像源已添加"}),p(!1),k({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O()}catch(z){e({title:"添加失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"})}},T=async()=>{if(d)try{const z=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${d.id}`,{method:"PUT",headers:{Authorization:`Bearer ${z}`,"Content-Type":"application/json"},body:JSON.stringify({name:b.name,raw_prefix:b.raw_prefix,clone_prefix:b.clone_prefix,enabled:b.enabled,priority:b.priority})})).ok)throw new Error("更新镜像源失败");e({title:"更新成功",description:"镜像源已更新"}),v(!1),h(null),O()}catch(z){e({title:"更新失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"})}},M=async z=>{if(confirm("确定要删除这个镜像源吗?"))try{const Q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z}`,{method:"DELETE",headers:{Authorization:`Bearer ${Q}`}})).ok)throw new Error("删除镜像源失败");e({title:"删除成功",description:"镜像源已删除"}),O()}catch(Q){e({title:"删除失败",description:Q instanceof Error?Q.message:"未知错误",variant:"destructive"})}},_=async z=>{try{const Q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z.id}`,{method:"PUT",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!z.enabled})})).ok)throw new Error("更新状态失败");O()}catch(Q){e({title:"更新失败",description:Q instanceof Error?Q.message:"未知错误",variant:"destructive"})}},D=z=>{h(z),k({id:z.id,name:z.name,raw_prefix:z.raw_prefix,clone_prefix:z.clone_prefix,enabled:z.enabled,priority:z.priority}),v(!0)},E=async(z,Q)=>{const F=Q==="up"?z.priority-1:z.priority+1;if(!(F<1))try{const B=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z.id}`,{method:"PUT",headers:{Authorization:`Bearer ${B}`,"Content-Type":"application/json"},body:JSON.stringify({priority:F})})).ok)throw new Error("更新优先级失败");O()}catch(B){e({title:"更新失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}};return a.jsx(fn,{className:"h-full",children:a.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>t({to:"/plugins"}),children:a.jsx(R9,{className:"h-5 w-5"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),a.jsxs(ie,{onClick:()=>p(!0),children:[a.jsx(Wr,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),s?a.jsx(yt,{className:"p-6",children:a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(hf,{className:"h-8 w-8 animate-spin text-primary"})})}):l?a.jsx(yt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Hu,{className:"h-12 w-12 text-destructive mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:l}),a.jsx(ie,{onClick:O,children:"重新加载"})]})}):a.jsxs(yt,{children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Ac,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(gt,{children:"状态"}),a.jsx(gt,{children:"名称"}),a.jsx(gt,{children:"ID"}),a.jsx(gt,{children:"优先级"}),a.jsx(gt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n.map(z=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(jt,{checked:z.enabled,onCheckedChange:()=>_(z)})}),a.jsx(it,{children:a.jsxs("div",{children:[a.jsx("div",{className:"font-medium",children:z.name}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",z.raw_prefix]})]})}),a.jsx(it,{children:a.jsx($n,{variant:"outline",children:z.id})}),a.jsx(it,{children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-mono",children:z.priority}),a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx(ie,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(z,"up"),disabled:z.priority===1,children:a.jsx(e2,{className:"h-3 w-3"})}),a.jsx(ie,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(z,"down"),children:a.jsx(df,{className:"h-3 w-3"})})]})]})}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>D(z),children:a.jsx(nd,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>M(z.id),children:a.jsx(Ht,{className:"h-4 w-4 text-destructive"})})]})})]},z.id))})]})}),a.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(z=>a.jsx(yt,{className:"p-4",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:"font-semibold",children:z.name}),z.enabled&&a.jsx($n,{variant:"default",className:"text-xs",children:"启用"})]}),a.jsx($n,{variant:"outline",className:"mt-1 text-xs",children:z.id})]}),a.jsx(jt,{checked:z.enabled,onCheckedChange:()=>_(z)})]}),a.jsxs("div",{className:"text-sm space-y-1",children:[a.jsxs("div",{className:"text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"Raw: "}),a.jsx("span",{className:"break-all",children:z.raw_prefix})]}),a.jsxs("div",{className:"text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"优先级: "}),a.jsx("span",{className:"font-mono",children:z.priority})]})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[a.jsxs(ie,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>D(z),children:[a.jsx(nd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>E(z,"up"),disabled:z.priority===1,children:a.jsx(e2,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>E(z,"down"),children:a.jsx(df,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"destructive",size:"sm",onClick:()=>M(z.id),children:a.jsx(Ht,{className:"h-4 w-4"})})]})]})},z.id))})]}),a.jsx(Rr,{open:m,onOpenChange:p,children:a.jsxs(Nr,{className:"max-w-lg",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"添加镜像源"}),a.jsx(Gr,{children:"添加新的 Git 镜像源配置"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-id",children:"镜像源 ID *"}),a.jsx(Ae,{id:"add-id",placeholder:"例如: my-mirror",value:b.id,onChange:z=>k({...b,id:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-name",children:"名称 *"}),a.jsx(Ae,{id:"add-name",placeholder:"例如: 我的镜像源",value:b.name,onChange:z=>k({...b,name:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),a.jsx(Ae,{id:"add-raw",placeholder:"https://example.com/raw",value:b.raw_prefix,onChange:z=>k({...b,raw_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-clone",children:"克隆前缀 *"}),a.jsx(Ae,{id:"add-clone",placeholder:"https://example.com/clone",value:b.clone_prefix,onChange:z=>k({...b,clone_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-priority",children:"优先级"}),a.jsx(Ae,{id:"add-priority",type:"number",min:"1",value:b.priority,onChange:z=>k({...b,priority:parseInt(z.target.value)||1})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"add-enabled",checked:b.enabled,onCheckedChange:z=>k({...b,enabled:z})}),a.jsx(te,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>p(!1),children:"取消"}),a.jsx(ie,{onClick:j,children:"添加"})]})]})}),a.jsx(Rr,{open:x,onOpenChange:v,children:a.jsxs(Nr,{className:"max-w-lg",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑镜像源"}),a.jsx(Gr,{children:"修改镜像源配置"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"镜像源 ID"}),a.jsx(Ae,{value:b.id,disabled:!0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-name",children:"名称 *"}),a.jsx(Ae,{id:"edit-name",value:b.name,onChange:z=>k({...b,name:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),a.jsx(Ae,{id:"edit-raw",value:b.raw_prefix,onChange:z=>k({...b,raw_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-clone",children:"克隆前缀 *"}),a.jsx(Ae,{id:"edit-clone",value:b.clone_prefix,onChange:z=>k({...b,clone_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-priority",children:"优先级"}),a.jsx(Ae,{id:"edit-priority",type:"number",min:"1",value:b.priority,onChange:z=>k({...b,priority:parseInt(z.target.value)||1})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"edit-enabled",checked:b.enabled,onCheckedChange:z=>k({...b,enabled:z})}),a.jsx(te,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>v(!1),children:"取消"}),a.jsx(ie,{onClick:T,children:"保存"})]})]})})]})})}const Rme=Nd("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),Pz=S.forwardRef(({className:t,size:e,abbrTitle:n,children:r,...s},i)=>a.jsx("kbd",{className:ye(Rme({size:e,className:t})),ref:i,...s,children:n?a.jsx("abbr",{title:n,children:r}):r}));Pz.displayName="Kbd";const zme=[{icon:hg,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:io,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:z9,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:P9,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:K4,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Wf,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:L9,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:Tq,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:pg,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:fg,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:dc,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function Pme({open:t,onOpenChange:e}){const[n,r]=S.useState(""),[s,i]=S.useState(0),l=ba(),c=zme.filter(m=>m.title.toLowerCase().includes(n.toLowerCase())||m.description.toLowerCase().includes(n.toLowerCase())||m.category.toLowerCase().includes(n.toLowerCase()));S.useEffect(()=>{t&&(r(""),i(0))},[t]);const d=S.useCallback(m=>{l({to:m}),e(!1)},[l,e]),h=S.useCallback(m=>{m.key==="ArrowDown"?(m.preventDefault(),i(p=>(p+1)%c.length)):m.key==="ArrowUp"?(m.preventDefault(),i(p=>(p-1+c.length)%c.length)):m.key==="Enter"&&c[s]&&(m.preventDefault(),d(c[s].path))},[c,s,d]);return a.jsx(Rr,{open:t,onOpenChange:e,children:a.jsxs(Nr,{className:"max-w-2xl p-0 gap-0",children:[a.jsxs(Cr,{className:"px-4 pt-4 pb-0",children:[a.jsx(Tr,{className:"sr-only",children:"搜索"}),a.jsxs("div",{className:"relative",children:[a.jsx(Ps,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),a.jsx(Ae,{value:n,onChange:m=>{r(m.target.value),i(0)},onKeyDown:h,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),a.jsx("div",{className:"border-t",children:a.jsx(fn,{className:"h-[400px]",children:c.length>0?a.jsx("div",{className:"p-2",children:c.map((m,p)=>{const x=m.icon;return a.jsxs("button",{onClick:()=>d(m.path),onMouseEnter:()=>i(p),className:ye("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",p===s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[a.jsx(x,{className:"h-5 w-5 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium text-sm",children:m.title}),a.jsx("div",{className:"text-xs text-muted-foreground truncate",children:m.description})]}),a.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:m.category})]},m.path)})}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx(Ps,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),a.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function Lme(t){const e=Bme(t),n=S.forwardRef((r,s)=>{const{children:i,...l}=r,c=S.Children.toArray(i),d=c.find(qme);if(d){const h=d.props.children,m=c.map(p=>p===d?S.Children.count(h)>1?S.Children.only(null):S.isValidElement(h)?h.props.children:null:p);return a.jsx(e,{...l,ref:s,children:S.isValidElement(h)?S.cloneElement(h,void 0,m):null})}return a.jsx(e,{...l,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function Bme(t){const e=S.forwardRef((n,r)=>{const{children:s,...i}=n;if(S.isValidElement(s)){const l=Qme(s),c=Fme(i,s.props);return s.type!==S.Fragment&&(c.ref=r?lo(r,l):l),S.cloneElement(s,c)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Ime=Symbol("radix.slottable");function qme(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Ime}function Fme(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...c)=>{const d=i(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function Qme(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var z4=["Enter"," "],$me=["ArrowDown","PageUp","Home"],Lz=["ArrowUp","PageDown","End"],Hme=[...$me,...Lz],Ume={ltr:[...z4,"ArrowRight"],rtl:[...z4,"ArrowLeft"]},Vme={ltr:["ArrowLeft"],rtl:["ArrowRight"]},T0="Menu",[$f,Wme,Gme]=tx(T0),[Bc,Bz]=Hi(T0,[Gme,wd,fx]),M0=wd(),Iz=fx(),[qz,Ao]=Bc(T0),[Xme,A0]=Bc(T0),Fz=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:l=!0}=t,c=M0(e),[d,h]=S.useState(null),m=S.useRef(!1),p=es(i),x=Vf(s);return S.useEffect(()=>{const v=()=>{m.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>m.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),a.jsx(ix,{...c,children:a.jsx(qz,{scope:e,open:n,onOpenChange:p,content:d,onContentChange:h,children:a.jsx(Xme,{scope:e,onClose:S.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:m,dir:x,modal:l,children:r})})})};Fz.displayName=T0;var Yme="MenuAnchor",Z5=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=M0(n);return a.jsx(ax,{...s,...r,ref:e})});Z5.displayName=Yme;var J5="MenuPortal",[Kme,Qz]=Bc(J5,{forceMount:void 0}),$z=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=Ao(J5,e);return a.jsx(Kme,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};$z.displayName=J5;var Ni="MenuContent",[Zme,e3]=Bc(Ni),Hz=S.forwardRef((t,e)=>{const n=Qz(Ni,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Ao(Ni,t.__scopeMenu),l=A0(Ni,t.__scopeMenu);return a.jsx($f.Provider,{scope:t.__scopeMenu,children:a.jsx(Ls,{present:r||i.open,children:a.jsx($f.Slot,{scope:t.__scopeMenu,children:l.modal?a.jsx(Jme,{...s,ref:e}):a.jsx(epe,{...s,ref:e})})})})}),Jme=S.forwardRef((t,e)=>{const n=Ao(Ni,t.__scopeMenu),r=S.useRef(null),s=Cn(e,r);return S.useEffect(()=>{const i=r.current;if(i)return j9(i)},[]),a.jsx(t3,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:$e(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),epe=S.forwardRef((t,e)=>{const n=Ao(Ni,t.__scopeMenu);return a.jsx(t3,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),tpe=Lme("MenuContent.ScrollLock"),t3=S.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:d,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:x,onDismiss:v,disableOutsideScroll:b,...k}=t,O=Ao(Ni,n),j=A0(Ni,n),T=M0(n),M=Iz(n),_=Wme(n),[D,E]=S.useState(null),z=S.useRef(null),Q=Cn(e,z,O.onContentChange),F=S.useRef(0),B=S.useRef(""),U=S.useRef(0),V=S.useRef(null),ce=S.useRef("right"),W=S.useRef(0),J=b?N9:S.Fragment,H=b?{as:tpe,allowPinchZoom:!0}:void 0,ae=ue=>{const R=B.current+ue,me=_().filter(ve=>!ve.disabled),Y=document.activeElement,P=me.find(ve=>ve.ref.current===Y)?.textValue,K=me.map(ve=>ve.textValue),$=fpe(K,R,P),fe=me.find(ve=>ve.textValue===$)?.ref.current;(function ve(Re){B.current=Re,window.clearTimeout(F.current),Re!==""&&(F.current=window.setTimeout(()=>ve(""),1e3))})(R),fe&&setTimeout(()=>fe.focus())};S.useEffect(()=>()=>window.clearTimeout(F.current),[]),C9();const ne=S.useCallback(ue=>ce.current===V.current?.side&&ppe(ue,V.current?.area),[]);return a.jsx(Zme,{scope:n,searchRef:B,onItemEnter:S.useCallback(ue=>{ne(ue)&&ue.preventDefault()},[ne]),onItemLeave:S.useCallback(ue=>{ne(ue)||(z.current?.focus(),E(null))},[ne]),onTriggerLeave:S.useCallback(ue=>{ne(ue)&&ue.preventDefault()},[ne]),pointerGraceTimerRef:U,onPointerGraceIntentChange:S.useCallback(ue=>{V.current=ue},[]),children:a.jsx(J,{...H,children:a.jsx(T9,{asChild:!0,trapped:s,onMountAutoFocus:$e(i,ue=>{ue.preventDefault(),z.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:x,onDismiss:v,children:a.jsx(NC,{asChild:!0,...M,dir:j.dir,orientation:"vertical",loop:r,currentTabStopId:D,onCurrentTabStopIdChange:E,onEntryFocus:$e(d,ue=>{j.isUsingKeyboardRef.current||ue.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(X4,{role:"menu","aria-orientation":"vertical","data-state":lP(O.open),"data-radix-menu-content":"",dir:j.dir,...T,...k,ref:Q,style:{outline:"none",...k.style},onKeyDown:$e(k.onKeyDown,ue=>{const me=ue.target.closest("[data-radix-menu-content]")===ue.currentTarget,Y=ue.ctrlKey||ue.altKey||ue.metaKey,P=ue.key.length===1;me&&(ue.key==="Tab"&&ue.preventDefault(),!Y&&P&&ae(ue.key));const K=z.current;if(ue.target!==K||!Hme.includes(ue.key))return;ue.preventDefault();const fe=_().filter(ve=>!ve.disabled).map(ve=>ve.ref.current);Lz.includes(ue.key)&&fe.reverse(),dpe(fe)}),onBlur:$e(t.onBlur,ue=>{ue.currentTarget.contains(ue.target)||(window.clearTimeout(F.current),B.current="")}),onPointerMove:$e(t.onPointerMove,Hf(ue=>{const R=ue.target,me=W.current!==ue.clientX;if(ue.currentTarget.contains(R)&&me){const Y=ue.clientX>W.current?"right":"left";ce.current=Y,W.current=ue.clientX}}))})})})})})})});Hz.displayName=Ni;var npe="MenuGroup",n3=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Yt.div,{role:"group",...r,ref:e})});n3.displayName=npe;var rpe="MenuLabel",Uz=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Yt.div,{...r,ref:e})});Uz.displayName=rpe;var Jg="MenuItem",l9="menu.itemSelect",Kx=S.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=S.useRef(null),l=A0(Jg,t.__scopeMenu),c=e3(Jg,t.__scopeMenu),d=Cn(e,i),h=S.useRef(!1),m=()=>{const p=i.current;if(!n&&p){const x=new CustomEvent(l9,{bubbles:!0,cancelable:!0});p.addEventListener(l9,v=>r?.(v),{once:!0}),A9(p,x),x.defaultPrevented?h.current=!1:l.onClose()}};return a.jsx(Vz,{...s,ref:d,disabled:n,onClick:$e(t.onClick,m),onPointerDown:p=>{t.onPointerDown?.(p),h.current=!0},onPointerUp:$e(t.onPointerUp,p=>{h.current||p.currentTarget?.click()}),onKeyDown:$e(t.onKeyDown,p=>{const x=c.searchRef.current!=="";n||x&&p.key===" "||z4.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Kx.displayName=Jg;var Vz=S.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,l=e3(Jg,n),c=Iz(n),d=S.useRef(null),h=Cn(e,d),[m,p]=S.useState(!1),[x,v]=S.useState("");return S.useEffect(()=>{const b=d.current;b&&v((b.textContent??"").trim())},[i.children]),a.jsx($f.ItemSlot,{scope:n,disabled:r,textValue:s??x,children:a.jsx(CC,{asChild:!0,...c,focusable:!r,children:a.jsx(Yt.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:h,onPointerMove:$e(t.onPointerMove,Hf(b=>{r?l.onItemLeave(b):(l.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:$e(t.onPointerLeave,Hf(b=>l.onItemLeave(b))),onFocus:$e(t.onFocus,()=>p(!0)),onBlur:$e(t.onBlur,()=>p(!1))})})})}),spe="MenuCheckboxItem",Wz=S.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return a.jsx(Zz,{scope:t.__scopeMenu,checked:n,children:a.jsx(Kx,{role:"menuitemcheckbox","aria-checked":ex(n)?"mixed":n,...s,ref:e,"data-state":i3(n),onSelect:$e(s.onSelect,()=>r?.(ex(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Wz.displayName=spe;var Gz="MenuRadioGroup",[ipe,ape]=Bc(Gz,{value:void 0,onValueChange:()=>{}}),Xz=S.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=es(r);return a.jsx(ipe,{scope:t.__scopeMenu,value:n,onValueChange:i,children:a.jsx(n3,{...s,ref:e})})});Xz.displayName=Gz;var Yz="MenuRadioItem",Kz=S.forwardRef((t,e)=>{const{value:n,...r}=t,s=ape(Yz,t.__scopeMenu),i=n===s.value;return a.jsx(Zz,{scope:t.__scopeMenu,checked:i,children:a.jsx(Kx,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":i3(i),onSelect:$e(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Kz.displayName=Yz;var r3="MenuItemIndicator",[Zz,lpe]=Bc(r3,{checked:!1}),Jz=S.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=lpe(r3,n);return a.jsx(Ls,{present:r||ex(i.checked)||i.checked===!0,children:a.jsx(Yt.span,{...s,ref:e,"data-state":i3(i.checked)})})});Jz.displayName=r3;var ope="MenuSeparator",eP=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Yt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});eP.displayName=ope;var cpe="MenuArrow",tP=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=M0(n);return a.jsx(Y4,{...s,...r,ref:e})});tP.displayName=cpe;var s3="MenuSub",[upe,nP]=Bc(s3),rP=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:s}=t,i=Ao(s3,e),l=M0(e),[c,d]=S.useState(null),[h,m]=S.useState(null),p=es(s);return S.useEffect(()=>(i.open===!1&&p(!1),()=>p(!1)),[i.open,p]),a.jsx(ix,{...l,children:a.jsx(qz,{scope:e,open:r,onOpenChange:p,content:h,onContentChange:m,children:a.jsx(upe,{scope:e,contentId:Oi(),triggerId:Oi(),trigger:c,onTriggerChange:d,children:n})})})};rP.displayName=s3;var Gh="MenuSubTrigger",sP=S.forwardRef((t,e)=>{const n=Ao(Gh,t.__scopeMenu),r=A0(Gh,t.__scopeMenu),s=nP(Gh,t.__scopeMenu),i=e3(Gh,t.__scopeMenu),l=S.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:d}=i,h={__scopeMenu:t.__scopeMenu},m=S.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return S.useEffect(()=>m,[m]),S.useEffect(()=>{const p=c.current;return()=>{window.clearTimeout(p),d(null)}},[c,d]),a.jsx(Z5,{asChild:!0,...h,children:a.jsx(Vz,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":lP(n.open),...t,ref:lo(e,s.onTriggerChange),onClick:p=>{t.onClick?.(p),!(t.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:$e(t.onPointerMove,Hf(p=>{i.onItemEnter(p),!p.defaultPrevented&&!t.disabled&&!n.open&&!l.current&&(i.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:$e(t.onPointerLeave,Hf(p=>{m();const x=n.content?.getBoundingClientRect();if(x){const v=n.content?.dataset.side,b=v==="right",k=b?-5:5,O=x[b?"left":"right"],j=x[b?"right":"left"];i.onPointerGraceIntentChange({area:[{x:p.clientX+k,y:p.clientY},{x:O,y:x.top},{x:j,y:x.top},{x:j,y:x.bottom},{x:O,y:x.bottom}],side:v}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(p),p.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:$e(t.onKeyDown,p=>{const x=i.searchRef.current!=="";t.disabled||x&&p.key===" "||Ume[r.dir].includes(p.key)&&(n.onOpenChange(!0),n.content?.focus(),p.preventDefault())})})})});sP.displayName=Gh;var iP="MenuSubContent",aP=S.forwardRef((t,e)=>{const n=Qz(Ni,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Ao(Ni,t.__scopeMenu),l=A0(Ni,t.__scopeMenu),c=nP(iP,t.__scopeMenu),d=S.useRef(null),h=Cn(e,d);return a.jsx($f.Provider,{scope:t.__scopeMenu,children:a.jsx(Ls,{present:r||i.open,children:a.jsx($f.Slot,{scope:t.__scopeMenu,children:a.jsx(t3,{id:c.contentId,"aria-labelledby":c.triggerId,...s,ref:h,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{l.isUsingKeyboardRef.current&&d.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:$e(t.onFocusOutside,m=>{m.target!==c.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:$e(t.onEscapeKeyDown,m=>{l.onClose(),m.preventDefault()}),onKeyDown:$e(t.onKeyDown,m=>{const p=m.currentTarget.contains(m.target),x=Vme[l.dir].includes(m.key);p&&x&&(i.onOpenChange(!1),c.trigger?.focus(),m.preventDefault())})})})})})});aP.displayName=iP;function lP(t){return t?"open":"closed"}function ex(t){return t==="indeterminate"}function i3(t){return ex(t)?"indeterminate":t?"checked":"unchecked"}function dpe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function hpe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function fpe(t,e,n){const s=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let l=hpe(t,Math.max(i,0));s.length===1&&(l=l.filter(h=>h!==n));const d=l.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return d!==n?d:void 0}function mpe(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,l=e.length-1;ir!=x>r&&n<(p-h)*(r-m)/(x-m)+h&&(s=!s)}return s}function ppe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return mpe(n,e)}function Hf(t){return e=>e.pointerType==="mouse"?t(e):void 0}var gpe=Fz,xpe=Z5,vpe=$z,ype=Hz,bpe=n3,wpe=Uz,Spe=Kx,kpe=Wz,Ope=Xz,jpe=Kz,Npe=Jz,Cpe=eP,Tpe=tP,Mpe=rP,Ape=sP,Epe=aP,a3="ContextMenu",[_pe]=Hi(a3,[Bz]),ls=Bz(),[Dpe,oP]=_pe(a3),cP=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:s,modal:i=!0}=t,[l,c]=S.useState(!1),d=ls(e),h=es(r),m=S.useCallback(p=>{c(p),h(p)},[h]);return a.jsx(Dpe,{scope:e,open:l,onOpenChange:m,modal:i,children:a.jsx(gpe,{...d,dir:s,open:l,onOpenChange:m,modal:i,children:n})})};cP.displayName=a3;var uP="ContextMenuTrigger",dP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=t,i=oP(uP,n),l=ls(n),c=S.useRef({x:0,y:0}),d=S.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...c.current})}),h=S.useRef(0),m=S.useCallback(()=>window.clearTimeout(h.current),[]),p=x=>{c.current={x:x.clientX,y:x.clientY},i.onOpenChange(!0)};return S.useEffect(()=>m,[m]),S.useEffect(()=>void(r&&m()),[r,m]),a.jsxs(a.Fragment,{children:[a.jsx(xpe,{...l,virtualRef:d}),a.jsx(Yt.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:$e(t.onContextMenu,x=>{m(),p(x),x.preventDefault()}),onPointerDown:r?t.onPointerDown:$e(t.onPointerDown,Fp(x=>{m(),h.current=window.setTimeout(()=>p(x),700)})),onPointerMove:r?t.onPointerMove:$e(t.onPointerMove,Fp(m)),onPointerCancel:r?t.onPointerCancel:$e(t.onPointerCancel,Fp(m)),onPointerUp:r?t.onPointerUp:$e(t.onPointerUp,Fp(m))})]})});dP.displayName=uP;var Rpe="ContextMenuPortal",hP=t=>{const{__scopeContextMenu:e,...n}=t,r=ls(e);return a.jsx(vpe,{...r,...n})};hP.displayName=Rpe;var fP="ContextMenuContent",mP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=oP(fP,n),i=ls(n),l=S.useRef(!1);return a.jsx(ype,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:c=>{t.onCloseAutoFocus?.(c),!c.defaultPrevented&&l.current&&c.preventDefault(),l.current=!1},onInteractOutside:c=>{t.onInteractOutside?.(c),!c.defaultPrevented&&!s.modal&&(l.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});mP.displayName=fP;var zpe="ContextMenuGroup",Ppe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(bpe,{...s,...r,ref:e})});Ppe.displayName=zpe;var Lpe="ContextMenuLabel",pP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(wpe,{...s,...r,ref:e})});pP.displayName=Lpe;var Bpe="ContextMenuItem",gP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Spe,{...s,...r,ref:e})});gP.displayName=Bpe;var Ipe="ContextMenuCheckboxItem",xP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(kpe,{...s,...r,ref:e})});xP.displayName=Ipe;var qpe="ContextMenuRadioGroup",Fpe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Ope,{...s,...r,ref:e})});Fpe.displayName=qpe;var Qpe="ContextMenuRadioItem",vP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(jpe,{...s,...r,ref:e})});vP.displayName=Qpe;var $pe="ContextMenuItemIndicator",yP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Npe,{...s,...r,ref:e})});yP.displayName=$pe;var Hpe="ContextMenuSeparator",bP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Cpe,{...s,...r,ref:e})});bP.displayName=Hpe;var Upe="ContextMenuArrow",Vpe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Tpe,{...s,...r,ref:e})});Vpe.displayName=Upe;var wP="ContextMenuSub",SP=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,open:s,defaultOpen:i}=t,l=ls(e),[c,d]=So({prop:s,defaultProp:i??!1,onChange:r,caller:wP});return a.jsx(Mpe,{...l,open:c,onOpenChange:d,children:n})};SP.displayName=wP;var Wpe="ContextMenuSubTrigger",kP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Ape,{...s,...r,ref:e})});kP.displayName=Wpe;var Gpe="ContextMenuSubContent",OP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Epe,{...s,...r,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});OP.displayName=Gpe;function Fp(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var Xpe=cP,Ype=dP,Kpe=hP,jP=mP,NP=pP,CP=gP,TP=xP,MP=vP,AP=yP,EP=bP,Zpe=SP,_P=kP,DP=OP;const Jpe=Xpe,ege=Ype,tge=Zpe,RP=S.forwardRef(({className:t,inset:e,children:n,...r},s)=>a.jsxs(_P,{ref:s,className:ye("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...r,children:[n,a.jsx(Mc,{className:"ml-auto h-4 w-4"})]}));RP.displayName=_P.displayName;const zP=S.forwardRef(({className:t,...e},n)=>a.jsx(DP,{ref:n,className:ye("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",t),...e}));zP.displayName=DP.displayName;const PP=S.forwardRef(({className:t,...e},n)=>a.jsx(Kpe,{children:a.jsx(jP,{ref:n,className:ye("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",t),...e})}));PP.displayName=jP.displayName;const Pi=S.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(CP,{ref:r,className:ye("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));Pi.displayName=CP.displayName;const nge=S.forwardRef(({className:t,children:e,checked:n,...r},s)=>a.jsxs(TP,{ref:s,className:ye("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(AP,{children:a.jsx(hc,{className:"h-4 w-4"})})}),e]}));nge.displayName=TP.displayName;const rge=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(MP,{ref:r,className:ye("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(AP,{children:a.jsx(Mq,{className:"h-2 w-2 fill-current"})})}),e]}));rge.displayName=MP.displayName;const sge=S.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(NP,{ref:r,className:ye("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...n}));sge.displayName=NP.displayName;const Xh=S.forwardRef(({className:t,...e},n)=>a.jsx(EP,{ref:n,className:ye("-mx-1 my-1 h-px bg-border",t),...e}));Xh.displayName=EP.displayName;const qu=({className:t,...e})=>a.jsx("span",{className:ye("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});qu.displayName="ContextMenuShortcut";var ige=Symbol("radix.slottable");function age(t){const e=({children:n})=>a.jsx(a.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=ige,e}var[Zx]=Hi("Tooltip",[wd]),Jx=wd(),LP="TooltipProvider",lge=700,P4="tooltip.open",[oge,l3]=Zx(LP),BP=t=>{const{__scopeTooltip:e,delayDuration:n=lge,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,l=S.useRef(!0),c=S.useRef(!1),d=S.useRef(0);return S.useEffect(()=>{const h=d.current;return()=>window.clearTimeout(h)},[]),a.jsx(oge,{scope:e,isOpenDelayedRef:l,delayDuration:n,onOpen:S.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:S.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:S.useCallback(h=>{c.current=h},[]),disableHoverableContent:s,children:i})};BP.displayName=LP;var Uf="Tooltip",[cge,E0]=Zx(Uf),IP=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:l,delayDuration:c}=t,d=l3(Uf,t.__scopeTooltip),h=Jx(e),[m,p]=S.useState(null),x=Oi(),v=S.useRef(0),b=l??d.disableHoverableContent,k=c??d.delayDuration,O=S.useRef(!1),[j,T]=So({prop:r,defaultProp:s??!1,onChange:z=>{z?(d.onOpen(),document.dispatchEvent(new CustomEvent(P4))):d.onClose(),i?.(z)},caller:Uf}),M=S.useMemo(()=>j?O.current?"delayed-open":"instant-open":"closed",[j]),_=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,O.current=!1,T(!0)},[T]),D=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,T(!1)},[T]),E=S.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{O.current=!0,T(!0),v.current=0},k)},[k,T]);return S.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),a.jsx(ix,{...h,children:a.jsx(cge,{scope:e,contentId:x,open:j,stateAttribute:M,trigger:m,onTriggerChange:p,onTriggerEnter:S.useCallback(()=>{d.isOpenDelayedRef.current?E():_()},[d.isOpenDelayedRef,E,_]),onTriggerLeave:S.useCallback(()=>{b?D():(window.clearTimeout(v.current),v.current=0)},[D,b]),onOpen:_,onClose:D,disableHoverableContent:b,children:n})})};IP.displayName=Uf;var L4="TooltipTrigger",qP=S.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=E0(L4,n),i=l3(L4,n),l=Jx(n),c=S.useRef(null),d=Cn(e,c,s.onTriggerChange),h=S.useRef(!1),m=S.useRef(!1),p=S.useCallback(()=>h.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),a.jsx(ax,{asChild:!0,...l,children:a.jsx(Yt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:d,onPointerMove:$e(t.onPointerMove,x=>{x.pointerType!=="touch"&&!m.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),m.current=!0)}),onPointerLeave:$e(t.onPointerLeave,()=>{s.onTriggerLeave(),m.current=!1}),onPointerDown:$e(t.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:$e(t.onFocus,()=>{h.current||s.onOpen()}),onBlur:$e(t.onBlur,s.onClose),onClick:$e(t.onClick,s.onClose)})})});qP.displayName=L4;var o3="TooltipPortal",[uge,dge]=Zx(o3,{forceMount:void 0}),FP=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=E0(o3,e);return a.jsx(uge,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};FP.displayName=o3;var bd="TooltipContent",QP=S.forwardRef((t,e)=>{const n=dge(bd,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,l=E0(bd,t.__scopeTooltip);return a.jsx(Ls,{present:r||l.open,children:l.disableHoverableContent?a.jsx($P,{side:s,...i,ref:e}):a.jsx(hge,{side:s,...i,ref:e})})}),hge=S.forwardRef((t,e)=>{const n=E0(bd,t.__scopeTooltip),r=l3(bd,t.__scopeTooltip),s=S.useRef(null),i=Cn(e,s),[l,c]=S.useState(null),{trigger:d,onClose:h}=n,m=s.current,{onPointerInTransitChange:p}=r,x=S.useCallback(()=>{c(null),p(!1)},[p]),v=S.useCallback((b,k)=>{const O=b.currentTarget,j={x:b.clientX,y:b.clientY},T=xge(j,O.getBoundingClientRect()),M=vge(j,T),_=yge(k.getBoundingClientRect()),D=wge([...M,..._]);c(D),p(!0)},[p]);return S.useEffect(()=>()=>x(),[x]),S.useEffect(()=>{if(d&&m){const b=O=>v(O,m),k=O=>v(O,d);return d.addEventListener("pointerleave",b),m.addEventListener("pointerleave",k),()=>{d.removeEventListener("pointerleave",b),m.removeEventListener("pointerleave",k)}}},[d,m,v,x]),S.useEffect(()=>{if(l){const b=k=>{const O=k.target,j={x:k.clientX,y:k.clientY},T=d?.contains(O)||m?.contains(O),M=!bge(j,l);T?x():M&&(x(),h())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[d,m,l,h,x]),a.jsx($P,{...t,ref:i})}),[fge,mge]=Zx(Uf,{isInside:!1}),pge=age("TooltipContent"),$P=S.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:l,...c}=t,d=E0(bd,n),h=Jx(n),{onClose:m}=d;return S.useEffect(()=>(document.addEventListener(P4,m),()=>document.removeEventListener(P4,m)),[m]),S.useEffect(()=>{if(d.trigger){const p=x=>{x.target?.contains(d.trigger)&&m()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[d.trigger,m]),a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:p=>p.preventDefault(),onDismiss:m,children:a.jsxs(X4,{"data-state":d.stateAttribute,...h,...c,ref:e,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(pge,{children:r}),a.jsx(fge,{scope:n,isInside:!0,children:a.jsx(sq,{id:d.contentId,role:"tooltip",children:s||r})})]})})});QP.displayName=bd;var HP="TooltipArrow",gge=S.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Jx(n);return mge(HP,n).isInside?null:a.jsx(Y4,{...s,...r,ref:e})});gge.displayName=HP;function xge(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function vge(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function yge(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function bge(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,l=e.length-1;ir!=x>r&&n<(p-h)*(r-m)/(x-m)+h&&(s=!s)}return s}function wge(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),Sge(e)}function Sge(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const i=e[e.length-1],l=e[e.length-2];if((i.x-l.x)*(s.y-l.y)>=(i.y-l.y)*(s.x-l.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],l=n[n.length-2];if((i.x-l.x)*(s.y-l.y)>=(i.y-l.y)*(s.x-l.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var kge=BP,Oge=IP,jge=qP,Nge=FP,UP=QP;const Cge=kge,Tge=Oge,Mge=jge,VP=S.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(Nge,{children:a.jsx(UP,{ref:r,sideOffset:e,className:ye("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",t),...n})}));VP.displayName=UP.displayName;function Age({children:t}){CH();const[e,n]=S.useState(!0),[r,s]=S.useState(!1),[i,l]=S.useState(!1),{theme:c,setTheme:d}=dw(),h=MI(),m=ba();S.useEffect(()=>{const k=O=>{(O.metaKey||O.ctrlKey)&&O.key==="k"&&(O.preventDefault(),l(!0))};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[]);const p=[{title:"概览",items:[{icon:hg,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:io,label:"麦麦主程序配置",path:"/config/bot"},{icon:z9,label:"麦麦模型提供商配置",path:"/config/modelProvider"},{icon:P9,label:"麦麦模型配置",path:"/config/model"},{icon:hO,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:K4,label:"表情包管理",path:"/resource/emoji"},{icon:Wf,label:"表达方式管理",path:"/resource/expression"},{icon:L9,label:"人物信息管理",path:"/resource/person"}]},{title:"扩展与监控",items:[{icon:pg,label:"插件市场",path:"/plugins"},{icon:hO,label:"插件配置",path:"/plugin-config"},{icon:fg,label:"日志查看器",path:"/logs"}]},{title:"系统",items:[{icon:dc,label:"系统设置",path:"/settings"}]}],v=c==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":c,b=()=>{localStorage.removeItem("access-token"),m({to:"/auth"})};return a.jsx(Cge,{delayDuration:300,children:a.jsxs("div",{className:"flex h-screen overflow-hidden",children:[a.jsxs("aside",{className:ye("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",e?"lg:w-64":"lg:w-16",r?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[a.jsx("div",{className:"flex h-16 items-center border-b px-4",children:a.jsxs("div",{className:ye("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!e&&"lg:flex-none lg:w-8"),children:[a.jsxs("div",{className:ye("flex items-baseline gap-2",!e&&"lg:hidden"),children:[a.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),a.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:rH()})]}),!e&&a.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),a.jsx(fn,{className:"flex-1",children:a.jsx("nav",{className:"p-4",children:a.jsx("ul",{className:ye("space-y-6",!e&&"lg:space-y-3"),children:p.map((k,O)=>a.jsxs("li",{children:[a.jsx("div",{className:ye("px-3 h-[1.25rem]","mb-2",!e&&"lg:mb-1 lg:invisible"),children:a.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:k.title})}),!e&&O>0&&a.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),a.jsx("ul",{className:"space-y-1",children:k.items.map(j=>{const T=h({to:j.path}),M=j.icon,_=a.jsxs(a.Fragment,{children:[T&&a.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),a.jsxs("div",{className:ye("flex items-center transition-all duration-300",e?"gap-3":"lg:gap-0"),children:[a.jsx(M,{className:ye("h-5 w-5 flex-shrink-0",T&&"text-primary"),strokeWidth:2,fill:"none"}),a.jsx("span",{className:ye("text-sm font-medium whitespace-nowrap transition-all duration-300",T&&"font-semibold",e?"opacity-100 max-w-[200px]":"lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:j.label})]})]});return a.jsx("li",{className:"relative",children:a.jsxs(Tge,{children:[a.jsx(Mge,{asChild:!0,children:a.jsx(AI,{to:j.path,className:ye("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",T?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",e?"px-3":"lg:px-0 lg:justify-center"),onClick:()=>s(!1),children:_})}),!e&&a.jsx(VP,{side:"right",className:"hidden lg:block",children:a.jsx("p",{children:j.label})})]})},j.path)})})]},k.title))})})})]}),r&&a.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>s(!1)}),a.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[a.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:()=>s(!r),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:a.jsx(Aq,{className:"h-5 w-5"})}),a.jsx("button",{onClick:()=>n(!e),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:e?"收起侧边栏":"展开侧边栏",children:a.jsx(Tc,{className:ye("h-5 w-5 transition-transform",!e&&"rotate-180")})})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>l(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[a.jsx(Ps,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),a.jsxs(Pz,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[a.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),a.jsx(Pme,{open:i,onOpenChange:l}),a.jsxs(ie,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[a.jsx(Eq,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),a.jsx("button",{onClick:k=>{Q$(v==="dark"?"light":"dark",d,k)},className:"rounded-lg p-2 hover:bg-accent",title:v==="dark"?"切换到浅色模式":"切换到深色模式",children:v==="dark"?a.jsx(Zb,{className:"h-5 w-5"}):a.jsx(Jb,{className:"h-5 w-5"})}),a.jsx("div",{className:"h-6 w-px bg-border"}),a.jsxs(ie,{variant:"ghost",size:"sm",onClick:b,className:"gap-2",title:"登出系统",children:[a.jsx(fO,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),a.jsxs(Jpe,{children:[a.jsx(ege,{asChild:!0,children:a.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:t})}),a.jsxs(PP,{className:"w-64",children:[a.jsxs(Pi,{onClick:()=>m({to:"/"}),children:[a.jsx(hg,{className:"mr-2 h-4 w-4"}),"首页"]}),a.jsxs(Pi,{onClick:()=>m({to:"/settings"}),children:[a.jsx(dc,{className:"mr-2 h-4 w-4"}),"系统设置"]}),a.jsxs(Pi,{onClick:()=>m({to:"/logs"}),children:[a.jsx(fg,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),a.jsx(Xh,{}),a.jsxs(tge,{children:[a.jsxs(RP,{children:[a.jsx(_9,{className:"mr-2 h-4 w-4"}),"切换主题"]}),a.jsxs(zP,{className:"w-48",children:[a.jsxs(Pi,{onClick:()=>d("light"),disabled:c==="light",children:[a.jsx(Zb,{className:"mr-2 h-4 w-4"}),"浅色",c==="light"&&a.jsx(qu,{children:"✓"})]}),a.jsxs(Pi,{onClick:()=>d("dark"),disabled:c==="dark",children:[a.jsx(Jb,{className:"mr-2 h-4 w-4"}),"深色",c==="dark"&&a.jsx(qu,{children:"✓"})]}),a.jsxs(Pi,{onClick:()=>d("system"),disabled:c==="system",children:[a.jsx(dc,{className:"mr-2 h-4 w-4"}),"跟随系统",c==="system"&&a.jsx(qu,{children:"✓"})]})]})]}),a.jsx(Xh,{}),a.jsxs(Pi,{onClick:()=>window.location.reload(),children:[a.jsx(_q,{className:"mr-2 h-4 w-4"}),"刷新页面",a.jsx(qu,{children:"⌘R"})]}),a.jsxs(Pi,{onClick:()=>l(!0),children:[a.jsx(Ps,{className:"mr-2 h-4 w-4"}),"搜索",a.jsx(qu,{children:"⌘K"})]}),a.jsx(Xh,{}),a.jsxs(Pi,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[a.jsx(Yh,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),a.jsx(Xh,{}),a.jsxs(Pi,{onClick:b,className:"text-destructive focus:text-destructive",children:[a.jsx(fO,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}const _0=EI({component:()=>a.jsxs(a.Fragment,{children:[a.jsx(c9,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!qT())throw DI({to:"/auth"})}}),Ege=Xr({getParentRoute:()=>_0,path:"/auth",component:TH}),_ge=Xr({getParentRoute:()=>_0,path:"/setup",component:WH}),Fs=Xr({getParentRoute:()=>_0,id:"protected",component:()=>a.jsx(Age,{children:a.jsx(c9,{})})}),Dge=Xr({getParentRoute:()=>Fs,path:"/",component:q$}),Rge=Xr({getParentRoute:()=>Fs,path:"/config/bot",component:Vee}),zge=Xr({getParentRoute:()=>Fs,path:"/config/modelProvider",component:ote}),Pge=Xr({getParentRoute:()=>Fs,path:"/config/model",component:Pte}),Lge=Xr({getParentRoute:()=>Fs,path:"/config/adapter",component:qte}),Bge=Xr({getParentRoute:()=>Fs,path:"/resource/emoji",component:ude}),Ige=Xr({getParentRoute:()=>Fs,path:"/resource/expression",component:bde}),qge=Xr({getParentRoute:()=>Fs,path:"/resource/person",component:Ede}),Fge=Xr({getParentRoute:()=>Fs,path:"/logs",component:hme}),Qge=Xr({getParentRoute:()=>Fs,path:"/plugins",component:Eme}),$ge=Xr({getParentRoute:()=>Fs,path:"/plugin-config",component:_me}),Hge=Xr({getParentRoute:()=>Fs,path:"/plugin-mirrors",component:Dme}),Uge=Xr({getParentRoute:()=>Fs,path:"/settings",component:bH}),Vge=Xr({getParentRoute:()=>_0,path:"*",component:$T}),Wge=_0.addChildren([Ege,_ge,Fs.addChildren([Dge,Rge,zge,Pge,Lge,Bge,Ige,qge,Qge,$ge,Hge,Fge,Uge]),Vge]),Gge=_I({routeTree:Wge,defaultNotFoundComponent:$T});function Xge({children:t,defaultTheme:e="system",storageKey:n="ui-theme",...r}){const[s,i]=S.useState(()=>localStorage.getItem(n)||e);S.useEffect(()=>{const c=window.document.documentElement;if(c.classList.remove("light","dark"),s==="system"){const d=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";c.classList.add(d);return}c.classList.add(s)},[s]),S.useEffect(()=>{const c=localStorage.getItem("accent-color");if(c){const d=document.documentElement,m={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[c];m&&(d.style.setProperty("--primary",m.hsl),m.gradient?(d.style.setProperty("--primary-gradient",m.gradient),d.classList.add("has-gradient")):(d.style.removeProperty("--primary-gradient"),d.classList.remove("has-gradient")))}},[]);const l={theme:s,setTheme:c=>{localStorage.setItem(n,c),i(c)}};return a.jsx(uT.Provider,{...r,value:l,children:t})}function Yge({children:t,defaultEnabled:e=!0,defaultWavesEnabled:n=!0,storageKey:r="enable-animations",wavesStorageKey:s="enable-waves-background"}){const[i,l]=S.useState(()=>{const m=localStorage.getItem(r);return m!==null?m==="true":e}),[c,d]=S.useState(()=>{const m=localStorage.getItem(s);return m!==null?m==="true":n});S.useEffect(()=>{const m=document.documentElement;i?m.classList.remove("no-animations"):m.classList.add("no-animations"),localStorage.setItem(r,String(i))},[i,r]),S.useEffect(()=>{localStorage.setItem(s,String(c))},[c,s]);const h={enableAnimations:i,setEnableAnimations:l,enableWavesBackground:c,setEnableWavesBackground:d};return a.jsx(dT.Provider,{value:h,children:t})}var c3="ToastProvider",[u3,Kge,Zge]=tx("Toast"),[WP]=Hi("Toast",[Zge]),[Jge,e1]=WP(c3),GP=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:l}=t,[c,d]=S.useState(null),[h,m]=S.useState(0),p=S.useRef(!1),x=S.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${c3}\`. Expected non-empty \`string\`.`),a.jsx(u3.Provider,{scope:e,children:a.jsx(Jge,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:h,viewport:c,onViewportChange:d,onToastAdd:S.useCallback(()=>m(v=>v+1),[]),onToastRemove:S.useCallback(()=>m(v=>v-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:x,children:l})})};GP.displayName=c3;var XP="ToastViewport",exe=["F8"],B4="toast.viewportPause",I4="toast.viewportResume",YP=S.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=exe,label:s="Notifications ({hotkey})",...i}=t,l=e1(XP,n),c=Kge(n),d=S.useRef(null),h=S.useRef(null),m=S.useRef(null),p=S.useRef(null),x=Cn(e,p,l.onViewportChange),v=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=l.toastCount>0;S.useEffect(()=>{const O=j=>{r.length!==0&&r.every(M=>j[M]||j.code===M)&&p.current?.focus()};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[r]),S.useEffect(()=>{const O=d.current,j=p.current;if(b&&O&&j){const T=()=>{if(!l.isClosePausedRef.current){const E=new CustomEvent(B4);j.dispatchEvent(E),l.isClosePausedRef.current=!0}},M=()=>{if(l.isClosePausedRef.current){const E=new CustomEvent(I4);j.dispatchEvent(E),l.isClosePausedRef.current=!1}},_=E=>{!O.contains(E.relatedTarget)&&M()},D=()=>{O.contains(document.activeElement)||M()};return O.addEventListener("focusin",T),O.addEventListener("focusout",_),O.addEventListener("pointermove",T),O.addEventListener("pointerleave",D),window.addEventListener("blur",T),window.addEventListener("focus",M),()=>{O.removeEventListener("focusin",T),O.removeEventListener("focusout",_),O.removeEventListener("pointermove",T),O.removeEventListener("pointerleave",D),window.removeEventListener("blur",T),window.removeEventListener("focus",M)}}},[b,l.isClosePausedRef]);const k=S.useCallback(({tabbingDirection:O})=>{const T=c().map(M=>{const _=M.ref.current,D=[_,...fxe(_)];return O==="forwards"?D:D.reverse()});return(O==="forwards"?T.reverse():T).flat()},[c]);return S.useEffect(()=>{const O=p.current;if(O){const j=T=>{const M=T.altKey||T.ctrlKey||T.metaKey;if(T.key==="Tab"&&!M){const D=document.activeElement,E=T.shiftKey;if(T.target===O&&E){h.current?.focus();return}const F=k({tabbingDirection:E?"backwards":"forwards"}),B=F.findIndex(U=>U===D);Gb(F.slice(B+1))?T.preventDefault():E?h.current?.focus():m.current?.focus()}};return O.addEventListener("keydown",j),()=>O.removeEventListener("keydown",j)}},[c,k]),a.jsxs(iq,{ref:d,role:"region","aria-label":s.replace("{hotkey}",v),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&a.jsx(q4,{ref:h,onFocusFromOutsideViewport:()=>{const O=k({tabbingDirection:"forwards"});Gb(O)}}),a.jsx(u3.Slot,{scope:n,children:a.jsx(Yt.ol,{tabIndex:-1,...i,ref:x})}),b&&a.jsx(q4,{ref:m,onFocusFromOutsideViewport:()=>{const O=k({tabbingDirection:"backwards"});Gb(O)}})]})});YP.displayName=XP;var KP="ToastFocusProxy",q4=S.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=e1(KP,n);return a.jsx(E9,{tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:l=>{const c=l.relatedTarget;!i.viewport?.contains(c)&&r()}})});q4.displayName=KP;var D0="Toast",txe="toast.swipeStart",nxe="toast.swipeMove",rxe="toast.swipeCancel",sxe="toast.swipeEnd",ZP=S.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...l}=t,[c,d]=So({prop:r,defaultProp:s??!0,onChange:i,caller:D0});return a.jsx(Ls,{present:n||c,children:a.jsx(lxe,{open:c,...l,ref:e,onClose:()=>d(!1),onPause:es(t.onPause),onResume:es(t.onResume),onSwipeStart:$e(t.onSwipeStart,h=>{h.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:$e(t.onSwipeMove,h=>{const{x:m,y:p}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","move"),h.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${m}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:$e(t.onSwipeCancel,h=>{h.currentTarget.setAttribute("data-swipe","cancel"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:$e(t.onSwipeEnd,h=>{const{x:m,y:p}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","end"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${m}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),d(!1)})})})});ZP.displayName=D0;var[ixe,axe]=WP(D0,{onClose(){}}),lxe=S.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:l,onEscapeKeyDown:c,onPause:d,onResume:h,onSwipeStart:m,onSwipeMove:p,onSwipeCancel:x,onSwipeEnd:v,...b}=t,k=e1(D0,n),[O,j]=S.useState(null),T=Cn(e,W=>j(W)),M=S.useRef(null),_=S.useRef(null),D=s||k.duration,E=S.useRef(0),z=S.useRef(D),Q=S.useRef(0),{onToastAdd:F,onToastRemove:B}=k,U=es(()=>{O?.contains(document.activeElement)&&k.viewport?.focus(),l()}),V=S.useCallback(W=>{!W||W===1/0||(window.clearTimeout(Q.current),E.current=new Date().getTime(),Q.current=window.setTimeout(U,W))},[U]);S.useEffect(()=>{const W=k.viewport;if(W){const J=()=>{V(z.current),h?.()},H=()=>{const ae=new Date().getTime()-E.current;z.current=z.current-ae,window.clearTimeout(Q.current),d?.()};return W.addEventListener(B4,H),W.addEventListener(I4,J),()=>{W.removeEventListener(B4,H),W.removeEventListener(I4,J)}}},[k.viewport,D,d,h,V]),S.useEffect(()=>{i&&!k.isClosePausedRef.current&&V(D)},[i,D,k.isClosePausedRef,V]),S.useEffect(()=>(F(),()=>B()),[F,B]);const ce=S.useMemo(()=>O?iL(O):null,[O]);return k.viewport?a.jsxs(a.Fragment,{children:[ce&&a.jsx(oxe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:ce}),a.jsx(ixe,{scope:n,onClose:U,children:RI.createPortal(a.jsx(u3.ItemSlot,{scope:n,children:a.jsx(aq,{asChild:!0,onEscapeKeyDown:$e(c,()=>{k.isFocusedToastEscapeKeyDownRef.current||U(),k.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(Yt.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":k.swipeDirection,...b,ref:T,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:$e(t.onKeyDown,W=>{W.key==="Escape"&&(c?.(W.nativeEvent),W.nativeEvent.defaultPrevented||(k.isFocusedToastEscapeKeyDownRef.current=!0,U()))}),onPointerDown:$e(t.onPointerDown,W=>{W.button===0&&(M.current={x:W.clientX,y:W.clientY})}),onPointerMove:$e(t.onPointerMove,W=>{if(!M.current)return;const J=W.clientX-M.current.x,H=W.clientY-M.current.y,ae=!!_.current,ne=["left","right"].includes(k.swipeDirection),ue=["left","up"].includes(k.swipeDirection)?Math.min:Math.max,R=ne?ue(0,J):0,me=ne?0:ue(0,H),Y=W.pointerType==="touch"?10:2,P={x:R,y:me},K={originalEvent:W,delta:P};ae?(_.current=P,Qp(nxe,p,K,{discrete:!1})):o9(P,k.swipeDirection,Y)?(_.current=P,Qp(txe,m,K,{discrete:!1}),W.target.setPointerCapture(W.pointerId)):(Math.abs(J)>Y||Math.abs(H)>Y)&&(M.current=null)}),onPointerUp:$e(t.onPointerUp,W=>{const J=_.current,H=W.target;if(H.hasPointerCapture(W.pointerId)&&H.releasePointerCapture(W.pointerId),_.current=null,M.current=null,J){const ae=W.currentTarget,ne={originalEvent:W,delta:J};o9(J,k.swipeDirection,k.swipeThreshold)?Qp(sxe,v,ne,{discrete:!0}):Qp(rxe,x,ne,{discrete:!0}),ae.addEventListener("click",ue=>ue.preventDefault(),{once:!0})}})})})}),k.viewport)})]}):null}),oxe=t=>{const{__scopeToast:e,children:n,...r}=t,s=e1(D0,e),[i,l]=S.useState(!1),[c,d]=S.useState(!1);return dxe(()=>l(!0)),S.useEffect(()=>{const h=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(h)},[]),c?null:a.jsx(sx,{asChild:!0,children:a.jsx(E9,{...r,children:i&&a.jsxs(a.Fragment,{children:[s.label," ",n]})})})},cxe="ToastTitle",JP=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(Yt.div,{...r,ref:e})});JP.displayName=cxe;var uxe="ToastDescription",eL=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(Yt.div,{...r,ref:e})});eL.displayName=uxe;var tL="ToastAction",nL=S.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?a.jsx(sL,{altText:n,asChild:!0,children:a.jsx(d3,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${tL}\`. Expected non-empty \`string\`.`),null)});nL.displayName=tL;var rL="ToastClose",d3=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=axe(rL,n);return a.jsx(sL,{asChild:!0,children:a.jsx(Yt.button,{type:"button",...r,ref:e,onClick:$e(t.onClick,s.onClose)})})});d3.displayName=rL;var sL=S.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return a.jsx(Yt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function iL(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),hxe(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const l=r.dataset.radixToastAnnounceAlt;l&&e.push(l)}else e.push(...iL(r))}}),e}function Qp(t,e,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?A9(s,i):s.dispatchEvent(i)}var o9=(t,e,n=0)=>{const r=Math.abs(t.x),s=Math.abs(t.y),i=r>s;return e==="left"||e==="right"?i&&r>n:!i&&s>n};function dxe(t=()=>{}){const e=es(t);h9(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function hxe(t){return t.nodeType===t.ELEMENT_NODE}function fxe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Gb(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var mxe=GP,aL=YP,lL=ZP,oL=JP,cL=eL,uL=nL,dL=d3;const pxe=mxe,hL=S.forwardRef(({className:t,...e},n)=>a.jsx(aL,{ref:n,className:ye("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));hL.displayName=aL.displayName;const gxe=Nd("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),fL=S.forwardRef(({className:t,variant:e,...n},r)=>a.jsx(lL,{ref:r,className:ye(gxe({variant:e}),t),...n}));fL.displayName=lL.displayName;const xxe=S.forwardRef(({className:t,...e},n)=>a.jsx(uL,{ref:n,className:ye("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));xxe.displayName=uL.displayName;const mL=S.forwardRef(({className:t,...e},n)=>a.jsx(dL,{ref:n,className:ye("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:a.jsx(Gf,{className:"h-4 w-4"})}));mL.displayName=dL.displayName;const pL=S.forwardRef(({className:t,...e},n)=>a.jsx(oL,{ref:n,className:ye("text-sm font-semibold [&+div]:text-xs",t),...e}));pL.displayName=oL.displayName;const gL=S.forwardRef(({className:t,...e},n)=>a.jsx(cL,{ref:n,className:ye("text-sm opacity-90",t),...e}));gL.displayName=cL.displayName;function vxe(){const{toasts:t}=Pr();return a.jsxs(pxe,{children:[t.map(function({id:e,title:n,description:r,action:s,...i}){return a.jsxs(fL,{...i,children:[a.jsxs("div",{className:"grid gap-1",children:[n&&a.jsx(pL,{children:n}),r&&a.jsx(gL,{children:r})]}),s,a.jsx(mL,{})]},e)}),a.jsx(hL,{})]})}Lq.createRoot(document.getElementById("root")).render(a.jsx(S.StrictMode,{children:a.jsx(Xge,{defaultTheme:"system",children:a.jsxs(Yge,{children:[a.jsx(zI,{router:Gge}),a.jsx(vxe,{})]})})})); diff --git a/webui/dist/assets/index-DYT0dd6E.js b/webui/dist/assets/index-DYT0dd6E.js deleted file mode 100644 index aa91560f..00000000 --- a/webui/dist/assets/index-DYT0dd6E.js +++ /dev/null @@ -1,151 +0,0 @@ -function MV(e,t){for(var n=0;nr[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var fp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var g0={exports:{}},Bd={};var Mk;function RV(){if(Mk)return Bd;Mk=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,i){var l=null;if(i!==void 0&&(l=""+i),a.key!==void 0&&(l=""+a.key),"key"in a){i={};for(var u in a)u!=="key"&&(i[u]=a[u])}else i=a;return a=i.ref,{$$typeof:e,type:r,key:l,ref:a!==void 0?a:null,props:i}}return Bd.Fragment=t,Bd.jsx=n,Bd.jsxs=n,Bd}var Rk;function DV(){return Rk||(Rk=1,g0.exports=RV()),g0.exports}var s=DV(),y0={exports:{}},Ve={};var Dk;function $V(){if(Dk)return Ve;Dk=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),g=Symbol.iterator;function x(I){return I===null||typeof I!="object"?null:(I=g&&I[g]||I["@@iterator"],typeof I=="function"?I:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,w={};function N(I,B,Y){this.props=I,this.context=B,this.refs=w,this.updater=Y||j}N.prototype.isReactComponent={},N.prototype.setState=function(I,B){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,B,"setState")},N.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function O(){}O.prototype=N.prototype;function C(I,B,Y){this.props=I,this.context=B,this.refs=w,this.updater=Y||j}var A=C.prototype=new O;A.constructor=C,b(A,N.prototype),A.isPureReactComponent=!0;var E=Array.isArray;function k(){}var T={H:null,A:null,T:null,S:null},P=Object.prototype.hasOwnProperty;function $(I,B,Y){var te=Y.ref;return{$$typeof:e,type:I,key:B,ref:te!==void 0?te:null,props:Y}}function F(I,B){return $(I.type,B,I.props)}function D(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function U(I){var B={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(Y){return B[Y]})}var V=/\/+/g;function H(I,B){return typeof I=="object"&&I!==null&&I.key!=null?U(""+I.key):B.toString(36)}function G(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(k,k):(I.status="pending",I.then(function(B){I.status==="pending"&&(I.status="fulfilled",I.value=B)},function(B){I.status==="pending"&&(I.status="rejected",I.reason=B)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function L(I,B,Y,te,oe){var xe=typeof I;(xe==="undefined"||xe==="boolean")&&(I=null);var J=!1;if(I===null)J=!0;else switch(xe){case"bigint":case"string":case"number":J=!0;break;case"object":switch(I.$$typeof){case e:case t:J=!0;break;case m:return J=I._init,L(J(I._payload),B,Y,te,oe)}}if(J)return oe=oe(I),J=te===""?"."+H(I,0):te,E(oe)?(Y="",J!=null&&(Y=J.replace(V,"$&/")+"/"),L(oe,B,Y,"",function(pe){return pe})):oe!=null&&(D(oe)&&(oe=F(oe,Y+(oe.key==null||I&&I.key===oe.key?"":(""+oe.key).replace(V,"$&/")+"/")+J)),B.push(oe)),1;J=0;var ae=te===""?".":te+":";if(E(I))for(var Z=0;Z>>1,ee=L[K];if(0>>1;Ka(Y,q))tea(oe,Y)?(L[K]=oe,L[te]=q,K=te):(L[K]=Y,L[B]=q,K=B);else if(tea(oe,q))L[K]=oe,L[te]=q,K=te;else break e}}return R}function a(L,R){var q=L.sortIndex-R.sortIndex;return q!==0?q:L.id-R.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var d=[],f=[],m=1,p=null,g=3,x=!1,j=!1,b=!1,w=!1,N=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function A(L){for(var R=n(f);R!==null;){if(R.callback===null)r(f);else if(R.startTime<=L)r(f),R.sortIndex=R.expirationTime,t(d,R);else break;R=n(f)}}function E(L){if(b=!1,A(L),!j)if(n(d)!==null)j=!0,k||(k=!0,U());else{var R=n(f);R!==null&&G(E,R.startTime-L)}}var k=!1,T=-1,P=5,$=-1;function F(){return w?!0:!(e.unstable_now()-$L&&F());){var K=p.callback;if(typeof K=="function"){p.callback=null,g=p.priorityLevel;var ee=K(p.expirationTime<=L);if(L=e.unstable_now(),typeof ee=="function"){p.callback=ee,A(L),R=!0;break t}p===n(d)&&r(d),A(L)}else r(d);p=n(d)}if(p!==null)R=!0;else{var I=n(f);I!==null&&G(E,I.startTime-L),R=!1}}break e}finally{p=null,g=q,x=!1}R=void 0}}finally{R?U():k=!1}}}var U;if(typeof C=="function")U=function(){C(D)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,H=V.port2;V.port1.onmessage=D,U=function(){H.postMessage(null)}}else U=function(){N(D,0)};function G(L,R){T=N(function(){L(e.unstable_now())},R)}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(L){L.callback=null},e.unstable_forceFrameRate=function(L){0>L||125K?(L.sortIndex=q,t(f,L),n(d)===null&&L===n(f)&&(b?(O(T),T=-1):b=!0,G(E,q-K))):(L.sortIndex=ee,t(d,L),j||x||(j=!0,k||(k=!0,U()))),L},e.unstable_shouldYield=F,e.unstable_wrapCallback=function(L){var R=g;return function(){var q=g;g=R;try{return L.apply(this,arguments)}finally{g=q}}}})(w0)),w0}var Lk;function LV(){return Lk||(Lk=1,b0.exports=IV()),b0.exports}var j0={exports:{}},nr={};var Bk;function BV(){if(Bk)return nr;Bk=1;var e=vh();function t(d){var f="https://react.dev/errors/"+d;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),j0.exports=BV(),j0.exports}var qk;function zV(){if(qk)return zd;qk=1;var e=LV(),t=vh(),n=P3();function r(o){var c="https://react.dev/errors/"+o;if(1ee||(o.current=K[ee],K[ee]=null,ee--)}function Y(o,c){ee++,K[ee]=o.current,o.current=c}var te=I(null),oe=I(null),xe=I(null),J=I(null);function ae(o,c){switch(Y(xe,c),Y(oe,o),Y(te,null),c.nodeType){case 9:case 11:o=(o=c.documentElement)&&(o=o.namespaceURI)?nk(o):0;break;default:if(o=c.tagName,c=c.namespaceURI)c=nk(c),o=rk(c,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}B(te),Y(te,o)}function Z(){B(te),B(oe),B(xe)}function pe(o){o.memoizedState!==null&&Y(J,o);var c=te.current,h=rk(c,o.type);c!==h&&(Y(oe,o),Y(te,h))}function je(o){oe.current===o&&(B(te),B(oe)),J.current===o&&(B(J),Dd._currentValue=q)}var le,Re;function _e(o){if(le===void 0)try{throw Error()}catch(h){var c=h.stack.trim().match(/\n( *(at )?)/);le=c&&c[1]||"",Re=-1)":-1S||X[v]!==se[S]){var ge=` -`+X[v].replace(" at new "," at ");return o.displayName&&ge.includes("")&&(ge=ge.replace("",o.displayName)),ge}while(1<=v&&0<=S);break}}}finally{he=!1,Error.prepareStackTrace=h}return(h=o?o.displayName||o.name:"")?_e(h):""}function Le(o,c){switch(o.tag){case 26:case 27:case 5:return _e(o.type);case 16:return _e("Lazy");case 13:return o.child!==c&&c!==null?_e("Suspense Fallback"):_e("Suspense");case 19:return _e("SuspenseList");case 0:case 15:return ve(o.type,!1);case 11:return ve(o.type.render,!1);case 1:return ve(o.type,!0);case 31:return _e("Activity");default:return""}}function Mt(o){try{var c="",h=null;do c+=Le(o,h),h=o,o=o.return;while(o);return c}catch(v){return` -Error generating stack: `+v.message+` -`+v.stack}}var vn=Object.prototype.hasOwnProperty,fr=e.unstable_scheduleCallback,er=e.unstable_cancelCallback,hr=e.unstable_shouldYield,it=e.unstable_requestPaint,nt=e.unstable_now,Nn=e.unstable_getCurrentPriorityLevel,ds=e.unstable_ImmediatePriority,Qh=e.unstable_UserBlockingPriority,Tl=e.unstable_NormalPriority,tx=e.unstable_LowPriority,Jh=e.unstable_IdlePriority,nx=e.log,rx=e.unstable_setDisableYieldValue,fs=null,mr=null;function Wa(o){if(typeof nx=="function"&&rx(o),mr&&typeof mr.setStrictMode=="function")try{mr.setStrictMode(fs,o)}catch{}}var tr=Math.clz32?Math.clz32:$t,ax=Math.log,Je=Math.LN2;function $t(o){return o>>>=0,o===0?32:31-(ax(o)/Je|0)|0}var He=256,pt=262144,On=4194304;function et(o){var c=o&42;if(c!==0)return c;switch(o&-o){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 o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function kl(o,c,h){var v=o.pendingLanes;if(v===0)return 0;var S=0,_=o.suspendedLanes,M=o.pingedLanes;o=o.warmLanes;var z=v&134217727;return z!==0?(v=z&~_,v!==0?S=et(v):(M&=z,M!==0?S=et(M):h||(h=z&~o,h!==0&&(S=et(h))))):(z=v&~_,z!==0?S=et(z):M!==0?S=et(M):h||(h=v&~o,h!==0&&(S=et(h)))),S===0?0:c!==0&&c!==S&&(c&_)===0&&(_=S&-S,h=c&-c,_>=h||_===32&&(h&4194048)!==0)?c:S}function hs(o,c){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&c)===0}function ix(o,c){switch(o){case 1:case 2:case 4:case 8:case 64:return c+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 c+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 Pl(){var o=On;return On<<=1,(On&62914560)===0&&(On=4194304),o}function ms(o){for(var c=[],h=0;31>h;h++)c.push(o);return c}function Ku(o,c){o.pendingLanes|=c,c!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function wW(o,c,h,v,S,_){var M=o.pendingLanes;o.pendingLanes=h,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=h,o.entangledLanes&=h,o.errorRecoveryDisabledLanes&=h,o.shellSuspendCounter=0;var z=o.entanglements,X=o.expirationTimes,se=o.hiddenUpdates;for(h=M&~h;0"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var CW=/[\n"\\]/g;function aa(o){return o.replace(CW,function(c){return"\\"+c.charCodeAt(0).toString(16)+" "})}function dx(o,c,h,v,S,_,M,z){o.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?o.type=M:o.removeAttribute("type"),c!=null?M==="number"?(c===0&&o.value===""||o.value!=c)&&(o.value=""+ra(c)):o.value!==""+ra(c)&&(o.value=""+ra(c)):M!=="submit"&&M!=="reset"||o.removeAttribute("value"),c!=null?fx(o,M,ra(c)):h!=null?fx(o,M,ra(h)):v!=null&&o.removeAttribute("value"),S==null&&_!=null&&(o.defaultChecked=!!_),S!=null&&(o.checked=S&&typeof S!="function"&&typeof S!="symbol"),z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"?o.name=""+ra(z):o.removeAttribute("name")}function XE(o,c,h,v,S,_,M,z){if(_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(o.type=_),c!=null||h!=null){if(!(_!=="submit"&&_!=="reset"||c!=null)){ux(o);return}h=h!=null?""+ra(h):"",c=c!=null?""+ra(c):h,z||c===o.value||(o.value=c),o.defaultValue=c}v=v??S,v=typeof v!="function"&&typeof v!="symbol"&&!!v,o.checked=z?o.checked:!!v,o.defaultChecked=!!v,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(o.name=M),ux(o)}function fx(o,c,h){c==="number"&&nm(o.ownerDocument)===o||o.defaultValue===""+h||(o.defaultValue=""+h)}function Ll(o,c,h,v){if(o=o.options,c){c={};for(var S=0;S"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gx=!1;if(ji)try{var Ju={};Object.defineProperty(Ju,"passive",{get:function(){gx=!0}}),window.addEventListener("test",Ju,Ju),window.removeEventListener("test",Ju,Ju)}catch{gx=!1}var fo=null,yx=null,am=null;function rA(){if(am)return am;var o,c=yx,h=c.length,v,S="value"in fo?fo.value:fo.textContent,_=S.length;for(o=0;o=nd),cA=" ",uA=!1;function dA(o,c){switch(o){case"keyup":return t7.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fA(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Fl=!1;function r7(o,c){switch(o){case"compositionend":return fA(c);case"keypress":return c.which!==32?null:(uA=!0,cA);case"textInput":return o=c.data,o===cA&&uA?null:o;default:return null}}function a7(o,c){if(Fl)return o==="compositionend"||!Sx&&dA(o,c)?(o=rA(),am=yx=fo=null,Fl=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1=c)return{node:h,offset:c-o};o=v}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=bA(h)}}function jA(o,c){return o&&c?o===c?!0:o&&o.nodeType===3?!1:c&&c.nodeType===3?jA(o,c.parentNode):"contains"in o?o.contains(c):o.compareDocumentPosition?!!(o.compareDocumentPosition(c)&16):!1:!1}function SA(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var c=nm(o.document);c instanceof o.HTMLIFrameElement;){try{var h=typeof c.contentWindow.location.href=="string"}catch{h=!1}if(h)o=c.contentWindow;else break;c=nm(o.document)}return c}function Ox(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c&&(c==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||c==="textarea"||o.contentEditable==="true")}var f7=ji&&"documentMode"in document&&11>=document.documentMode,Ul=null,Cx=null,od=null,Ex=!1;function _A(o,c,h){var v=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Ex||Ul==null||Ul!==nm(v)||(v=Ul,"selectionStart"in v&&Ox(v)?v={start:v.selectionStart,end:v.selectionEnd}:(v=(v.ownerDocument&&v.ownerDocument.defaultView||window).getSelection(),v={anchorNode:v.anchorNode,anchorOffset:v.anchorOffset,focusNode:v.focusNode,focusOffset:v.focusOffset}),od&&id(od,v)||(od=v,v=Zm(Cx,"onSelect"),0>=M,S-=M,Va=1<<32-tr(c)+S|h<Ze?(st=De,De=null):st=De.sibling;var dt=ce(ne,De,ie[Ze],be);if(dt===null){De===null&&(De=st);break}o&&De&&dt.alternate===null&&c(ne,De),Q=_(dt,Q,Ze),ut===null?Ie=dt:ut.sibling=dt,ut=dt,De=st}if(Ze===ie.length)return h(ne,De),lt&&_i(ne,Ze),Ie;if(De===null){for(;ZeZe?(st=De,De=null):st=De.sibling;var Ro=ce(ne,De,dt.value,be);if(Ro===null){De===null&&(De=st);break}o&&De&&Ro.alternate===null&&c(ne,De),Q=_(Ro,Q,Ze),ut===null?Ie=Ro:ut.sibling=Ro,ut=Ro,De=st}if(dt.done)return h(ne,De),lt&&_i(ne,Ze),Ie;if(De===null){for(;!dt.done;Ze++,dt=ie.next())dt=we(ne,dt.value,be),dt!==null&&(Q=_(dt,Q,Ze),ut===null?Ie=dt:ut.sibling=dt,ut=dt);return lt&&_i(ne,Ze),Ie}for(De=v(De);!dt.done;Ze++,dt=ie.next())dt=fe(De,ne,Ze,dt.value,be),dt!==null&&(o&&dt.alternate!==null&&De.delete(dt.key===null?Ze:dt.key),Q=_(dt,Q,Ze),ut===null?Ie=dt:ut.sibling=dt,ut=dt);return o&&De.forEach(function(PV){return c(ne,PV)}),lt&&_i(ne,Ze),Ie}function At(ne,Q,ie,be){if(typeof ie=="object"&&ie!==null&&ie.type===b&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case x:e:{for(var Ie=ie.key;Q!==null;){if(Q.key===Ie){if(Ie=ie.type,Ie===b){if(Q.tag===7){h(ne,Q.sibling),be=S(Q,ie.props.children),be.return=ne,ne=be;break e}}else if(Q.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===P&&Ns(Ie)===Q.type){h(ne,Q.sibling),be=S(Q,ie.props),fd(be,ie),be.return=ne,ne=be;break e}h(ne,Q);break}else c(ne,Q);Q=Q.sibling}ie.type===b?(be=bs(ie.props.children,ne.mode,be,ie.key),be.return=ne,ne=be):(be=mm(ie.type,ie.key,ie.props,null,ne.mode,be),fd(be,ie),be.return=ne,ne=be)}return M(ne);case j:e:{for(Ie=ie.key;Q!==null;){if(Q.key===Ie)if(Q.tag===4&&Q.stateNode.containerInfo===ie.containerInfo&&Q.stateNode.implementation===ie.implementation){h(ne,Q.sibling),be=S(Q,ie.children||[]),be.return=ne,ne=be;break e}else{h(ne,Q);break}else c(ne,Q);Q=Q.sibling}be=Dx(ie,ne.mode,be),be.return=ne,ne=be}return M(ne);case P:return ie=Ns(ie),At(ne,Q,ie,be)}if(G(ie))return Ae(ne,Q,ie,be);if(U(ie)){if(Ie=U(ie),typeof Ie!="function")throw Error(r(150));return ie=Ie.call(ie),ze(ne,Q,ie,be)}if(typeof ie.then=="function")return At(ne,Q,wm(ie),be);if(ie.$$typeof===C)return At(ne,Q,gm(ne,ie),be);jm(ne,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,Q!==null&&Q.tag===6?(h(ne,Q.sibling),be=S(Q,ie),be.return=ne,ne=be):(h(ne,Q),be=Rx(ie,ne.mode,be),be.return=ne,ne=be),M(ne)):h(ne,Q)}return function(ne,Q,ie,be){try{dd=0;var Ie=At(ne,Q,ie,be);return ec=null,Ie}catch(De){if(De===Jl||De===xm)throw De;var ut=Lr(29,De,null,ne.mode);return ut.lanes=be,ut.return=ne,ut}finally{}}}var Cs=GA(!0),YA=GA(!1),go=!1;function Gx(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Yx(o,c){o=o.updateQueue,c.updateQueue===o&&(c.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function yo(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function xo(o,c,h){var v=o.updateQueue;if(v===null)return null;if(v=v.shared,(vt&2)!==0){var S=v.pending;return S===null?c.next=c:(c.next=S.next,S.next=c),v.pending=c,c=hm(o),kA(o,null,h),c}return fm(o,v,c,h),hm(o)}function hd(o,c,h){if(c=c.updateQueue,c!==null&&(c=c.shared,(h&4194048)!==0)){var v=c.lanes;v&=o.pendingLanes,h|=v,c.lanes=h,BE(o,h)}}function Kx(o,c){var h=o.updateQueue,v=o.alternate;if(v!==null&&(v=v.updateQueue,h===v)){var S=null,_=null;if(h=h.firstBaseUpdate,h!==null){do{var M={lane:h.lane,tag:h.tag,payload:h.payload,callback:null,next:null};_===null?S=_=M:_=_.next=M,h=h.next}while(h!==null);_===null?S=_=c:_=_.next=c}else S=_=c;h={baseState:v.baseState,firstBaseUpdate:S,lastBaseUpdate:_,shared:v.shared,callbacks:v.callbacks},o.updateQueue=h;return}o=h.lastBaseUpdate,o===null?h.firstBaseUpdate=c:o.next=c,h.lastBaseUpdate=c}var Xx=!1;function md(){if(Xx){var o=Ql;if(o!==null)throw o}}function pd(o,c,h,v){Xx=!1;var S=o.updateQueue;go=!1;var _=S.firstBaseUpdate,M=S.lastBaseUpdate,z=S.shared.pending;if(z!==null){S.shared.pending=null;var X=z,se=X.next;X.next=null,M===null?_=se:M.next=se,M=X;var ge=o.alternate;ge!==null&&(ge=ge.updateQueue,z=ge.lastBaseUpdate,z!==M&&(z===null?ge.firstBaseUpdate=se:z.next=se,ge.lastBaseUpdate=X))}if(_!==null){var we=S.baseState;M=0,ge=se=X=null,z=_;do{var ce=z.lane&-536870913,fe=ce!==z.lane;if(fe?(ot&ce)===ce:(v&ce)===ce){ce!==0&&ce===Zl&&(Xx=!0),ge!==null&&(ge=ge.next={lane:0,tag:z.tag,payload:z.payload,callback:null,next:null});e:{var Ae=o,ze=z;ce=c;var At=h;switch(ze.tag){case 1:if(Ae=ze.payload,typeof Ae=="function"){we=Ae.call(At,we,ce);break e}we=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=ze.payload,ce=typeof Ae=="function"?Ae.call(At,we,ce):Ae,ce==null)break e;we=p({},we,ce);break e;case 2:go=!0}}ce=z.callback,ce!==null&&(o.flags|=64,fe&&(o.flags|=8192),fe=S.callbacks,fe===null?S.callbacks=[ce]:fe.push(ce))}else fe={lane:ce,tag:z.tag,payload:z.payload,callback:z.callback,next:null},ge===null?(se=ge=fe,X=we):ge=ge.next=fe,M|=ce;if(z=z.next,z===null){if(z=S.shared.pending,z===null)break;fe=z,z=fe.next,fe.next=null,S.lastBaseUpdate=fe,S.shared.pending=null}}while(!0);ge===null&&(X=we),S.baseState=X,S.firstBaseUpdate=se,S.lastBaseUpdate=ge,_===null&&(S.shared.lanes=0),_o|=M,o.lanes=M,o.memoizedState=we}}function KA(o,c){if(typeof o!="function")throw Error(r(191,o));o.call(c)}function XA(o,c){var h=o.callbacks;if(h!==null)for(o.callbacks=null,o=0;o_?_:8;var M=L.T,z={};L.T=z,pb(o,!1,c,h);try{var X=S(),se=L.S;if(se!==null&&se(z,X),X!==null&&typeof X=="object"&&typeof X.then=="function"){var ge=w7(X,v);yd(o,c,ge,Ur(o))}else yd(o,c,v,Ur(o))}catch(we){yd(o,c,{then:function(){},status:"rejected",reason:we},Ur())}finally{R.p=_,M!==null&&z.types!==null&&(M.types=z.types),L.T=M}}function C7(){}function hb(o,c,h,v){if(o.tag!==5)throw Error(r(476));var S=ET(o).queue;CT(o,S,c,q,h===null?C7:function(){return AT(o),h(v)})}function ET(o){var c=o.memoizedState;if(c!==null)return c;c={memoizedState:q,baseState:q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ei,lastRenderedState:q},next:null};var h={};return c.next={memoizedState:h,baseState:h,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ei,lastRenderedState:h},next:null},o.memoizedState=c,o=o.alternate,o!==null&&(o.memoizedState=c),c}function AT(o){var c=ET(o);c.next===null&&(c=o.alternate.memoizedState),yd(o,c.next.queue,{},Ur())}function mb(){return Vn(Dd)}function TT(){return rn().memoizedState}function kT(){return rn().memoizedState}function E7(o){for(var c=o.return;c!==null;){switch(c.tag){case 24:case 3:var h=Ur();o=yo(h);var v=xo(c,o,h);v!==null&&(Or(v,c,h),hd(v,c,h)),c={cache:Ux()},o.payload=c;return}c=c.return}}function A7(o,c,h){var v=Ur();h={lane:v,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Pm(o)?MT(c,h):(h=Px(o,c,h,v),h!==null&&(Or(h,o,v),RT(h,c,v)))}function PT(o,c,h){var v=Ur();yd(o,c,h,v)}function yd(o,c,h,v){var S={lane:v,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null};if(Pm(o))MT(c,S);else{var _=o.alternate;if(o.lanes===0&&(_===null||_.lanes===0)&&(_=c.lastRenderedReducer,_!==null))try{var M=c.lastRenderedState,z=_(M,h);if(S.hasEagerState=!0,S.eagerState=z,Ir(z,M))return fm(o,c,S,0),Rt===null&&dm(),!1}catch{}finally{}if(h=Px(o,c,S,v),h!==null)return Or(h,o,v),RT(h,c,v),!0}return!1}function pb(o,c,h,v){if(v={lane:2,revertLane:Gb(),gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},Pm(o)){if(c)throw Error(r(479))}else c=Px(o,h,v,2),c!==null&&Or(c,o,2)}function Pm(o){var c=o.alternate;return o===Ke||c!==null&&c===Ke}function MT(o,c){nc=Nm=!0;var h=o.pending;h===null?c.next=c:(c.next=h.next,h.next=c),o.pending=c}function RT(o,c,h){if((h&4194048)!==0){var v=c.lanes;v&=o.pendingLanes,h|=v,c.lanes=h,BE(o,h)}}var xd={readContext:Vn,use:Em,useCallback:Zt,useContext:Zt,useEffect:Zt,useImperativeHandle:Zt,useLayoutEffect:Zt,useInsertionEffect:Zt,useMemo:Zt,useReducer:Zt,useRef:Zt,useState:Zt,useDebugValue:Zt,useDeferredValue:Zt,useTransition:Zt,useSyncExternalStore:Zt,useId:Zt,useHostTransitionStatus:Zt,useFormState:Zt,useActionState:Zt,useOptimistic:Zt,useMemoCache:Zt,useCacheRefresh:Zt};xd.useEffectEvent=Zt;var DT={readContext:Vn,use:Em,useCallback:function(o,c){return pr().memoizedState=[o,c===void 0?null:c],o},useContext:Vn,useEffect:yT,useImperativeHandle:function(o,c,h){h=h!=null?h.concat([o]):null,Tm(4194308,4,jT.bind(null,c,o),h)},useLayoutEffect:function(o,c){return Tm(4194308,4,o,c)},useInsertionEffect:function(o,c){Tm(4,2,o,c)},useMemo:function(o,c){var h=pr();c=c===void 0?null:c;var v=o();if(Es){Wa(!0);try{o()}finally{Wa(!1)}}return h.memoizedState=[v,c],v},useReducer:function(o,c,h){var v=pr();if(h!==void 0){var S=h(c);if(Es){Wa(!0);try{h(c)}finally{Wa(!1)}}}else S=c;return v.memoizedState=v.baseState=S,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:S},v.queue=o,o=o.dispatch=A7.bind(null,Ke,o),[v.memoizedState,o]},useRef:function(o){var c=pr();return o={current:o},c.memoizedState=o},useState:function(o){o=lb(o);var c=o.queue,h=PT.bind(null,Ke,c);return c.dispatch=h,[o.memoizedState,h]},useDebugValue:db,useDeferredValue:function(o,c){var h=pr();return fb(h,o,c)},useTransition:function(){var o=lb(!1);return o=CT.bind(null,Ke,o.queue,!0,!1),pr().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,c,h){var v=Ke,S=pr();if(lt){if(h===void 0)throw Error(r(407));h=h()}else{if(h=c(),Rt===null)throw Error(r(349));(ot&127)!==0||nT(v,c,h)}S.memoizedState=h;var _={value:h,getSnapshot:c};return S.queue=_,yT(aT.bind(null,v,_,o),[o]),v.flags|=2048,ac(9,{destroy:void 0},rT.bind(null,v,_,h,c),null),h},useId:function(){var o=pr(),c=Rt.identifierPrefix;if(lt){var h=Ga,v=Va;h=(v&~(1<<32-tr(v)-1)).toString(32)+h,c="_"+c+"R_"+h,h=Om++,0<\/script>",_=_.removeChild(_.firstChild);break;case"select":_=typeof v.is=="string"?M.createElement("select",{is:v.is}):M.createElement("select"),v.multiple?_.multiple=!0:v.size&&(_.size=v.size);break;default:_=typeof v.is=="string"?M.createElement(S,{is:v.is}):M.createElement(S)}}_[Hn]=c,_[br]=v;e:for(M=c.child;M!==null;){if(M.tag===5||M.tag===6)_.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===c)break e;for(;M.sibling===null;){if(M.return===null||M.return===c)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}c.stateNode=_;e:switch(Yn(_,S,v),S){case"button":case"input":case"select":case"textarea":v=!!v.autoFocus;break e;case"img":v=!0;break e;default:v=!1}v&&Ti(c)}}return Ft(c),Ab(c,c.type,o===null?null:o.memoizedProps,c.pendingProps,h),null;case 6:if(o&&c.stateNode!=null)o.memoizedProps!==v&&Ti(c);else{if(typeof v!="string"&&c.stateNode===null)throw Error(r(166));if(o=xe.current,Kl(c)){if(o=c.stateNode,h=c.memoizedProps,v=null,S=Wn,S!==null)switch(S.tag){case 27:case 5:v=S.memoizedProps}o[Hn]=c,o=!!(o.nodeValue===h||v!==null&&v.suppressHydrationWarning===!0||ek(o.nodeValue,h)),o||po(c,!0)}else o=Qm(o).createTextNode(v),o[Hn]=c,c.stateNode=o}return Ft(c),null;case 31:if(h=c.memoizedState,o===null||o.memoizedState!==null){if(v=Kl(c),h!==null){if(o===null){if(!v)throw Error(r(318));if(o=c.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[Hn]=c}else ws(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Ft(c),o=!1}else h=Bx(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=h),o=!0;if(!o)return c.flags&256?(zr(c),c):(zr(c),null);if((c.flags&128)!==0)throw Error(r(558))}return Ft(c),null;case 13:if(v=c.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(S=Kl(c),v!==null&&v.dehydrated!==null){if(o===null){if(!S)throw Error(r(318));if(S=c.memoizedState,S=S!==null?S.dehydrated:null,!S)throw Error(r(317));S[Hn]=c}else ws(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Ft(c),S=!1}else S=Bx(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=S),S=!0;if(!S)return c.flags&256?(zr(c),c):(zr(c),null)}return zr(c),(c.flags&128)!==0?(c.lanes=h,c):(h=v!==null,o=o!==null&&o.memoizedState!==null,h&&(v=c.child,S=null,v.alternate!==null&&v.alternate.memoizedState!==null&&v.alternate.memoizedState.cachePool!==null&&(S=v.alternate.memoizedState.cachePool.pool),_=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(_=v.memoizedState.cachePool.pool),_!==S&&(v.flags|=2048)),h!==o&&h&&(c.child.flags|=8192),Im(c,c.updateQueue),Ft(c),null);case 4:return Z(),o===null&&Zb(c.stateNode.containerInfo),Ft(c),null;case 10:return Oi(c.type),Ft(c),null;case 19:if(B(nn),v=c.memoizedState,v===null)return Ft(c),null;if(S=(c.flags&128)!==0,_=v.rendering,_===null)if(S)wd(v,!1);else{if(Qt!==0||o!==null&&(o.flags&128)!==0)for(o=c.child;o!==null;){if(_=_m(o),_!==null){for(c.flags|=128,wd(v,!1),o=_.updateQueue,c.updateQueue=o,Im(c,o),c.subtreeFlags=0,o=h,h=c.child;h!==null;)PA(h,o),h=h.sibling;return Y(nn,nn.current&1|2),lt&&_i(c,v.treeForkCount),c.child}o=o.sibling}v.tail!==null&&nt()>Fm&&(c.flags|=128,S=!0,wd(v,!1),c.lanes=4194304)}else{if(!S)if(o=_m(_),o!==null){if(c.flags|=128,S=!0,o=o.updateQueue,c.updateQueue=o,Im(c,o),wd(v,!0),v.tail===null&&v.tailMode==="hidden"&&!_.alternate&&!lt)return Ft(c),null}else 2*nt()-v.renderingStartTime>Fm&&h!==536870912&&(c.flags|=128,S=!0,wd(v,!1),c.lanes=4194304);v.isBackwards?(_.sibling=c.child,c.child=_):(o=v.last,o!==null?o.sibling=_:c.child=_,v.last=_)}return v.tail!==null?(o=v.tail,v.rendering=o,v.tail=o.sibling,v.renderingStartTime=nt(),o.sibling=null,h=nn.current,Y(nn,S?h&1|2:h&1),lt&&_i(c,v.treeForkCount),o):(Ft(c),null);case 22:case 23:return zr(c),Qx(),v=c.memoizedState!==null,o!==null?o.memoizedState!==null!==v&&(c.flags|=8192):v&&(c.flags|=8192),v?(h&536870912)!==0&&(c.flags&128)===0&&(Ft(c),c.subtreeFlags&6&&(c.flags|=8192)):Ft(c),h=c.updateQueue,h!==null&&Im(c,h.retryQueue),h=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),v=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(v=c.memoizedState.cachePool.pool),v!==h&&(c.flags|=2048),o!==null&&B(_s),null;case 24:return h=null,o!==null&&(h=o.memoizedState.cache),c.memoizedState.cache!==h&&(c.flags|=2048),Oi(on),Ft(c),null;case 25:return null;case 30:return null}throw Error(r(156,c.tag))}function R7(o,c){switch(Ix(c),c.tag){case 1:return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 3:return Oi(on),Z(),o=c.flags,(o&65536)!==0&&(o&128)===0?(c.flags=o&-65537|128,c):null;case 26:case 27:case 5:return je(c),null;case 31:if(c.memoizedState!==null){if(zr(c),c.alternate===null)throw Error(r(340));ws()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 13:if(zr(c),o=c.memoizedState,o!==null&&o.dehydrated!==null){if(c.alternate===null)throw Error(r(340));ws()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 19:return B(nn),null;case 4:return Z(),null;case 10:return Oi(c.type),null;case 22:case 23:return zr(c),Qx(),o!==null&&B(_s),o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 24:return Oi(on),null;case 25:return null;default:return null}}function i2(o,c){switch(Ix(c),c.tag){case 3:Oi(on),Z();break;case 26:case 27:case 5:je(c);break;case 4:Z();break;case 31:c.memoizedState!==null&&zr(c);break;case 13:zr(c);break;case 19:B(nn);break;case 10:Oi(c.type);break;case 22:case 23:zr(c),Qx(),o!==null&&B(_s);break;case 24:Oi(on)}}function jd(o,c){try{var h=c.updateQueue,v=h!==null?h.lastEffect:null;if(v!==null){var S=v.next;h=S;do{if((h.tag&o)===o){v=void 0;var _=h.create,M=h.inst;v=_(),M.destroy=v}h=h.next}while(h!==S)}}catch(z){St(c,c.return,z)}}function jo(o,c,h){try{var v=c.updateQueue,S=v!==null?v.lastEffect:null;if(S!==null){var _=S.next;v=_;do{if((v.tag&o)===o){var M=v.inst,z=M.destroy;if(z!==void 0){M.destroy=void 0,S=c;var X=h,se=z;try{se()}catch(ge){St(S,X,ge)}}}v=v.next}while(v!==_)}}catch(ge){St(c,c.return,ge)}}function o2(o){var c=o.updateQueue;if(c!==null){var h=o.stateNode;try{XA(c,h)}catch(v){St(o,o.return,v)}}}function s2(o,c,h){h.props=As(o.type,o.memoizedProps),h.state=o.memoizedState;try{h.componentWillUnmount()}catch(v){St(o,c,v)}}function Sd(o,c){try{var h=o.ref;if(h!==null){switch(o.tag){case 26:case 27:case 5:var v=o.stateNode;break;case 30:v=o.stateNode;break;default:v=o.stateNode}typeof h=="function"?o.refCleanup=h(v):h.current=v}}catch(S){St(o,c,S)}}function Ya(o,c){var h=o.ref,v=o.refCleanup;if(h!==null)if(typeof v=="function")try{v()}catch(S){St(o,c,S)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof h=="function")try{h(null)}catch(S){St(o,c,S)}else h.current=null}function l2(o){var c=o.type,h=o.memoizedProps,v=o.stateNode;try{e:switch(c){case"button":case"input":case"select":case"textarea":h.autoFocus&&v.focus();break e;case"img":h.src?v.src=h.src:h.srcSet&&(v.srcset=h.srcSet)}}catch(S){St(o,o.return,S)}}function Tb(o,c,h){try{var v=o.stateNode;nV(v,o.type,h,c),v[br]=c}catch(S){St(o,o.return,S)}}function c2(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Ao(o.type)||o.tag===4}function kb(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||c2(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Ao(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Pb(o,c,h){var v=o.tag;if(v===5||v===6)o=o.stateNode,c?(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h).insertBefore(o,c):(c=h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,c.appendChild(o),h=h._reactRootContainer,h!=null||c.onclick!==null||(c.onclick=wi));else if(v!==4&&(v===27&&Ao(o.type)&&(h=o.stateNode,c=null),o=o.child,o!==null))for(Pb(o,c,h),o=o.sibling;o!==null;)Pb(o,c,h),o=o.sibling}function Lm(o,c,h){var v=o.tag;if(v===5||v===6)o=o.stateNode,c?h.insertBefore(o,c):h.appendChild(o);else if(v!==4&&(v===27&&Ao(o.type)&&(h=o.stateNode),o=o.child,o!==null))for(Lm(o,c,h),o=o.sibling;o!==null;)Lm(o,c,h),o=o.sibling}function u2(o){var c=o.stateNode,h=o.memoizedProps;try{for(var v=o.type,S=c.attributes;S.length;)c.removeAttributeNode(S[0]);Yn(c,v,h),c[Hn]=o,c[br]=h}catch(_){St(o,o.return,_)}}var ki=!1,cn=!1,Mb=!1,d2=typeof WeakSet=="function"?WeakSet:Set,En=null;function D7(o,c){if(o=o.containerInfo,e0=ip,o=SA(o),Ox(o)){if("selectionStart"in o)var h={start:o.selectionStart,end:o.selectionEnd};else e:{h=(h=o.ownerDocument)&&h.defaultView||window;var v=h.getSelection&&h.getSelection();if(v&&v.rangeCount!==0){h=v.anchorNode;var S=v.anchorOffset,_=v.focusNode;v=v.focusOffset;try{h.nodeType,_.nodeType}catch{h=null;break e}var M=0,z=-1,X=-1,se=0,ge=0,we=o,ce=null;t:for(;;){for(var fe;we!==h||S!==0&&we.nodeType!==3||(z=M+S),we!==_||v!==0&&we.nodeType!==3||(X=M+v),we.nodeType===3&&(M+=we.nodeValue.length),(fe=we.firstChild)!==null;)ce=we,we=fe;for(;;){if(we===o)break t;if(ce===h&&++se===S&&(z=M),ce===_&&++ge===v&&(X=M),(fe=we.nextSibling)!==null)break;we=ce,ce=we.parentNode}we=fe}h=z===-1||X===-1?null:{start:z,end:X}}else h=null}h=h||{start:0,end:0}}else h=null;for(t0={focusedElem:o,selectionRange:h},ip=!1,En=c;En!==null;)if(c=En,o=c.child,(c.subtreeFlags&1028)!==0&&o!==null)o.return=c,En=o;else for(;En!==null;){switch(c=En,_=c.alternate,o=c.flags,c.tag){case 0:if((o&4)!==0&&(o=c.updateQueue,o=o!==null?o.events:null,o!==null))for(h=0;h title"))),Yn(_,v,h),_[Hn]=o,Cn(_),v=_;break e;case"link":var M=gk("link","href",S).get(v+(h.href||""));if(M){for(var z=0;zAt&&(M=At,At=ze,ze=M);var ne=wA(z,ze),Q=wA(z,At);if(ne&&Q&&(fe.rangeCount!==1||fe.anchorNode!==ne.node||fe.anchorOffset!==ne.offset||fe.focusNode!==Q.node||fe.focusOffset!==Q.offset)){var ie=we.createRange();ie.setStart(ne.node,ne.offset),fe.removeAllRanges(),ze>At?(fe.addRange(ie),fe.extend(Q.node,Q.offset)):(ie.setEnd(Q.node,Q.offset),fe.addRange(ie))}}}}for(we=[],fe=z;fe=fe.parentNode;)fe.nodeType===1&&we.push({element:fe,left:fe.scrollLeft,top:fe.scrollTop});for(typeof z.focus=="function"&&z.focus(),z=0;zh?32:h,L.T=null,h=zb,zb=null;var _=Oo,M=$i;if(gn=0,cc=Oo=null,$i=0,(vt&6)!==0)throw Error(r(331));var z=vt;if(vt|=4,j2(_.current),x2(_,_.current,M,h),vt=z,Ad(0,!1),mr&&typeof mr.onPostCommitFiberRoot=="function")try{mr.onPostCommitFiberRoot(fs,_)}catch{}return!0}finally{R.p=S,L.T=v,z2(o,c)}}function F2(o,c,h){c=oa(h,c),c=xb(o.stateNode,c,2),o=xo(o,c,2),o!==null&&(Ku(o,2),Ka(o))}function St(o,c,h){if(o.tag===3)F2(o,o,h);else for(;c!==null;){if(c.tag===3){F2(c,o,h);break}else if(c.tag===1){var v=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(No===null||!No.has(v))){o=oa(h,o),h=UT(2),v=xo(c,h,2),v!==null&&(HT(h,v,c,o),Ku(v,2),Ka(v));break}}c=c.return}}function Hb(o,c,h){var v=o.pingCache;if(v===null){v=o.pingCache=new L7;var S=new Set;v.set(c,S)}else S=v.get(c),S===void 0&&(S=new Set,v.set(c,S));S.has(h)||($b=!0,S.add(h),o=U7.bind(null,o,c,h),c.then(o,o))}function U7(o,c,h){var v=o.pingCache;v!==null&&v.delete(c),o.pingedLanes|=o.suspendedLanes&h,o.warmLanes&=~h,Rt===o&&(ot&h)===h&&(Qt===4||Qt===3&&(ot&62914560)===ot&&300>nt()-qm?(vt&2)===0&&uc(o,0):Ib|=h,lc===ot&&(lc=0)),Ka(o)}function U2(o,c){c===0&&(c=Pl()),o=xs(o,c),o!==null&&(Ku(o,c),Ka(o))}function H7(o){var c=o.memoizedState,h=0;c!==null&&(h=c.retryLane),U2(o,h)}function W7(o,c){var h=0;switch(o.tag){case 31:case 13:var v=o.stateNode,S=o.memoizedState;S!==null&&(h=S.retryLane);break;case 19:v=o.stateNode;break;case 22:v=o.stateNode._retryCache;break;default:throw Error(r(314))}v!==null&&v.delete(c),U2(o,h)}function V7(o,c){return fr(o,c)}var Ym=null,fc=null,Wb=!1,Km=!1,Vb=!1,Eo=0;function Ka(o){o!==fc&&o.next===null&&(fc===null?Ym=fc=o:fc=fc.next=o),Km=!0,Wb||(Wb=!0,Y7())}function Ad(o,c){if(!Vb&&Km){Vb=!0;do for(var h=!1,v=Ym;v!==null;){if(o!==0){var S=v.pendingLanes;if(S===0)var _=0;else{var M=v.suspendedLanes,z=v.pingedLanes;_=(1<<31-tr(42|o)+1)-1,_&=S&~(M&~z),_=_&201326741?_&201326741|1:_?_|2:0}_!==0&&(h=!0,G2(v,_))}else _=ot,_=kl(v,v===Rt?_:0,v.cancelPendingCommit!==null||v.timeoutHandle!==-1),(_&3)===0||hs(v,_)||(h=!0,G2(v,_));v=v.next}while(h);Vb=!1}}function G7(){H2()}function H2(){Km=Wb=!1;var o=0;Eo!==0&&aV()&&(o=Eo);for(var c=nt(),h=null,v=Ym;v!==null;){var S=v.next,_=W2(v,c);_===0?(v.next=null,h===null?Ym=S:h.next=S,S===null&&(fc=h)):(h=v,(o!==0||(_&3)!==0)&&(Km=!0)),v=S}gn!==0&&gn!==5||Ad(o),Eo!==0&&(Eo=0)}function W2(o,c){for(var h=o.suspendedLanes,v=o.pingedLanes,S=o.expirationTimes,_=o.pendingLanes&-62914561;0<_;){var M=31-tr(_),z=1<z)break;var ge=X.transferSize,we=X.initiatorType;ge&&tk(we)&&(X=X.responseEnd,M+=ge*(X"u"?null:document;function hk(o,c,h){var v=hc;if(v&&typeof c=="string"&&c){var S=aa(c);S='link[rel="'+o+'"][href="'+S+'"]',typeof h=="string"&&(S+='[crossorigin="'+h+'"]'),fk.has(S)||(fk.add(S),o={rel:o,crossOrigin:h,href:c},v.querySelector(S)===null&&(c=v.createElement("link"),Yn(c,"link",o),Cn(c),v.head.appendChild(c)))}}function hV(o){Ii.D(o),hk("dns-prefetch",o,null)}function mV(o,c){Ii.C(o,c),hk("preconnect",o,c)}function pV(o,c,h){Ii.L(o,c,h);var v=hc;if(v&&o&&c){var S='link[rel="preload"][as="'+aa(c)+'"]';c==="image"&&h&&h.imageSrcSet?(S+='[imagesrcset="'+aa(h.imageSrcSet)+'"]',typeof h.imageSizes=="string"&&(S+='[imagesizes="'+aa(h.imageSizes)+'"]')):S+='[href="'+aa(o)+'"]';var _=S;switch(c){case"style":_=mc(o);break;case"script":_=pc(o)}fa.has(_)||(o=p({rel:"preload",href:c==="image"&&h&&h.imageSrcSet?void 0:o,as:c},h),fa.set(_,o),v.querySelector(S)!==null||c==="style"&&v.querySelector(Md(_))||c==="script"&&v.querySelector(Rd(_))||(c=v.createElement("link"),Yn(c,"link",o),Cn(c),v.head.appendChild(c)))}}function vV(o,c){Ii.m(o,c);var h=hc;if(h&&o){var v=c&&typeof c.as=="string"?c.as:"script",S='link[rel="modulepreload"][as="'+aa(v)+'"][href="'+aa(o)+'"]',_=S;switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":_=pc(o)}if(!fa.has(_)&&(o=p({rel:"modulepreload",href:o},c),fa.set(_,o),h.querySelector(S)===null)){switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(h.querySelector(Rd(_)))return}v=h.createElement("link"),Yn(v,"link",o),Cn(v),h.head.appendChild(v)}}}function gV(o,c,h){Ii.S(o,c,h);var v=hc;if(v&&o){var S=$l(v).hoistableStyles,_=mc(o);c=c||"default";var M=S.get(_);if(!M){var z={loading:0,preload:null};if(M=v.querySelector(Md(_)))z.loading=5;else{o=p({rel:"stylesheet",href:o,"data-precedence":c},h),(h=fa.get(_))&&l0(o,h);var X=M=v.createElement("link");Cn(X),Yn(X,"link",o),X._p=new Promise(function(se,ge){X.onload=se,X.onerror=ge}),X.addEventListener("load",function(){z.loading|=1}),X.addEventListener("error",function(){z.loading|=2}),z.loading|=4,ep(M,c,v)}M={type:"stylesheet",instance:M,count:1,state:z},S.set(_,M)}}}function yV(o,c){Ii.X(o,c);var h=hc;if(h&&o){var v=$l(h).hoistableScripts,S=pc(o),_=v.get(S);_||(_=h.querySelector(Rd(S)),_||(o=p({src:o,async:!0},c),(c=fa.get(S))&&c0(o,c),_=h.createElement("script"),Cn(_),Yn(_,"link",o),h.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},v.set(S,_))}}function xV(o,c){Ii.M(o,c);var h=hc;if(h&&o){var v=$l(h).hoistableScripts,S=pc(o),_=v.get(S);_||(_=h.querySelector(Rd(S)),_||(o=p({src:o,async:!0,type:"module"},c),(c=fa.get(S))&&c0(o,c),_=h.createElement("script"),Cn(_),Yn(_,"link",o),h.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},v.set(S,_))}}function mk(o,c,h,v){var S=(S=xe.current)?Jm(S):null;if(!S)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof h.precedence=="string"&&typeof h.href=="string"?(c=mc(h.href),h=$l(S).hoistableStyles,v=h.get(c),v||(v={type:"style",instance:null,count:0,state:null},h.set(c,v)),v):{type:"void",instance:null,count:0,state:null};case"link":if(h.rel==="stylesheet"&&typeof h.href=="string"&&typeof h.precedence=="string"){o=mc(h.href);var _=$l(S).hoistableStyles,M=_.get(o);if(M||(S=S.ownerDocument||S,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},_.set(o,M),(_=S.querySelector(Md(o)))&&!_._p&&(M.instance=_,M.state.loading=5),fa.has(o)||(h={rel:"preload",as:"style",href:h.href,crossOrigin:h.crossOrigin,integrity:h.integrity,media:h.media,hrefLang:h.hrefLang,referrerPolicy:h.referrerPolicy},fa.set(o,h),_||bV(S,o,h,M.state))),c&&v===null)throw Error(r(528,""));return M}if(c&&v!==null)throw Error(r(529,""));return null;case"script":return c=h.async,h=h.src,typeof h=="string"&&c&&typeof c!="function"&&typeof c!="symbol"?(c=pc(h),h=$l(S).hoistableScripts,v=h.get(c),v||(v={type:"script",instance:null,count:0,state:null},h.set(c,v)),v):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function mc(o){return'href="'+aa(o)+'"'}function Md(o){return'link[rel="stylesheet"]['+o+"]"}function pk(o){return p({},o,{"data-precedence":o.precedence,precedence:null})}function bV(o,c,h,v){o.querySelector('link[rel="preload"][as="style"]['+c+"]")?v.loading=1:(c=o.createElement("link"),v.preload=c,c.addEventListener("load",function(){return v.loading|=1}),c.addEventListener("error",function(){return v.loading|=2}),Yn(c,"link",h),Cn(c),o.head.appendChild(c))}function pc(o){return'[src="'+aa(o)+'"]'}function Rd(o){return"script[async]"+o}function vk(o,c,h){if(c.count++,c.instance===null)switch(c.type){case"style":var v=o.querySelector('style[data-href~="'+aa(h.href)+'"]');if(v)return c.instance=v,Cn(v),v;var S=p({},h,{"data-href":h.href,"data-precedence":h.precedence,href:null,precedence:null});return v=(o.ownerDocument||o).createElement("style"),Cn(v),Yn(v,"style",S),ep(v,h.precedence,o),c.instance=v;case"stylesheet":S=mc(h.href);var _=o.querySelector(Md(S));if(_)return c.state.loading|=4,c.instance=_,Cn(_),_;v=pk(h),(S=fa.get(S))&&l0(v,S),_=(o.ownerDocument||o).createElement("link"),Cn(_);var M=_;return M._p=new Promise(function(z,X){M.onload=z,M.onerror=X}),Yn(_,"link",v),c.state.loading|=4,ep(_,h.precedence,o),c.instance=_;case"script":return _=pc(h.src),(S=o.querySelector(Rd(_)))?(c.instance=S,Cn(S),S):(v=h,(S=fa.get(_))&&(v=p({},h),c0(v,S)),o=o.ownerDocument||o,S=o.createElement("script"),Cn(S),Yn(S,"link",v),o.head.appendChild(S),c.instance=S);case"void":return null;default:throw Error(r(443,c.type))}else c.type==="stylesheet"&&(c.state.loading&4)===0&&(v=c.instance,c.state.loading|=4,ep(v,h.precedence,o));return c.instance}function ep(o,c,h){for(var v=h.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),S=v.length?v[v.length-1]:null,_=S,M=0;M title"):null)}function wV(o,c,h){if(h===1||c.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof c.precedence!="string"||typeof c.href!="string"||c.href==="")break;return!0;case"link":if(typeof c.rel!="string"||typeof c.href!="string"||c.href===""||c.onLoad||c.onError)break;switch(c.rel){case"stylesheet":return o=c.disabled,typeof c.precedence=="string"&&o==null;default:return!0}case"script":if(c.async&&typeof c.async!="function"&&typeof c.async!="symbol"&&!c.onLoad&&!c.onError&&c.src&&typeof c.src=="string")return!0}return!1}function xk(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function jV(o,c,h,v){if(h.type==="stylesheet"&&(typeof v.media!="string"||matchMedia(v.media).matches!==!1)&&(h.state.loading&4)===0){if(h.instance===null){var S=mc(v.href),_=c.querySelector(Md(S));if(_){c=_._p,c!==null&&typeof c=="object"&&typeof c.then=="function"&&(o.count++,o=np.bind(o),c.then(o,o)),h.state.loading|=4,h.instance=_,Cn(_);return}_=c.ownerDocument||c,v=pk(v),(S=fa.get(S))&&l0(v,S),_=_.createElement("link"),Cn(_);var M=_;M._p=new Promise(function(z,X){M.onload=z,M.onerror=X}),Yn(_,"link",v),h.instance=_}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(h,c),(c=h.state.preload)&&(h.state.loading&3)===0&&(o.count++,h=np.bind(o),c.addEventListener("load",h),c.addEventListener("error",h))}}var u0=0;function SV(o,c){return o.stylesheets&&o.count===0&&ap(o,o.stylesheets),0u0?50:800)+c);return o.unsuspend=h,function(){o.unsuspend=null,clearTimeout(v),clearTimeout(S)}}:null}function np(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ap(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var rp=null;function ap(o,c){o.stylesheets=null,o.unsuspend!==null&&(o.count++,rp=new Map,c.forEach(_V,o),rp=null,np.call(o))}function _V(o,c){if(!(c.state.loading&4)){var h=rp.get(o);if(h)var v=h.get(null);else{h=new Map,rp.set(o,h);for(var S=o.querySelectorAll("link[data-precedence],style[data-precedence]"),_=0;_"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),x0.exports=zV(),x0.exports}var FV=qV();const o_=new WeakMap,UV=new WeakMap,av={current:[]};let S0=!1,hf=0;const rf=new Set,hp=new Map;function M3(e){for(const t of e){if(av.current.includes(t))continue;av.current.push(t),t.recompute();const n=UV.get(t);if(n)for(const r of n){const a=o_.get(r);a?.length&&M3(a)}}}function HV(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function WV(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function R3(e){if(hf>0&&!hp.has(e)&&hp.set(e,e.prevState),rf.add(e),!(hf>0)&&!S0)try{for(S0=!0;rf.size>0;){const t=Array.from(rf);rf.clear();for(const n of t){const r=hp.get(n)??n.prevState;n.prevState=r,HV(n)}for(const n of t){const r=o_.get(n);r&&(av.current.push(n),M3(r))}for(const n of t){const r=o_.get(n);if(r)for(const a of r)WV(a)}}}finally{S0=!1,av.current=[],hp.clear()}}function mf(e){hf++;try{e()}finally{if(hf--,hf===0){const t=rf.values().next().value;t&&R3(t)}}}function VV(e){return typeof e=="function"}class GV{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var a,i;this.listeners.add(r);const l=(i=(a=this.options)==null?void 0:a.onSubscribe)==null?void 0:i.call(a,r,this);return()=>{this.listeners.delete(r),l?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,a;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):VV(t)?this.state=t(this.prevState):this.state=t,(a=(r=this.options)==null?void 0:r.onUpdate)==null||a.call(r),R3(this)}}const Uo="__TSR_index",Uk="popstate",Hk="beforeunload";function YV(e){let t=e.getLocation();const n=new Set,r=l=>{t=e.getLocation(),n.forEach(u=>u({location:t,action:l}))},a=l=>{e.notifyOnIndexChange??!0?r(l):t=e.getLocation()},i=async({task:l,navigateOpts:u,...d})=>{if(u?.ignoreBlocker??!1){l();return}const m=e.getBlockers?.()??[],p=d.type==="PUSH"||d.type==="REPLACE";if(typeof document<"u"&&m.length&&p)for(const g of m){const x=iv(d.path,d.state);if(await g.blockerFn({currentLocation:t,nextLocation:x,action:d.type})){e.onBlocked?.();return}}l()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:l=>(n.add(l),()=>{n.delete(l)}),push:(l,u,d)=>{const f=t.state[Uo];u=Wk(f+1,u),i({task:()=>{e.pushState(l,u),r({type:"PUSH"})},navigateOpts:d,type:"PUSH",path:l,state:u})},replace:(l,u,d)=>{const f=t.state[Uo];u=Wk(f,u),i({task:()=>{e.replaceState(l,u),r({type:"REPLACE"})},navigateOpts:d,type:"REPLACE",path:l,state:u})},go:(l,u)=>{i({task:()=>{e.go(l),a({type:"GO",index:l})},navigateOpts:u,type:"GO"})},back:l=>{i({task:()=>{e.back(l?.ignoreBlocker??!1),a({type:"BACK"})},navigateOpts:l,type:"BACK"})},forward:l=>{i({task:()=>{e.forward(l?.ignoreBlocker??!1),a({type:"FORWARD"})},navigateOpts:l,type:"FORWARD"})},canGoBack:()=>t.state[Uo]!==0,createHref:l=>e.createHref(l),block:l=>{if(!e.setBlockers)return()=>{};const u=e.getBlockers?.()??[];return e.setBlockers([...u,l]),()=>{const d=e.getBlockers?.()??[];e.setBlockers?.(d.filter(f=>f!==l))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Wk(e,t){t||(t={});const n=yO();return{...t,key:n,__TSR_key:n,[Uo]:e}}function KV(e){const t=typeof document<"u"?window:void 0,n=t.history.pushState,r=t.history.replaceState;let a=[];const i=()=>a,l=P=>a=P,u=(P=>P),d=(()=>iv(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const P=yO();t.history.replaceState({[Uo]:0,key:P,__TSR_key:P},"")}let f=d(),m,p=!1,g=!1,x=!1,j=!1;const b=()=>f;let w,N;const O=()=>{w&&(T._ignoreSubscribers=!0,(w.isPush?t.history.pushState:t.history.replaceState)(w.state,"",w.href),T._ignoreSubscribers=!1,w=void 0,N=void 0,m=void 0)},C=(P,$,F)=>{const D=u($);N||(m=f),f=iv($,F),w={href:D,state:F,isPush:w?.isPush||P==="push"},N||(N=Promise.resolve().then(()=>O()))},A=P=>{f=d(),T.notify({type:P})},E=async()=>{if(g){g=!1;return}const P=d(),$=P.state[Uo]-f.state[Uo],F=$===1,D=$===-1,U=!F&&!D||p;p=!1;const V=U?"GO":D?"BACK":"FORWARD",H=U?{type:"GO",index:$}:{type:D?"BACK":"FORWARD"};if(x)x=!1;else{const G=i();if(typeof document<"u"&&G.length){for(const L of G)if(await L.blockerFn({currentLocation:f,nextLocation:P,action:V})){g=!0,t.history.go(1),T.notify(H);return}}}f=d(),T.notify(H)},k=P=>{if(j){j=!1;return}let $=!1;const F=i();if(typeof document<"u"&&F.length)for(const D of F){const U=D.enableBeforeUnload??!0;if(U===!0){$=!0;break}if(typeof U=="function"&&U()===!0){$=!0;break}}if($)return P.preventDefault(),P.returnValue=""},T=YV({getLocation:b,getLength:()=>t.history.length,pushState:(P,$)=>C("push",P,$),replaceState:(P,$)=>C("replace",P,$),back:P=>(P&&(x=!0),j=!0,t.history.back()),forward:P=>{P&&(x=!0),j=!0,t.history.forward()},go:P=>{p=!0,t.history.go(P)},createHref:P=>u(P),flush:O,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Hk,k,{capture:!0}),t.removeEventListener(Uk,E)},onBlocked:()=>{m&&f!==m&&(f=m)},getBlockers:i,setBlockers:l,notifyOnIndexChange:!1});return t.addEventListener(Hk,k,{capture:!0}),t.addEventListener(Uk,E),t.history.pushState=function(...P){const $=n.apply(t.history,P);return T._ignoreSubscribers||A("PUSH"),$},t.history.replaceState=function(...P){const $=r.apply(t.history,P);return T._ignoreSubscribers||A("REPLACE"),$},T}function iv(e,t){const n=e.indexOf("#"),r=e.indexOf("?"),a=yO();return{href:e,pathname:e.substring(0,n>0?r>0?Math.min(n,r):n:r>0?r:e.length),hash:n>-1?e.substring(n):"",search:r>-1?e.slice(r,n===-1?void 0:n):"",state:t||{[Uo]:0,key:a,__TSR_key:a}}}function yO(){return(Math.random()+1).toString(36).substring(7)}function s_(e){return e[e.length-1]}function XV(e){return typeof e=="function"}function Vs(e,t){return XV(e)?e(t):e}const ZV=Object.prototype.hasOwnProperty;function ga(e,t){if(e===t)return e;const n=t,r=Yk(e)&&Yk(n);if(!r&&!(ov(e)&&ov(n)))return n;const a=r?e:Vk(e);if(!a)return n;const i=r?n:Vk(n);if(!i)return n;const l=a.length,u=i.length,d=r?new Array(u):{};let f=0;for(let m=0;m"u")return!0;const n=t.prototype;return!(!Gk(n)||!n.hasOwnProperty("isPrototypeOf"))}function Gk(e){return Object.prototype.toString.call(e)==="[object Object]"}function Yk(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Gs(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,a=e.length;ra||!Gs(e[l],t[l],n)))return!1;return a===i}return!1}function Gc(e){let t,n;const r=new Promise((a,i)=>{t=a,n=i});return r.status="pending",r.resolve=a=>{r.status="resolved",r.value=a,t(a),e?.(a)},r.reject=a=>{r.status="rejected",n(a)},r}function Ho(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}const QV=Array.from(new Map([["%","%25"],["\\","%5C"]]).values());function Kk(e,t=QV){function n(a,i,l=0){for(let u=l;u{try{return decodeURI(u)}catch{return u}})}}if(e===""||!/%[0-9A-Fa-f]{2}/g.test(e))return e;const r=e.replaceAll(/%[0-9a-f]{2}/g,a=>a.toUpperCase());return n(r,t)}var JV="Invariant failed";function sr(e,t){if(!e)throw new Error(JV)}const si=0,nl=1,Yc=2,Kc=3;function Yi(e){return xO(e.filter(t=>t!==void 0).join("/"))}function xO(e){return e.replace(/\/{2,}/g,"/")}function bO(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Wo(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function Wp(e){return Wo(bO(e))}function sv(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function eG(e,t,n){return sv(e,n)===sv(t,n)}function tG(e){const{type:t,value:n}=e;if(t===si)return n;const{prefixSegment:r,suffixSegment:a}=e;if(t===nl){const i=n.substring(1);if(r&&a)return`${r}{$${i}}${a}`;if(r)return`${r}{$${i}}`;if(a)return`{$${i}}${a}`}if(t===Kc){const i=n.substring(1);return r&&a?`${r}{-$${i}}${a}`:r?`${r}{-$${i}}`:a?`{-$${i}}${a}`:`{-$${i}}`}if(t===Yc){if(r&&a)return`${r}{$}${a}`;if(r)return`${r}{$}`;if(a)return`{$}${a}`}return n}function nG({base:e,to:t,trailingSlash:n="never",parseCache:r}){let a=Xc(e,r).slice();const i=Xc(t,r);a.length>1&&s_(a)?.value==="/"&&a.pop();for(let d=0,f=i.length;d1&&(s_(a).value==="/"?n==="never"&&a.pop():n==="always"&&a.push({type:si,value:"/"}));const l=a.map(tG);return Yi(l)}const Xc=(e,t)=>{if(!e)return[];const n=t?.get(e);if(n)return n;const r=lG(e);return t?.set(e,r),r},rG=/^\$.{1,}$/,aG=/^(.*?)\{(\$[a-zA-Z_$][a-zA-Z0-9_$]*)\}(.*)$/,iG=/^(.*?)\{-(\$[a-zA-Z_$][a-zA-Z0-9_$]*)\}(.*)$/,oG=/^\$$/,sG=/^(.*?)\{\$\}(.*)$/;function lG(e){e=xO(e);const t=[];if(e.slice(0,1)==="/"&&(e=e.substring(1),t.push({type:si,value:"/"})),!e)return t;const n=e.split("/").filter(Boolean);return t.push(...n.map(r=>{const a=r.match(sG);if(a){const u=a[1],d=a[2];return{type:Yc,value:"$",prefixSegment:u||void 0,suffixSegment:d||void 0}}const i=r.match(iG);if(i){const u=i[1],d=i[2],f=i[3];return{type:Kc,value:d,prefixSegment:u||void 0,suffixSegment:f||void 0}}const l=r.match(aG);if(l){const u=l[1],d=l[2],f=l[3];return{type:nl,value:""+d,prefixSegment:u||void 0,suffixSegment:f||void 0}}if(rG.test(r)){const u=r.substring(1);return{type:nl,value:"$"+u,prefixSegment:void 0,suffixSegment:void 0}}return oG.test(r)?{type:Yc,value:"$",prefixSegment:void 0,suffixSegment:void 0}:{type:si,value:r}})),e.slice(-1)==="/"&&(e=e.substring(1),t.push({type:si,value:"/"})),t}function _0({path:e,params:t,decodeCharMap:n,parseCache:r}){const a=Xc(e,r);function i(f){const m=t[f],p=typeof m=="string";return f==="*"||f==="_splat"?p?encodeURI(m):m:p?cG(m,n):m}let l=!1;const u={},d=Yi(a.map(f=>{if(f.type===si)return f.value;if(f.type===Yc){u._splat=t._splat,u["*"]=t._splat;const m=f.prefixSegment||"",p=f.suffixSegment||"";if(!t._splat)return l=!0,m||p?`${m}${p}`:void 0;const g=i("_splat");return`${m}${g}${p}`}if(f.type===nl){const m=f.value.substring(1);!l&&!(m in t)&&(l=!0),u[m]=t[m];const p=f.prefixSegment||"",g=f.suffixSegment||"";return`${p}${i(m)??"undefined"}${g}`}if(f.type===Kc){const m=f.value.substring(1),p=f.prefixSegment||"",g=f.suffixSegment||"";return!(m in t)||t[m]==null?p||g?`${p}${g}`:void 0:(u[m]=t[m],`${p}${i(m)??""}${g}`)}return f.value}));return{usedParams:u,interpolatedPath:d,isMissingParams:l}}function cG(e,t){let n=encodeURIComponent(e);if(t)for(const[r,a]of t)n=n.replaceAll(r,a);return n}function l_(e,t,n){const r=uG(e,t,n);if(!(t.to&&!r))return r??{}}function uG(e,{to:t,fuzzy:n,caseSensitive:r},a){const i=t,l=Xc(e.startsWith("/")?e:`/${e}`,a),u=Xc(i.startsWith("/")?i:`/${i}`,a),d={};return dG(l,u,d,n,r)?d:void 0}function dG(e,t,n,r,a){let i=0,l=0;for(;ib.value)));p&&j.startsWith(p)&&(j=j.slice(p.length)),g&&j.endsWith(g)&&(j=j.slice(0,j.length-g.length)),m=j}else m=decodeURI(Yi(f.map(p=>p.value)));return n["*"]=m,n._splat=m,!0}if(d.type===si){if(d.value==="/"&&!u?.value){l++;continue}if(u){if(a){if(d.value!==u.value)return!1}else if(d.value.toLowerCase()!==u.value.toLowerCase())return!1;i++,l++;continue}else return!1}if(d.type===nl){if(!u||u.value==="/")return!1;let f="",m=!1;if(d.prefixSegment||d.suffixSegment){const p=d.prefixSegment||"",g=d.suffixSegment||"",x=u.value;if(p&&!x.startsWith(p)||g&&!x.endsWith(g))return!1;let j=x;p&&j.startsWith(p)&&(j=j.slice(p.length)),g&&j.endsWith(g)&&(j=j.slice(0,j.length-g.length)),f=decodeURIComponent(j),m=!0}else f=decodeURIComponent(u.value),m=!0;m&&(n[d.value.substring(1)]=f,i++),l++;continue}if(d.type===Kc){if(!u){l++;continue}if(u.value==="/"){l++;continue}let f="",m=!1;if(d.prefixSegment||d.suffixSegment){const p=d.prefixSegment||"",g=d.suffixSegment||"",x=u.value;if((!p||x.startsWith(p))&&(!g||x.endsWith(g))){let j=x;p&&j.startsWith(p)&&(j=j.slice(p.length)),g&&j.endsWith(g)&&(j=j.slice(0,j.length-g.length)),f=decodeURIComponent(j),m=!0}}else{let p=!0;for(let g=l+1;g=t.length)return n["**"]=Yi(e.slice(i).map(f=>f.value)),!!r&&t[t.length-1]?.value!=="/";if(l=e.length){for(let f=l;f{if(r.isRoot||!r.path)return;const i=bO(r.fullPath);let l=Xc(i),u=0;for(;l.length>u+1&&l[u]?.value==="/";)u++;u>0&&(l=l.slice(u));let d=0,f=!1;const m=l.map((p,g)=>{if(p.value==="/")return fG;if(p.type===si)return hG;let x;p.type===nl?x=mG:p.type===Kc?(x=pG,d++):x=vG;for(let j=g+1;j{const i=Math.min(r.scores.length,a.scores.length);for(let l=0;la.parsed[l].value?1:-1;return r.index-a.index}).map((r,a)=>(r.child.rank=a,r.child))}function jG({routeTree:e,initRoute:t}){const n={},r={},a=l=>{l.forEach((u,d)=>{t?.(u,d);const f=n[u.id];if(sr(!f,`Duplicate routes found with id: ${String(u.id)}`),n[u.id]=u,!u.isRoot&&u.path){const p=Wo(u.fullPath);(!r[p]||u.fullPath.endsWith("/"))&&(r[p]=u)}const m=u.children;m?.length&&a(m)})};a([e]);const i=wG(Object.values(n));return{routesById:n,routesByPath:r,flatRoutes:i}}function La(e){return!!e?.isNotFound}function SG(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}const lv="tsr-scroll-restoration-v1_3",_G=(e,t)=>{let n;return(...r)=>{n||(n=setTimeout(()=>{e(...r),n=null},t))}};function NG(){const e=SG();if(!e)return null;const t=e.getItem(lv);let n=t?JSON.parse(t):{};return{state:n,set:r=>(n=Vs(r,n)||n,e.setItem(lv,JSON.stringify(n)))}}const mp=NG(),c_=e=>e.state.__TSR_key||e.href;function OG(e){const t=[];let n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(" > ")}`.toLowerCase()}let cv=!1;function D3({storageKey:e,key:t,behavior:n,shouldScrollRestoration:r,scrollToTopSelectors:a,location:i}){let l;try{l=JSON.parse(sessionStorage.getItem(e)||"{}")}catch(f){console.error(f);return}const u=t||window.history.state?.__TSR_key,d=l[u];cv=!0;e:{if(r&&d&&Object.keys(d).length>0){for(const p in d){const g=d[p];if(p==="window")window.scrollTo({top:g.scrollY,left:g.scrollX,behavior:n});else if(p){const x=document.querySelector(p);x&&(x.scrollLeft=g.scrollX,x.scrollTop=g.scrollY)}}break e}const f=(i??window.location).hash.split("#",2)[1];if(f){const p=window.history.state?.__hashScrollIntoViewOptions??!0;if(p){const g=document.getElementById(f);g&&g.scrollIntoView(p)}break e}const m={top:0,left:0,behavior:n};if(window.scrollTo(m),a)for(const p of a){if(p==="window")continue;const g=typeof p=="function"?p():document.querySelector(p);g&&g.scrollTo(m)}}cv=!1}function CG(e,t){if(!mp&&!e.isServer||((e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isServer||e.isScrollRestorationSetup||!mp))return;e.isScrollRestorationSetup=!0,cv=!1;const r=e.options.getScrollRestorationKey||c_;window.history.scrollRestoration="manual";const a=i=>{if(cv||!e.isScrollRestoring)return;let l="";if(i.target===document||i.target===window)l="window";else{const d=i.target.getAttribute("data-scroll-restoration-id");d?l=`[data-scroll-restoration-id="${d}"]`:l=OG(i.target)}const u=r(e.state.location);mp.set(d=>{const f=d[u]||={},m=f[l]||={};if(l==="window")m.scrollX=window.scrollX||0,m.scrollY=window.scrollY||0;else if(l){const p=document.querySelector(l);p&&(m.scrollX=p.scrollLeft||0,m.scrollY=p.scrollTop||0)}return d})};typeof document<"u"&&document.addEventListener("scroll",_G(a,100),!0),e.subscribe("onRendered",i=>{const l=r(i.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation})||(D3({storageKey:lv,key:l,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&mp.set(u=>(u[l]||={},u)))})}function EG(e){if(typeof document<"u"&&document.querySelector){const t=e.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&e.state.location.hash!==""){const n=document.getElementById(e.state.location.hash);n&&n.scrollIntoView(t)}}}function AG(e,t=String){const n=new URLSearchParams;for(const r in e){const a=e[r];a!==void 0&&n.set(r,t(a))}return n.toString()}function N0(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function TG(e){const t=new URLSearchParams(e),n={};for(const[r,a]of t.entries()){const i=n[r];i==null?n[r]=N0(a):Array.isArray(i)?i.push(N0(a)):n[r]=[i,N0(a)]}return n}const kG=MG(JSON.parse),PG=RG(JSON.stringify,JSON.parse);function MG(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=TG(t);for(const r in n){const a=n[r];if(typeof a=="string")try{n[r]=e(a)}catch{}}return n}}function RG(e,t){const n=typeof t=="function";function r(a){if(typeof a=="object"&&a!==null)try{return e(a)}catch{}else if(n&&typeof a=="string")try{return t(a),e(a)}catch{}return a}return a=>{const i=AG(a,r);return i?`?${i}`:""}}const Yr="__root__";function $3(e){if(e.statusCode=e.statusCode||e.code||307,!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function ni(e){return e instanceof Response&&!!e.options}function DG(e){const t=new Map;let n,r;const a=i=>{i.next&&(i.prev?(i.prev.next=i.next,i.next.prev=i.prev,i.next=void 0,r&&(r.next=i,i.prev=r)):(i.next.prev=void 0,n=i.next,i.next=void 0,r&&(i.prev=r,r.next=i)),r=i)};return{get(i){const l=t.get(i);if(l)return a(l),l.value},set(i,l){if(t.size>=e&&n){const d=n;t.delete(d.key),d.next&&(n=d.next,d.next.prev=void 0),d===r&&(r=void 0)}const u=t.get(i);if(u)u.value=l,a(u);else{const d={key:i,value:l,prev:r};r&&(r.next=d),r=d,n||(n=d),t.set(i,d)}}}}const Vp=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Ag=(e,t)=>!!(e.preload&&!e.router.state.matches.some(n=>n.id===t)),I3=(e,t)=>{const n=e.router.routesById[t.routeId??""]??e.router.routeTree;!n.options.notFoundComponent&&e.router.options?.defaultNotFoundComponent&&(n.options.notFoundComponent=e.router.options.defaultNotFoundComponent),sr(n.options.notFoundComponent);const r=e.matches.find(a=>a.routeId===n.id);sr(r,"Could not find match for route: "+n.id),e.updateMatch(r.id,a=>({...a,status:"notFound",error:t,isFetching:!1})),t.routerCode==="BEFORE_LOAD"&&n.parentRoute&&(t.routeId=n.parentRoute.id,I3(e,t))},zo=(e,t,n)=>{if(!(!ni(n)&&!La(n))){if(ni(n)&&n.redirectHandled&&!n.options.reloadDocument)throw n;if(t){t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0;const r=ni(n)?"redirected":"notFound";t._nonReactive.error=n,e.updateMatch(t.id,a=>({...a,status:r,isFetching:!1,error:n})),La(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()}throw ni(n)?(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n),n):(I3(e,n),n)}},L3=(e,t)=>{const n=e.router.getMatch(t);return!!(!e.router.isServer&&n._nonReactive.dehydrated||e.router.isServer&&n.ssr===!1)},qd=(e,t,n,r)=>{const{id:a,routeId:i}=e.matches[t],l=e.router.looseRoutesById[i];if(n instanceof Promise)throw n;n.routerCode=r,e.firstBadMatchIndex??=t,zo(e,e.router.getMatch(a),n);try{l.options.onError?.(n)}catch(u){n=u,zo(e,e.router.getMatch(a),n)}e.updateMatch(a,u=>(u._nonReactive.beforeLoadPromise?.resolve(),u._nonReactive.beforeLoadPromise=void 0,u._nonReactive.loadPromise?.resolve(),{...u,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}))},$G=(e,t,n,r)=>{const a=e.router.getMatch(t),i=e.matches[n-1]?.id,l=i?e.router.getMatch(i):void 0;if(e.router.isShell()){a.ssr=r.id===Yr;return}if(l?.ssr===!1){a.ssr=!1;return}const u=x=>x===!0&&l?.ssr==="data-only"?"data-only":x,d=e.router.options.defaultSsr??!0;if(r.options.ssr===void 0){a.ssr=u(d);return}if(typeof r.options.ssr!="function"){a.ssr=u(r.options.ssr);return}const{search:f,params:m}=a,p={search:pp(f,a.searchError),params:pp(m,a.paramsError),location:e.location,matches:e.matches.map(x=>({index:x.index,pathname:x.pathname,fullPath:x.fullPath,staticData:x.staticData,id:x.id,routeId:x.routeId,search:pp(x.search,x.searchError),params:pp(x.params,x.paramsError),ssr:x.ssr}))},g=r.options.ssr(p);if(Ho(g))return g.then(x=>{a.ssr=u(x??d)});a.ssr=u(g??d)},B3=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;const a=n.options.pendingMs??e.router.options.defaultPendingMs;if(!!(e.onReady&&!e.router.isServer&&!Ag(e,t)&&(n.options.loader||n.options.beforeLoad||F3(n))&&typeof a=="number"&&a!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent))){const l=setTimeout(()=>{Vp(e)},a);r._nonReactive.pendingTimeout=l}},IG=(e,t,n)=>{const r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;B3(e,t,n,r);const a=()=>{const i=e.router.getMatch(t);i.preload&&(i.status==="redirected"||i.status==="notFound")&&zo(e,i,i.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(a):a()},LG=(e,t,n,r)=>{const a=e.router.getMatch(t),i=a._nonReactive.loadPromise;a._nonReactive.loadPromise=Gc(()=>{i?.resolve()});const{paramsError:l,searchError:u}=a;l&&qd(e,n,l,"PARSE_PARAMS"),u&&qd(e,n,u,"VALIDATE_SEARCH"),B3(e,t,r,a);const d=new AbortController,f=e.matches[n-1]?.id,g={...(f?e.router.getMatch(f):void 0)?.context??e.router.options.context??void 0,...a.__routeContext};let x=!1;const j=()=>{x||(x=!0,e.updateMatch(t,T=>({...T,isFetching:"beforeLoad",fetchCount:T.fetchCount+1,abortController:d,context:g})))},b=()=>{a._nonReactive.beforeLoadPromise?.resolve(),a._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,T=>({...T,isFetching:!1}))};if(!r.options.beforeLoad){mf(()=>{j(),b()});return}a._nonReactive.beforeLoadPromise=Gc();const{search:w,params:N,cause:O}=a,C=Ag(e,t),A={search:w,abortController:d,params:N,preload:C,context:g,location:e.location,navigate:T=>e.router.navigate({...T,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:C?"preload":O,matches:e.matches,...e.router.options.additionalContext},E=T=>{if(T===void 0){mf(()=>{j(),b()});return}(ni(T)||La(T))&&(j(),qd(e,n,T,"BEFORE_LOAD")),mf(()=>{j(),e.updateMatch(t,P=>({...P,__beforeLoadContext:T,context:{...P.context,...T}})),b()})};let k;try{if(k=r.options.beforeLoad(A),Ho(k))return j(),k.catch(T=>{qd(e,n,T,"BEFORE_LOAD")}).then(E)}catch(T){j(),qd(e,n,T,"BEFORE_LOAD")}E(k)},BG=(e,t)=>{const{id:n,routeId:r}=e.matches[t],a=e.router.looseRoutesById[r],i=()=>{if(e.router.isServer){const d=$G(e,n,t,a);if(Ho(d))return d.then(u)}return u()},l=()=>LG(e,n,t,a),u=()=>{if(L3(e,n))return;const d=IG(e,n,a);return Ho(d)?d.then(l):l()};return i()},pf=(e,t,n)=>{const r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const a={matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(a),n.options.scripts?.(a),n.options.headers?.(a)]).then(([i,l,u])=>{const d=i?.meta,f=i?.links,m=i?.scripts,p=i?.styles;return{meta:d,links:f,headScripts:m,headers:u,scripts:l,styles:p}})},z3=(e,t,n,r)=>{const a=e.matchPromises[n-1],{params:i,loaderDeps:l,abortController:u,cause:d}=e.router.getMatch(t);let f=e.router.options.context??{};for(let p=0;p<=n;p++){const g=e.matches[p];if(!g)continue;const x=e.router.getMatch(g.id);x&&(f={...f,...x.__routeContext??{},...x.__beforeLoadContext??{}})}const m=Ag(e,t);return{params:i,deps:l,preload:!!m,parentMatchPromise:a,abortController:u,context:f,location:e.location,navigate:p=>e.router.navigate({...p,_fromLocation:e.location}),cause:m?"preload":d,route:r,...e.router.options.additionalContext}},Jk=async(e,t,n,r)=>{try{const a=e.router.getMatch(t);try{(!e.router.isServer||a.ssr===!0)&&q3(r);const i=r.options.loader?.(z3(e,t,n,r)),l=r.options.loader&&Ho(i);if(!!(l||r._lazyPromise||r._componentsPromise||r.options.head||r.options.scripts||r.options.headers||a._nonReactive.minPendingPromise)&&e.updateMatch(t,p=>({...p,isFetching:"loader"})),r.options.loader){const p=l?await i:i;zo(e,e.router.getMatch(t),p),p!==void 0&&e.updateMatch(t,g=>({...g,loaderData:p}))}r._lazyPromise&&await r._lazyPromise;const d=pf(e,t,r),f=d?await d:void 0,m=a._nonReactive.minPendingPromise;m&&await m,r._componentsPromise&&await r._componentsPromise,e.updateMatch(t,p=>({...p,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),...f}))}catch(i){let l=i;const u=a._nonReactive.minPendingPromise;u&&await u,La(i)&&await r.options.notFoundComponent?.preload?.(),zo(e,e.router.getMatch(t),i);try{r.options.onError?.(i)}catch(m){l=m,zo(e,e.router.getMatch(t),m)}const d=pf(e,t,r),f=d?await d:void 0;e.updateMatch(t,m=>({...m,error:l,status:"error",isFetching:!1,...f}))}}catch(a){const i=e.router.getMatch(t);if(i){const l=pf(e,t,r);if(l){const u=await l;e.updateMatch(t,d=>({...d,...u}))}i._nonReactive.loaderPromise=void 0}zo(e,i,a)}},zG=async(e,t)=>{const{id:n,routeId:r}=e.matches[t];let a=!1,i=!1;const l=e.router.looseRoutesById[r];if(L3(e,n)){if(e.router.isServer){const f=pf(e,n,l);if(f){const m=await f;e.updateMatch(n,p=>({...p,...m}))}return e.router.getMatch(n)}}else{const f=e.router.getMatch(n);if(f._nonReactive.loaderPromise){if(f.status==="success"&&!e.sync&&!f.preload)return f;await f._nonReactive.loaderPromise;const m=e.router.getMatch(n),p=m._nonReactive.error||m.error;p&&zo(e,m,p)}else{const m=Date.now()-f.updatedAt,p=Ag(e,n),g=p?l.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:l.options.staleTime??e.router.options.defaultStaleTime??0,x=l.options.shouldReload,j=typeof x=="function"?x(z3(e,n,t,l)):x,b=!!p&&!e.router.state.matches.some(C=>C.id===n),w=e.router.getMatch(n);w._nonReactive.loaderPromise=Gc(),b!==w.preload&&e.updateMatch(n,C=>({...C,preload:b}));const{status:N,invalid:O}=w;if(a=N==="success"&&(O||(j??m>g)),!(p&&l.options.preload===!1))if(a&&!e.sync)i=!0,(async()=>{try{await Jk(e,n,t,l);const C=e.router.getMatch(n);C._nonReactive.loaderPromise?.resolve(),C._nonReactive.loadPromise?.resolve(),C._nonReactive.loaderPromise=void 0}catch(C){ni(C)&&await e.router.navigate(C.options)}})();else if(N!=="success"||a&&e.sync)await Jk(e,n,t,l);else{const C=pf(e,n,l);if(C){const A=await C;e.updateMatch(n,E=>({...E,...A}))}}}}const u=e.router.getMatch(n);i||(u._nonReactive.loaderPromise?.resolve(),u._nonReactive.loadPromise?.resolve()),clearTimeout(u._nonReactive.pendingTimeout),u._nonReactive.pendingTimeout=void 0,i||(u._nonReactive.loaderPromise=void 0),u._nonReactive.dehydrated=void 0;const d=i?u.isFetching:!1;return d!==u.isFetching||u.invalid!==!1?(e.updateMatch(n,f=>({...f,isFetching:d,invalid:!1})),e.router.getMatch(n)):u};async function eP(e){const t=Object.assign(e,{matchPromises:[]});!t.router.isServer&&t.router.state.matches.some(n=>n._forcePending)&&Vp(t);try{for(let a=0;a{const{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0),!e._componentsLoaded&&e._componentsPromise===void 0){const t=()=>{const n=[];for(const r of U3){const a=e.options[r]?.preload;a&&n.push(a())}if(n.length)return Promise.all(n).then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0});e._componentsLoaded=!0,e._componentsPromise=void 0};e._componentsPromise=e._lazyPromise?e._lazyPromise.then(t):t()}return e._componentsPromise}function pp(e,t){return t?{status:"error",error:t}:{status:"success",value:e}}function F3(e){for(const t of U3)if(e.options[t]?.preload)return!0;return!1}const U3=["component","errorComponent","pendingComponent","notFoundComponent"];function qG(e){return{input:({url:t})=>{for(const n of e)t=H3(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=W3(e[n],t);return t}}}function FG(e){const t=Wp(e.basepath),n=`/${t}`,r=`${n}/`,a=e.caseSensitive?n:n.toLowerCase(),i=e.caseSensitive?r:r.toLowerCase();return{input:({url:l})=>{const u=e.caseSensitive?l.pathname:l.pathname.toLowerCase();return u===a?l.pathname="/":u.startsWith(i)&&(l.pathname=l.pathname.slice(n.length)),l},output:({url:l})=>(l.pathname=Yi(["/",t,l.pathname]),l)}}function H3(e,t){const n=e?.input?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function W3(e,t){const n=e?.output?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function Ys(e){const t=e.resolvedLocation,n=e.location,r=t?.pathname!==n.pathname,a=t?.href!==n.href,i=t?.hash!==n.hash;return{fromLocation:t,toLocation:n,pathChanged:r,hrefChanged:a,hashChanged:i}}class UG{constructor(t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=n=>n(),this.update=n=>{n.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const r=this.options,a=this.basepath??r?.basepath??"/",i=this.basepath===void 0,l=r?.rewrite;this.options={...r,...n},this.isServer=this.options.isServer??typeof document>"u",this.pathParamsDecodeCharMap=this.options.pathParamsAllowedCharacters?new Map(this.options.pathParamsAllowedCharacters.map(g=>[encodeURIComponent(g),g])):void 0,(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.isServer||(this.history=KV())),this.origin=this.options.origin,this.origin||(!this.isServer&&window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),!this.__store&&this.latestLocation&&(this.__store=new GV(WG(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(g=>!["redirected"].includes(g.status))}}}),CG(this));let u=!1;const d=this.options.basepath??"/",f=this.options.rewrite;if(i||a!==d||l!==f){this.basepath=d;const g=[];Wp(d)!==""&&g.push(FG({basepath:d})),f&&g.push(f),this.rewrite=g.length===0?void 0:g.length===1?g[0]:qG(g),this.history&&this.updateLatestLocation(),u=!0}u&&this.__store&&(this.__store.state={...this.state,location:this.latestLocation}),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const{routesById:n,routesByPath:r,flatRoutes:a}=jG({routeTree:this.routeTree,initRoute:(l,u)=>{l.init({originalIndex:u})}});this.routesById=n,this.routesByPath=r,this.flatRoutes=a;const i=this.options.notFoundRoute;i&&(i.init({originalIndex:99999999999}),this.routesById[i.id]=i)},this.subscribe=(n,r)=>{const a={eventType:n,fn:r};return this.subscribers.add(a),()=>{this.subscribers.delete(a)}},this.emit=n=>{this.subscribers.forEach(r=>{r.eventType===n.type&&r.fn(n)})},this.parseLocation=(n,r)=>{const a=({href:d,state:f})=>{const m=new URL(d,this.origin),p=H3(this.rewrite,m),g=this.options.parseSearch(p.search),x=this.options.stringifySearch(g);p.search=x;const j=p.href.replace(p.origin,""),{pathname:b,hash:w}=p;return{href:j,publicHref:d,url:p.href,pathname:Kk(b),searchStr:x,search:ga(r?.search,g),hash:w.split("#").reverse()[0]??"",state:ga(r?.state,f)}},i=a(n),{__tempLocation:l,__tempKey:u}=i.state;if(l&&(!u||u===this.tempLocationKey)){const d=a(l);return d.state.key=i.state.key,d.state.__TSR_key=i.state.__TSR_key,delete d.state.__tempLocation,{...d,maskedLocation:i}}return i},this.resolvePathWithBase=(n,r)=>nG({base:n,to:xO(r),trailingSlash:this.options.trailingSlash,parseCache:this.parsePathnameCache}),this.matchRoutes=(n,r,a)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:r},a):this.matchRoutesInternal(n,r),this.parsePathnameCache=DG(1e3),this.getMatchedRoutes=(n,r)=>VG({pathname:n,routePathname:r,caseSensitive:this.options.caseSensitive,routesByPath:this.routesByPath,routesById:this.routesById,flatRoutes:this.flatRoutes,parseCache:this.parsePathnameCache}),this.cancelMatch=n=>{const r=this.getMatch(n);r&&(r.abortController.abort(),clearTimeout(r._nonReactive.pendingTimeout),r._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const n=this.state.matches.filter(i=>i.status==="pending"),r=this.state.matches.filter(i=>i.isFetching==="loader");new Set([...this.state.pendingMatches??[],...n,...r]).forEach(i=>{this.cancelMatch(i.id)})},this.buildLocation=n=>{const r=(i={})=>{const l=i._fromLocation||this.pendingBuiltLocation||this.latestLocation,u=this.matchRoutes(l,{_buildLocation:!0}),d=s_(u);i.from;const f=i.unsafeRelative==="path"?l.pathname:i.from??d.fullPath,m=this.resolvePathWithBase(f,"."),p=d.search,g={...d.params},x=i.to?this.resolvePathWithBase(m,`${i.to}`):this.resolvePathWithBase(m,"."),j=i.params===!1||i.params===null?{}:(i.params??!0)===!0?g:Object.assign(g,Vs(i.params,g)),b=_0({path:x,params:j,parseCache:this.parsePathnameCache}).interpolatedPath,w=this.matchRoutes(b,void 0,{_buildLocation:!0}).map(F=>this.looseRoutesById[F.routeId]);if(Object.keys(j).length>0)for(const F of w){const D=F.options.params?.stringify??F.options.stringifyParams;D&&Object.assign(j,D(j))}const N=n.leaveParams?x:Kk(_0({path:x,params:j,decodeCharMap:this.pathParamsDecodeCharMap,parseCache:this.parsePathnameCache}).interpolatedPath);let O=p;if(n._includeValidateSearch&&this.options.search?.strict){const F={};w.forEach(D=>{if(D.options.validateSearch)try{Object.assign(F,u_(D.options.validateSearch,{...F,...O}))}catch{}}),O=F}O=GG({search:O,dest:i,destRoutes:w,_includeValidateSearch:n._includeValidateSearch}),O=ga(p,O);const C=this.options.stringifySearch(O),A=i.hash===!0?l.hash:i.hash?Vs(i.hash,l.hash):void 0,E=A?`#${A}`:"";let k=i.state===!0?l.state:i.state?Vs(i.state,l.state):{};k=ga(l.state,k);const T=`${N}${C}${E}`,P=new URL(T,this.origin),$=W3(this.rewrite,P);return{publicHref:$.pathname+$.search+$.hash,href:T,url:$.href,pathname:N,search:O,searchStr:C,state:k,hash:A??"",unmaskOnReload:i.unmaskOnReload}},a=(i={},l)=>{const u=r(i);let d=l?r(l):void 0;if(!d){let f={};const m=this.options.routeMasks?.find(p=>{const g=l_(u.pathname,{to:p.from,caseSensitive:!1,fuzzy:!1},this.parsePathnameCache);return g?(f=g,!0):!1});if(m){const{from:p,...g}=m;l={from:n.from,...g,params:f},d=r(l)}}return d&&(u.maskedLocation=d),u};return n.mask?a(n,{from:n.from,...n.mask}):a(n)},this.commitLocation=({viewTransition:n,ignoreBlocker:r,...a})=>{const i=()=>{const d=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];d.forEach(m=>{a.state[m]=this.latestLocation.state[m]});const f=Gs(a.state,this.latestLocation.state);return d.forEach(m=>{delete a.state[m]}),f},l=Wo(this.latestLocation.href)===Wo(a.href),u=this.commitLocationPromise;if(this.commitLocationPromise=Gc(()=>{u?.resolve()}),l&&i())this.load();else{let{maskedLocation:d,hashScrollIntoView:f,...m}=a;d&&(m={...d,state:{...d.state,__tempKey:void 0,__tempLocation:{...m,search:m.searchStr,state:{...m.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(m.unmaskOnReload??this.options.unmaskOnReload??!1)&&(m.state.__tempKey=this.tempLocationKey)),m.state.__hashScrollIntoViewOptions=f??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,this.history[a.replace?"replace":"push"](m.publicHref,m.state,{ignoreBlocker:r})}return this.resetNextScroll=a.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:r,hashScrollIntoView:a,viewTransition:i,ignoreBlocker:l,href:u,...d}={})=>{if(u){const p=this.history.location.state.__TSR_index,g=iv(u,{__TSR_index:n?p:p+1});d.to=g.pathname,d.search=this.options.parseSearch(g.search),d.hash=g.hash.slice(1)}const f=this.buildLocation({...d,_includeValidateSearch:!0});this.pendingBuiltLocation=f;const m=this.commitLocation({...f,viewTransition:i,replace:n,resetScroll:r,hashScrollIntoView:a,ignoreBlocker:l});return Promise.resolve().then(()=>{this.pendingBuiltLocation===f&&(this.pendingBuiltLocation=void 0)}),m},this.navigate=({to:n,reloadDocument:r,href:a,...i})=>{if(!r&&a)try{new URL(`${a}`),r=!0}catch{}return r?(a||(a=this.buildLocation({to:n,...i}).url),i.replace?window.location.replace(a):window.location.href=a,Promise.resolve()):this.buildAndCommitLocation({...i,href:a,to:n,_isNavigate:!0})},this.beforeLoad=()=>{if(this.cancelMatches(),this.updateLatestLocation(),this.isServer){const r=this.buildLocation({to:this.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0}),a=i=>{try{return encodeURI(decodeURI(i))}catch{return i}};if(Wp(a(this.latestLocation.href))!==Wp(a(r.href))){let i=r.url;throw this.origin&&i.startsWith(this.origin)&&(i=i.replace(this.origin,"")||"/"),$3({href:i})}}const n=this.matchRoutes(this.latestLocation);this.__store.setState(r=>({...r,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:n,cachedMatches:r.cachedMatches.filter(a=>!n.some(i=>i.id===a.id))}))},this.load=async n=>{let r,a,i;for(i=new Promise(u=>{this.startTransition(async()=>{try{this.beforeLoad();const d=this.latestLocation,f=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...Ys({resolvedLocation:f,location:d})}),this.emit({type:"onBeforeLoad",...Ys({resolvedLocation:f,location:d})}),await eP({router:this,sync:n?.sync,matches:this.state.pendingMatches,location:d,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let m=[],p=[],g=[];mf(()=>{this.__store.setState(x=>{const j=x.matches,b=x.pendingMatches||x.matches;return m=j.filter(w=>!b.some(N=>N.id===w.id)),p=b.filter(w=>!j.some(N=>N.id===w.id)),g=b.filter(w=>j.some(N=>N.id===w.id)),{...x,isLoading:!1,loadedAt:Date.now(),matches:b,pendingMatches:void 0,cachedMatches:[...x.cachedMatches,...m.filter(w=>w.status!=="error")]}}),this.clearExpiredCache()}),[[m,"onLeave"],[p,"onEnter"],[g,"onStay"]].forEach(([x,j])=>{x.forEach(b=>{this.looseRoutesById[b.routeId].options[j]?.(b)})})})})}})}catch(d){ni(d)?(r=d,this.isServer||this.navigate({...r.options,replace:!0,ignoreBlocker:!0})):La(d)&&(a=d),this.__store.setState(f=>({...f,statusCode:r?r.status:a?404:f.matches.some(m=>m.status==="error")?500:200,redirect:r}))}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),u()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let l;this.hasNotFoundMatch()?l=404:this.__store.state.matches.some(u=>u.status==="error")&&(l=500),l!==void 0&&this.__store.setState(u=>({...u,statusCode:l}))},this.startViewTransition=n=>{const r=this.shouldViewTransition??this.options.defaultViewTransition;if(delete this.shouldViewTransition,r&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let a;if(typeof r=="object"&&this.isViewTransitionTypesSupported){const i=this.latestLocation,l=this.state.resolvedLocation,u=typeof r.types=="function"?r.types(Ys({resolvedLocation:l,location:i})):r.types;if(u===!1){n();return}a={update:n,types:u}}else a=n;document.startViewTransition(a)}else n()},this.updateMatch=(n,r)=>{this.startTransition(()=>{const a=this.state.pendingMatches?.some(i=>i.id===n)?"pendingMatches":this.state.matches.some(i=>i.id===n)?"matches":this.state.cachedMatches.some(i=>i.id===n)?"cachedMatches":"";a&&this.__store.setState(i=>({...i,[a]:i[a]?.map(l=>l.id===n?r(l):l)}))})},this.getMatch=n=>{const r=a=>a.id===n;return this.state.cachedMatches.find(r)??this.state.pendingMatches?.find(r)??this.state.matches.find(r)},this.invalidate=n=>{const r=a=>n?.filter?.(a)??!0?{...a,invalid:!0,...n?.forcePending||a.status==="error"?{status:"pending",error:void 0}:void 0}:a;return this.__store.setState(a=>({...a,matches:a.matches.map(r),cachedMatches:a.cachedMatches.map(r),pendingMatches:a.pendingMatches?.map(r)})),this.shouldViewTransition=!1,this.load({sync:n?.sync})},this.resolveRedirect=n=>{if(!n.options.href){const r=this.buildLocation(n.options);let a=r.url;this.origin&&a.startsWith(this.origin)&&(a=a.replace(this.origin,"")||"/"),n.options.href=r.href,n.headers.set("Location",a)}return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const r=n?.filter;r!==void 0?this.__store.setState(a=>({...a,cachedMatches:a.cachedMatches.filter(i=>!r(i))})):this.__store.setState(a=>({...a,cachedMatches:[]}))},this.clearExpiredCache=()=>{const n=r=>{const a=this.looseRoutesById[r.routeId];if(!a.options.loader)return!0;const i=(r.preload?a.options.preloadGcTime??this.options.defaultPreloadGcTime:a.options.gcTime??this.options.defaultGcTime)??300*1e3;return r.status==="error"?!0:Date.now()-r.updatedAt>=i};this.clearCache({filter:n})},this.loadRouteChunk=q3,this.preloadRoute=async n=>{const r=this.buildLocation(n);let a=this.matchRoutes(r,{throwOnError:!0,preload:!0,dest:n});const i=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(u=>u.id)),l=new Set([...i,...this.state.cachedMatches.map(u=>u.id)]);mf(()=>{a.forEach(u=>{l.has(u.id)||this.__store.setState(d=>({...d,cachedMatches:[...d.cachedMatches,u]}))})});try{return a=await eP({router:this,matches:a,location:r,preload:!0,updateMatch:(u,d)=>{i.has(u)?a=a.map(f=>f.id===u?d(f):f):this.updateMatch(u,d)}}),a}catch(u){if(ni(u))return u.options.reloadDocument?void 0:await this.preloadRoute({...u.options,_fromLocation:r});La(u)||console.error(u);return}},this.matchRoute=(n,r)=>{const a={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},i=this.buildLocation(a);if(r?.pending&&this.state.status!=="pending")return!1;const u=(r?.pending===void 0?!this.state.isLoading:r.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,d=l_(u.pathname,{...r,to:i.pathname},this.parsePathnameCache);return!d||n.params&&!Gs(d,n.params,{partial:!0})?!1:d&&(r?.includeSearch??!0)?Gs(u.search,i.search,{partial:!0})?d:!1:d},this.hasNotFoundMatch=()=>this.__store.state.matches.some(n=>n.status==="notFound"||n.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...t,caseSensitive:t.caseSensitive??!1,notFoundMode:t.notFoundMode??"fuzzy",stringifySearch:t.stringifySearch??PG,parseSearch:t.parseSearch??kG}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}get looseRoutesById(){return this.routesById}matchRoutesInternal(t,n){const{foundRoute:r,matchedRoutes:a,routeParams:i}=this.getMatchedRoutes(t.pathname,n?.dest?.to);let l=!1;(r?r.path!=="/"&&i["**"]:Wo(t.pathname))&&(this.options.notFoundRoute?a.push(this.options.notFoundRoute):l=!0);const u=(()=>{if(l){if(this.options.notFoundMode!=="root")for(let m=a.length-1;m>=0;m--){const p=a[m];if(p.children)return p.id}return Yr}})(),d=[],f=m=>m?.id?m.context??this.options.context??void 0:this.options.context??void 0;return a.forEach((m,p)=>{const g=d[p-1],[x,j,b]=(()=>{const U=g?.search??t.search,V=g?._strictSearch??void 0;try{const H=u_(m.options.validateSearch,{...U})??void 0;return[{...U,...H},{...V,...H},void 0]}catch(H){let G=H;if(H instanceof uv||(G=new uv(H.message,{cause:H})),n?.throwOnError)throw G;return[U,{},G]}})(),w=m.options.loaderDeps?.({search:x})??"",N=w?JSON.stringify(w):"",{interpolatedPath:O,usedParams:C}=_0({path:m.fullPath,params:i,decodeCharMap:this.pathParamsDecodeCharMap}),A=m.id+O+N,E=this.getMatch(A),k=this.state.matches.find(U=>U.routeId===m.id),T=E?._strictParams??C;let P;if(!E){const U=m.options.params?.parse??m.options.parseParams;if(U)try{Object.assign(T,U(T))}catch(V){if(P=new HG(V.message,{cause:V}),n?.throwOnError)throw P}}Object.assign(i,T);const $=k?"stay":"enter";let F;if(E)F={...E,cause:$,params:k?ga(k.params,i):i,_strictParams:T,search:ga(k?k.search:E.search,x),_strictSearch:j};else{const U=m.options.loader||m.options.beforeLoad||m.lazyFn||F3(m)?"pending":"success";F={id:A,index:p,routeId:m.id,params:k?ga(k.params,i):i,_strictParams:T,pathname:O,updatedAt:Date.now(),search:k?ga(k.search,x):x,_strictSearch:j,searchError:void 0,status:U,isFetching:!1,error:void 0,paramsError:P,__routeContext:void 0,_nonReactive:{loadPromise:Gc()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:$,loaderDeps:k?ga(k.loaderDeps,w):w,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:m.options.staticData||{},fullPath:m.fullPath}}n?.preload||(F.globalNotFound=u===m.id),F.searchError=b;const D=f(g);F.context={...D,...F.__routeContext,...F.__beforeLoadContext},d.push(F)}),d.forEach((m,p)=>{const g=this.looseRoutesById[m.routeId];if(!this.getMatch(m.id)&&n?._buildLocation!==!0){const j=d[p-1],b=f(j);if(g.options.context){const w={deps:m.loaderDeps,params:m.params,context:b??{},location:t,navigate:N=>this.navigate({...N,_fromLocation:t}),buildLocation:this.buildLocation,cause:m.cause,abortController:m.abortController,preload:!!m.preload,matches:d};m.__routeContext=g.options.context(w)??void 0}m.context={...b,...m.__routeContext,...m.__beforeLoadContext}}}),d}}class uv extends Error{}class HG extends Error{}function WG(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function u_(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new uv("Async validation not supported");if(n.issues)throw new uv(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function VG({pathname:e,routePathname:t,caseSensitive:n,routesByPath:r,routesById:a,flatRoutes:i,parseCache:l}){let u={};const d=Wo(e),f=x=>l_(d,{to:x.fullPath,caseSensitive:x.options?.caseSensitive??n,fuzzy:!0},l);let m=t!==void 0?r[t]:void 0;if(m)u=f(m);else{let x;for(const j of i){const b=f(j);if(b)if(j.path!=="/"&&b["**"])x||(x={foundRoute:j,routeParams:b});else{m=j,u=b;break}}!m&&x&&(m=x.foundRoute,u=x.routeParams)}let p=m||a[Yr];const g=[p];for(;p.parentRoute;)p=p.parentRoute,g.push(p);return g.reverse(),{matchedRoutes:g,routeParams:u,foundRoute:m}}function GG({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){const a=n.reduce((u,d)=>{const f=[];if("search"in d.options)d.options.search?.middlewares&&f.push(...d.options.search.middlewares);else if(d.options.preSearchFilters||d.options.postSearchFilters){const m=({search:p,next:g})=>{let x=p;"preSearchFilters"in d.options&&d.options.preSearchFilters&&(x=d.options.preSearchFilters.reduce((b,w)=>w(b),p));const j=g(x);return"postSearchFilters"in d.options&&d.options.postSearchFilters?d.options.postSearchFilters.reduce((b,w)=>w(b),j):j};f.push(m)}if(r&&d.options.validateSearch){const m=({search:p,next:g})=>{const x=g(p);try{return{...x,...u_(d.options.validateSearch,x)??void 0}}catch{return x}};f.push(m)}return u.concat(f)},[])??[],i=({search:u})=>t.search?t.search===!0?u:Vs(t.search,u):{};a.push(i);const l=(u,d)=>{if(u>=a.length)return d;const f=a[u];return f({search:d,next:p=>l(u+1,p)})};return l(0,e)}const YG="Error preloading route! ☝️";class V3{constructor(t){if(this.init=n=>{this.originalIndex=n.originalIndex;const r=this.options,a=!r?.path&&!r?.id;this.parentRoute=this.options.getParentRoute?.(),a?this._path=Yr:this.parentRoute||sr(!1);let i=a?Yr:r?.path;i&&i!=="/"&&(i=bO(i));const l=r?.id||i;let u=a?Yr:Yi([this.parentRoute.id===Yr?"":this.parentRoute.id,l]);i===Yr&&(i="/"),u!==Yr&&(u=Yi(["/",u]));const d=u===Yr?"/":Yi([this.parentRoute.fullPath,i]);this._path=i,this._id=u,this._fullPath=d,this._to=d},this.addChildren=n=>this._addFileChildren(n),this._addFileChildren=n=>(Array.isArray(n)&&(this.children=n),typeof n=="object"&&n!==null&&(this.children=Object.values(n)),this),this._addFileTypes=()=>this,this.updateLoader=n=>(Object.assign(this.options,n),this),this.update=n=>(Object.assign(this.options,n),this),this.lazy=n=>(this.lazyFn=n,this),this.options=t||{},this.isRoot=!t?.getParentRoute,t?.id&&t?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class KG extends V3{constructor(t){super(t)}}function wO(e){const t=e.errorComponent??Tg;return s.jsx(XG,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?y.createElement(t,{error:n,reset:r}):e.children})}class XG extends y.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(t){return{resetKey:t.getResetKey()}}static getDerivedStateFromError(t){return{error:t}}reset(){this.setState({error:null})}componentDidUpdate(t,n){n.error&&n.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(t,n){this.props.onCatch&&this.props.onCatch(t,n)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function Tg({error:e}){const[t,n]=y.useState(!1);return s.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[s.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),s.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(r=>!r),children:t?"Hide Error":"Show Error"})]}),s.jsx("div",{style:{height:".25rem"}}),t?s.jsx("div",{children:s.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?s.jsx("code",{children:e.message}):null})}):null]})}function ZG({children:e,fallback:t=null}){return QG()?s.jsx(W.Fragment,{children:e}):s.jsx(W.Fragment,{children:t})}function QG(){return W.useSyncExternalStore(JG,()=>!0,()=>!1)}function JG(){return()=>{}}var O0={exports:{}},C0={},E0={exports:{}},A0={};var tP;function eY(){if(tP)return A0;tP=1;var e=vh();function t(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,a=e.useEffect,i=e.useLayoutEffect,l=e.useDebugValue;function u(p,g){var x=g(),j=r({inst:{value:x,getSnapshot:g}}),b=j[0].inst,w=j[1];return i(function(){b.value=x,b.getSnapshot=g,d(b)&&w({inst:b})},[p,x,g]),a(function(){return d(b)&&w({inst:b}),p(function(){d(b)&&w({inst:b})})},[p]),l(x),x}function d(p){var g=p.getSnapshot;p=p.value;try{var x=g();return!n(p,x)}catch{return!0}}function f(p,g){return g()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:u;return A0.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,A0}var nP;function tY(){return nP||(nP=1,E0.exports=eY()),E0.exports}var rP;function nY(){if(rP)return C0;rP=1;var e=vh(),t=tY();function n(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var r=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,i=e.useRef,l=e.useEffect,u=e.useMemo,d=e.useDebugValue;return C0.useSyncExternalStoreWithSelector=function(f,m,p,g,x){var j=i(null);if(j.current===null){var b={hasValue:!1,value:null};j.current=b}else b=j.current;j=u(function(){function N(k){if(!O){if(O=!0,C=k,k=g(k),x!==void 0&&b.hasValue){var T=b.value;if(x(T,k))return A=T}return A=k}if(T=A,r(C,k))return T;var P=g(k);return x!==void 0&&x(T,P)?(C=k,T):(C=k,A=P)}var O=!1,C,A,E=p===void 0?null:p;return[function(){return N(m())},E===null?void 0:function(){return N(E())}]},[m,p,g,x]);var w=a(f,j[0],j[1]);return l(function(){b.hasValue=!0,b.value=w},[w]),d(w),w},C0}var aP;function rY(){return aP||(aP=1,O0.exports=nY()),O0.exports}var aY=rY();function iY(e,t=r=>r,n={}){const r=n.equal??oY;return aY.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function oY(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,a]of e)if(!t.has(r)||!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=iP(e);if(n.length!==iP(t).length)return!1;for(let r=0;r"u"?T0:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=T0,T0)}function Mr(e){const t=y.useContext(G3());return e?.warn,t}function xr(e){const t=Mr({warn:e?.router===void 0}),n=e?.router||t,r=y.useRef(void 0);return iY(n.__store,a=>{if(e?.select){if(e.structuralSharing??n.options.defaultStructuralSharing){const i=ga(r.current,e.select(a));return r.current=i,i}return e.select(a)}return a})}const kg=y.createContext(void 0),sY=y.createContext(void 0);function di(e){const t=y.useContext(e.from?sY:kg);return xr({select:r=>{const a=r.matches.find(i=>e.from?e.from===i.routeId:i.id===t);if(sr(!((e.shouldThrow??!0)&&!a),`Could not find ${e.from?`an active match from "${e.from}"`:"a nearest match!"}`),a!==void 0)return e.select?e.select(a):a},structuralSharing:e.structuralSharing})}function jO(e){return di({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function SO(e){const{select:t,...n}=e;return di({...n,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function _O(e){return di({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function NO(e){return di({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function qa(e){const t=Mr();return y.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}var pl=P3();const lY=wt(pl),vp=typeof window<"u"?y.useLayoutEffect:y.useEffect;function k0(e){const t=y.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function cY(e,t,n={},r={}){y.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!="function")return;const a=new IntersectionObserver(([i])=>{t(i)},n);return a.observe(e.current),()=>{a.disconnect()}},[t,n,r.disabled,e])}function uY(e){const t=y.useRef(null);return y.useImperativeHandle(e,()=>t.current,[]),t}function dY(e,t){const n=Mr(),[r,a]=y.useState(!1),i=y.useRef(!1),l=uY(t),{activeProps:u,inactiveProps:d,activeOptions:f,to:m,preload:p,preloadDelay:g,hashScrollIntoView:x,replace:j,startTransition:b,resetScroll:w,viewTransition:N,children:O,target:C,disabled:A,style:E,className:k,onClick:T,onFocus:P,onMouseEnter:$,onMouseLeave:F,onTouchStart:D,ignoreBlocker:U,params:V,search:H,hash:G,state:L,mask:R,reloadDocument:q,unsafeRelative:K,from:ee,_fromLocation:I,...B}=e,Y=xr({select:it=>it.location.search,structuralSharing:!0}),te=e.from,oe=y.useMemo(()=>({...e,from:te}),[n,Y,te,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),xe=y.useMemo(()=>n.buildLocation({...oe}),[n,oe]),J=y.useMemo(()=>{if(A)return;let it=xe.maskedLocation?xe.maskedLocation.url:xe.url,nt=!1;return n.origin&&(it.startsWith(n.origin)?it=n.history.createHref(it.replace(n.origin,""))||"/":nt=!0),{href:it,external:nt}},[A,xe.maskedLocation,xe.url,n.origin,n.history]),ae=y.useMemo(()=>{if(J?.external)return J.href;try{return new URL(m),m}catch{}},[m,J]),Z=e.reloadDocument||ae?!1:p??n.options.defaultPreload,pe=g??n.options.defaultPreloadDelay??0,je=xr({select:it=>{if(ae)return!1;if(f?.exact){if(!eG(it.location.pathname,xe.pathname,n.basepath))return!1}else{const nt=sv(it.location.pathname,n.basepath),Nn=sv(xe.pathname,n.basepath);if(!(nt.startsWith(Nn)&&(nt.length===Nn.length||nt[Nn.length]==="/")))return!1}return(f?.includeSearch??!0)&&!Gs(it.location.search,xe.search,{partial:!f?.exact,ignoreUndefined:!f?.explicitUndefined})?!1:f?.includeHash?it.location.hash===xe.hash:!0}}),le=y.useCallback(()=>{n.preloadRoute({...oe}).catch(it=>{console.warn(it),console.warn(YG)})},[n,oe]),Re=y.useCallback(it=>{it?.isIntersecting&&le()},[le]);cY(l,Re,vY,{disabled:!!A||Z!=="viewport"}),y.useEffect(()=>{i.current||!A&&Z==="render"&&(le(),i.current=!0)},[A,le,Z]);const _e=it=>{const nt=it.currentTarget.getAttribute("target"),Nn=C!==void 0?C:nt;if(!A&&!gY(it)&&!it.defaultPrevented&&(!Nn||Nn==="_self")&&it.button===0){it.preventDefault(),pl.flushSync(()=>{a(!0)});const ds=n.subscribe("onResolved",()=>{ds(),a(!1)});n.navigate({...oe,replace:j,resetScroll:w,hashScrollIntoView:x,startTransition:b,viewTransition:N,ignoreBlocker:U})}};if(ae)return{...B,ref:l,href:ae,...O&&{children:O},...C&&{target:C},...A&&{disabled:A},...E&&{style:E},...k&&{className:k},...T&&{onClick:T},...P&&{onFocus:P},...$&&{onMouseEnter:$},...F&&{onMouseLeave:F},...D&&{onTouchStart:D}};const he=it=>{A||Z&&le()},ve=he,Le=it=>{if(!(A||!Z))if(!pe)le();else{const nt=it.target;if(Fd.has(nt))return;const Nn=setTimeout(()=>{Fd.delete(nt),le()},pe);Fd.set(nt,Nn)}},Mt=it=>{if(A||!Z||!pe)return;const nt=it.target,Nn=Fd.get(nt);Nn&&(clearTimeout(Nn),Fd.delete(nt))},vn=je?Vs(u,{})??fY:P0,fr=je?P0:Vs(d,{})??P0,er=[k,vn.className,fr.className].filter(Boolean).join(" "),hr=(E||vn.style||fr.style)&&{...E,...vn.style,...fr.style};return{...B,...vn,...fr,href:J?.href,ref:l,onClick:Ud([T,_e]),onFocus:Ud([P,he]),onMouseEnter:Ud([$,Le]),onMouseLeave:Ud([F,Mt]),onTouchStart:Ud([D,ve]),disabled:!!A,target:C,...hr&&{style:hr},...er&&{className:er},...A&&hY,...je&&mY,...r&&pY}}const P0={},fY={className:"active"},hY={role:"link","aria-disabled":!0},mY={"data-status":"active","aria-current":"page"},pY={"data-transitioning":"transitioning"},Fd=new WeakMap,vY={rootMargin:"100px"},Ud=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}},OO=y.forwardRef((e,t)=>{const{_asChild:n,...r}=e,{type:a,ref:i,...l}=dY(r,t),u=typeof r.children=="function"?r.children({isActive:l["data-status"]==="active"}):r.children;return n===void 0&&delete l.disabled,y.createElement(n||"a",{...l,ref:i},u)});function gY(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}class yY extends V3{constructor(t){super(t),this.useMatch=n=>di({select:n?.select,from:this.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>di({...n,from:this.id,select:r=>n?.select?n.select(r.context):r.context}),this.useSearch=n=>NO({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useParams=n=>_O({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useLoaderDeps=n=>SO({...n,from:this.id}),this.useLoaderData=n=>jO({...n,from:this.id}),this.useNavigate=()=>qa({from:this.fullPath}),this.Link=W.forwardRef((n,r)=>s.jsx(OO,{ref:r,from:this.fullPath,...n})),this.$$typeof=Symbol.for("react.memo")}}function cr(e){return new yY(e)}class xY extends KG{constructor(t){super(t),this.useMatch=n=>di({select:n?.select,from:this.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>di({...n,from:this.id,select:r=>n?.select?n.select(r.context):r.context}),this.useSearch=n=>NO({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useParams=n=>_O({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useLoaderDeps=n=>SO({...n,from:this.id}),this.useLoaderData=n=>jO({...n,from:this.id}),this.useNavigate=()=>qa({from:this.fullPath}),this.Link=W.forwardRef((n,r)=>s.jsx(OO,{ref:r,from:this.fullPath,...n})),this.$$typeof=Symbol.for("react.memo")}}function bY(e){return new xY(e)}function oP(e){return typeof e=="object"?new sP(e,{silent:!0}).createRoute(e):new sP(e,{silent:!0}).createRoute}class sP{constructor(t,n){this.path=t,this.createRoute=r=>{this.silent;const a=cr(r);return a.isRoot=!1,a},this.silent=n?.silent}}class lP{constructor(t){this.useMatch=n=>di({select:n?.select,from:this.options.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>di({from:this.options.id,select:r=>n?.select?n.select(r.context):r.context}),this.useSearch=n=>NO({select:n?.select,structuralSharing:n?.structuralSharing,from:this.options.id}),this.useParams=n=>_O({select:n?.select,structuralSharing:n?.structuralSharing,from:this.options.id}),this.useLoaderDeps=n=>SO({...n,from:this.options.id}),this.useLoaderData=n=>jO({...n,from:this.options.id}),this.useNavigate=()=>{const n=Mr();return qa({from:n.routesById[this.options.id].fullPath})},this.options=t,this.$$typeof=Symbol.for("react.memo")}}function cP(e){return typeof e=="object"?new lP(e):t=>new lP({id:e,...t})}function wY(){const e=Mr(),t=y.useRef({router:e,mounted:!1}),[n,r]=y.useState(!1),{hasPendingMatches:a,isLoading:i}=xr({select:p=>({isLoading:p.isLoading,hasPendingMatches:p.matches.some(g=>g.status==="pending")}),structuralSharing:!0}),l=k0(i),u=i||n||a,d=k0(u),f=i||a,m=k0(f);return e.startTransition=p=>{r(!0),y.startTransition(()=>{p(),r(!1)})},y.useEffect(()=>{const p=e.history.subscribe(e.load),g=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Wo(e.latestLocation.href)!==Wo(g.href)&&e.commitLocation({...g,replace:!0}),()=>{p()}},[e,e.history]),vp(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(g){console.error(g)}})()},[e]),vp(()=>{l&&!i&&e.emit({type:"onLoad",...Ys(e.state)})},[l,e,i]),vp(()=>{m&&!f&&e.emit({type:"onBeforeRouteMount",...Ys(e.state)})},[f,m,e]),vp(()=>{d&&!u&&(e.emit({type:"onResolved",...Ys(e.state)}),e.__store.setState(p=>({...p,status:"idle",resolvedLocation:p.location})),EG(e))},[u,d,e]),null}function jY(e){const t=xr({select:n=>`not-found-${n.location.pathname}-${n.status}`});return s.jsx(wO,{getResetKey:()=>t,onCatch:(n,r)=>{if(La(n))e.onCatch?.(n,r);else throw n},errorComponent:({error:n})=>{if(La(n))return e.fallback?.(n);throw n},children:e.children})}function SY(){return s.jsx("p",{children:"Not Found"})}function Cc(e){return s.jsx(s.Fragment,{children:e.children})}function Y3(e,t,n){return t.options.notFoundComponent?s.jsx(t.options.notFoundComponent,{data:n}):e.options.defaultNotFoundComponent?s.jsx(e.options.defaultNotFoundComponent,{data:n}):s.jsx(SY,{})}function _Y({children:e}){const t=Mr();return t.isServer?s.jsx("script",{nonce:t.options.ssr?.nonce,className:"$tsr",dangerouslySetInnerHTML:{__html:[e].filter(Boolean).join(` -`)+";$_TSR.c()"}}):null}function NY(){const e=Mr();if(!e.isScrollRestoring||!e.isServer||typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))return null;const n=(e.options.getScrollRestorationKey||c_)(e.latestLocation),r=n!==c_(e.latestLocation)?n:void 0,a={storageKey:lv,shouldScrollRestoration:!0};return r&&(a.key=r),s.jsx(_Y,{children:`(${D3.toString()})(${JSON.stringify(a)})`})}const K3=y.memo(function({matchId:t}){const n=Mr(),r=xr({select:N=>{const O=N.matches.find(C=>C.id===t);return sr(O),{routeId:O.routeId,ssr:O.ssr,_displayPending:O._displayPending}},structuralSharing:!0}),a=n.routesById[r.routeId],i=a.options.pendingComponent??n.options.defaultPendingComponent,l=i?s.jsx(i,{}):null,u=a.options.errorComponent??n.options.defaultErrorComponent,d=a.options.onCatch??n.options.defaultOnCatch,f=a.isRoot?a.options.notFoundComponent??n.options.notFoundRoute?.options.component:a.options.notFoundComponent,m=r.ssr===!1||r.ssr==="data-only",p=(!a.isRoot||a.options.wrapInSuspense||m)&&(a.options.wrapInSuspense??i??(a.options.errorComponent?.preload||m))?y.Suspense:Cc,g=u?wO:Cc,x=f?jY:Cc,j=xr({select:N=>N.loadedAt}),b=xr({select:N=>{const O=N.matches.findIndex(C=>C.id===t);return N.matches[O-1]?.routeId}}),w=a.isRoot?a.options.shellComponent??Cc:Cc;return s.jsxs(w,{children:[s.jsx(kg.Provider,{value:t,children:s.jsx(p,{fallback:l,children:s.jsx(g,{getResetKey:()=>j,errorComponent:u||Tg,onCatch:(N,O)=>{if(La(N))throw N;d?.(N,O)},children:s.jsx(x,{fallback:N=>{if(!f||N.routeId&&N.routeId!==r.routeId||!N.routeId&&!a.isRoot)throw N;return y.createElement(f,N)},children:m||r._displayPending?s.jsx(ZG,{fallback:l,children:s.jsx(uP,{matchId:t})}):s.jsx(uP,{matchId:t})})})})}),b===Yr&&n.options.scrollRestoration?s.jsxs(s.Fragment,{children:[s.jsx(OY,{}),s.jsx(NY,{})]}):null]})});function OY(){const e=Mr(),t=y.useRef(void 0);return s.jsx("script",{suppressHydrationWarning:!0,ref:n=>{n&&(t.current===void 0||t.current.href!==e.latestLocation.href)&&(e.emit({type:"onRendered",...Ys(e.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}const uP=y.memo(function({matchId:t}){const n=Mr(),{match:r,key:a,routeId:i}=xr({select:d=>{const f=d.matches.find(j=>j.id===t),m=f.routeId,g=(n.routesById[m].options.remountDeps??n.options.defaultRemountDeps)?.({routeId:m,loaderDeps:f.loaderDeps,params:f._strictParams,search:f._strictSearch});return{key:g?JSON.stringify(g):void 0,routeId:m,match:{id:f.id,status:f.status,error:f.error,_forcePending:f._forcePending,_displayPending:f._displayPending}}},structuralSharing:!0}),l=n.routesById[i],u=y.useMemo(()=>{const d=l.options.component??n.options.defaultComponent;return d?s.jsx(d,{},a):s.jsx(CO,{})},[a,l.options.component,n.options.defaultComponent]);if(r._displayPending)throw n.getMatch(r.id)?._nonReactive.displayPendingPromise;if(r._forcePending)throw n.getMatch(r.id)?._nonReactive.minPendingPromise;if(r.status==="pending"){const d=l.options.pendingMinMs??n.options.defaultPendingMinMs;if(d){const f=n.getMatch(r.id);if(f&&!f._nonReactive.minPendingPromise&&!n.isServer){const m=Gc();f._nonReactive.minPendingPromise=m,setTimeout(()=>{m.resolve(),f._nonReactive.minPendingPromise=void 0},d)}}throw n.getMatch(r.id)?._nonReactive.loadPromise}if(r.status==="notFound")return sr(La(r.error)),Y3(n,l,r.error);if(r.status==="redirected")throw sr(ni(r.error)),n.getMatch(r.id)?._nonReactive.loadPromise;if(r.status==="error"){if(n.isServer){const d=(l.options.errorComponent??n.options.defaultErrorComponent)||Tg;return s.jsx(d,{error:r.error,reset:void 0,info:{componentStack:""}})}throw r.error}return u}),CO=y.memo(function(){const t=Mr(),n=y.useContext(kg),r=xr({select:f=>f.matches.find(m=>m.id===n)?.routeId}),a=t.routesById[r],i=xr({select:f=>{const p=f.matches.find(g=>g.id===n);return sr(p),p.globalNotFound}}),l=xr({select:f=>{const m=f.matches,p=m.findIndex(g=>g.id===n);return m[p+1]?.id}}),u=t.options.defaultPendingComponent?s.jsx(t.options.defaultPendingComponent,{}):null;if(i)return Y3(t,a,void 0);if(!l)return null;const d=s.jsx(K3,{matchId:l});return r===Yr?s.jsx(y.Suspense,{fallback:u,children:d}):d});function CY(){const e=Mr(),n=e.routesById[Yr].options.pendingComponent??e.options.defaultPendingComponent,r=n?s.jsx(n,{}):null,a=e.isServer||typeof document<"u"&&e.ssr?Cc:y.Suspense,i=s.jsxs(a,{fallback:r,children:[!e.isServer&&s.jsx(wY,{}),s.jsx(EY,{})]});return e.options.InnerWrap?s.jsx(e.options.InnerWrap,{children:i}):i}function EY(){const e=Mr(),t=xr({select:a=>a.matches[0]?.id}),n=xr({select:a=>a.loadedAt}),r=t?s.jsx(K3,{matchId:t}):null;return s.jsx(kg.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:s.jsx(wO,{getResetKey:()=>n,errorComponent:Tg,onCatch:a=>{a.message||a.toString()},children:r})})}function AY(){const e=Mr();return xr({select:t=>[t.location.href,t.resolvedLocation?.href,t.status],structuralSharing:!0}),y.useCallback(t=>{const{pending:n,caseSensitive:r,fuzzy:a,includeSearch:i,...l}=t;return e.matchRoute(l,{pending:n,caseSensitive:r,fuzzy:a,includeSearch:i})},[e])}const TY=e=>new kY(e);class kY extends UG{constructor(t){super(t)}}typeof globalThis<"u"?(globalThis.createFileRoute=oP,globalThis.createLazyFileRoute=cP):typeof window<"u"&&(window.createFileRoute=oP,window.createLazyFileRoute=cP);function PY({router:e,children:t,...n}){Object.keys(n).length>0&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const r=G3(),a=s.jsx(r.Provider,{value:e,children:t});return e.options.Wrap?s.jsx(e.options.Wrap,{children:a}):a}function MY({router:e,...t}){return s.jsx(PY,{router:e,...t,children:s.jsx(CY,{})})}function X3(e,t){return function(){return e.apply(t,arguments)}}const{toString:RY}=Object.prototype,{getPrototypeOf:EO}=Object,{iterator:Pg,toStringTag:Z3}=Symbol,Mg=(e=>t=>{const n=RY.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Fa=e=>(e=e.toLowerCase(),t=>Mg(t)===e),Rg=e=>t=>typeof t===e,{isArray:Au}=Array,Zc=Rg("undefined");function gh(e){return e!==null&&!Zc(e)&&e.constructor!==null&&!Zc(e.constructor)&&Er(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Q3=Fa("ArrayBuffer");function DY(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Q3(e.buffer),t}const $Y=Rg("string"),Er=Rg("function"),J3=Rg("number"),yh=e=>e!==null&&typeof e=="object",IY=e=>e===!0||e===!1,Gp=e=>{if(Mg(e)!=="object")return!1;const t=EO(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Z3 in e)&&!(Pg in e)},LY=e=>{if(!yh(e)||gh(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},BY=Fa("Date"),zY=Fa("File"),qY=Fa("Blob"),FY=Fa("FileList"),UY=e=>yh(e)&&Er(e.pipe),HY=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Er(e.append)&&((t=Mg(e))==="formdata"||t==="object"&&Er(e.toString)&&e.toString()==="[object FormData]"))},WY=Fa("URLSearchParams"),[VY,GY,YY,KY]=["ReadableStream","Request","Response","Headers"].map(Fa),XY=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function xh(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,a;if(typeof e!="object"&&(e=[e]),Au(e))for(r=0,a=e.length;r0;)if(a=n[r],t===a.toLowerCase())return a;return null}const zs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,t5=e=>!Zc(e)&&e!==zs;function d_(){const{caseless:e,skipUndefined:t}=t5(this)&&this||{},n={},r=(a,i)=>{const l=e&&e5(n,i)||i;Gp(n[l])&&Gp(a)?n[l]=d_(n[l],a):Gp(a)?n[l]=d_({},a):Au(a)?n[l]=a.slice():(!t||!Zc(a))&&(n[l]=a)};for(let a=0,i=arguments.length;a(xh(t,(a,i)=>{n&&Er(a)?e[i]=X3(a,n):e[i]=a},{allOwnKeys:r}),e),QY=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),JY=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},eK=(e,t,n,r)=>{let a,i,l;const u={};if(t=t||{},e==null)return t;do{for(a=Object.getOwnPropertyNames(e),i=a.length;i-- >0;)l=a[i],(!r||r(l,e,t))&&!u[l]&&(t[l]=e[l],u[l]=!0);e=n!==!1&&EO(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},tK=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},nK=e=>{if(!e)return null;if(Au(e))return e;let t=e.length;if(!J3(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},rK=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&EO(Uint8Array)),aK=(e,t)=>{const r=(e&&e[Pg]).call(e);let a;for(;(a=r.next())&&!a.done;){const i=a.value;t.call(e,i[0],i[1])}},iK=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},oK=Fa("HTMLFormElement"),sK=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,a){return r.toUpperCase()+a}),dP=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),lK=Fa("RegExp"),n5=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};xh(n,(a,i)=>{let l;(l=t(a,i,e))!==!1&&(r[i]=l||a)}),Object.defineProperties(e,r)},cK=e=>{n5(e,(t,n)=>{if(Er(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Er(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},uK=(e,t)=>{const n={},r=a=>{a.forEach(i=>{n[i]=!0})};return Au(e)?r(e):r(String(e).split(t)),n},dK=()=>{},fK=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function hK(e){return!!(e&&Er(e.append)&&e[Z3]==="FormData"&&e[Pg])}const mK=e=>{const t=new Array(10),n=(r,a)=>{if(yh(r)){if(t.indexOf(r)>=0)return;if(gh(r))return r;if(!("toJSON"in r)){t[a]=r;const i=Au(r)?[]:{};return xh(r,(l,u)=>{const d=n(l,a+1);!Zc(d)&&(i[u]=d)}),t[a]=void 0,i}}return r};return n(e,0)},pK=Fa("AsyncFunction"),vK=e=>e&&(yh(e)||Er(e))&&Er(e.then)&&Er(e.catch),r5=((e,t)=>e?setImmediate:t?((n,r)=>(zs.addEventListener("message",({source:a,data:i})=>{a===zs&&i===n&&r.length&&r.shift()()},!1),a=>{r.push(a),zs.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Er(zs.postMessage)),gK=typeof queueMicrotask<"u"?queueMicrotask.bind(zs):typeof process<"u"&&process.nextTick||r5,yK=e=>e!=null&&Er(e[Pg]),de={isArray:Au,isArrayBuffer:Q3,isBuffer:gh,isFormData:HY,isArrayBufferView:DY,isString:$Y,isNumber:J3,isBoolean:IY,isObject:yh,isPlainObject:Gp,isEmptyObject:LY,isReadableStream:VY,isRequest:GY,isResponse:YY,isHeaders:KY,isUndefined:Zc,isDate:BY,isFile:zY,isBlob:qY,isRegExp:lK,isFunction:Er,isStream:UY,isURLSearchParams:WY,isTypedArray:rK,isFileList:FY,forEach:xh,merge:d_,extend:ZY,trim:XY,stripBOM:QY,inherits:JY,toFlatObject:eK,kindOf:Mg,kindOfTest:Fa,endsWith:tK,toArray:nK,forEachEntry:aK,matchAll:iK,isHTMLForm:oK,hasOwnProperty:dP,hasOwnProp:dP,reduceDescriptors:n5,freezeMethods:cK,toObjectSet:uK,toCamelCase:sK,noop:dK,toFiniteNumber:fK,findKey:e5,global:zs,isContextDefined:t5,isSpecCompliantForm:hK,toJSONObject:mK,isAsyncFn:pK,isThenable:vK,setImmediate:r5,asap:gK,isIterable:yK};function Xe(e,t,n,r,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),a&&(this.response=a,this.status=a.status?a.status:null)}de.inherits(Xe,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:de.toJSONObject(this.config),code:this.code,status:this.status}}});const a5=Xe.prototype,i5={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{i5[e]={value:e}});Object.defineProperties(Xe,i5);Object.defineProperty(a5,"isAxiosError",{value:!0});Xe.from=(e,t,n,r,a,i)=>{const l=Object.create(a5);de.toFlatObject(e,l,function(m){return m!==Error.prototype},f=>f!=="isAxiosError");const u=e&&e.message?e.message:"Error",d=t==null&&e?e.code:t;return Xe.call(l,u,d,n,r,a),e&&l.cause==null&&Object.defineProperty(l,"cause",{value:e,configurable:!0}),l.name=e&&e.name||"Error",i&&Object.assign(l,i),l};const xK=null;function f_(e){return de.isPlainObject(e)||de.isArray(e)}function o5(e){return de.endsWith(e,"[]")?e.slice(0,-2):e}function fP(e,t,n){return e?e.concat(t).map(function(a,i){return a=o5(a),!n&&i?"["+a+"]":a}).join(n?".":""):t}function bK(e){return de.isArray(e)&&!e.some(f_)}const wK=de.toFlatObject(de,{},null,function(t){return/^is[A-Z]/.test(t)});function Dg(e,t,n){if(!de.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=de.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,w){return!de.isUndefined(w[b])});const r=n.metaTokens,a=n.visitor||m,i=n.dots,l=n.indexes,d=(n.Blob||typeof Blob<"u"&&Blob)&&de.isSpecCompliantForm(t);if(!de.isFunction(a))throw new TypeError("visitor must be a function");function f(j){if(j===null)return"";if(de.isDate(j))return j.toISOString();if(de.isBoolean(j))return j.toString();if(!d&&de.isBlob(j))throw new Xe("Blob is not supported. Use a Buffer instead.");return de.isArrayBuffer(j)||de.isTypedArray(j)?d&&typeof Blob=="function"?new Blob([j]):Buffer.from(j):j}function m(j,b,w){let N=j;if(j&&!w&&typeof j=="object"){if(de.endsWith(b,"{}"))b=r?b:b.slice(0,-2),j=JSON.stringify(j);else if(de.isArray(j)&&bK(j)||(de.isFileList(j)||de.endsWith(b,"[]"))&&(N=de.toArray(j)))return b=o5(b),N.forEach(function(C,A){!(de.isUndefined(C)||C===null)&&t.append(l===!0?fP([b],A,i):l===null?b:b+"[]",f(C))}),!1}return f_(j)?!0:(t.append(fP(w,b,i),f(j)),!1)}const p=[],g=Object.assign(wK,{defaultVisitor:m,convertValue:f,isVisitable:f_});function x(j,b){if(!de.isUndefined(j)){if(p.indexOf(j)!==-1)throw Error("Circular reference detected in "+b.join("."));p.push(j),de.forEach(j,function(N,O){(!(de.isUndefined(N)||N===null)&&a.call(t,N,de.isString(O)?O.trim():O,b,g))===!0&&x(N,b?b.concat(O):[O])}),p.pop()}}if(!de.isObject(e))throw new TypeError("data must be an object");return x(e),t}function hP(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function AO(e,t){this._pairs=[],e&&Dg(e,this,t)}const s5=AO.prototype;s5.append=function(t,n){this._pairs.push([t,n])};s5.toString=function(t){const n=t?function(r){return t.call(this,r,hP)}:hP;return this._pairs.map(function(a){return n(a[0])+"="+n(a[1])},"").join("&")};function jK(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function l5(e,t,n){if(!t)return e;const r=n&&n.encode||jK;de.isFunction(n)&&(n={serialize:n});const a=n&&n.serialize;let i;if(a?i=a(t,n):i=de.isURLSearchParams(t)?t.toString():new AO(t,n).toString(r),i){const l=e.indexOf("#");l!==-1&&(e=e.slice(0,l)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class mP{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){de.forEach(this.handlers,function(r){r!==null&&t(r)})}}const c5={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},SK=typeof URLSearchParams<"u"?URLSearchParams:AO,_K=typeof FormData<"u"?FormData:null,NK=typeof Blob<"u"?Blob:null,OK={isBrowser:!0,classes:{URLSearchParams:SK,FormData:_K,Blob:NK},protocols:["http","https","file","blob","url","data"]},TO=typeof window<"u"&&typeof document<"u",h_=typeof navigator=="object"&&navigator||void 0,CK=TO&&(!h_||["ReactNative","NativeScript","NS"].indexOf(h_.product)<0),EK=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",AK=TO&&window.location.href||"http://localhost",TK=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:TO,hasStandardBrowserEnv:CK,hasStandardBrowserWebWorkerEnv:EK,navigator:h_,origin:AK},Symbol.toStringTag,{value:"Module"})),or={...TK,...OK};function kK(e,t){return Dg(e,new or.classes.URLSearchParams,{visitor:function(n,r,a,i){return or.isNode&&de.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function PK(e){return de.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function MK(e){const t={},n=Object.keys(e);let r;const a=n.length;let i;for(r=0;r=n.length;return l=!l&&de.isArray(a)?a.length:l,d?(de.hasOwnProp(a,l)?a[l]=[a[l],r]:a[l]=r,!u):((!a[l]||!de.isObject(a[l]))&&(a[l]=[]),t(n,r,a[l],i)&&de.isArray(a[l])&&(a[l]=MK(a[l])),!u)}if(de.isFormData(e)&&de.isFunction(e.entries)){const n={};return de.forEachEntry(e,(r,a)=>{t(PK(r),a,n,0)}),n}return null}function RK(e,t,n){if(de.isString(e))try{return(t||JSON.parse)(e),de.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const bh={transitional:c5,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",a=r.indexOf("application/json")>-1,i=de.isObject(t);if(i&&de.isHTMLForm(t)&&(t=new FormData(t)),de.isFormData(t))return a?JSON.stringify(u5(t)):t;if(de.isArrayBuffer(t)||de.isBuffer(t)||de.isStream(t)||de.isFile(t)||de.isBlob(t)||de.isReadableStream(t))return t;if(de.isArrayBufferView(t))return t.buffer;if(de.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let u;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return kK(t,this.formSerializer).toString();if((u=de.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return Dg(u?{"files[]":t}:t,d&&new d,this.formSerializer)}}return i||a?(n.setContentType("application/json",!1),RK(t)):t}],transformResponse:[function(t){const n=this.transitional||bh.transitional,r=n&&n.forcedJSONParsing,a=this.responseType==="json";if(de.isResponse(t)||de.isReadableStream(t))return t;if(t&&de.isString(t)&&(r&&!this.responseType||a)){const l=!(n&&n.silentJSONParsing)&&a;try{return JSON.parse(t,this.parseReviver)}catch(u){if(l)throw u.name==="SyntaxError"?Xe.from(u,Xe.ERR_BAD_RESPONSE,this,null,this.response):u}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:or.classes.FormData,Blob:or.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};de.forEach(["delete","get","head","post","put","patch"],e=>{bh.headers[e]={}});const DK=de.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),$K=e=>{const t={};let n,r,a;return e&&e.split(` -`).forEach(function(l){a=l.indexOf(":"),n=l.substring(0,a).trim().toLowerCase(),r=l.substring(a+1).trim(),!(!n||t[n]&&DK[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},pP=Symbol("internals");function Hd(e){return e&&String(e).trim().toLowerCase()}function Yp(e){return e===!1||e==null?e:de.isArray(e)?e.map(Yp):String(e)}function IK(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const LK=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function M0(e,t,n,r,a){if(de.isFunction(r))return r.call(this,t,n);if(a&&(t=n),!!de.isString(t)){if(de.isString(r))return t.indexOf(r)!==-1;if(de.isRegExp(r))return r.test(t)}}function BK(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function zK(e,t){const n=de.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(a,i,l){return this[r].call(this,t,a,i,l)},configurable:!0})})}let Ar=class{constructor(t){t&&this.set(t)}set(t,n,r){const a=this;function i(u,d,f){const m=Hd(d);if(!m)throw new Error("header name must be a non-empty string");const p=de.findKey(a,m);(!p||a[p]===void 0||f===!0||f===void 0&&a[p]!==!1)&&(a[p||d]=Yp(u))}const l=(u,d)=>de.forEach(u,(f,m)=>i(f,m,d));if(de.isPlainObject(t)||t instanceof this.constructor)l(t,n);else if(de.isString(t)&&(t=t.trim())&&!LK(t))l($K(t),n);else if(de.isObject(t)&&de.isIterable(t)){let u={},d,f;for(const m of t){if(!de.isArray(m))throw TypeError("Object iterator must return a key-value pair");u[f=m[0]]=(d=u[f])?de.isArray(d)?[...d,m[1]]:[d,m[1]]:m[1]}l(u,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=Hd(t),t){const r=de.findKey(this,t);if(r){const a=this[r];if(!n)return a;if(n===!0)return IK(a);if(de.isFunction(n))return n.call(this,a,r);if(de.isRegExp(n))return n.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Hd(t),t){const r=de.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||M0(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let a=!1;function i(l){if(l=Hd(l),l){const u=de.findKey(r,l);u&&(!n||M0(r,r[u],u,n))&&(delete r[u],a=!0)}}return de.isArray(t)?t.forEach(i):i(t),a}clear(t){const n=Object.keys(this);let r=n.length,a=!1;for(;r--;){const i=n[r];(!t||M0(this,this[i],i,t,!0))&&(delete this[i],a=!0)}return a}normalize(t){const n=this,r={};return de.forEach(this,(a,i)=>{const l=de.findKey(r,i);if(l){n[l]=Yp(a),delete n[i];return}const u=t?BK(i):String(i).trim();u!==i&&delete n[i],n[u]=Yp(a),r[u]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return de.forEach(this,(r,a)=>{r!=null&&r!==!1&&(n[a]=t&&de.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` -`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(a=>r.set(a)),r}static accessor(t){const r=(this[pP]=this[pP]={accessors:{}}).accessors,a=this.prototype;function i(l){const u=Hd(l);r[u]||(zK(a,l),r[u]=!0)}return de.isArray(t)?t.forEach(i):i(t),this}};Ar.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);de.reduceDescriptors(Ar.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});de.freezeMethods(Ar);function R0(e,t){const n=this||bh,r=t||n,a=Ar.from(r.headers);let i=r.data;return de.forEach(e,function(u){i=u.call(n,i,a.normalize(),t?t.status:void 0)}),a.normalize(),i}function d5(e){return!!(e&&e.__CANCEL__)}function Tu(e,t,n){Xe.call(this,e??"canceled",Xe.ERR_CANCELED,t,n),this.name="CanceledError"}de.inherits(Tu,Xe,{__CANCEL__:!0});function f5(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Xe("Request failed with status code "+n.status,[Xe.ERR_BAD_REQUEST,Xe.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function qK(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function FK(e,t){e=e||10;const n=new Array(e),r=new Array(e);let a=0,i=0,l;return t=t!==void 0?t:1e3,function(d){const f=Date.now(),m=r[i];l||(l=f),n[a]=d,r[a]=f;let p=i,g=0;for(;p!==a;)g+=n[p++],p=p%e;if(a=(a+1)%e,a===i&&(i=(i+1)%e),f-l{n=m,a=null,i&&(clearTimeout(i),i=null),e(...f)};return[(...f)=>{const m=Date.now(),p=m-n;p>=r?l(f,m):(a=f,i||(i=setTimeout(()=>{i=null,l(a)},r-p)))},()=>a&&l(a)]}const dv=(e,t,n=3)=>{let r=0;const a=FK(50,250);return UK(i=>{const l=i.loaded,u=i.lengthComputable?i.total:void 0,d=l-r,f=a(d),m=l<=u;r=l;const p={loaded:l,total:u,progress:u?l/u:void 0,bytes:d,rate:f||void 0,estimated:f&&u&&m?(u-l)/f:void 0,event:i,lengthComputable:u!=null,[t?"download":"upload"]:!0};e(p)},n)},vP=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},gP=e=>(...t)=>de.asap(()=>e(...t)),HK=or.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,or.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(or.origin),or.navigator&&/(msie|trident)/i.test(or.navigator.userAgent)):()=>!0,WK=or.hasStandardBrowserEnv?{write(e,t,n,r,a,i,l){if(typeof document>"u")return;const u=[`${e}=${encodeURIComponent(t)}`];de.isNumber(n)&&u.push(`expires=${new Date(n).toUTCString()}`),de.isString(r)&&u.push(`path=${r}`),de.isString(a)&&u.push(`domain=${a}`),i===!0&&u.push("secure"),de.isString(l)&&u.push(`SameSite=${l}`),document.cookie=u.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function VK(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function GK(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function h5(e,t,n){let r=!VK(t);return e&&(r||n==!1)?GK(e,t):t}const yP=e=>e instanceof Ar?{...e}:e;function rl(e,t){t=t||{};const n={};function r(f,m,p,g){return de.isPlainObject(f)&&de.isPlainObject(m)?de.merge.call({caseless:g},f,m):de.isPlainObject(m)?de.merge({},m):de.isArray(m)?m.slice():m}function a(f,m,p,g){if(de.isUndefined(m)){if(!de.isUndefined(f))return r(void 0,f,p,g)}else return r(f,m,p,g)}function i(f,m){if(!de.isUndefined(m))return r(void 0,m)}function l(f,m){if(de.isUndefined(m)){if(!de.isUndefined(f))return r(void 0,f)}else return r(void 0,m)}function u(f,m,p){if(p in t)return r(f,m);if(p in e)return r(void 0,f)}const d={url:i,method:i,data:i,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:u,headers:(f,m,p)=>a(yP(f),yP(m),p,!0)};return de.forEach(Object.keys({...e,...t}),function(m){const p=d[m]||a,g=p(e[m],t[m],m);de.isUndefined(g)&&p!==u||(n[m]=g)}),n}const m5=e=>{const t=rl({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:i,headers:l,auth:u}=t;if(t.headers=l=Ar.from(l),t.url=l5(h5(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),u&&l.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):""))),de.isFormData(n)){if(or.hasStandardBrowserEnv||or.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if(de.isFunction(n.getHeaders)){const d=n.getHeaders(),f=["content-type","content-length"];Object.entries(d).forEach(([m,p])=>{f.includes(m.toLowerCase())&&l.set(m,p)})}}if(or.hasStandardBrowserEnv&&(r&&de.isFunction(r)&&(r=r(t)),r||r!==!1&&HK(t.url))){const d=a&&i&&WK.read(i);d&&l.set(a,d)}return t},YK=typeof XMLHttpRequest<"u",KK=YK&&function(e){return new Promise(function(n,r){const a=m5(e);let i=a.data;const l=Ar.from(a.headers).normalize();let{responseType:u,onUploadProgress:d,onDownloadProgress:f}=a,m,p,g,x,j;function b(){x&&x(),j&&j(),a.cancelToken&&a.cancelToken.unsubscribe(m),a.signal&&a.signal.removeEventListener("abort",m)}let w=new XMLHttpRequest;w.open(a.method.toUpperCase(),a.url,!0),w.timeout=a.timeout;function N(){if(!w)return;const C=Ar.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders()),E={data:!u||u==="text"||u==="json"?w.responseText:w.response,status:w.status,statusText:w.statusText,headers:C,config:e,request:w};f5(function(T){n(T),b()},function(T){r(T),b()},E),w=null}"onloadend"in w?w.onloadend=N:w.onreadystatechange=function(){!w||w.readyState!==4||w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)||setTimeout(N)},w.onabort=function(){w&&(r(new Xe("Request aborted",Xe.ECONNABORTED,e,w)),w=null)},w.onerror=function(A){const E=A&&A.message?A.message:"Network Error",k=new Xe(E,Xe.ERR_NETWORK,e,w);k.event=A||null,r(k),w=null},w.ontimeout=function(){let A=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const E=a.transitional||c5;a.timeoutErrorMessage&&(A=a.timeoutErrorMessage),r(new Xe(A,E.clarifyTimeoutError?Xe.ETIMEDOUT:Xe.ECONNABORTED,e,w)),w=null},i===void 0&&l.setContentType(null),"setRequestHeader"in w&&de.forEach(l.toJSON(),function(A,E){w.setRequestHeader(E,A)}),de.isUndefined(a.withCredentials)||(w.withCredentials=!!a.withCredentials),u&&u!=="json"&&(w.responseType=a.responseType),f&&([g,j]=dv(f,!0),w.addEventListener("progress",g)),d&&w.upload&&([p,x]=dv(d),w.upload.addEventListener("progress",p),w.upload.addEventListener("loadend",x)),(a.cancelToken||a.signal)&&(m=C=>{w&&(r(!C||C.type?new Tu(null,e,w):C),w.abort(),w=null)},a.cancelToken&&a.cancelToken.subscribe(m),a.signal&&(a.signal.aborted?m():a.signal.addEventListener("abort",m)));const O=qK(a.url);if(O&&or.protocols.indexOf(O)===-1){r(new Xe("Unsupported protocol "+O+":",Xe.ERR_BAD_REQUEST,e));return}w.send(i||null)})},XK=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,a;const i=function(f){if(!a){a=!0,u();const m=f instanceof Error?f:this.reason;r.abort(m instanceof Xe?m:new Tu(m instanceof Error?m.message:m))}};let l=t&&setTimeout(()=>{l=null,i(new Xe(`timeout ${t} of ms exceeded`,Xe.ETIMEDOUT))},t);const u=()=>{e&&(l&&clearTimeout(l),l=null,e.forEach(f=>{f.unsubscribe?f.unsubscribe(i):f.removeEventListener("abort",i)}),e=null)};e.forEach(f=>f.addEventListener("abort",i));const{signal:d}=r;return d.unsubscribe=()=>de.asap(u),d}},ZK=function*(e,t){let n=e.byteLength;if(n{const a=QK(e,t);let i=0,l,u=d=>{l||(l=!0,r&&r(d))};return new ReadableStream({async pull(d){try{const{done:f,value:m}=await a.next();if(f){u(),d.close();return}let p=m.byteLength;if(n){let g=i+=p;n(g)}d.enqueue(new Uint8Array(m))}catch(f){throw u(f),f}},cancel(d){return u(d),a.return()}},{highWaterMark:2})},bP=64*1024,{isFunction:gp}=de,eX=(({Request:e,Response:t})=>({Request:e,Response:t}))(de.global),{ReadableStream:wP,TextEncoder:jP}=de.global,SP=(e,...t)=>{try{return!!e(...t)}catch{return!1}},tX=e=>{e=de.merge.call({skipUndefined:!0},eX,e);const{fetch:t,Request:n,Response:r}=e,a=t?gp(t):typeof fetch=="function",i=gp(n),l=gp(r);if(!a)return!1;const u=a&&gp(wP),d=a&&(typeof jP=="function"?(j=>b=>j.encode(b))(new jP):async j=>new Uint8Array(await new n(j).arrayBuffer())),f=i&&u&&SP(()=>{let j=!1;const b=new n(or.origin,{body:new wP,method:"POST",get duplex(){return j=!0,"half"}}).headers.has("Content-Type");return j&&!b}),m=l&&u&&SP(()=>de.isReadableStream(new r("").body)),p={stream:m&&(j=>j.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(j=>{!p[j]&&(p[j]=(b,w)=>{let N=b&&b[j];if(N)return N.call(b);throw new Xe(`Response type '${j}' is not supported`,Xe.ERR_NOT_SUPPORT,w)})});const g=async j=>{if(j==null)return 0;if(de.isBlob(j))return j.size;if(de.isSpecCompliantForm(j))return(await new n(or.origin,{method:"POST",body:j}).arrayBuffer()).byteLength;if(de.isArrayBufferView(j)||de.isArrayBuffer(j))return j.byteLength;if(de.isURLSearchParams(j)&&(j=j+""),de.isString(j))return(await d(j)).byteLength},x=async(j,b)=>{const w=de.toFiniteNumber(j.getContentLength());return w??g(b)};return async j=>{let{url:b,method:w,data:N,signal:O,cancelToken:C,timeout:A,onDownloadProgress:E,onUploadProgress:k,responseType:T,headers:P,withCredentials:$="same-origin",fetchOptions:F}=m5(j),D=t||fetch;T=T?(T+"").toLowerCase():"text";let U=XK([O,C&&C.toAbortSignal()],A),V=null;const H=U&&U.unsubscribe&&(()=>{U.unsubscribe()});let G;try{if(k&&f&&w!=="get"&&w!=="head"&&(G=await x(P,N))!==0){let I=new n(b,{method:"POST",body:N,duplex:"half"}),B;if(de.isFormData(N)&&(B=I.headers.get("content-type"))&&P.setContentType(B),I.body){const[Y,te]=vP(G,dv(gP(k)));N=xP(I.body,bP,Y,te)}}de.isString($)||($=$?"include":"omit");const L=i&&"credentials"in n.prototype,R={...F,signal:U,method:w.toUpperCase(),headers:P.normalize().toJSON(),body:N,duplex:"half",credentials:L?$:void 0};V=i&&new n(b,R);let q=await(i?D(V,F):D(b,R));const K=m&&(T==="stream"||T==="response");if(m&&(E||K&&H)){const I={};["status","statusText","headers"].forEach(oe=>{I[oe]=q[oe]});const B=de.toFiniteNumber(q.headers.get("content-length")),[Y,te]=E&&vP(B,dv(gP(E),!0))||[];q=new r(xP(q.body,bP,Y,()=>{te&&te(),H&&H()}),I)}T=T||"text";let ee=await p[de.findKey(p,T)||"text"](q,j);return!K&&H&&H(),await new Promise((I,B)=>{f5(I,B,{data:ee,headers:Ar.from(q.headers),status:q.status,statusText:q.statusText,config:j,request:V})})}catch(L){throw H&&H(),L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)?Object.assign(new Xe("Network Error",Xe.ERR_NETWORK,j,V),{cause:L.cause||L}):Xe.from(L,L&&L.code,j,V)}}},nX=new Map,p5=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:a}=t,i=[r,a,n];let l=i.length,u=l,d,f,m=nX;for(;u--;)d=i[u],f=m.get(d),f===void 0&&m.set(d,f=u?new Map:tX(t)),m=f;return f};p5();const kO={http:xK,xhr:KK,fetch:{get:p5}};de.forEach(kO,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const _P=e=>`- ${e}`,rX=e=>de.isFunction(e)||e===null||e===!1;function aX(e,t){e=de.isArray(e)?e:[e];const{length:n}=e;let r,a;const i={};for(let l=0;l`adapter ${d} `+(f===!1?"is not supported by the environment":"is not available in the build"));let u=n?l.length>1?`since : -`+l.map(_P).join(` -`):" "+_P(l[0]):"as no adapter specified";throw new Xe("There is no suitable adapter to dispatch the request "+u,"ERR_NOT_SUPPORT")}return a}const v5={getAdapter:aX,adapters:kO};function D0(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Tu(null,e)}function NP(e){return D0(e),e.headers=Ar.from(e.headers),e.data=R0.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),v5.getAdapter(e.adapter||bh.adapter,e)(e).then(function(r){return D0(e),r.data=R0.call(e,e.transformResponse,r),r.headers=Ar.from(r.headers),r},function(r){return d5(r)||(D0(e),r&&r.response&&(r.response.data=R0.call(e,e.transformResponse,r.response),r.response.headers=Ar.from(r.response.headers))),Promise.reject(r)})}const g5="1.13.2",$g={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{$g[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const OP={};$g.transitional=function(t,n,r){function a(i,l){return"[Axios v"+g5+"] Transitional option '"+i+"'"+l+(r?". "+r:"")}return(i,l,u)=>{if(t===!1)throw new Xe(a(l," has been removed"+(n?" in "+n:"")),Xe.ERR_DEPRECATED);return n&&!OP[l]&&(OP[l]=!0,console.warn(a(l," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,l,u):!0}};$g.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function iX(e,t,n){if(typeof e!="object")throw new Xe("options must be an object",Xe.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let a=r.length;for(;a-- >0;){const i=r[a],l=t[i];if(l){const u=e[i],d=u===void 0||l(u,i,e);if(d!==!0)throw new Xe("option "+i+" must be "+d,Xe.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Xe("Unknown option "+i,Xe.ERR_BAD_OPTION)}}const Kp={assertOptions:iX,validators:$g},Xa=Kp.validators;let Ks=class{constructor(t){this.defaults=t||{},this.interceptors={request:new mP,response:new mP}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const i=a.stack?a.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=rl(this.defaults,n);const{transitional:r,paramsSerializer:a,headers:i}=n;r!==void 0&&Kp.assertOptions(r,{silentJSONParsing:Xa.transitional(Xa.boolean),forcedJSONParsing:Xa.transitional(Xa.boolean),clarifyTimeoutError:Xa.transitional(Xa.boolean)},!1),a!=null&&(de.isFunction(a)?n.paramsSerializer={serialize:a}:Kp.assertOptions(a,{encode:Xa.function,serialize:Xa.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Kp.assertOptions(n,{baseUrl:Xa.spelling("baseURL"),withXsrfToken:Xa.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=i&&de.merge(i.common,i[n.method]);i&&de.forEach(["delete","get","head","post","put","patch","common"],j=>{delete i[j]}),n.headers=Ar.concat(l,i);const u=[];let d=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(n)===!1||(d=d&&b.synchronous,u.unshift(b.fulfilled,b.rejected))});const f=[];this.interceptors.response.forEach(function(b){f.push(b.fulfilled,b.rejected)});let m,p=0,g;if(!d){const j=[NP.bind(this),void 0];for(j.unshift(...u),j.push(...f),g=j.length,m=Promise.resolve(n);p{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](a);r._listeners=null}),this.promise.then=a=>{let i;const l=new Promise(u=>{r.subscribe(u),i=u}).then(a);return l.cancel=function(){r.unsubscribe(i)},l},t(function(i,l,u){r.reason||(r.reason=new Tu(i,l,u),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new y5(function(a){t=a}),cancel:t}}};function sX(e){return function(n){return e.apply(null,n)}}function lX(e){return de.isObject(e)&&e.isAxiosError===!0}const m_={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(m_).forEach(([e,t])=>{m_[t]=e});function x5(e){const t=new Ks(e),n=X3(Ks.prototype.request,t);return de.extend(n,Ks.prototype,t,{allOwnKeys:!0}),de.extend(n,t,null,{allOwnKeys:!0}),n.create=function(a){return x5(rl(e,a))},n}const an=x5(bh);an.Axios=Ks;an.CanceledError=Tu;an.CancelToken=oX;an.isCancel=d5;an.VERSION=g5;an.toFormData=Dg;an.AxiosError=Xe;an.Cancel=an.CanceledError;an.all=function(t){return Promise.all(t)};an.spread=sX;an.isAxiosError=lX;an.mergeConfig=rl;an.AxiosHeaders=Ar;an.formToJSON=e=>u5(de.isHTMLForm(e)?new FormData(e):e);an.getAdapter=v5.getAdapter;an.HttpStatusCode=m_;an.default=an;const{Axios:PEe,AxiosError:MEe,CanceledError:REe,isCancel:DEe,CancelToken:$Ee,VERSION:IEe,all:LEe,Cancel:BEe,isAxiosError:zEe,spread:qEe,toFormData:FEe,AxiosHeaders:UEe,HttpStatusCode:HEe,formToJSON:WEe,getAdapter:VEe,mergeConfig:GEe}=an;function b5(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t{const n=new Array(e.length+t.length);for(let r=0;r({classGroupId:e,validator:t}),w5=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),fv="-",CP=[],dX="arbitrary..",fX=e=>{const t=mX(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return hX(l);const u=l.split(fv),d=u[0]===""&&u.length>1?1:0;return j5(u,d,t)},getConflictingClassGroupIds:(l,u)=>{if(u){const d=r[l],f=n[l];return d?f?cX(f,d):d:f||CP}return n[l]||CP}}},j5=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const a=e[t],i=n.nextPart.get(a);if(i){const f=j5(e,t+1,i);if(f)return f}const l=n.validators;if(l===null)return;const u=t===0?e.join(fv):e.slice(t).join(fv),d=l.length;for(let f=0;fe.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?dX+r:void 0})(),mX=e=>{const{theme:t,classGroups:n}=e;return pX(n,t)},pX=(e,t)=>{const n=w5();for(const r in e){const a=e[r];PO(a,n,r,t)}return n},PO=(e,t,n,r)=>{const a=e.length;for(let i=0;i{if(typeof e=="string"){gX(e,t,n);return}if(typeof e=="function"){yX(e,t,n,r);return}xX(e,t,n,r)},gX=(e,t,n)=>{const r=e===""?t:S5(t,e);r.classGroupId=n},yX=(e,t,n,r)=>{if(bX(e)){PO(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(uX(n,e))},xX=(e,t,n,r)=>{const a=Object.entries(e),i=a.length;for(let l=0;l{let n=e;const r=t.split(fv),a=r.length;for(let i=0;i"isThemeGetter"in e&&e.isThemeGetter===!0,wX=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const a=(i,l)=>{n[i]=l,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(i){let l=n[i];if(l!==void 0)return l;if((l=r[i])!==void 0)return a(i,l),l},set(i,l){i in n?n[i]=l:a(i,l)}}},p_="!",EP=":",jX=[],AP=(e,t,n,r,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),SX=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=a=>{const i=[];let l=0,u=0,d=0,f;const m=a.length;for(let b=0;bd?f-d:void 0;return AP(i,x,g,j)};if(t){const a=t+EP,i=r;r=l=>l.startsWith(a)?i(l.slice(a.length)):AP(jX,!1,l,void 0,!0)}if(n){const a=r;r=i=>n({className:i,parseClassName:a})}return r},_X=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let a=[];for(let i=0;i0&&(a.sort(),r.push(...a),a=[]),r.push(l)):a.push(l)}return a.length>0&&(a.sort(),r.push(...a)),r}},NX=e=>({cache:wX(e.cacheSize),parseClassName:SX(e),sortModifiers:_X(e),...fX(e)}),OX=/\s+/,CX=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:i}=t,l=[],u=e.trim().split(OX);let d="";for(let f=u.length-1;f>=0;f-=1){const m=u[f],{isExternal:p,modifiers:g,hasImportantModifier:x,baseClassName:j,maybePostfixModifierPosition:b}=n(m);if(p){d=m+(d.length>0?" "+d:d);continue}let w=!!b,N=r(w?j.substring(0,b):j);if(!N){if(!w){d=m+(d.length>0?" "+d:d);continue}if(N=r(j),!N){d=m+(d.length>0?" "+d:d);continue}w=!1}const O=g.length===0?"":g.length===1?g[0]:i(g).join(":"),C=x?O+p_:O,A=C+N;if(l.indexOf(A)>-1)continue;l.push(A);const E=a(N,w);for(let k=0;k0?" "+d:d)}return d},EX=(...e)=>{let t=0,n,r,a="";for(;t{if(typeof e=="string")return e;let t,n="";for(let r=0;r{let n,r,a,i;const l=d=>{const f=t.reduce((m,p)=>p(m),e());return n=NX(f),r=n.cache.get,a=n.cache.set,i=u,u(d)},u=d=>{const f=r(d);if(f)return f;const m=CX(d,n);return a(d,m),m};return i=l,(...d)=>i(EX(...d))},TX=[],yn=e=>{const t=n=>n[e]||TX;return t.isThemeGetter=!0,t},N5=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,O5=/^\((?:(\w[\w-]*):)?(.+)\)$/i,kX=/^\d+\/\d+$/,PX=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,MX=/\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$/,RX=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,DX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$X=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,gc=e=>kX.test(e),tt=e=>!!e&&!Number.isNaN(Number(e)),Do=e=>!!e&&Number.isInteger(Number(e)),$0=e=>e.endsWith("%")&&tt(e.slice(0,-1)),Li=e=>PX.test(e),IX=()=>!0,LX=e=>MX.test(e)&&!RX.test(e),C5=()=>!1,BX=e=>DX.test(e),zX=e=>$X.test(e),qX=e=>!Te(e)&&!ke(e),FX=e=>ku(e,T5,C5),Te=e=>N5.test(e),Ps=e=>ku(e,k5,LX),I0=e=>ku(e,GX,tt),TP=e=>ku(e,E5,C5),UX=e=>ku(e,A5,zX),yp=e=>ku(e,P5,BX),ke=e=>O5.test(e),Wd=e=>Pu(e,k5),HX=e=>Pu(e,YX),kP=e=>Pu(e,E5),WX=e=>Pu(e,T5),VX=e=>Pu(e,A5),xp=e=>Pu(e,P5,!0),ku=(e,t,n)=>{const r=N5.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Pu=(e,t,n=!1)=>{const r=O5.exec(e);return r?r[1]?t(r[1]):n:!1},E5=e=>e==="position"||e==="percentage",A5=e=>e==="image"||e==="url",T5=e=>e==="length"||e==="size"||e==="bg-size",k5=e=>e==="length",GX=e=>e==="number",YX=e=>e==="family-name",P5=e=>e==="shadow",KX=()=>{const e=yn("color"),t=yn("font"),n=yn("text"),r=yn("font-weight"),a=yn("tracking"),i=yn("leading"),l=yn("breakpoint"),u=yn("container"),d=yn("spacing"),f=yn("radius"),m=yn("shadow"),p=yn("inset-shadow"),g=yn("text-shadow"),x=yn("drop-shadow"),j=yn("blur"),b=yn("perspective"),w=yn("aspect"),N=yn("ease"),O=yn("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...A(),ke,Te],k=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],P=()=>[ke,Te,d],$=()=>[gc,"full","auto",...P()],F=()=>[Do,"none","subgrid",ke,Te],D=()=>["auto",{span:["full",Do,ke,Te]},Do,ke,Te],U=()=>[Do,"auto",ke,Te],V=()=>["auto","min","max","fr",ke,Te],H=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],G=()=>["start","end","center","stretch","center-safe","end-safe"],L=()=>["auto",...P()],R=()=>[gc,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],q=()=>[e,ke,Te],K=()=>[...A(),kP,TP,{position:[ke,Te]}],ee=()=>["no-repeat",{repeat:["","x","y","space","round"]}],I=()=>["auto","cover","contain",WX,FX,{size:[ke,Te]}],B=()=>[$0,Wd,Ps],Y=()=>["","none","full",f,ke,Te],te=()=>["",tt,Wd,Ps],oe=()=>["solid","dashed","dotted","double"],xe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>[tt,$0,kP,TP],ae=()=>["","none",j,ke,Te],Z=()=>["none",tt,ke,Te],pe=()=>["none",tt,ke,Te],je=()=>[tt,ke,Te],le=()=>[gc,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Li],breakpoint:[Li],color:[IX],container:[Li],"drop-shadow":[Li],ease:["in","out","in-out"],font:[qX],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Li],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Li],shadow:[Li],spacing:["px",tt],text:[Li],"text-shadow":[Li],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",gc,Te,ke,w]}],container:["container"],columns:[{columns:[tt,Te,ke,u]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"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"],sr:["sr-only","not-sr-only"],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:E()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],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:[Do,"auto",ke,Te]}],basis:[{basis:[gc,"full","auto",u,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[tt,gc,"auto","initial","none",Te]}],grow:[{grow:["",tt,ke,Te]}],shrink:[{shrink:["",tt,ke,Te]}],order:[{order:[Do,"first","last","none",ke,Te]}],"grid-cols":[{"grid-cols":F()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":F()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":V()}],"auto-rows":[{"auto-rows":V()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...H(),"normal"]}],"justify-items":[{"justify-items":[...G(),"normal"]}],"justify-self":[{"justify-self":["auto",...G()]}],"align-content":[{content:["normal",...H()]}],"align-items":[{items:[...G(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...G(),{baseline:["","last"]}]}],"place-content":[{"place-content":H()}],"place-items":[{"place-items":[...G(),"baseline"]}],"place-self":[{"place-self":["auto",...G()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:L()}],mx:[{mx:L()}],my:[{my:L()}],ms:[{ms:L()}],me:[{me:L()}],mt:[{mt:L()}],mr:[{mr:L()}],mb:[{mb:L()}],ml:[{ml:L()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:R()}],w:[{w:[u,"screen",...R()]}],"min-w":[{"min-w":[u,"screen","none",...R()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[l]},...R()]}],h:[{h:["screen","lh",...R()]}],"min-h":[{"min-h":["screen","lh","none",...R()]}],"max-h":[{"max-h":["screen","lh",...R()]}],"font-size":[{text:["base",n,Wd,Ps]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ke,I0]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",$0,Te]}],"font-family":[{font:[HX,Te,t]}],"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:[a,ke,Te]}],"line-clamp":[{"line-clamp":[tt,"none",ke,I0]}],leading:[{leading:[i,...P()]}],"list-image":[{"list-image":["none",ke,Te]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ke,Te]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:q()}],"text-color":[{text:q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[tt,"from-font","auto",ke,Ps]}],"text-decoration-color":[{decoration:q()}],"underline-offset":[{"underline-offset":[tt,"auto",ke,Te]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke,Te]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ke,Te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:K()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:I()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Do,ke,Te],radial:["",ke,Te],conic:[Do,ke,Te]},VX,UX]}],"bg-color":[{bg:q()}],"gradient-from-pos":[{from:B()}],"gradient-via-pos":[{via:B()}],"gradient-to-pos":[{to:B()}],"gradient-from":[{from:q()}],"gradient-via":[{via:q()}],"gradient-to":[{to:q()}],rounded:[{rounded:Y()}],"rounded-s":[{"rounded-s":Y()}],"rounded-e":[{"rounded-e":Y()}],"rounded-t":[{"rounded-t":Y()}],"rounded-r":[{"rounded-r":Y()}],"rounded-b":[{"rounded-b":Y()}],"rounded-l":[{"rounded-l":Y()}],"rounded-ss":[{"rounded-ss":Y()}],"rounded-se":[{"rounded-se":Y()}],"rounded-ee":[{"rounded-ee":Y()}],"rounded-es":[{"rounded-es":Y()}],"rounded-tl":[{"rounded-tl":Y()}],"rounded-tr":[{"rounded-tr":Y()}],"rounded-br":[{"rounded-br":Y()}],"rounded-bl":[{"rounded-bl":Y()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:q()}],"border-color-x":[{"border-x":q()}],"border-color-y":[{"border-y":q()}],"border-color-s":[{"border-s":q()}],"border-color-e":[{"border-e":q()}],"border-color-t":[{"border-t":q()}],"border-color-r":[{"border-r":q()}],"border-color-b":[{"border-b":q()}],"border-color-l":[{"border-l":q()}],"divide-color":[{divide:q()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[tt,ke,Te]}],"outline-w":[{outline:["",tt,Wd,Ps]}],"outline-color":[{outline:q()}],shadow:[{shadow:["","none",m,xp,yp]}],"shadow-color":[{shadow:q()}],"inset-shadow":[{"inset-shadow":["none",p,xp,yp]}],"inset-shadow-color":[{"inset-shadow":q()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:q()}],"ring-offset-w":[{"ring-offset":[tt,Ps]}],"ring-offset-color":[{"ring-offset":q()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":q()}],"text-shadow":[{"text-shadow":["none",g,xp,yp]}],"text-shadow-color":[{"text-shadow":q()}],opacity:[{opacity:[tt,ke,Te]}],"mix-blend":[{"mix-blend":[...xe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":xe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[tt]}],"mask-image-linear-from-pos":[{"mask-linear-from":J()}],"mask-image-linear-to-pos":[{"mask-linear-to":J()}],"mask-image-linear-from-color":[{"mask-linear-from":q()}],"mask-image-linear-to-color":[{"mask-linear-to":q()}],"mask-image-t-from-pos":[{"mask-t-from":J()}],"mask-image-t-to-pos":[{"mask-t-to":J()}],"mask-image-t-from-color":[{"mask-t-from":q()}],"mask-image-t-to-color":[{"mask-t-to":q()}],"mask-image-r-from-pos":[{"mask-r-from":J()}],"mask-image-r-to-pos":[{"mask-r-to":J()}],"mask-image-r-from-color":[{"mask-r-from":q()}],"mask-image-r-to-color":[{"mask-r-to":q()}],"mask-image-b-from-pos":[{"mask-b-from":J()}],"mask-image-b-to-pos":[{"mask-b-to":J()}],"mask-image-b-from-color":[{"mask-b-from":q()}],"mask-image-b-to-color":[{"mask-b-to":q()}],"mask-image-l-from-pos":[{"mask-l-from":J()}],"mask-image-l-to-pos":[{"mask-l-to":J()}],"mask-image-l-from-color":[{"mask-l-from":q()}],"mask-image-l-to-color":[{"mask-l-to":q()}],"mask-image-x-from-pos":[{"mask-x-from":J()}],"mask-image-x-to-pos":[{"mask-x-to":J()}],"mask-image-x-from-color":[{"mask-x-from":q()}],"mask-image-x-to-color":[{"mask-x-to":q()}],"mask-image-y-from-pos":[{"mask-y-from":J()}],"mask-image-y-to-pos":[{"mask-y-to":J()}],"mask-image-y-from-color":[{"mask-y-from":q()}],"mask-image-y-to-color":[{"mask-y-to":q()}],"mask-image-radial":[{"mask-radial":[ke,Te]}],"mask-image-radial-from-pos":[{"mask-radial-from":J()}],"mask-image-radial-to-pos":[{"mask-radial-to":J()}],"mask-image-radial-from-color":[{"mask-radial-from":q()}],"mask-image-radial-to-color":[{"mask-radial-to":q()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[tt]}],"mask-image-conic-from-pos":[{"mask-conic-from":J()}],"mask-image-conic-to-pos":[{"mask-conic-to":J()}],"mask-image-conic-from-color":[{"mask-conic-from":q()}],"mask-image-conic-to-color":[{"mask-conic-to":q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:K()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:I()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ke,Te]}],filter:[{filter:["","none",ke,Te]}],blur:[{blur:ae()}],brightness:[{brightness:[tt,ke,Te]}],contrast:[{contrast:[tt,ke,Te]}],"drop-shadow":[{"drop-shadow":["","none",x,xp,yp]}],"drop-shadow-color":[{"drop-shadow":q()}],grayscale:[{grayscale:["",tt,ke,Te]}],"hue-rotate":[{"hue-rotate":[tt,ke,Te]}],invert:[{invert:["",tt,ke,Te]}],saturate:[{saturate:[tt,ke,Te]}],sepia:[{sepia:["",tt,ke,Te]}],"backdrop-filter":[{"backdrop-filter":["","none",ke,Te]}],"backdrop-blur":[{"backdrop-blur":ae()}],"backdrop-brightness":[{"backdrop-brightness":[tt,ke,Te]}],"backdrop-contrast":[{"backdrop-contrast":[tt,ke,Te]}],"backdrop-grayscale":[{"backdrop-grayscale":["",tt,ke,Te]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[tt,ke,Te]}],"backdrop-invert":[{"backdrop-invert":["",tt,ke,Te]}],"backdrop-opacity":[{"backdrop-opacity":[tt,ke,Te]}],"backdrop-saturate":[{"backdrop-saturate":[tt,ke,Te]}],"backdrop-sepia":[{"backdrop-sepia":["",tt,ke,Te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ke,Te]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[tt,"initial",ke,Te]}],ease:[{ease:["linear","initial",N,ke,Te]}],delay:[{delay:[tt,ke,Te]}],animate:[{animate:["none",O,ke,Te]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,ke,Te]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:Z()}],"rotate-x":[{"rotate-x":Z()}],"rotate-y":[{"rotate-y":Z()}],"rotate-z":[{"rotate-z":Z()}],scale:[{scale:pe()}],"scale-x":[{"scale-x":pe()}],"scale-y":[{"scale-y":pe()}],"scale-z":[{"scale-z":pe()}],"scale-3d":["scale-3d"],skew:[{skew:je()}],"skew-x":[{"skew-x":je()}],"skew-y":[{"skew-y":je()}],transform:[{transform:[ke,Te,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":["translate-none"],accent:[{accent:q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:q()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",ke,Te]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ke,Te]}],fill:[{fill:["none",...q()]}],"stroke-w":[{stroke:[tt,Wd,Ps,I0]}],stroke:[{stroke:["none",...q()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},XX=AX(KX);function ue(...e){return XX(Ye(e))}const ct=y.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ue("rounded-xl border bg-card text-card-foreground shadow",e),...t}));ct.displayName="Card";const Ut=y.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ue("flex flex-col space-y-1.5 p-6",e),...t}));Ut.displayName="CardHeader";const Ht=y.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ue("font-semibold leading-none tracking-tight",e),...t}));Ht.displayName="CardTitle";const Xn=y.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ue("text-sm text-muted-foreground",e),...t}));Xn.displayName="CardDescription";const un=y.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ue("p-6 pt-0",e),...t}));un.displayName="CardContent";const M5=y.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ue("flex items-center p-6 pt-0",e),...t}));M5.displayName="CardFooter";function Se(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e?.(a),n===!1||!a.defaultPrevented)return t?.(a)}}function ZX(e,t){const n=y.createContext(t),r=i=>{const{children:l,...u}=i,d=y.useMemo(()=>u,Object.values(u));return s.jsx(n.Provider,{value:d,children:l})};r.displayName=e+"Provider";function a(i){const l=y.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,a]}function ur(e,t=[]){let n=[];function r(i,l){const u=y.createContext(l),d=n.length;n=[...n,l];const f=p=>{const{scope:g,children:x,...j}=p,b=g?.[e]?.[d]||u,w=y.useMemo(()=>j,Object.values(j));return s.jsx(b.Provider,{value:w,children:x})};f.displayName=i+"Provider";function m(p,g){const x=g?.[e]?.[d]||u,j=y.useContext(x);if(j)return j;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[f,m]}const a=()=>{const i=n.map(l=>y.createContext(l));return function(u){const d=u?.[e]||i;return y.useMemo(()=>({[`__scope${e}`]:{...u,[e]:d}}),[u,d])}};return a.scopeName=e,[r,QX(a,...t)]}function QX(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const l=r.reduce((u,{useScope:d,scopeName:f})=>{const p=d(i)[`__scope${f}`];return{...u,...p}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}function PP(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Tr(...e){return t=>{let n=!1;const r=e.map(a=>{const i=PP(a,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a{const{children:i,...l}=r,u=y.Children.toArray(i),d=u.find(tZ);if(d){const f=d.props.children,m=u.map(p=>p===d?y.Children.count(f)>1?y.Children.only(null):y.isValidElement(f)?f.props.children:null:p);return s.jsx(t,{...l,ref:a,children:y.isValidElement(f)?y.cloneElement(f,void 0,m):null})}return s.jsx(t,{...l,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}function JX(e){const t=y.forwardRef((n,r)=>{const{children:a,...i}=n;if(y.isValidElement(a)){const l=rZ(a),u=nZ(i,a.props);return a.type!==y.Fragment&&(u.ref=r?Tr(r,l):l),y.cloneElement(a,u)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var eZ=Symbol("radix.slottable");function tZ(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===eZ}function nZ(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...u)=>{const d=i(...u);return a(...u),d}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function rZ(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function wh(e){const t=e+"CollectionProvider",[n,r]=ur(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=b=>{const{scope:w,children:N}=b,O=W.useRef(null),C=W.useRef(new Map).current;return s.jsx(a,{scope:w,itemMap:C,collectionRef:O,children:N})};l.displayName=t;const u=e+"CollectionSlot",d=MP(u),f=W.forwardRef((b,w)=>{const{scope:N,children:O}=b,C=i(u,N),A=qe(w,C.collectionRef);return s.jsx(d,{ref:A,children:O})});f.displayName=u;const m=e+"CollectionItemSlot",p="data-radix-collection-item",g=MP(m),x=W.forwardRef((b,w)=>{const{scope:N,children:O,...C}=b,A=W.useRef(null),E=qe(w,A),k=i(m,N);return W.useEffect(()=>(k.itemMap.set(A,{ref:A,...C}),()=>void k.itemMap.delete(A))),s.jsx(g,{[p]:"",ref:E,children:O})});x.displayName=m;function j(b){const w=i(e+"CollectionConsumer",b);return W.useCallback(()=>{const O=w.collectionRef.current;if(!O)return[];const C=Array.from(O.querySelectorAll(`[${p}]`));return Array.from(w.itemMap.values()).sort((k,T)=>C.indexOf(k.ref.current)-C.indexOf(T.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:l,Slot:f,ItemSlot:x},j,r]}var Bn=globalThis?.document?y.useLayoutEffect:()=>{},aZ=gO[" useId ".trim().toString()]||(()=>{}),iZ=0;function kn(e){const[t,n]=y.useState(aZ());return Bn(()=>{n(r=>r??String(iZ++))},[e]),t?`radix-${t}`:""}function oZ(e){const t=sZ(e),n=y.forwardRef((r,a)=>{const{children:i,...l}=r,u=y.Children.toArray(i),d=u.find(cZ);if(d){const f=d.props.children,m=u.map(p=>p===d?y.Children.count(f)>1?y.Children.only(null):y.isValidElement(f)?f.props.children:null:p);return s.jsx(t,{...l,ref:a,children:y.isValidElement(f)?y.cloneElement(f,void 0,m):null})}return s.jsx(t,{...l,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}function sZ(e){const t=y.forwardRef((n,r)=>{const{children:a,...i}=n;if(y.isValidElement(a)){const l=dZ(a),u=uZ(i,a.props);return a.type!==y.Fragment&&(u.ref=r?Tr(r,l):l),y.cloneElement(a,u)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var lZ=Symbol("radix.slottable");function cZ(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===lZ}function uZ(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...u)=>{const d=i(...u);return a(...u),d}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function dZ(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var fZ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Me=fZ.reduce((e,t)=>{const n=oZ(`Primitive.${t}`),r=y.forwardRef((a,i)=>{const{asChild:l,...u}=a,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(d,{...u,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function MO(e,t){e&&pl.flushSync(()=>e.dispatchEvent(t))}function Xt(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e}),y.useMemo(()=>(...n)=>t.current?.(...n),[])}var hZ=gO[" useInsertionEffect ".trim().toString()]||Bn;function wa({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,i,l]=mZ({defaultProp:t,onChange:n}),u=e!==void 0,d=u?e:a;{const m=y.useRef(e!==void 0);y.useEffect(()=>{const p=m.current;p!==u&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),m.current=u},[u,r])}const f=y.useCallback(m=>{if(u){const p=pZ(m)?m(e):m;p!==e&&l.current?.(p)}else i(m)},[u,e,i,l]);return[d,f]}function mZ({defaultProp:e,onChange:t}){const[n,r]=y.useState(e),a=y.useRef(n),i=y.useRef(t);return hZ(()=>{i.current=t},[t]),y.useEffect(()=>{a.current!==n&&(i.current?.(n),a.current=n)},[n,a]),[n,r,i]}function pZ(e){return typeof e=="function"}var vZ=y.createContext(void 0);function Mu(e){const t=y.useContext(vZ);return e||t||"ltr"}var L0="rovingFocusGroup.onEntryFocus",gZ={bubbles:!1,cancelable:!0},jh="RovingFocusGroup",[v_,R5,yZ]=wh(jh),[xZ,Ig]=ur(jh,[yZ]),[bZ,wZ]=xZ(jh),D5=y.forwardRef((e,t)=>s.jsx(v_.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(v_.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(jZ,{...e,ref:t})})}));D5.displayName=jh;var jZ=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:i,currentTabStopId:l,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:d,onEntryFocus:f,preventScrollOnEntryFocus:m=!1,...p}=e,g=y.useRef(null),x=qe(t,g),j=Mu(i),[b,w]=wa({prop:l,defaultProp:u??null,onChange:d,caller:jh}),[N,O]=y.useState(!1),C=Xt(f),A=R5(n),E=y.useRef(!1),[k,T]=y.useState(0);return y.useEffect(()=>{const P=g.current;if(P)return P.addEventListener(L0,C),()=>P.removeEventListener(L0,C)},[C]),s.jsx(bZ,{scope:n,orientation:r,dir:j,loop:a,currentTabStopId:b,onItemFocus:y.useCallback(P=>w(P),[w]),onItemShiftTab:y.useCallback(()=>O(!0),[]),onFocusableItemAdd:y.useCallback(()=>T(P=>P+1),[]),onFocusableItemRemove:y.useCallback(()=>T(P=>P-1),[]),children:s.jsx(Me.div,{tabIndex:N||k===0?-1:0,"data-orientation":r,...p,ref:x,style:{outline:"none",...e.style},onMouseDown:Se(e.onMouseDown,()=>{E.current=!0}),onFocus:Se(e.onFocus,P=>{const $=!E.current;if(P.target===P.currentTarget&&$&&!N){const F=new CustomEvent(L0,gZ);if(P.currentTarget.dispatchEvent(F),!F.defaultPrevented){const D=A().filter(L=>L.focusable),U=D.find(L=>L.active),V=D.find(L=>L.id===b),G=[U,V,...D].filter(Boolean).map(L=>L.ref.current);L5(G,m)}}E.current=!1}),onBlur:Se(e.onBlur,()=>O(!1))})})}),$5="RovingFocusGroupItem",I5=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:l,...u}=e,d=kn(),f=i||d,m=wZ($5,n),p=m.currentTabStopId===f,g=R5(n),{onFocusableItemAdd:x,onFocusableItemRemove:j,currentTabStopId:b}=m;return y.useEffect(()=>{if(r)return x(),()=>j()},[r,x,j]),s.jsx(v_.ItemSlot,{scope:n,id:f,focusable:r,active:a,children:s.jsx(Me.span,{tabIndex:p?0:-1,"data-orientation":m.orientation,...u,ref:t,onMouseDown:Se(e.onMouseDown,w=>{r?m.onItemFocus(f):w.preventDefault()}),onFocus:Se(e.onFocus,()=>m.onItemFocus(f)),onKeyDown:Se(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){m.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const N=NZ(w,m.orientation,m.dir);if(N!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let C=g().filter(A=>A.focusable).map(A=>A.ref.current);if(N==="last")C.reverse();else if(N==="prev"||N==="next"){N==="prev"&&C.reverse();const A=C.indexOf(w.currentTarget);C=m.loop?OZ(C,A+1):C.slice(A+1)}setTimeout(()=>L5(C))}}),children:typeof l=="function"?l({isCurrentTabStop:p,hasTabStop:b!=null}):l})})});I5.displayName=$5;var SZ={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function _Z(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function NZ(e,t,n){const r=_Z(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return SZ[r]}function L5(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function OZ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var B5=D5,z5=I5;function CZ(e,t){return y.useReducer((n,r)=>t[n][r]??n,e)}var Sn=e=>{const{present:t,children:n}=e,r=EZ(t),a=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),i=qe(r.ref,AZ(a));return typeof n=="function"||r.isPresent?y.cloneElement(a,{ref:i}):null};Sn.displayName="Presence";function EZ(e){const[t,n]=y.useState(),r=y.useRef(null),a=y.useRef(e),i=y.useRef("none"),l=e?"mounted":"unmounted",[u,d]=CZ(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const f=bp(r.current);i.current=u==="mounted"?f:"none"},[u]),Bn(()=>{const f=r.current,m=a.current;if(m!==e){const g=i.current,x=bp(f);e?d("MOUNT"):x==="none"||f?.display==="none"?d("UNMOUNT"):d(m&&g!==x?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,d]),Bn(()=>{if(t){let f;const m=t.ownerDocument.defaultView??window,p=x=>{const b=bp(r.current).includes(CSS.escape(x.animationName));if(x.target===t&&b&&(d("ANIMATION_END"),!a.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",f=m.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},g=x=>{x.target===t&&(i.current=bp(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{m.clearTimeout(f),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:y.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function bp(e){return e?.animationName||"none"}function AZ(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Lg="Tabs",[TZ]=ur(Lg,[Ig]),q5=Ig(),[kZ,RO]=TZ(Lg),F5=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:l="horizontal",dir:u,activationMode:d="automatic",...f}=e,m=Mu(u),[p,g]=wa({prop:r,onChange:a,defaultProp:i??"",caller:Lg});return s.jsx(kZ,{scope:n,baseId:kn(),value:p,onValueChange:g,orientation:l,dir:m,activationMode:d,children:s.jsx(Me.div,{dir:m,"data-orientation":l,...f,ref:t})})});F5.displayName=Lg;var U5="TabsList",H5=y.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...a}=e,i=RO(U5,n),l=q5(n);return s.jsx(B5,{asChild:!0,...l,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(Me.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:t})})});H5.displayName=U5;var W5="TabsTrigger",V5=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=e,l=RO(W5,n),u=q5(n),d=K5(l.baseId,r),f=X5(l.baseId,r),m=r===l.value;return s.jsx(z5,{asChild:!0,...u,focusable:!a,active:m,children:s.jsx(Me.button,{type:"button",role:"tab","aria-selected":m,"aria-controls":f,"data-state":m?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:d,...i,ref:t,onMouseDown:Se(e.onMouseDown,p=>{!a&&p.button===0&&p.ctrlKey===!1?l.onValueChange(r):p.preventDefault()}),onKeyDown:Se(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&l.onValueChange(r)}),onFocus:Se(e.onFocus,()=>{const p=l.activationMode!=="manual";!m&&!a&&p&&l.onValueChange(r)})})})});V5.displayName=W5;var G5="TabsContent",Y5=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...l}=e,u=RO(G5,n),d=K5(u.baseId,r),f=X5(u.baseId,r),m=r===u.value,p=y.useRef(m);return y.useEffect(()=>{const g=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(g)},[]),s.jsx(Sn,{present:a||m,children:({present:g})=>s.jsx(Me.div,{"data-state":m?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":d,hidden:!g,id:f,tabIndex:0,...l,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:g&&i})})});Y5.displayName=G5;function K5(e,t){return`${e}-trigger-${t}`}function X5(e,t){return`${e}-content-${t}`}var PZ=F5,Z5=H5,Q5=V5,J5=Y5;const al=PZ,Yo=y.forwardRef(({className:e,...t},n)=>s.jsx(Z5,{ref:n,className:ue("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));Yo.displayName=Z5.displayName;const Tt=y.forwardRef(({className:e,...t},n)=>s.jsx(Q5,{ref:n,className:ue("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));Tt.displayName=Q5.displayName;const Jt=y.forwardRef(({className:e,...t},n)=>s.jsx(J5,{ref:n,className:ue("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",e),...t}));Jt.displayName=J5.displayName;function Nf(e,[t,n]){return Math.min(n,Math.max(t,e))}function MZ(e,t){return y.useReducer((n,r)=>t[n][r]??n,e)}var DO="ScrollArea",[eB]=ur(DO),[RZ,Sa]=eB(DO),tB=y.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:a,scrollHideDelay:i=600,...l}=e,[u,d]=y.useState(null),[f,m]=y.useState(null),[p,g]=y.useState(null),[x,j]=y.useState(null),[b,w]=y.useState(null),[N,O]=y.useState(0),[C,A]=y.useState(0),[E,k]=y.useState(!1),[T,P]=y.useState(!1),$=qe(t,D=>d(D)),F=Mu(a);return s.jsx(RZ,{scope:n,type:r,dir:F,scrollHideDelay:i,scrollArea:u,viewport:f,onViewportChange:m,content:p,onContentChange:g,scrollbarX:x,onScrollbarXChange:j,scrollbarXEnabled:E,onScrollbarXEnabledChange:k,scrollbarY:b,onScrollbarYChange:w,scrollbarYEnabled:T,onScrollbarYEnabledChange:P,onCornerWidthChange:O,onCornerHeightChange:A,children:s.jsx(Me.div,{dir:F,...l,ref:$,style:{position:"relative","--radix-scroll-area-corner-width":N+"px","--radix-scroll-area-corner-height":C+"px",...e.style}})})});tB.displayName=DO;var nB="ScrollAreaViewport",rB=y.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:a,...i}=e,l=Sa(nB,n),u=y.useRef(null),d=qe(t,u,l.onViewportChange);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),s.jsx(Me.div,{"data-radix-scroll-area-viewport":"",...i,ref:d,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:s.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});rB.displayName=nB;var pi="ScrollAreaScrollbar",$O=y.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=Sa(pi,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:l}=a,u=e.orientation==="horizontal";return y.useEffect(()=>(u?i(!0):l(!0),()=>{u?i(!1):l(!1)}),[u,i,l]),a.type==="hover"?s.jsx(DZ,{...r,ref:t,forceMount:n}):a.type==="scroll"?s.jsx($Z,{...r,ref:t,forceMount:n}):a.type==="auto"?s.jsx(aB,{...r,ref:t,forceMount:n}):a.type==="always"?s.jsx(IO,{...r,ref:t}):null});$O.displayName=pi;var DZ=y.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=Sa(pi,e.__scopeScrollArea),[i,l]=y.useState(!1);return y.useEffect(()=>{const u=a.scrollArea;let d=0;if(u){const f=()=>{window.clearTimeout(d),l(!0)},m=()=>{d=window.setTimeout(()=>l(!1),a.scrollHideDelay)};return u.addEventListener("pointerenter",f),u.addEventListener("pointerleave",m),()=>{window.clearTimeout(d),u.removeEventListener("pointerenter",f),u.removeEventListener("pointerleave",m)}}},[a.scrollArea,a.scrollHideDelay]),s.jsx(Sn,{present:n||i,children:s.jsx(aB,{"data-state":i?"visible":"hidden",...r,ref:t})})}),$Z=y.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=Sa(pi,e.__scopeScrollArea),i=e.orientation==="horizontal",l=zg(()=>d("SCROLL_END"),100),[u,d]=MZ("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return y.useEffect(()=>{if(u==="idle"){const f=window.setTimeout(()=>d("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(f)}},[u,a.scrollHideDelay,d]),y.useEffect(()=>{const f=a.viewport,m=i?"scrollLeft":"scrollTop";if(f){let p=f[m];const g=()=>{const x=f[m];p!==x&&(d("SCROLL"),l()),p=x};return f.addEventListener("scroll",g),()=>f.removeEventListener("scroll",g)}},[a.viewport,i,d,l]),s.jsx(Sn,{present:n||u!=="hidden",children:s.jsx(IO,{"data-state":u==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Se(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Se(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),aB=y.forwardRef((e,t)=>{const n=Sa(pi,e.__scopeScrollArea),{forceMount:r,...a}=e,[i,l]=y.useState(!1),u=e.orientation==="horizontal",d=zg(()=>{if(n.viewport){const f=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,a=Sa(pi,e.__scopeScrollArea),i=y.useRef(null),l=y.useRef(0),[u,d]=y.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),f=cB(u.viewport,u.content),m={...r,sizes:u,onSizesChange:d,hasThumb:f>0&&f<1,onThumbChange:g=>i.current=g,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:g=>l.current=g};function p(g,x){return FZ(g,l.current,u,x)}return n==="horizontal"?s.jsx(IZ,{...m,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const g=a.viewport.scrollLeft,x=RP(g,u,a.dir);i.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:g=>{a.viewport&&(a.viewport.scrollLeft=g)},onDragScroll:g=>{a.viewport&&(a.viewport.scrollLeft=p(g,a.dir))}}):n==="vertical"?s.jsx(LZ,{...m,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const g=a.viewport.scrollTop,x=RP(g,u);i.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:g=>{a.viewport&&(a.viewport.scrollTop=g)},onDragScroll:g=>{a.viewport&&(a.viewport.scrollTop=p(g))}}):null}),IZ=y.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...a}=e,i=Sa(pi,e.__scopeScrollArea),[l,u]=y.useState(),d=y.useRef(null),f=qe(t,d,i.onScrollbarXChange);return y.useEffect(()=>{d.current&&u(getComputedStyle(d.current))},[d]),s.jsx(oB,{"data-orientation":"horizontal",...a,ref:f,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Bg(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.x),onDragScroll:m=>e.onDragScroll(m.x),onWheelScroll:(m,p)=>{if(i.viewport){const g=i.viewport.scrollLeft+m.deltaX;e.onWheelScroll(g),dB(g,p)&&m.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:mv(l.paddingLeft),paddingEnd:mv(l.paddingRight)}})}})}),LZ=y.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...a}=e,i=Sa(pi,e.__scopeScrollArea),[l,u]=y.useState(),d=y.useRef(null),f=qe(t,d,i.onScrollbarYChange);return y.useEffect(()=>{d.current&&u(getComputedStyle(d.current))},[d]),s.jsx(oB,{"data-orientation":"vertical",...a,ref:f,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Bg(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.y),onDragScroll:m=>e.onDragScroll(m.y),onWheelScroll:(m,p)=>{if(i.viewport){const g=i.viewport.scrollTop+m.deltaY;e.onWheelScroll(g),dB(g,p)&&m.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:mv(l.paddingTop),paddingEnd:mv(l.paddingBottom)}})}})}),[BZ,iB]=eB(pi),oB=y.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:a,onThumbChange:i,onThumbPointerUp:l,onThumbPointerDown:u,onThumbPositionChange:d,onDragScroll:f,onWheelScroll:m,onResize:p,...g}=e,x=Sa(pi,n),[j,b]=y.useState(null),w=qe(t,$=>b($)),N=y.useRef(null),O=y.useRef(""),C=x.viewport,A=r.content-r.viewport,E=Xt(m),k=Xt(d),T=zg(p,10);function P($){if(N.current){const F=$.clientX-N.current.left,D=$.clientY-N.current.top;f({x:F,y:D})}}return y.useEffect(()=>{const $=F=>{const D=F.target;j?.contains(D)&&E(F,A)};return document.addEventListener("wheel",$,{passive:!1}),()=>document.removeEventListener("wheel",$,{passive:!1})},[C,j,A,E]),y.useEffect(k,[r,k]),Qc(j,T),Qc(x.content,T),s.jsx(BZ,{scope:n,scrollbar:j,hasThumb:a,onThumbChange:Xt(i),onThumbPointerUp:Xt(l),onThumbPositionChange:k,onThumbPointerDown:Xt(u),children:s.jsx(Me.div,{...g,ref:w,style:{position:"absolute",...g.style},onPointerDown:Se(e.onPointerDown,$=>{$.button===0&&($.target.setPointerCapture($.pointerId),N.current=j.getBoundingClientRect(),O.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),P($))}),onPointerMove:Se(e.onPointerMove,P),onPointerUp:Se(e.onPointerUp,$=>{const F=$.target;F.hasPointerCapture($.pointerId)&&F.releasePointerCapture($.pointerId),document.body.style.webkitUserSelect=O.current,x.viewport&&(x.viewport.style.scrollBehavior=""),N.current=null})})})}),hv="ScrollAreaThumb",sB=y.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=iB(hv,e.__scopeScrollArea);return s.jsx(Sn,{present:n||a.hasThumb,children:s.jsx(zZ,{ref:t,...r})})}),zZ=y.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...a}=e,i=Sa(hv,n),l=iB(hv,n),{onThumbPositionChange:u}=l,d=qe(t,p=>l.onThumbChange(p)),f=y.useRef(void 0),m=zg(()=>{f.current&&(f.current(),f.current=void 0)},100);return y.useEffect(()=>{const p=i.viewport;if(p){const g=()=>{if(m(),!f.current){const x=UZ(p,u);f.current=x,u()}};return u(),p.addEventListener("scroll",g),()=>p.removeEventListener("scroll",g)}},[i.viewport,m,u]),s.jsx(Me.div,{"data-state":l.hasThumb?"visible":"hidden",...a,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Se(e.onPointerDownCapture,p=>{const x=p.target.getBoundingClientRect(),j=p.clientX-x.left,b=p.clientY-x.top;l.onThumbPointerDown({x:j,y:b})}),onPointerUp:Se(e.onPointerUp,l.onThumbPointerUp)})});sB.displayName=hv;var LO="ScrollAreaCorner",lB=y.forwardRef((e,t)=>{const n=Sa(LO,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?s.jsx(qZ,{...e,ref:t}):null});lB.displayName=LO;var qZ=y.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,a=Sa(LO,n),[i,l]=y.useState(0),[u,d]=y.useState(0),f=!!(i&&u);return Qc(a.scrollbarX,()=>{const m=a.scrollbarX?.offsetHeight||0;a.onCornerHeightChange(m),d(m)}),Qc(a.scrollbarY,()=>{const m=a.scrollbarY?.offsetWidth||0;a.onCornerWidthChange(m),l(m)}),f?s.jsx(Me.div,{...r,ref:t,style:{width:i,height:u,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function mv(e){return e?parseInt(e,10):0}function cB(e,t){const n=e/t;return isNaN(n)?0:n}function Bg(e){const t=cB(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function FZ(e,t,n,r="ltr"){const a=Bg(n),i=a/2,l=t||i,u=a-l,d=n.scrollbar.paddingStart+l,f=n.scrollbar.size-n.scrollbar.paddingEnd-u,m=n.content-n.viewport,p=r==="ltr"?[0,m]:[m*-1,0];return uB([d,f],p)(e)}function RP(e,t,n="ltr"){const r=Bg(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-a,l=t.content-t.viewport,u=i-r,d=n==="ltr"?[0,l]:[l*-1,0],f=Nf(e,d);return uB([0,l],[0,u])(f)}function uB(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function dB(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function a(){const i={left:e.scrollLeft,top:e.scrollTop},l=n.left!==i.left,u=n.top!==i.top;(l||u)&&t(),n=i,r=window.requestAnimationFrame(a)})(),()=>window.cancelAnimationFrame(r)};function zg(e,t){const n=Xt(e),r=y.useRef(0);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),y.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Qc(e,t){const n=Xt(t);Bn(()=>{let r=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return a.observe(e),()=>{window.cancelAnimationFrame(r),a.unobserve(e)}}},[e,n])}var fB=tB,HZ=rB,WZ=lB;const Kt=y.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(fB,{ref:r,className:ue("relative overflow-hidden",e),...n,children:[s.jsx(HZ,{className:"h-full w-full rounded-[inherit]",children:t}),s.jsx(hB,{}),s.jsx(WZ,{})]}));Kt.displayName=fB.displayName;const hB=y.forwardRef(({className:e,orientation:t="vertical",...n},r)=>s.jsx($O,{ref:r,orientation:t,className:ue("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:s.jsx(sB,{className:"relative flex-1 rounded-full bg-border"})}));hB.displayName=$O.displayName;var B0,DP;function Rr(){if(DP)return B0;DP=1;var e=Array.isArray;return B0=e,B0}var z0,$P;function mB(){if($P)return z0;$P=1;var e=typeof fp=="object"&&fp&&fp.Object===Object&&fp;return z0=e,z0}var q0,IP;function vi(){if(IP)return q0;IP=1;var e=mB(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return q0=n,q0}var F0,LP;function Sh(){if(LP)return F0;LP=1;var e=vi(),t=e.Symbol;return F0=t,F0}var U0,BP;function VZ(){if(BP)return U0;BP=1;var e=Sh(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,a=e?e.toStringTag:void 0;function i(l){var u=n.call(l,a),d=l[a];try{l[a]=void 0;var f=!0}catch{}var m=r.call(l);return f&&(u?l[a]=d:delete l[a]),m}return U0=i,U0}var H0,zP;function GZ(){if(zP)return H0;zP=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return H0=n,H0}var W0,qP;function io(){if(qP)return W0;qP=1;var e=Sh(),t=VZ(),n=GZ(),r="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?a:r:i&&i in Object(u)?t(u):n(u)}return W0=l,W0}var V0,FP;function oo(){if(FP)return V0;FP=1;function e(t){return t!=null&&typeof t=="object"}return V0=e,V0}var G0,UP;function Ru(){if(UP)return G0;UP=1;var e=io(),t=oo(),n="[object Symbol]";function r(a){return typeof a=="symbol"||t(a)&&e(a)==n}return G0=r,G0}var Y0,HP;function BO(){if(HP)return Y0;HP=1;var e=Rr(),t=Ru(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function a(i,l){if(e(i))return!1;var u=typeof i;return u=="number"||u=="symbol"||u=="boolean"||i==null||t(i)?!0:r.test(i)||!n.test(i)||l!=null&&i in Object(l)}return Y0=a,Y0}var K0,WP;function ts(){if(WP)return K0;WP=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return K0=e,K0}var X0,VP;function zO(){if(VP)return X0;VP=1;var e=io(),t=ts(),n="[object AsyncFunction]",r="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function l(u){if(!t(u))return!1;var d=e(u);return d==r||d==a||d==n||d==i}return X0=l,X0}var Z0,GP;function YZ(){if(GP)return Z0;GP=1;var e=vi(),t=e["__core-js_shared__"];return Z0=t,Z0}var Q0,YP;function KZ(){if(YP)return Q0;YP=1;var e=YZ(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return Q0=n,Q0}var J0,KP;function pB(){if(KP)return J0;KP=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return J0=n,J0}var ew,XP;function XZ(){if(XP)return ew;XP=1;var e=zO(),t=KZ(),n=ts(),r=pB(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,d=l.toString,f=u.hasOwnProperty,m=RegExp("^"+d.call(f).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p(g){if(!n(g)||t(g))return!1;var x=e(g)?m:i;return x.test(r(g))}return ew=p,ew}var tw,ZP;function ZZ(){if(ZP)return tw;ZP=1;function e(t,n){return t?.[n]}return tw=e,tw}var nw,QP;function vl(){if(QP)return nw;QP=1;var e=XZ(),t=ZZ();function n(r,a){var i=t(r,a);return e(i)?i:void 0}return nw=n,nw}var rw,JP;function qg(){if(JP)return rw;JP=1;var e=vl(),t=e(Object,"create");return rw=t,rw}var aw,eM;function QZ(){if(eM)return aw;eM=1;var e=qg();function t(){this.__data__=e?e(null):{},this.size=0}return aw=t,aw}var iw,tM;function JZ(){if(tM)return iw;tM=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return iw=e,iw}var ow,nM;function eQ(){if(nM)return ow;nM=1;var e=qg(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function a(i){var l=this.__data__;if(e){var u=l[i];return u===t?void 0:u}return r.call(l,i)?l[i]:void 0}return ow=a,ow}var sw,rM;function tQ(){if(rM)return sw;rM=1;var e=qg(),t=Object.prototype,n=t.hasOwnProperty;function r(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return sw=r,sw}var lw,aM;function nQ(){if(aM)return lw;aM=1;var e=qg(),t="__lodash_hash_undefined__";function n(r,a){var i=this.__data__;return this.size+=this.has(r)?0:1,i[r]=e&&a===void 0?t:a,this}return lw=n,lw}var cw,iM;function rQ(){if(iM)return cw;iM=1;var e=QZ(),t=JZ(),n=eQ(),r=tQ(),a=nQ();function i(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u-1}return pw=t,pw}var vw,fM;function lQ(){if(fM)return vw;fM=1;var e=Fg();function t(n,r){var a=this.__data__,i=e(a,n);return i<0?(++this.size,a.push([n,r])):a[i][1]=r,this}return vw=t,vw}var gw,hM;function Ug(){if(hM)return gw;hM=1;var e=aQ(),t=iQ(),n=oQ(),r=sQ(),a=lQ();function i(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u0?1:-1},qs=function(t){return il(t)&&t.indexOf("%")===t.length-1},Ne=function(t){return kQ(t)&&!_h(t)},PQ=function(t){return Ge(t)},jn=function(t){return Ne(t)||il(t)},MQ=0,$u=function(t){var n=++MQ;return"".concat(t||"").concat(n)},gr=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Ne(t)&&!il(t))return r;var i;if(qs(t)){var l=t.indexOf("%");i=n*parseFloat(t.slice(0,l))/100}else i=+t;return _h(i)&&(i=r),a&&i>n&&(i=n),i},Bo=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},RQ=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function qQ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function y_(e){"@babel/helpers - typeof";return y_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y_(e)}var qM={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},Ki=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},FM=null,Uw=null,GO=function e(t){if(t===FM&&Array.isArray(Uw))return Uw;var n=[];return y.Children.forEach(t,function(r){Ge(r)||(CQ.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),Uw=n,FM=t,n};function Jr(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(a){return Ki(a)}):r=[Ki(t)],GO(e).forEach(function(a){var i=Qr(a,"type.displayName")||Qr(a,"type.name");r.indexOf(i)!==-1&&n.push(a)}),n}function Vr(e,t){var n=Jr(e,t);return n&&n[0]}var UM=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,a=n.height;return!(!Ne(r)||r<=0||!Ne(a)||a<=0)},FQ=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],UQ=function(t){return t&&t.type&&il(t.type)&&FQ.indexOf(t.type)>=0},HQ=function(t){return t&&y_(t)==="object"&&"clipDot"in t},WQ=function(t,n,r,a){var i,l=(i=Fw?.[a])!==null&&i!==void 0?i:[];return n.startsWith("data-")||!We(t)&&(a&&l.includes(n)||IQ.includes(n))||r&&VO.includes(n)},Be=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var a=t;if(y.isValidElement(t)&&(a=t.props),!Du(a))return null;var i={};return Object.keys(a).forEach(function(l){var u;WQ((u=a)===null||u===void 0?void 0:u[l],l,n,r)&&(i[l]=a[l])}),i},x_=function e(t,n){if(t===n)return!0;var r=y.Children.count(t);if(r!==y.Children.count(n))return!1;if(r===0)return!0;if(r===1)return HM(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function XQ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function w_(e){var t=e.children,n=e.width,r=e.height,a=e.viewBox,i=e.className,l=e.style,u=e.title,d=e.desc,f=KQ(e,YQ),m=a||{width:n,height:r,x:0,y:0},p=Ye("recharts-surface",i);return W.createElement("svg",b_({},Be(f,!0,"svg"),{className:p,width:n,height:r,style:l,viewBox:"".concat(m.x," ").concat(m.y," ").concat(m.width," ").concat(m.height)}),W.createElement("title",null,u),W.createElement("desc",null,d),t)}var ZQ=["children","className"];function j_(){return j_=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function JQ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var ft=W.forwardRef(function(e,t){var n=e.children,r=e.className,a=QQ(e,ZQ),i=Ye("recharts-layer",r);return W.createElement("g",j_({className:i},Be(a,!0),{ref:t}),n)}),$a=function(t,n){for(var r=arguments.length,a=new Array(r>2?r-2:0),i=2;ii?0:i+n),r=r>i?i:r,r<0&&(r+=i),i=n>r?0:r-n>>>0,n>>>=0;for(var l=Array(i);++a=i?n:e(n,r,a)}return Ww=t,Ww}var Vw,YM;function wB(){if(YM)return Vw;YM=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,i="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+a+i+"]");function d(f){return u.test(f)}return Vw=d,Vw}var Gw,KM;function nJ(){if(KM)return Gw;KM=1;function e(t){return t.split("")}return Gw=e,Gw}var Yw,XM;function rJ(){if(XM)return Yw;XM=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,i="\\ufe0e\\ufe0f",l="["+e+"]",u="["+a+"]",d="\\ud83c[\\udffb-\\udfff]",f="(?:"+u+"|"+d+")",m="[^"+e+"]",p="(?:\\ud83c[\\udde6-\\uddff]){2}",g="[\\ud800-\\udbff][\\udc00-\\udfff]",x="\\u200d",j=f+"?",b="["+i+"]?",w="(?:"+x+"(?:"+[m,p,g].join("|")+")"+b+j+")*",N=b+j+w,O="(?:"+[m+u+"?",u,p,g,l].join("|")+")",C=RegExp(d+"(?="+d+")|"+O+N,"g");function A(E){return E.match(C)||[]}return Yw=A,Yw}var Kw,ZM;function aJ(){if(ZM)return Kw;ZM=1;var e=nJ(),t=wB(),n=rJ();function r(a){return t(a)?n(a):e(a)}return Kw=r,Kw}var Xw,QM;function iJ(){if(QM)return Xw;QM=1;var e=tJ(),t=wB(),n=aJ(),r=gB();function a(i){return function(l){l=r(l);var u=t(l)?n(l):void 0,d=u?u[0]:l.charAt(0),f=u?e(u,1).join(""):l.slice(1);return d[i]()+f}}return Xw=a,Xw}var Zw,JM;function oJ(){if(JM)return Zw;JM=1;var e=iJ(),t=e("toUpperCase");return Zw=t,Zw}var sJ=oJ();const Vg=wt(sJ);function Lt(e){return function(){return e}}const jB=Math.cos,gv=Math.sin,Ua=Math.sqrt,yv=Math.PI,Gg=2*yv,S_=Math.PI,__=2*S_,$s=1e-6,lJ=__-$s;function SB(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return SB;const n=10**t;return function(r){this._+=r[0];for(let a=1,i=r.length;a$s)if(!(Math.abs(p*d-f*m)>$s)||!i)this._append`L${this._x1=t},${this._y1=n}`;else{let x=r-l,j=a-u,b=d*d+f*f,w=x*x+j*j,N=Math.sqrt(b),O=Math.sqrt(g),C=i*Math.tan((S_-Math.acos((b+g-w)/(2*N*O)))/2),A=C/O,E=C/N;Math.abs(A-1)>$s&&this._append`L${t+A*m},${n+A*p}`,this._append`A${i},${i},0,0,${+(p*x>m*j)},${this._x1=t+E*d},${this._y1=n+E*f}`}}arc(t,n,r,a,i,l){if(t=+t,n=+n,r=+r,l=!!l,r<0)throw new Error(`negative radius: ${r}`);let u=r*Math.cos(a),d=r*Math.sin(a),f=t+u,m=n+d,p=1^l,g=l?a-i:i-a;this._x1===null?this._append`M${f},${m}`:(Math.abs(this._x1-f)>$s||Math.abs(this._y1-m)>$s)&&this._append`L${f},${m}`,r&&(g<0&&(g=g%__+__),g>lJ?this._append`A${r},${r},0,1,${p},${t-u},${n-d}A${r},${r},0,1,${p},${this._x1=f},${this._y1=m}`:g>$s&&this._append`A${r},${r},0,${+(g>=S_)},${p},${this._x1=t+r*Math.cos(i)},${this._y1=n+r*Math.sin(i)}`)}rect(t,n,r,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+a}h${-r}Z`}toString(){return this._}}function YO(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new uJ(t)}function KO(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function _B(e){this._context=e}_B.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Yg(e){return new _B(e)}function NB(e){return e[0]}function OB(e){return e[1]}function CB(e,t){var n=Lt(!0),r=null,a=Yg,i=null,l=YO(u);e=typeof e=="function"?e:e===void 0?NB:Lt(e),t=typeof t=="function"?t:t===void 0?OB:Lt(t);function u(d){var f,m=(d=KO(d)).length,p,g=!1,x;for(r==null&&(i=a(x=l())),f=0;f<=m;++f)!(f=x;--j)u.point(C[j],A[j]);u.lineEnd(),u.areaEnd()}N&&(C[g]=+e(w,g,p),A[g]=+t(w,g,p),u.point(r?+r(w,g,p):C[g],n?+n(w,g,p):A[g]))}if(O)return u=null,O+""||null}function m(){return CB().defined(a).curve(l).context(i)}return f.x=function(p){return arguments.length?(e=typeof p=="function"?p:Lt(+p),r=null,f):e},f.x0=function(p){return arguments.length?(e=typeof p=="function"?p:Lt(+p),f):e},f.x1=function(p){return arguments.length?(r=p==null?null:typeof p=="function"?p:Lt(+p),f):r},f.y=function(p){return arguments.length?(t=typeof p=="function"?p:Lt(+p),n=null,f):t},f.y0=function(p){return arguments.length?(t=typeof p=="function"?p:Lt(+p),f):t},f.y1=function(p){return arguments.length?(n=p==null?null:typeof p=="function"?p:Lt(+p),f):n},f.lineX0=f.lineY0=function(){return m().x(e).y(t)},f.lineY1=function(){return m().x(e).y(n)},f.lineX1=function(){return m().x(r).y(t)},f.defined=function(p){return arguments.length?(a=typeof p=="function"?p:Lt(!!p),f):a},f.curve=function(p){return arguments.length?(l=p,i!=null&&(u=l(i)),f):l},f.context=function(p){return arguments.length?(p==null?i=u=null:u=l(i=p),f):i},f}class EB{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function dJ(e){return new EB(e,!0)}function fJ(e){return new EB(e,!1)}const XO={draw(e,t){const n=Ua(t/yv);e.moveTo(n,0),e.arc(0,0,n,0,Gg)}},hJ={draw(e,t){const n=Ua(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},AB=Ua(1/3),mJ=AB*2,pJ={draw(e,t){const n=Ua(t/mJ),r=n*AB;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},vJ={draw(e,t){const n=Ua(t),r=-n/2;e.rect(r,r,n,n)}},gJ=.8908130915292852,TB=gv(yv/10)/gv(7*yv/10),yJ=gv(Gg/10)*TB,xJ=-jB(Gg/10)*TB,bJ={draw(e,t){const n=Ua(t*gJ),r=yJ*n,a=xJ*n;e.moveTo(0,-n),e.lineTo(r,a);for(let i=1;i<5;++i){const l=Gg*i/5,u=jB(l),d=gv(l);e.lineTo(d*n,-u*n),e.lineTo(u*r-d*a,d*r+u*a)}e.closePath()}},Qw=Ua(3),wJ={draw(e,t){const n=-Ua(t/(Qw*3));e.moveTo(0,n*2),e.lineTo(-Qw*n,-n),e.lineTo(Qw*n,-n),e.closePath()}},ha=-.5,ma=Ua(3)/2,N_=1/Ua(12),jJ=(N_/2+1)*3,SJ={draw(e,t){const n=Ua(t/jJ),r=n/2,a=n*N_,i=r,l=n*N_+n,u=-i,d=l;e.moveTo(r,a),e.lineTo(i,l),e.lineTo(u,d),e.lineTo(ha*r-ma*a,ma*r+ha*a),e.lineTo(ha*i-ma*l,ma*i+ha*l),e.lineTo(ha*u-ma*d,ma*u+ha*d),e.lineTo(ha*r+ma*a,ha*a-ma*r),e.lineTo(ha*i+ma*l,ha*l-ma*i),e.lineTo(ha*u+ma*d,ha*d-ma*u),e.closePath()}};function _J(e,t){let n=null,r=YO(a);e=typeof e=="function"?e:Lt(e||XO),t=typeof t=="function"?t:Lt(t===void 0?64:+t);function a(){let i;if(n||(n=i=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return a.type=function(i){return arguments.length?(e=typeof i=="function"?i:Lt(i),a):e},a.size=function(i){return arguments.length?(t=typeof i=="function"?i:Lt(+i),a):t},a.context=function(i){return arguments.length?(n=i??null,a):n},a}function xv(){}function bv(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function kB(e){this._context=e}kB.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:bv(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:bv(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function NJ(e){return new kB(e)}function PB(e){this._context=e}PB.prototype={areaStart:xv,areaEnd:xv,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:bv(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function OJ(e){return new PB(e)}function MB(e){this._context=e}MB.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:bv(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function CJ(e){return new MB(e)}function RB(e){this._context=e}RB.prototype={areaStart:xv,areaEnd:xv,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function EJ(e){return new RB(e)}function eR(e){return e<0?-1:1}function tR(e,t,n){var r=e._x1-e._x0,a=t-e._x1,i=(e._y1-e._y0)/(r||a<0&&-0),l=(n-e._y1)/(a||r<0&&-0),u=(i*a+l*r)/(r+a);return(eR(i)+eR(l))*Math.min(Math.abs(i),Math.abs(l),.5*Math.abs(u))||0}function nR(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Jw(e,t,n){var r=e._x0,a=e._y0,i=e._x1,l=e._y1,u=(i-r)/3;e._context.bezierCurveTo(r+u,a+u*t,i-u,l-u*n,i,l)}function wv(e){this._context=e}wv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Jw(this,this._t0,nR(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Jw(this,nR(this,n=tR(this,e,t)),n);break;default:Jw(this,this._t0,n=tR(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function DB(e){this._context=new $B(e)}(DB.prototype=Object.create(wv.prototype)).point=function(e,t){wv.prototype.point.call(this,t,e)};function $B(e){this._context=e}$B.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,a,i){this._context.bezierCurveTo(t,e,r,n,i,a)}};function AJ(e){return new wv(e)}function TJ(e){return new DB(e)}function IB(e){this._context=e}IB.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=rR(e),a=rR(t),i=0,l=1;l=0;--t)a[t]=(l[t]-a[t+1])/i[t];for(i[n-1]=(e[n]+a[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function PJ(e){return new Kg(e,.5)}function MJ(e){return new Kg(e,0)}function RJ(e){return new Kg(e,1)}function Jc(e,t){if((l=e.length)>1)for(var n=1,r,a,i=e[t[0]],l,u=i.length;n=0;)n[t]=t;return n}function DJ(e,t){return e[t]}function $J(e){const t=[];return t.key=e,t}function IJ(){var e=Lt([]),t=O_,n=Jc,r=DJ;function a(i){var l=Array.from(e.apply(this,arguments),$J),u,d=l.length,f=-1,m;for(const p of i)for(u=0,++f;u0){for(var n,r,a=0,i=e[0].length,l;a0){for(var n=0,r=e[t[0]],a,i=r.length;n0)||!((i=(a=e[t[0]]).length)>0))){for(var n=0,r=1,a,i,l;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function VJ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var LB={symbolCircle:XO,symbolCross:hJ,symbolDiamond:pJ,symbolSquare:vJ,symbolStar:bJ,symbolTriangle:wJ,symbolWye:SJ},GJ=Math.PI/180,YJ=function(t){var n="symbol".concat(Vg(t));return LB[n]||XO},KJ=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var a=18*GJ;return 1.25*t*t*(Math.tan(a)-Math.tan(a*2)*Math.pow(Math.tan(a),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},XJ=function(t,n){LB["symbol".concat(Vg(t))]=n},ZO=function(t){var n=t.type,r=n===void 0?"circle":n,a=t.size,i=a===void 0?64:a,l=t.sizeType,u=l===void 0?"area":l,d=WJ(t,qJ),f=iR(iR({},d),{},{type:r,size:i,sizeType:u}),m=function(){var w=YJ(r),N=_J().type(w).size(KJ(i,u,r));return N()},p=f.className,g=f.cx,x=f.cy,j=Be(f,!0);return g===+g&&x===+x&&i===+i?W.createElement("path",C_({},j,{className:Ye("recharts-symbols",p),transform:"translate(".concat(g,", ").concat(x,")"),d:m()})):null};ZO.registerSymbol=XJ;function eu(e){"@babel/helpers - typeof";return eu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},eu(e)}function E_(){return E_=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var O=x.inactive?f:x.color;return W.createElement("li",E_({className:w,style:p,key:"legend-item-".concat(j)},ol(r.props,x,j)),W.createElement(w_,{width:l,height:l,viewBox:m,style:g},r.renderIcon(x)),W.createElement("span",{className:"recharts-legend-item-text",style:{color:O}},b?b(N,x,j):N))})}},{key:"render",value:function(){var r=this.props,a=r.payload,i=r.layout,l=r.align;if(!a||!a.length)return null;var u={padding:0,margin:0,textAlign:i==="horizontal"?l:"left"};return W.createElement("ul",{className:"recharts-default-legend",style:u},this.renderItems())}}])})(y.PureComponent);Cf(QO,"displayName","Legend");Cf(QO,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var e1,sR;function oee(){if(sR)return e1;sR=1;var e=Ug();function t(){this.__data__=new e,this.size=0}return e1=t,e1}var t1,lR;function see(){if(lR)return t1;lR=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return t1=e,t1}var n1,cR;function lee(){if(cR)return n1;cR=1;function e(t){return this.__data__.get(t)}return n1=e,n1}var r1,uR;function cee(){if(uR)return r1;uR=1;function e(t){return this.__data__.has(t)}return r1=e,r1}var a1,dR;function uee(){if(dR)return a1;dR=1;var e=Ug(),t=FO(),n=UO(),r=200;function a(i,l){var u=this.__data__;if(u instanceof e){var d=u.__data__;if(!t||d.lengthx))return!1;var b=p.get(l),w=p.get(u);if(b&&w)return b==u&&w==l;var N=-1,O=!0,C=d&a?new e:void 0;for(p.set(l,u),p.set(u,l);++N-1&&r%1==0&&r-1&&n%1==0&&n<=e}return O1=t,O1}var C1,DR;function See(){if(DR)return C1;DR=1;var e=io(),t=nC(),n=oo(),r="[object Arguments]",a="[object Array]",i="[object Boolean]",l="[object Date]",u="[object Error]",d="[object Function]",f="[object Map]",m="[object Number]",p="[object Object]",g="[object RegExp]",x="[object Set]",j="[object String]",b="[object WeakMap]",w="[object ArrayBuffer]",N="[object DataView]",O="[object Float32Array]",C="[object Float64Array]",A="[object Int8Array]",E="[object Int16Array]",k="[object Int32Array]",T="[object Uint8Array]",P="[object Uint8ClampedArray]",$="[object Uint16Array]",F="[object Uint32Array]",D={};D[O]=D[C]=D[A]=D[E]=D[k]=D[T]=D[P]=D[$]=D[F]=!0,D[r]=D[a]=D[w]=D[i]=D[N]=D[l]=D[u]=D[d]=D[f]=D[m]=D[p]=D[g]=D[x]=D[j]=D[b]=!1;function U(V){return n(V)&&t(V.length)&&!!D[e(V)]}return C1=U,C1}var E1,$R;function YB(){if($R)return E1;$R=1;function e(t){return function(n){return t(n)}}return E1=e,E1}var of={exports:{}};of.exports;var IR;function _ee(){return IR||(IR=1,(function(e,t){var n=mB(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===r,l=i&&n.process,u=(function(){try{var d=a&&a.require&&a.require("util").types;return d||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(of,of.exports)),of.exports}var A1,LR;function KB(){if(LR)return A1;LR=1;var e=See(),t=YB(),n=_ee(),r=n&&n.isTypedArray,a=r?t(r):e;return A1=a,A1}var T1,BR;function Nee(){if(BR)return T1;BR=1;var e=bee(),t=eC(),n=Rr(),r=GB(),a=tC(),i=KB(),l=Object.prototype,u=l.hasOwnProperty;function d(f,m){var p=n(f),g=!p&&t(f),x=!p&&!g&&r(f),j=!p&&!g&&!x&&i(f),b=p||g||x||j,w=b?e(f.length,String):[],N=w.length;for(var O in f)(m||u.call(f,O))&&!(b&&(O=="length"||x&&(O=="offset"||O=="parent")||j&&(O=="buffer"||O=="byteLength"||O=="byteOffset")||a(O,N)))&&w.push(O);return w}return T1=d,T1}var k1,zR;function Oee(){if(zR)return k1;zR=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,a=typeof r=="function"&&r.prototype||e;return n===a}return k1=t,k1}var P1,qR;function XB(){if(qR)return P1;qR=1;function e(t,n){return function(r){return t(n(r))}}return P1=e,P1}var M1,FR;function Cee(){if(FR)return M1;FR=1;var e=XB(),t=e(Object.keys,Object);return M1=t,M1}var R1,UR;function Eee(){if(UR)return R1;UR=1;var e=Oee(),t=Cee(),n=Object.prototype,r=n.hasOwnProperty;function a(i){if(!e(i))return t(i);var l=[];for(var u in Object(i))r.call(i,u)&&u!="constructor"&&l.push(u);return l}return R1=a,R1}var D1,HR;function Nh(){if(HR)return D1;HR=1;var e=zO(),t=nC();function n(r){return r!=null&&t(r.length)&&!e(r)}return D1=n,D1}var $1,WR;function Xg(){if(WR)return $1;WR=1;var e=Nee(),t=Eee(),n=Nh();function r(a){return n(a)?e(a):t(a)}return $1=r,$1}var I1,VR;function Aee(){if(VR)return I1;VR=1;var e=vee(),t=xee(),n=Xg();function r(a){return e(a,n,t)}return I1=r,I1}var L1,GR;function Tee(){if(GR)return L1;GR=1;var e=Aee(),t=1,n=Object.prototype,r=n.hasOwnProperty;function a(i,l,u,d,f,m){var p=u&t,g=e(i),x=g.length,j=e(l),b=j.length;if(x!=b&&!p)return!1;for(var w=x;w--;){var N=g[w];if(!(p?N in l:r.call(l,N)))return!1}var O=m.get(i),C=m.get(l);if(O&&C)return O==l&&C==i;var A=!0;m.set(i,l),m.set(l,i);for(var E=p;++w-1}return uj=t,uj}var dj,bD;function Xee(){if(bD)return dj;bD=1;function e(t,n,r){for(var a=-1,i=t==null?0:t.length;++a=l){var N=f?null:a(d);if(N)return i(N);j=!1,g=r,w=new e}else w=f?[]:b;e:for(;++p=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function dte(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function fte(e){return e.value}function hte(e,t){if(W.isValidElement(e))return W.cloneElement(e,t);if(typeof e=="function")return W.createElement(e,t);t.ref;var n=ute(t,nte);return W.createElement(QO,n)}var ED=1,Xs=(function(e){function t(){var n;rte(this,t);for(var r=arguments.length,a=new Array(r),i=0;iED||Math.abs(a.height-this.lastBoundingBox.height)>ED)&&(this.lastBoundingBox.width=a.width,this.lastBoundingBox.height=a.height,r&&r(a)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Bi({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var a=this.props,i=a.layout,l=a.align,u=a.verticalAlign,d=a.margin,f=a.chartWidth,m=a.chartHeight,p,g;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(l==="center"&&i==="vertical"){var x=this.getBBoxSnapshot();p={left:((f||0)-x.width)/2}}else p=l==="right"?{right:d&&d.right||0}:{left:d&&d.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(u==="middle"){var j=this.getBBoxSnapshot();g={top:((m||0)-j.height)/2}}else g=u==="bottom"?{bottom:d&&d.bottom||0}:{top:d&&d.top||0};return Bi(Bi({},p),g)}},{key:"render",value:function(){var r=this,a=this.props,i=a.content,l=a.width,u=a.height,d=a.wrapperStyle,f=a.payloadUniqBy,m=a.payload,p=Bi(Bi({position:"absolute",width:l||"auto",height:u||"auto"},this.getDefaultPosition(d)),d);return W.createElement("div",{className:"recharts-legend-wrapper",style:p,ref:function(x){r.wrapperNode=x}},hte(i,Bi(Bi({},this.props),{},{payload:tz(m,f,fte)})))}}],[{key:"getWithHeight",value:function(r,a){var i=Bi(Bi({},this.defaultProps),r.props),l=i.layout;return l==="vertical"&&Ne(r.props.height)?{height:r.props.height}:l==="horizontal"?{width:r.props.width||a}:null}}])})(y.PureComponent);Zg(Xs,"displayName","Legend");Zg(Xs,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var vj,AD;function mte(){if(AD)return vj;AD=1;var e=Sh(),t=eC(),n=Rr(),r=e?e.isConcatSpreadable:void 0;function a(i){return n(i)||t(i)||!!(r&&i&&i[r])}return vj=a,vj}var gj,TD;function az(){if(TD)return gj;TD=1;var e=VB(),t=mte();function n(r,a,i,l,u){var d=-1,f=r.length;for(i||(i=t),u||(u=[]);++d0&&i(m)?a>1?n(m,a-1,i,l,u):e(u,m):l||(u[u.length]=m)}return u}return gj=n,gj}var yj,kD;function pte(){if(kD)return yj;kD=1;function e(t){return function(n,r,a){for(var i=-1,l=Object(n),u=a(n),d=u.length;d--;){var f=u[t?d:++i];if(r(l[f],f,l)===!1)break}return n}}return yj=e,yj}var xj,PD;function vte(){if(PD)return xj;PD=1;var e=pte(),t=e();return xj=t,xj}var bj,MD;function iz(){if(MD)return bj;MD=1;var e=vte(),t=Xg();function n(r,a){return r&&e(r,a,t)}return bj=n,bj}var wj,RD;function gte(){if(RD)return wj;RD=1;var e=Nh();function t(n,r){return function(a,i){if(a==null)return a;if(!e(a))return n(a,i);for(var l=a.length,u=r?l:-1,d=Object(a);(r?u--:++ur||u&&d&&m&&!f&&!p||i&&d&&m||!a&&m||!l)return 1;if(!i&&!u&&!p&&n=f)return m;var p=a[i];return m*(p=="desc"?-1:1)}}return n.index-r.index}return Oj=t,Oj}var Cj,zD;function wte(){if(zD)return Cj;zD=1;var e=HO(),t=WO(),n=gi(),r=oz(),a=yte(),i=YB(),l=bte(),u=Iu(),d=Rr();function f(m,p,g){p.length?p=e(p,function(b){return d(b)?function(w){return t(w,b.length===1?b[0]:b)}:b}):p=[u];var x=-1;p=e(p,i(n));var j=r(m,function(b,w,N){var O=e(p,function(C){return C(b)});return{criteria:O,index:++x,value:b}});return a(j,function(b,w){return l(b,w,g)})}return Cj=f,Cj}var Ej,qD;function jte(){if(qD)return Ej;qD=1;function e(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}return Ej=e,Ej}var Aj,FD;function Ste(){if(FD)return Aj;FD=1;var e=jte(),t=Math.max;function n(r,a,i){return a=t(a===void 0?r.length-1:a,0),function(){for(var l=arguments,u=-1,d=t(l.length-a,0),f=Array(d);++u0){if(++i>=e)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return Mj=r,Mj}var Rj,GD;function Cte(){if(GD)return Rj;GD=1;var e=Nte(),t=Ote(),n=t(e);return Rj=n,Rj}var Dj,YD;function Ete(){if(YD)return Dj;YD=1;var e=Iu(),t=Ste(),n=Cte();function r(a,i){return n(t(a,i,e),a+"")}return Dj=r,Dj}var $j,KD;function Qg(){if(KD)return $j;KD=1;var e=qO(),t=Nh(),n=tC(),r=ts();function a(i,l,u){if(!r(u))return!1;var d=typeof l;return(d=="number"?t(u)&&n(l,u.length):d=="string"&&l in u)?e(u[l],i):!1}return $j=a,$j}var Ij,XD;function Ate(){if(XD)return Ij;XD=1;var e=az(),t=wte(),n=Ete(),r=Qg(),a=n(function(i,l){if(i==null)return[];var u=l.length;return u>1&&r(i,l[0],l[1])?l=[]:u>2&&r(l[0],l[1],l[2])&&(l=[l[0]]),t(i,e(l,1),[])});return Ij=a,Ij}var Tte=Ate();const iC=wt(Tte);function Ef(e){"@babel/helpers - typeof";return Ef=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ef(e)}function k_(){return k_=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t.x),"".concat(Vd,"-left"),Ne(n)&&t&&Ne(t.x)&&n=t.y),"".concat(Vd,"-top"),Ne(r)&&t&&Ne(t.y)&&rb?Math.max(m,d[r]):Math.max(p,d[r])}function Wte(e){var t=e.translateX,n=e.translateY,r=e.useTranslate3d;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function Vte(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,a=e.position,i=e.reverseDirection,l=e.tooltipBox,u=e.useTranslate3d,d=e.viewBox,f,m,p;return l.height>0&&l.width>0&&n?(m=JD({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:r,position:a,reverseDirection:i,tooltipDimension:l.width,viewBox:d,viewBoxDimension:d.width}),p=JD({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:r,position:a,reverseDirection:i,tooltipDimension:l.height,viewBox:d,viewBoxDimension:d.height}),f=Wte({translateX:m,translateY:p,useTranslate3d:u})):f=Ute,{cssProperties:f,cssClasses:Hte({translateX:m,translateY:p,coordinate:n})}}function nu(e){"@babel/helpers - typeof";return nu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nu(e)}function e$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function t$(e){for(var t=1;tn$||Math.abs(r.height-this.state.lastBoundingBox.height)>n$)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,a;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,a=this.props,i=a.active,l=a.allowEscapeViewBox,u=a.animationDuration,d=a.animationEasing,f=a.children,m=a.coordinate,p=a.hasPayload,g=a.isAnimationActive,x=a.offset,j=a.position,b=a.reverseDirection,w=a.useTranslate3d,N=a.viewBox,O=a.wrapperStyle,C=Vte({allowEscapeViewBox:l,coordinate:m,offsetTopLeft:x,position:j,reverseDirection:b,tooltipBox:this.state.lastBoundingBox,useTranslate3d:w,viewBox:N}),A=C.cssClasses,E=C.cssProperties,k=t$(t$({transition:g&&i?"transform ".concat(u,"ms ").concat(d):void 0},E),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&p?"visible":"hidden",position:"absolute",top:0,left:0},O);return W.createElement("div",{tabIndex:-1,className:A,style:k,ref:function(P){r.wrapperNode=P}},f)}}])})(y.PureComponent),nne=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},gl={isSsr:nne()};function ru(e){"@babel/helpers - typeof";return ru=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ru(e)}function r$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function a$(e){for(var t=1;t0;return W.createElement(tne,{allowEscapeViewBox:l,animationDuration:u,animationEasing:d,isAnimationActive:g,active:i,coordinate:m,hasPayload:k,offset:x,position:w,reverseDirection:N,useTranslate3d:O,viewBox:C,wrapperStyle:A},fne(f,a$(a$({},this.props),{},{payload:E})))}}])})(y.PureComponent);oC(Qa,"displayName","Tooltip");oC(Qa,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!gl.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var Bj,i$;function hne(){if(i$)return Bj;i$=1;var e=vi(),t=function(){return e.Date.now()};return Bj=t,Bj}var zj,o$;function mne(){if(o$)return zj;o$=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return zj=t,zj}var qj,s$;function pne(){if(s$)return qj;s$=1;var e=mne(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return qj=n,qj}var Fj,l$;function fz(){if(l$)return Fj;l$=1;var e=pne(),t=ts(),n=Ru(),r=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function d(f){if(typeof f=="number")return f;if(n(f))return r;if(t(f)){var m=typeof f.valueOf=="function"?f.valueOf():f;f=t(m)?m+"":m}if(typeof f!="string")return f===0?f:+f;f=e(f);var p=i.test(f);return p||l.test(f)?u(f.slice(2),p?2:8):a.test(f)?r:+f}return Fj=d,Fj}var Uj,c$;function vne(){if(c$)return Uj;c$=1;var e=ts(),t=hne(),n=fz(),r="Expected a function",a=Math.max,i=Math.min;function l(u,d,f){var m,p,g,x,j,b,w=0,N=!1,O=!1,C=!0;if(typeof u!="function")throw new TypeError(r);d=n(d)||0,e(f)&&(N=!!f.leading,O="maxWait"in f,g=O?a(n(f.maxWait)||0,d):g,C="trailing"in f?!!f.trailing:C);function A(V){var H=m,G=p;return m=p=void 0,w=V,x=u.apply(G,H),x}function E(V){return w=V,j=setTimeout(P,d),N?A(V):x}function k(V){var H=V-b,G=V-w,L=d-H;return O?i(L,g-G):L}function T(V){var H=V-b,G=V-w;return b===void 0||H>=d||H<0||O&&G>=g}function P(){var V=t();if(T(V))return $(V);j=setTimeout(P,k(V))}function $(V){return j=void 0,C&&m?A(V):(m=p=void 0,x)}function F(){j!==void 0&&clearTimeout(j),w=0,m=b=p=j=void 0}function D(){return j===void 0?x:$(t())}function U(){var V=t(),H=T(V);if(m=arguments,p=this,b=V,H){if(j===void 0)return E(b);if(O)return clearTimeout(j),j=setTimeout(P,d),A(b)}return j===void 0&&(j=setTimeout(P,d)),x}return U.cancel=F,U.flush=D,U}return Uj=l,Uj}var Hj,u$;function gne(){if(u$)return Hj;u$=1;var e=vne(),t=ts(),n="Expected a function";function r(a,i,l){var u=!0,d=!0;if(typeof a!="function")throw new TypeError(n);return t(l)&&(u="leading"in l?!!l.leading:u,d="trailing"in l?!!l.trailing:d),e(a,i,{leading:u,maxWait:i,trailing:d})}return Hj=r,Hj}var yne=gne();const hz=wt(yne);function Tf(e){"@babel/helpers - typeof";return Tf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tf(e)}function d$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Sp(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(V=hz(V,b,{trailing:!0,leading:!1}));var H=new ResizeObserver(V),G=E.current.getBoundingClientRect(),L=G.width,R=G.height;return D(L,R),H.observe(E.current),function(){H.disconnect()}},[D,b]);var U=y.useMemo(function(){var V=$.containerWidth,H=$.containerHeight;if(V<0||H<0)return null;$a(qs(l)||qs(d),`The width(%s) and height(%s) are both fixed numbers, - maybe you don't need to use a ResponsiveContainer.`,l,d),$a(!n||n>0,"The aspect(%s) must be greater than zero.",n);var G=qs(l)?V:l,L=qs(d)?H:d;n&&n>0&&(G?L=G/n:L&&(G=L*n),g&&L>g&&(L=g)),$a(G>0||L>0,`The width(%s) and height(%s) of chart should be greater than 0, - please check the style of container, or the props width(%s) and height(%s), - or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the - height and width.`,G,L,l,d,m,p,n);var R=!Array.isArray(x)&&Ki(x.type).endsWith("Chart");return W.Children.map(x,function(q){return W.isValidElement(q)?y.cloneElement(q,Sp({width:G,height:L},R?{style:Sp({height:"100%",width:"100%",maxHeight:L,maxWidth:G},q.props.style)}:{})):q})},[n,x,d,g,p,m,$,l]);return W.createElement("div",{id:w?"".concat(w):void 0,className:Ye("recharts-responsive-container",N),style:Sp(Sp({},A),{},{width:l,height:d,minWidth:m,minHeight:p,maxHeight:g}),ref:E},U)}),Jg=function(t){return null};Jg.displayName="Cell";function kf(e){"@babel/helpers - typeof";return kf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kf(e)}function h$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function D_(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||gl.isSsr)return{width:0,height:0};var r=Mne(n),a=JSON.stringify({text:t,copyStyle:r});if(yc.widthCache[a])return yc.widthCache[a];try{var i=document.getElementById(m$);i||(i=document.createElement("span"),i.setAttribute("id",m$),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var l=D_(D_({},Pne),r);Object.assign(i.style,l),i.textContent="".concat(t);var u=i.getBoundingClientRect(),d={width:u.width,height:u.height};return yc.widthCache[a]=d,++yc.cacheCount>kne&&(yc.cacheCount=0,yc.widthCache={}),d}catch{return{width:0,height:0}}},Rne=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Pf(e){"@babel/helpers - typeof";return Pf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pf(e)}function Ov(e,t){return Lne(e)||Ine(e,t)||$ne(e,t)||Dne()}function Dne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $ne(e,t){if(e){if(typeof e=="string")return p$(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p$(e,t)}}function p$(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Qne(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function w$(e,t){return nre(e)||tre(e,t)||ere(e,t)||Jne()}function Jne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ere(e,t){if(e){if(typeof e=="string")return j$(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return j$(e,t)}}function j$(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[];return G.reduce(function(L,R){var q=R.word,K=R.width,ee=L[L.length-1];if(ee&&(a==null||i||ee.width+K+rR.width?L:R})};if(!m)return x;for(var b="…",w=function(G){var L=p.slice(0,G),R=gz({breakAll:f,style:d,children:L+b}).wordsWithComputedWidth,q=g(R),K=q.length>l||j(q).width>Number(a);return[K,q]},N=0,O=p.length-1,C=0,A;N<=O&&C<=p.length-1;){var E=Math.floor((N+O)/2),k=E-1,T=w(k),P=w$(T,2),$=P[0],F=P[1],D=w(E),U=w$(D,1),V=U[0];if(!$&&!V&&(N=E+1),$&&V&&(O=E-1),!$&&V){A=F;break}C++}return A||x},S$=function(t){var n=Ge(t)?[]:t.toString().split(vz);return[{words:n}]},are=function(t){var n=t.width,r=t.scaleToFit,a=t.children,i=t.style,l=t.breakAll,u=t.maxLines;if((n||r)&&!gl.isSsr){var d,f,m=gz({breakAll:l,children:a,style:i});if(m){var p=m.wordsWithComputedWidth,g=m.spaceWidth;d=p,f=g}else return S$(a);return rre({breakAll:l,children:a,maxLines:u,style:i},d,f,n,r)}return S$(a)},_$="#808080",sl=function(t){var n=t.x,r=n===void 0?0:n,a=t.y,i=a===void 0?0:a,l=t.lineHeight,u=l===void 0?"1em":l,d=t.capHeight,f=d===void 0?"0.71em":d,m=t.scaleToFit,p=m===void 0?!1:m,g=t.textAnchor,x=g===void 0?"start":g,j=t.verticalAnchor,b=j===void 0?"end":j,w=t.fill,N=w===void 0?_$:w,O=b$(t,Xne),C=y.useMemo(function(){return are({breakAll:O.breakAll,children:O.children,maxLines:O.maxLines,scaleToFit:p,style:O.style,width:O.width})},[O.breakAll,O.children,O.maxLines,p,O.style,O.width]),A=O.dx,E=O.dy,k=O.angle,T=O.className,P=O.breakAll,$=b$(O,Zne);if(!jn(r)||!jn(i))return null;var F=r+(Ne(A)?A:0),D=i+(Ne(E)?E:0),U;switch(b){case"start":U=Wj("calc(".concat(f,")"));break;case"middle":U=Wj("calc(".concat((C.length-1)/2," * -").concat(u," + (").concat(f," / 2))"));break;default:U=Wj("calc(".concat(C.length-1," * -").concat(u,")"));break}var V=[];if(p){var H=C[0].width,G=O.width;V.push("scale(".concat((Ne(G)?G/H:1)/H,")"))}return k&&V.push("rotate(".concat(k,", ").concat(F,", ").concat(D,")")),V.length&&($.transform=V.join(" ")),W.createElement("text",$_({},Be($,!0),{x:F,y:D,className:Ye("recharts-text",T),textAnchor:x,fill:N.includes("url")?_$:N}),C.map(function(L,R){var q=L.words.join(P?"":" ");return W.createElement("tspan",{x:F,dy:R===0?U:u,key:"".concat(q,"-").concat(R)},q)}))};function Vo(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function ire(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function sC(e){let t,n,r;e.length!==2?(t=Vo,n=(u,d)=>Vo(e(u),d),r=(u,d)=>e(u)-d):(t=e===Vo||e===ire?e:ore,n=e,r=e);function a(u,d,f=0,m=u.length){if(f>>1;n(u[p],d)<0?f=p+1:m=p}while(f>>1;n(u[p],d)<=0?f=p+1:m=p}while(ff&&r(u[p-1],d)>-r(u[p],d)?p-1:p}return{left:a,center:l,right:i}}function ore(){return 0}function yz(e){return e===null?NaN:+e}function*sre(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const lre=sC(Vo),Oh=lre.right;sC(yz).center;class N$ extends Map{constructor(t,n=dre){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,a]of t)this.set(r,a)}get(t){return super.get(O$(this,t))}has(t){return super.has(O$(this,t))}set(t,n){return super.set(cre(this,t),n)}delete(t){return super.delete(ure(this,t))}}function O$({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function cre({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function ure({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function dre(e){return e!==null&&typeof e=="object"?e.valueOf():e}function fre(e=Vo){if(e===Vo)return xz;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function xz(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const hre=Math.sqrt(50),mre=Math.sqrt(10),pre=Math.sqrt(2);function Cv(e,t,n){const r=(t-e)/Math.max(0,n),a=Math.floor(Math.log10(r)),i=r/Math.pow(10,a),l=i>=hre?10:i>=mre?5:i>=pre?2:1;let u,d,f;return a<0?(f=Math.pow(10,-a)/l,u=Math.round(e*f),d=Math.round(t*f),u/ft&&--d,f=-f):(f=Math.pow(10,a)*l,u=Math.round(e/f),d=Math.round(t/f),u*ft&&--d),d0))return[];if(e===t)return[e];const r=t=a))return[];const u=i-a+1,d=new Array(u);if(r)if(l<0)for(let f=0;f=r)&&(n=r);return n}function E$(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function bz(e,t,n=0,r=1/0,a){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(a=a===void 0?xz:fre(a);r>n;){if(r-n>600){const d=r-n+1,f=t-n+1,m=Math.log(d),p=.5*Math.exp(2*m/3),g=.5*Math.sqrt(m*p*(d-p)/d)*(f-d/2<0?-1:1),x=Math.max(n,Math.floor(t-f*p/d+g)),j=Math.min(r,Math.floor(t+(d-f)*p/d+g));bz(e,t,x,j,a)}const i=e[t];let l=n,u=r;for(Gd(e,n,t),a(e[r],i)>0&&Gd(e,n,r);l0;)--u}a(e[n],i)===0?Gd(e,n,u):(++u,Gd(e,u,r)),u<=t&&(n=u+1),t<=u&&(r=u-1)}return e}function Gd(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function vre(e,t,n){if(e=Float64Array.from(sre(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return E$(e);if(t>=1)return C$(e);var r,a=(r-1)*t,i=Math.floor(a),l=C$(bz(e,i).subarray(0,i+1)),u=E$(e.subarray(i+1));return l+(u-l)*(a-i)}}function gre(e,t,n=yz){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,a=(r-1)*t,i=Math.floor(a),l=+n(e[i],i,e),u=+n(e[i+1],i+1,e);return l+(u-l)*(a-i)}}function yre(e,t,n){e=+e,t=+t,n=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+n;for(var r=-1,a=Math.max(0,Math.ceil((t-e)/n))|0,i=new Array(a);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Np(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Np(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=bre.exec(e))?new Cr(t[1],t[2],t[3],1):(t=wre.exec(e))?new Cr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=jre.exec(e))?Np(t[1],t[2],t[3],t[4]):(t=Sre.exec(e))?Np(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=_re.exec(e))?D$(t[1],t[2]/100,t[3]/100,1):(t=Nre.exec(e))?D$(t[1],t[2]/100,t[3]/100,t[4]):A$.hasOwnProperty(e)?P$(A$[e]):e==="transparent"?new Cr(NaN,NaN,NaN,0):null}function P$(e){return new Cr(e>>16&255,e>>8&255,e&255,1)}function Np(e,t,n,r){return r<=0&&(e=t=n=NaN),new Cr(e,t,n,r)}function Ere(e){return e instanceof Ch||(e=$f(e)),e?(e=e.rgb(),new Cr(e.r,e.g,e.b,e.opacity)):new Cr}function q_(e,t,n,r){return arguments.length===1?Ere(e):new Cr(e,t,n,r??1)}function Cr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}cC(Cr,q_,jz(Ch,{brighter(e){return e=e==null?Ev:Math.pow(Ev,e),new Cr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Rf:Math.pow(Rf,e),new Cr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Cr(Zs(this.r),Zs(this.g),Zs(this.b),Av(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:M$,formatHex:M$,formatHex8:Are,formatRgb:R$,toString:R$}));function M$(){return`#${Fs(this.r)}${Fs(this.g)}${Fs(this.b)}`}function Are(){return`#${Fs(this.r)}${Fs(this.g)}${Fs(this.b)}${Fs((isNaN(this.opacity)?1:this.opacity)*255)}`}function R$(){const e=Av(this.opacity);return`${e===1?"rgb(":"rgba("}${Zs(this.r)}, ${Zs(this.g)}, ${Zs(this.b)}${e===1?")":`, ${e})`}`}function Av(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Zs(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Fs(e){return e=Zs(e),(e<16?"0":"")+e.toString(16)}function D$(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ra(e,t,n,r)}function Sz(e){if(e instanceof Ra)return new Ra(e.h,e.s,e.l,e.opacity);if(e instanceof Ch||(e=$f(e)),!e)return new Ra;if(e instanceof Ra)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),i=Math.max(t,n,r),l=NaN,u=i-a,d=(i+a)/2;return u?(t===i?l=(n-r)/u+(n0&&d<1?0:l,new Ra(l,u,d,e.opacity)}function Tre(e,t,n,r){return arguments.length===1?Sz(e):new Ra(e,t,n,r??1)}function Ra(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}cC(Ra,Tre,jz(Ch,{brighter(e){return e=e==null?Ev:Math.pow(Ev,e),new Ra(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Rf:Math.pow(Rf,e),new Ra(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new Cr(Vj(e>=240?e-240:e+120,a,r),Vj(e,a,r),Vj(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new Ra($$(this.h),Op(this.s),Op(this.l),Av(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Av(this.opacity);return`${e===1?"hsl(":"hsla("}${$$(this.h)}, ${Op(this.s)*100}%, ${Op(this.l)*100}%${e===1?")":`, ${e})`}`}}));function $$(e){return e=(e||0)%360,e<0?e+360:e}function Op(e){return Math.max(0,Math.min(1,e||0))}function Vj(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const uC=e=>()=>e;function kre(e,t){return function(n){return e+n*t}}function Pre(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Mre(e){return(e=+e)==1?_z:function(t,n){return n-t?Pre(t,n,e):uC(isNaN(t)?n:t)}}function _z(e,t){var n=t-e;return n?kre(e,n):uC(isNaN(e)?t:e)}const I$=(function e(t){var n=Mre(t);function r(a,i){var l=n((a=q_(a)).r,(i=q_(i)).r),u=n(a.g,i.g),d=n(a.b,i.b),f=_z(a.opacity,i.opacity);return function(m){return a.r=l(m),a.g=u(m),a.b=d(m),a.opacity=f(m),a+""}}return r.gamma=e,r})(1);function Rre(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),a;return function(i){for(a=0;an&&(i=t.slice(n,i),u[l]?u[l]+=i:u[++l]=i),(r=r[0])===(a=a[0])?u[l]?u[l]+=a:u[++l]=a:(u[++l]=null,d.push({i:l,x:Tv(r,a)})),n=Gj.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function Wre(e,t,n){var r=e[0],a=e[1],i=t[0],l=t[1];return a2?Vre:Wre,d=f=null,p}function p(g){return g==null||isNaN(g=+g)?i:(d||(d=u(e.map(r),t,n)))(r(l(g)))}return p.invert=function(g){return l(a((f||(f=u(t,e.map(r),Tv)))(g)))},p.domain=function(g){return arguments.length?(e=Array.from(g,kv),m()):e.slice()},p.range=function(g){return arguments.length?(t=Array.from(g),m()):t.slice()},p.rangeRound=function(g){return t=Array.from(g),n=dC,m()},p.clamp=function(g){return arguments.length?(l=g?!0:yr,m()):l!==yr},p.interpolate=function(g){return arguments.length?(n=g,m()):n},p.unknown=function(g){return arguments.length?(i=g,p):i},function(g,x){return r=g,a=x,m()}}function fC(){return ey()(yr,yr)}function Gre(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Pv(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function au(e){return e=Pv(Math.abs(e)),e?e[1]:NaN}function Yre(e,t){return function(n,r){for(var a=n.length,i=[],l=0,u=e[0],d=0;a>0&&u>0&&(d+u+1>r&&(u=Math.max(1,r-d)),i.push(n.substring(a-=u,a+u)),!((d+=u+1)>r));)u=e[l=(l+1)%e.length];return i.reverse().join(t)}}function Kre(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var Xre=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function If(e){if(!(t=Xre.exec(e)))throw new Error("invalid format: "+e);var t;return new hC({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}If.prototype=hC.prototype;function hC(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}hC.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Zre(e){e:for(var t=e.length,n=1,r=-1,a;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(a+1):e}var Nz;function Qre(e,t){var n=Pv(e,t);if(!n)return e+"";var r=n[0],a=n[1],i=a-(Nz=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,l=r.length;return i===l?r:i>l?r+new Array(i-l+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+Pv(e,Math.max(0,t+i-1))[0]}function B$(e,t){var n=Pv(e,t);if(!n)return e+"";var r=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}const z$={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Gre,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>B$(e*100,t),r:B$,s:Qre,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function q$(e){return e}var F$=Array.prototype.map,U$=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Jre(e){var t=e.grouping===void 0||e.thousands===void 0?q$:Yre(F$.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?q$:Kre(F$.call(e.numerals,String)),l=e.percent===void 0?"%":e.percent+"",u=e.minus===void 0?"−":e.minus+"",d=e.nan===void 0?"NaN":e.nan+"";function f(p){p=If(p);var g=p.fill,x=p.align,j=p.sign,b=p.symbol,w=p.zero,N=p.width,O=p.comma,C=p.precision,A=p.trim,E=p.type;E==="n"?(O=!0,E="g"):z$[E]||(C===void 0&&(C=12),A=!0,E="g"),(w||g==="0"&&x==="=")&&(w=!0,g="0",x="=");var k=b==="$"?n:b==="#"&&/[boxX]/.test(E)?"0"+E.toLowerCase():"",T=b==="$"?r:/[%p]/.test(E)?l:"",P=z$[E],$=/[defgprs%]/.test(E);C=C===void 0?6:/[gprs]/.test(E)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function F(D){var U=k,V=T,H,G,L;if(E==="c")V=P(D)+V,D="";else{D=+D;var R=D<0||1/D<0;if(D=isNaN(D)?d:P(Math.abs(D),C),A&&(D=Zre(D)),R&&+D==0&&j!=="+"&&(R=!1),U=(R?j==="("?j:u:j==="-"||j==="("?"":j)+U,V=(E==="s"?U$[8+Nz/3]:"")+V+(R&&j==="("?")":""),$){for(H=-1,G=D.length;++HL||L>57){V=(L===46?a+D.slice(H+1):D.slice(H))+V,D=D.slice(0,H);break}}}O&&!w&&(D=t(D,1/0));var q=U.length+D.length+V.length,K=q>1)+U+D+V+K.slice(q);break;default:D=K+U+D+V;break}return i(D)}return F.toString=function(){return p+""},F}function m(p,g){var x=f((p=If(p),p.type="f",p)),j=Math.max(-8,Math.min(8,Math.floor(au(g)/3)))*3,b=Math.pow(10,-j),w=U$[8+j/3];return function(N){return x(b*N)+w}}return{format:f,formatPrefix:m}}var Cp,mC,Oz;eae({thousands:",",grouping:[3],currency:["$",""]});function eae(e){return Cp=Jre(e),mC=Cp.format,Oz=Cp.formatPrefix,Cp}function tae(e){return Math.max(0,-au(Math.abs(e)))}function nae(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(au(t)/3)))*3-au(Math.abs(e)))}function rae(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,au(t)-au(e))+1}function Cz(e,t,n,r){var a=B_(e,t,n),i;switch(r=If(r??",f"),r.type){case"s":{var l=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(i=nae(a,l))&&(r.precision=i),Oz(r,l)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=rae(a,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=tae(a))&&(r.precision=i-(r.type==="%")*2);break}}return mC(r)}function ns(e){var t=e.domain;return e.ticks=function(n){var r=t();return I_(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var a=t();return Cz(a[0],a[a.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),a=0,i=r.length-1,l=r[a],u=r[i],d,f,m=10;for(u0;){if(f=L_(l,u,n),f===d)return r[a]=l,r[i]=u,t(r);if(f>0)l=Math.floor(l/f)*f,u=Math.ceil(u/f)*f;else if(f<0)l=Math.ceil(l*f)/f,u=Math.floor(u*f)/f;else break;d=f}return e},e}function Mv(){var e=fC();return e.copy=function(){return Eh(e,Mv())},_a.apply(e,arguments),ns(e)}function Ez(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,kv),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return Ez(e).unknown(t)},e=arguments.length?Array.from(e,kv):[0,1],ns(n)}function Az(e,t){e=e.slice();var n=0,r=e.length-1,a=e[n],i=e[r],l;return iMath.pow(e,t)}function lae(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function V$(e){return(t,n)=>-e(-t,n)}function pC(e){const t=e(H$,W$),n=t.domain;let r=10,a,i;function l(){return a=lae(r),i=sae(r),n()[0]<0?(a=V$(a),i=V$(i),e(aae,iae)):e(H$,W$),t}return t.base=function(u){return arguments.length?(r=+u,l()):r},t.domain=function(u){return arguments.length?(n(u),l()):n()},t.ticks=u=>{const d=n();let f=d[0],m=d[d.length-1];const p=m0){for(;g<=x;++g)for(j=1;jm)break;N.push(b)}}else for(;g<=x;++g)for(j=r-1;j>=1;--j)if(b=g>0?j/i(-g):j*i(g),!(bm)break;N.push(b)}N.length*2{if(u==null&&(u=10),d==null&&(d=r===10?"s":","),typeof d!="function"&&(!(r%1)&&(d=If(d)).precision==null&&(d.trim=!0),d=mC(d)),u===1/0)return d;const f=Math.max(1,r*u/t.ticks().length);return m=>{let p=m/i(Math.round(a(m)));return p*rn(Az(n(),{floor:u=>i(Math.floor(a(u))),ceil:u=>i(Math.ceil(a(u)))})),t}function Tz(){const e=pC(ey()).domain([1,10]);return e.copy=()=>Eh(e,Tz()).base(e.base()),_a.apply(e,arguments),e}function G$(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Y$(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function vC(e){var t=1,n=e(G$(t),Y$(t));return n.constant=function(r){return arguments.length?e(G$(t=+r),Y$(t)):t},ns(n)}function kz(){var e=vC(ey());return e.copy=function(){return Eh(e,kz()).constant(e.constant())},_a.apply(e,arguments)}function K$(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function cae(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function uae(e){return e<0?-e*e:e*e}function gC(e){var t=e(yr,yr),n=1;function r(){return n===1?e(yr,yr):n===.5?e(cae,uae):e(K$(n),K$(1/n))}return t.exponent=function(a){return arguments.length?(n=+a,r()):n},ns(t)}function yC(){var e=gC(ey());return e.copy=function(){return Eh(e,yC()).exponent(e.exponent())},_a.apply(e,arguments),e}function dae(){return yC.apply(null,arguments).exponent(.5)}function X$(e){return Math.sign(e)*e*e}function fae(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function Pz(){var e=fC(),t=[0,1],n=!1,r;function a(i){var l=fae(e(i));return isNaN(l)?r:n?Math.round(l):l}return a.invert=function(i){return e.invert(X$(i))},a.domain=function(i){return arguments.length?(e.domain(i),a):e.domain()},a.range=function(i){return arguments.length?(e.range((t=Array.from(i,kv)).map(X$)),a):t.slice()},a.rangeRound=function(i){return a.range(i).round(!0)},a.round=function(i){return arguments.length?(n=!!i,a):n},a.clamp=function(i){return arguments.length?(e.clamp(i),a):e.clamp()},a.unknown=function(i){return arguments.length?(r=i,a):r},a.copy=function(){return Pz(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},_a.apply(a,arguments),ns(a)}function Mz(){var e=[],t=[],n=[],r;function a(){var l=0,u=Math.max(1,t.length);for(n=new Array(u-1);++l0?n[u-1]:e[0],u=n?[r[n-1],t]:[r[f-1],r[f]]},l.unknown=function(d){return arguments.length&&(i=d),l},l.thresholds=function(){return r.slice()},l.copy=function(){return Rz().domain([e,t]).range(a).unknown(i)},_a.apply(ns(l),arguments)}function Dz(){var e=[.5],t=[0,1],n,r=1;function a(i){return i!=null&&i<=i?t[Oh(e,i,0,r)]:n}return a.domain=function(i){return arguments.length?(e=Array.from(i),r=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(i){return arguments.length?(t=Array.from(i),r=Math.min(e.length,t.length-1),a):t.slice()},a.invertExtent=function(i){var l=t.indexOf(i);return[e[l-1],e[l]]},a.unknown=function(i){return arguments.length?(n=i,a):n},a.copy=function(){return Dz().domain(e).range(t).unknown(n)},_a.apply(a,arguments)}const Yj=new Date,Kj=new Date;function _n(e,t,n,r){function a(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return a.floor=i=>(e(i=new Date(+i)),i),a.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),a.round=i=>{const l=a(i),u=a.ceil(i);return i-l(t(i=new Date(+i),l==null?1:Math.floor(l)),i),a.range=(i,l,u)=>{const d=[];if(i=a.ceil(i),u=u==null?1:Math.floor(u),!(i0))return d;let f;do d.push(f=new Date(+i)),t(i,u),e(i);while(f_n(l=>{if(l>=l)for(;e(l),!i(l);)l.setTime(l-1)},(l,u)=>{if(l>=l)if(u<0)for(;++u<=0;)for(;t(l,-1),!i(l););else for(;--u>=0;)for(;t(l,1),!i(l););}),n&&(a.count=(i,l)=>(Yj.setTime(+i),Kj.setTime(+l),e(Yj),e(Kj),Math.floor(n(Yj,Kj))),a.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?a.filter(r?l=>r(l)%i===0:l=>a.count(0,l)%i===0):a)),a}const Rv=_n(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Rv.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?_n(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Rv);Rv.range;const Ui=1e3,xa=Ui*60,Hi=xa*60,Qi=Hi*24,xC=Qi*7,Z$=Qi*30,Xj=Qi*365,Us=_n(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Ui)},(e,t)=>(t-e)/Ui,e=>e.getUTCSeconds());Us.range;const bC=_n(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ui)},(e,t)=>{e.setTime(+e+t*xa)},(e,t)=>(t-e)/xa,e=>e.getMinutes());bC.range;const wC=_n(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*xa)},(e,t)=>(t-e)/xa,e=>e.getUTCMinutes());wC.range;const jC=_n(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ui-e.getMinutes()*xa)},(e,t)=>{e.setTime(+e+t*Hi)},(e,t)=>(t-e)/Hi,e=>e.getHours());jC.range;const SC=_n(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Hi)},(e,t)=>(t-e)/Hi,e=>e.getUTCHours());SC.range;const Ah=_n(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*xa)/Qi,e=>e.getDate()-1);Ah.range;const ty=_n(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Qi,e=>e.getUTCDate()-1);ty.range;const $z=_n(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Qi,e=>Math.floor(e/Qi));$z.range;function yl(e){return _n(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*xa)/xC)}const ny=yl(0),Dv=yl(1),hae=yl(2),mae=yl(3),iu=yl(4),pae=yl(5),vae=yl(6);ny.range;Dv.range;hae.range;mae.range;iu.range;pae.range;vae.range;function xl(e){return _n(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/xC)}const ry=xl(0),$v=xl(1),gae=xl(2),yae=xl(3),ou=xl(4),xae=xl(5),bae=xl(6);ry.range;$v.range;gae.range;yae.range;ou.range;xae.range;bae.range;const _C=_n(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());_C.range;const NC=_n(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());NC.range;const Ji=_n(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Ji.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:_n(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Ji.range;const eo=_n(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());eo.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:_n(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});eo.range;function Iz(e,t,n,r,a,i){const l=[[Us,1,Ui],[Us,5,5*Ui],[Us,15,15*Ui],[Us,30,30*Ui],[i,1,xa],[i,5,5*xa],[i,15,15*xa],[i,30,30*xa],[a,1,Hi],[a,3,3*Hi],[a,6,6*Hi],[a,12,12*Hi],[r,1,Qi],[r,2,2*Qi],[n,1,xC],[t,1,Z$],[t,3,3*Z$],[e,1,Xj]];function u(f,m,p){const g=mw).right(l,g);if(x===l.length)return e.every(B_(f/Xj,m/Xj,p));if(x===0)return Rv.every(Math.max(B_(f,m,p),1));const[j,b]=l[g/l[x-1][2]53)return null;"w"in le||(le.w=1),"Z"in le?(_e=Qj(Yd(le.y,0,1)),he=_e.getUTCDay(),_e=he>4||he===0?$v.ceil(_e):$v(_e),_e=ty.offset(_e,(le.V-1)*7),le.y=_e.getUTCFullYear(),le.m=_e.getUTCMonth(),le.d=_e.getUTCDate()+(le.w+6)%7):(_e=Zj(Yd(le.y,0,1)),he=_e.getDay(),_e=he>4||he===0?Dv.ceil(_e):Dv(_e),_e=Ah.offset(_e,(le.V-1)*7),le.y=_e.getFullYear(),le.m=_e.getMonth(),le.d=_e.getDate()+(le.w+6)%7)}else("W"in le||"U"in le)&&("w"in le||(le.w="u"in le?le.u%7:"W"in le?1:0),he="Z"in le?Qj(Yd(le.y,0,1)).getUTCDay():Zj(Yd(le.y,0,1)).getDay(),le.m=0,le.d="W"in le?(le.w+6)%7+le.W*7-(he+5)%7:le.w+le.U*7-(he+6)%7);return"Z"in le?(le.H+=le.Z/100|0,le.M+=le.Z%100,Qj(le)):Zj(le)}}function P(Z,pe,je,le){for(var Re=0,_e=pe.length,he=je.length,ve,Le;Re<_e;){if(le>=he)return-1;if(ve=pe.charCodeAt(Re++),ve===37){if(ve=pe.charAt(Re++),Le=E[ve in Q$?pe.charAt(Re++):ve],!Le||(le=Le(Z,je,le))<0)return-1}else if(ve!=je.charCodeAt(le++))return-1}return le}function $(Z,pe,je){var le=f.exec(pe.slice(je));return le?(Z.p=m.get(le[0].toLowerCase()),je+le[0].length):-1}function F(Z,pe,je){var le=x.exec(pe.slice(je));return le?(Z.w=j.get(le[0].toLowerCase()),je+le[0].length):-1}function D(Z,pe,je){var le=p.exec(pe.slice(je));return le?(Z.w=g.get(le[0].toLowerCase()),je+le[0].length):-1}function U(Z,pe,je){var le=N.exec(pe.slice(je));return le?(Z.m=O.get(le[0].toLowerCase()),je+le[0].length):-1}function V(Z,pe,je){var le=b.exec(pe.slice(je));return le?(Z.m=w.get(le[0].toLowerCase()),je+le[0].length):-1}function H(Z,pe,je){return P(Z,t,pe,je)}function G(Z,pe,je){return P(Z,n,pe,je)}function L(Z,pe,je){return P(Z,r,pe,je)}function R(Z){return l[Z.getDay()]}function q(Z){return i[Z.getDay()]}function K(Z){return d[Z.getMonth()]}function ee(Z){return u[Z.getMonth()]}function I(Z){return a[+(Z.getHours()>=12)]}function B(Z){return 1+~~(Z.getMonth()/3)}function Y(Z){return l[Z.getUTCDay()]}function te(Z){return i[Z.getUTCDay()]}function oe(Z){return d[Z.getUTCMonth()]}function xe(Z){return u[Z.getUTCMonth()]}function J(Z){return a[+(Z.getUTCHours()>=12)]}function ae(Z){return 1+~~(Z.getUTCMonth()/3)}return{format:function(Z){var pe=k(Z+="",C);return pe.toString=function(){return Z},pe},parse:function(Z){var pe=T(Z+="",!1);return pe.toString=function(){return Z},pe},utcFormat:function(Z){var pe=k(Z+="",A);return pe.toString=function(){return Z},pe},utcParse:function(Z){var pe=T(Z+="",!0);return pe.toString=function(){return Z},pe}}}var Q$={"-":"",_:" ",0:"0"},Un=/^\s*\d+/,Oae=/^%/,Cae=/[\\^$*+?|[\]().{}]/g;function mt(e,t,n){var r=e<0?"-":"",a=(r?-e:e)+"",i=a.length;return r+(i[t.toLowerCase(),n]))}function Aae(e,t,n){var r=Un.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Tae(e,t,n){var r=Un.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function kae(e,t,n){var r=Un.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Pae(e,t,n){var r=Un.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Mae(e,t,n){var r=Un.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function J$(e,t,n){var r=Un.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function e4(e,t,n){var r=Un.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Rae(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Dae(e,t,n){var r=Un.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function $ae(e,t,n){var r=Un.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function t4(e,t,n){var r=Un.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Iae(e,t,n){var r=Un.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function n4(e,t,n){var r=Un.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Lae(e,t,n){var r=Un.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Bae(e,t,n){var r=Un.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function zae(e,t,n){var r=Un.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function qae(e,t,n){var r=Un.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Fae(e,t,n){var r=Oae.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Uae(e,t,n){var r=Un.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Hae(e,t,n){var r=Un.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function r4(e,t){return mt(e.getDate(),t,2)}function Wae(e,t){return mt(e.getHours(),t,2)}function Vae(e,t){return mt(e.getHours()%12||12,t,2)}function Gae(e,t){return mt(1+Ah.count(Ji(e),e),t,3)}function Lz(e,t){return mt(e.getMilliseconds(),t,3)}function Yae(e,t){return Lz(e,t)+"000"}function Kae(e,t){return mt(e.getMonth()+1,t,2)}function Xae(e,t){return mt(e.getMinutes(),t,2)}function Zae(e,t){return mt(e.getSeconds(),t,2)}function Qae(e){var t=e.getDay();return t===0?7:t}function Jae(e,t){return mt(ny.count(Ji(e)-1,e),t,2)}function Bz(e){var t=e.getDay();return t>=4||t===0?iu(e):iu.ceil(e)}function eie(e,t){return e=Bz(e),mt(iu.count(Ji(e),e)+(Ji(e).getDay()===4),t,2)}function tie(e){return e.getDay()}function nie(e,t){return mt(Dv.count(Ji(e)-1,e),t,2)}function rie(e,t){return mt(e.getFullYear()%100,t,2)}function aie(e,t){return e=Bz(e),mt(e.getFullYear()%100,t,2)}function iie(e,t){return mt(e.getFullYear()%1e4,t,4)}function oie(e,t){var n=e.getDay();return e=n>=4||n===0?iu(e):iu.ceil(e),mt(e.getFullYear()%1e4,t,4)}function sie(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+mt(t/60|0,"0",2)+mt(t%60,"0",2)}function a4(e,t){return mt(e.getUTCDate(),t,2)}function lie(e,t){return mt(e.getUTCHours(),t,2)}function cie(e,t){return mt(e.getUTCHours()%12||12,t,2)}function uie(e,t){return mt(1+ty.count(eo(e),e),t,3)}function zz(e,t){return mt(e.getUTCMilliseconds(),t,3)}function die(e,t){return zz(e,t)+"000"}function fie(e,t){return mt(e.getUTCMonth()+1,t,2)}function hie(e,t){return mt(e.getUTCMinutes(),t,2)}function mie(e,t){return mt(e.getUTCSeconds(),t,2)}function pie(e){var t=e.getUTCDay();return t===0?7:t}function vie(e,t){return mt(ry.count(eo(e)-1,e),t,2)}function qz(e){var t=e.getUTCDay();return t>=4||t===0?ou(e):ou.ceil(e)}function gie(e,t){return e=qz(e),mt(ou.count(eo(e),e)+(eo(e).getUTCDay()===4),t,2)}function yie(e){return e.getUTCDay()}function xie(e,t){return mt($v.count(eo(e)-1,e),t,2)}function bie(e,t){return mt(e.getUTCFullYear()%100,t,2)}function wie(e,t){return e=qz(e),mt(e.getUTCFullYear()%100,t,2)}function jie(e,t){return mt(e.getUTCFullYear()%1e4,t,4)}function Sie(e,t){var n=e.getUTCDay();return e=n>=4||n===0?ou(e):ou.ceil(e),mt(e.getUTCFullYear()%1e4,t,4)}function _ie(){return"+0000"}function i4(){return"%"}function o4(e){return+e}function s4(e){return Math.floor(+e/1e3)}var xc,Fz,Uz;Nie({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Nie(e){return xc=Nae(e),Fz=xc.format,xc.parse,Uz=xc.utcFormat,xc.utcParse,xc}function Oie(e){return new Date(e)}function Cie(e){return e instanceof Date?+e:+new Date(+e)}function OC(e,t,n,r,a,i,l,u,d,f){var m=fC(),p=m.invert,g=m.domain,x=f(".%L"),j=f(":%S"),b=f("%I:%M"),w=f("%I %p"),N=f("%a %d"),O=f("%b %d"),C=f("%B"),A=f("%Y");function E(k){return(d(k)t(a/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(a,i)=>vre(e,i/r))},n.copy=function(){return Gz(t).domain(e)},so.apply(n,arguments)}function iy(){var e=0,t=.5,n=1,r=1,a,i,l,u,d,f=yr,m,p=!1,g;function x(b){return isNaN(b=+b)?g:(b=.5+((b=+m(b))-i)*(r*bn}return eS=e,eS}var tS,d4;function Pie(){if(d4)return tS;d4=1;var e=oy(),t=Zz(),n=Iu();function r(a){return a&&a.length?e(a,n,t):void 0}return tS=r,tS}var Mie=Pie();const sy=wt(Mie);var nS,f4;function Qz(){if(f4)return nS;f4=1;function e(t,n){return te.e^i.s<0?1:-1;for(r=i.d.length,a=e.d.length,t=0,n=re.d[t]^i.s<0?1:-1;return r===a?0:r>a^i.s<0?1:-1};Ee.decimalPlaces=Ee.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*Wt;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};Ee.dividedBy=Ee.div=function(e){return Xi(this,new this.constructor(e))};Ee.dividedToIntegerBy=Ee.idiv=function(e){var t=this,n=t.constructor;return Dt(Xi(t,new n(e),0,1),n.precision)};Ee.equals=Ee.eq=function(e){return!this.cmp(e)};Ee.exponent=function(){return mn(this)};Ee.greaterThan=Ee.gt=function(e){return this.cmp(e)>0};Ee.greaterThanOrEqualTo=Ee.gte=function(e){return this.cmp(e)>=0};Ee.isInteger=Ee.isint=function(){return this.e>this.d.length-2};Ee.isNegative=Ee.isneg=function(){return this.s<0};Ee.isPositive=Ee.ispos=function(){return this.s>0};Ee.isZero=function(){return this.s===0};Ee.lessThan=Ee.lt=function(e){return this.cmp(e)<0};Ee.lessThanOrEqualTo=Ee.lte=function(e){return this.cmp(e)<1};Ee.logarithm=Ee.log=function(e){var t,n=this,r=n.constructor,a=r.precision,i=a+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(Zr))throw Error(ja+"NaN");if(n.s<1)throw Error(ja+(n.s?"NaN":"-Infinity"));return n.eq(Zr)?new r(0):(Gt=!1,t=Xi(Lf(n,i),Lf(e,i),i),Gt=!0,Dt(t,a))};Ee.minus=Ee.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?n6(t,e):e6(t,(e.s=-e.s,e))};Ee.modulo=Ee.mod=function(e){var t,n=this,r=n.constructor,a=r.precision;if(e=new r(e),!e.s)throw Error(ja+"NaN");return n.s?(Gt=!1,t=Xi(n,e,0,1).times(e),Gt=!0,n.minus(t)):Dt(new r(n),a)};Ee.naturalExponential=Ee.exp=function(){return t6(this)};Ee.naturalLogarithm=Ee.ln=function(){return Lf(this)};Ee.negated=Ee.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Ee.plus=Ee.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?e6(t,e):n6(t,(e.s=-e.s,e))};Ee.precision=Ee.sd=function(e){var t,n,r,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Qs+e);if(t=mn(a)+1,r=a.d.length-1,n=r*Wt+1,r=a.d[r],r){for(;r%10==0;r/=10)n--;for(r=a.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};Ee.squareRoot=Ee.sqrt=function(){var e,t,n,r,a,i,l,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(ja+"NaN")}for(e=mn(u),Gt=!1,a=Math.sqrt(+u),a==0||a==1/0?(t=ri(u.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=zu((e+1)/2)-(e<0||e%2),a==1/0?t="5e"+e:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new d(t)):r=new d(a.toString()),n=d.precision,a=l=n+3;;)if(i=r,r=i.plus(Xi(u,i,l+2)).times(.5),ri(i.d).slice(0,l)===(t=ri(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),a==l&&t=="4999"){if(Dt(i,n+1,0),i.times(i).eq(u)){r=i;break}}else if(t!="9999")break;l+=4}return Gt=!0,Dt(r,n)};Ee.times=Ee.mul=function(e){var t,n,r,a,i,l,u,d,f,m=this,p=m.constructor,g=m.d,x=(e=new p(e)).d;if(!m.s||!e.s)return new p(0);for(e.s*=m.s,n=m.e+e.e,d=g.length,f=x.length,d=0;){for(t=0,a=d+r;a>r;)u=i[a]+x[r]*g[a-r-1]+t,i[a--]=u%An|0,t=u/An|0;i[a]=(i[a]+t)%An|0}for(;!i[--l];)i.pop();return t?++n:i.shift(),e.d=i,e.e=n,Gt?Dt(e,p.precision):e};Ee.toDecimalPlaces=Ee.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(fi(e,0,Bu),t===void 0?t=r.rounding:fi(t,0,8),Dt(n,e+mn(n)+1,t))};Ee.toExponential=function(e,t){var n,r=this,a=r.constructor;return e===void 0?n=ll(r,!0):(fi(e,0,Bu),t===void 0?t=a.rounding:fi(t,0,8),r=Dt(new a(r),e+1,t),n=ll(r,!0,e+1)),n};Ee.toFixed=function(e,t){var n,r,a=this,i=a.constructor;return e===void 0?ll(a):(fi(e,0,Bu),t===void 0?t=i.rounding:fi(t,0,8),r=Dt(new i(a),e+mn(a)+1,t),n=ll(r.abs(),!1,e+mn(r)+1),a.isneg()&&!a.isZero()?"-"+n:n)};Ee.toInteger=Ee.toint=function(){var e=this,t=e.constructor;return Dt(new t(e),mn(e)+1,t.rounding)};Ee.toNumber=function(){return+this};Ee.toPower=Ee.pow=function(e){var t,n,r,a,i,l,u=this,d=u.constructor,f=12,m=+(e=new d(e));if(!e.s)return new d(Zr);if(u=new d(u),!u.s){if(e.s<1)throw Error(ja+"Infinity");return u}if(u.eq(Zr))return u;if(r=d.precision,e.eq(Zr))return Dt(u,r);if(t=e.e,n=e.d.length-1,l=t>=n,i=u.s,l){if((n=m<0?-m:m)<=Jz){for(a=new d(Zr),t=Math.ceil(r/Wt+4),Gt=!1;n%2&&(a=a.times(u),y4(a.d,t)),n=zu(n/2),n!==0;)u=u.times(u),y4(u.d,t);return Gt=!0,e.s<0?new d(Zr).div(a):Dt(a,r)}}else if(i<0)throw Error(ja+"NaN");return i=i<0&&e.d[Math.max(t,n)]&1?-1:1,u.s=1,Gt=!1,a=e.times(Lf(u,r+f)),Gt=!0,a=t6(a),a.s=i,a};Ee.toPrecision=function(e,t){var n,r,a=this,i=a.constructor;return e===void 0?(n=mn(a),r=ll(a,n<=i.toExpNeg||n>=i.toExpPos)):(fi(e,1,Bu),t===void 0?t=i.rounding:fi(t,0,8),a=Dt(new i(a),e,t),n=mn(a),r=ll(a,e<=n||n<=i.toExpNeg,e)),r};Ee.toSignificantDigits=Ee.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(fi(e,1,Bu),t===void 0?t=r.rounding:fi(t,0,8)),Dt(new r(n),e,t)};Ee.toString=Ee.valueOf=Ee.val=Ee.toJSON=Ee[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=mn(e),n=e.constructor;return ll(e,t<=n.toExpNeg||t>=n.toExpPos)};function e6(e,t){var n,r,a,i,l,u,d,f,m=e.constructor,p=m.precision;if(!e.s||!t.s)return t.s||(t=new m(e)),Gt?Dt(t,p):t;if(d=e.d,f=t.d,l=e.e,a=t.e,d=d.slice(),i=l-a,i){for(i<0?(r=d,i=-i,u=f.length):(r=f,a=l,u=d.length),l=Math.ceil(p/Wt),u=l>u?l+1:u+1,i>u&&(i=u,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(u=d.length,i=f.length,u-i<0&&(i=u,r=f,f=d,d=r),n=0;i;)n=(d[--i]=d[i]+f[i]+n)/An|0,d[i]%=An;for(n&&(d.unshift(n),++a),u=d.length;d[--u]==0;)d.pop();return t.d=d,t.e=a,Gt?Dt(t,p):t}function fi(e,t,n){if(e!==~~e||en)throw Error(Qs+e)}function ri(e){var t,n,r,a=e.length-1,i="",l=e[0];if(a>0){for(i+=l,t=1;tl?1:-1;else for(u=d=0;ua[u]?1:-1;break}return d}function n(r,a,i){for(var l=0;i--;)r[i]-=l,l=r[i]1;)r.shift()}return function(r,a,i,l){var u,d,f,m,p,g,x,j,b,w,N,O,C,A,E,k,T,P,$=r.constructor,F=r.s==a.s?1:-1,D=r.d,U=a.d;if(!r.s)return new $(r);if(!a.s)throw Error(ja+"Division by zero");for(d=r.e-a.e,T=U.length,E=D.length,x=new $(F),j=x.d=[],f=0;U[f]==(D[f]||0);)++f;if(U[f]>(D[f]||0)&&--d,i==null?O=i=$.precision:l?O=i+(mn(r)-mn(a))+1:O=i,O<0)return new $(0);if(O=O/Wt+2|0,f=0,T==1)for(m=0,U=U[0],O++;(f1&&(U=e(U,m),D=e(D,m),T=U.length,E=D.length),A=T,b=D.slice(0,T),w=b.length;w=An/2&&++k;do m=0,u=t(U,b,T,w),u<0?(N=b[0],T!=w&&(N=N*An+(b[1]||0)),m=N/k|0,m>1?(m>=An&&(m=An-1),p=e(U,m),g=p.length,w=b.length,u=t(p,b,g,w),u==1&&(m--,n(p,T16)throw Error(AC+mn(e));if(!e.s)return new m(Zr);for(Gt=!1,u=p,l=new m(.03125);e.abs().gte(.1);)e=e.times(l),f+=5;for(r=Math.log(Is(2,f))/Math.LN10*2+5|0,u+=r,n=a=i=new m(Zr),m.precision=u;;){if(a=Dt(a.times(e),u),n=n.times(++d),l=i.plus(Xi(a,n,u)),ri(l.d).slice(0,u)===ri(i.d).slice(0,u)){for(;f--;)i=Dt(i.times(i),u);return m.precision=p,t==null?(Gt=!0,Dt(i,p)):i}i=l}}function mn(e){for(var t=e.e*Wt,n=e.d[0];n>=10;n/=10)t++;return t}function sS(e,t,n){if(t>e.LN10.sd())throw Gt=!0,n&&(e.precision=n),Error(ja+"LN10 precision limit exceeded");return Dt(new e(e.LN10),t)}function Lo(e){for(var t="";e--;)t+="0";return t}function Lf(e,t){var n,r,a,i,l,u,d,f,m,p=1,g=10,x=e,j=x.d,b=x.constructor,w=b.precision;if(x.s<1)throw Error(ja+(x.s?"NaN":"-Infinity"));if(x.eq(Zr))return new b(0);if(t==null?(Gt=!1,f=w):f=t,x.eq(10))return t==null&&(Gt=!0),sS(b,f);if(f+=g,b.precision=f,n=ri(j),r=n.charAt(0),i=mn(x),Math.abs(i)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)x=x.times(e),n=ri(x.d),r=n.charAt(0),p++;i=mn(x),r>1?(x=new b("0."+n),i++):x=new b(r+"."+n.slice(1))}else return d=sS(b,f+2,w).times(i+""),x=Lf(new b(r+"."+n.slice(1)),f-g).plus(d),b.precision=w,t==null?(Gt=!0,Dt(x,w)):x;for(u=l=x=Xi(x.minus(Zr),x.plus(Zr),f),m=Dt(x.times(x),f),a=3;;){if(l=Dt(l.times(m),f),d=u.plus(Xi(l,new b(a),f)),ri(d.d).slice(0,f)===ri(u.d).slice(0,f))return u=u.times(2),i!==0&&(u=u.plus(sS(b,f+2,w).times(i+""))),u=Xi(u,new b(p),f),b.precision=w,t==null?(Gt=!0,Dt(u,w)):u;u=d,a+=2}}function g4(e,t){var n,r,a;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=zu(n/Wt),e.d=[],r=(n+1)%Wt,n<0&&(r+=Wt),rIv||e.e<-Iv))throw Error(AC+n)}else e.s=0,e.e=0,e.d=[0];return e}function Dt(e,t,n){var r,a,i,l,u,d,f,m,p=e.d;for(l=1,i=p[0];i>=10;i/=10)l++;if(r=t-l,r<0)r+=Wt,a=t,f=p[m=0];else{if(m=Math.ceil((r+1)/Wt),i=p.length,m>=i)return e;for(f=i=p[m],l=1;i>=10;i/=10)l++;r%=Wt,a=r-Wt+l}if(n!==void 0&&(i=Is(10,l-a-1),u=f/i%10|0,d=t<0||p[m+1]!==void 0||f%i,d=n<4?(u||d)&&(n==0||n==(e.s<0?3:2)):u>5||u==5&&(n==4||d||n==6&&(r>0?a>0?f/Is(10,l-a):0:p[m-1])%10&1||n==(e.s<0?8:7))),t<1||!p[0])return d?(i=mn(e),p.length=1,t=t-i-1,p[0]=Is(10,(Wt-t%Wt)%Wt),e.e=zu(-t/Wt)||0):(p.length=1,p[0]=e.e=e.s=0),e;if(r==0?(p.length=m,i=1,m--):(p.length=m+1,i=Is(10,Wt-r),p[m]=a>0?(f/Is(10,l-a)%Is(10,a)|0)*i:0),d)for(;;)if(m==0){(p[0]+=i)==An&&(p[0]=1,++e.e);break}else{if(p[m]+=i,p[m]!=An)break;p[m--]=0,i=1}for(r=p.length;p[--r]===0;)p.pop();if(Gt&&(e.e>Iv||e.e<-Iv))throw Error(AC+mn(e));return e}function n6(e,t){var n,r,a,i,l,u,d,f,m,p,g=e.constructor,x=g.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new g(e),Gt?Dt(t,x):t;if(d=e.d,p=t.d,r=t.e,f=e.e,d=d.slice(),l=f-r,l){for(m=l<0,m?(n=d,l=-l,u=p.length):(n=p,r=f,u=d.length),a=Math.max(Math.ceil(x/Wt),u)+2,l>a&&(l=a,n.length=1),n.reverse(),a=l;a--;)n.push(0);n.reverse()}else{for(a=d.length,u=p.length,m=a0;--a)d[u++]=0;for(a=p.length;a>l;){if(d[--a]0?i=i.charAt(0)+"."+i.slice(1)+Lo(r):l>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(a<0?"e":"e+")+a):a<0?(i="0."+Lo(-a-1)+i,n&&(r=n-l)>0&&(i+=Lo(r))):a>=l?(i+=Lo(a+1-l),n&&(r=n-a-1)>0&&(i=i+"."+Lo(r))):((r=a+1)0&&(a+1===l&&(i+="."),i+=Lo(r))),e.s<0?"-"+i:i}function y4(e,t){if(e.length>t)return e.length=t,!0}function r6(e){var t,n,r;function a(i){var l=this;if(!(l instanceof a))return new a(i);if(l.constructor=a,i instanceof a){l.s=i.s,l.e=i.e,l.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(Qs+i);if(i>0)l.s=1;else if(i<0)i=-i,l.s=-1;else{l.s=0,l.e=0,l.d=[0];return}if(i===~~i&&i<1e7){l.e=0,l.d=[i];return}return g4(l,i.toString())}else if(typeof i!="string")throw Error(Qs+i);if(i.charCodeAt(0)===45?(i=i.slice(1),l.s=-1):l.s=1,Uie.test(i))g4(l,i);else throw Error(Qs+i)}if(a.prototype=Ee,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=r6,a.config=a.set=Hie,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=a[t+1]&&r<=a[t+2])this[n]=r;else throw Error(Qs+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Qs+n+": "+r);return this}var TC=r6(Fie);Zr=new TC(1);const kt=TC;function Wie(e){return Kie(e)||Yie(e)||Gie(e)||Vie()}function Vie(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gie(e,t){if(e){if(typeof e=="string")return H_(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return H_(e,t)}}function Yie(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function Kie(e){if(Array.isArray(e))return H_(e)}function H_(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t?n.apply(void 0,a):e(t-l,x4(function(){for(var u=arguments.length,d=new Array(u),f=0;fe.length)&&(t=e.length);for(var n=0,r=new Array(t);n"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,a=!1,i=void 0;try{for(var l=e[Symbol.iterator](),u;!(r=(u=l.next()).done)&&(n.push(u.value),!(t&&n.length===t));r=!0);}catch(d){a=!0,i=d}finally{try{!r&&l.return!=null&&l.return()}finally{if(a)throw i}}return n}}function uoe(e){if(Array.isArray(e))return e}function l6(e){var t=Bf(e,2),n=t[0],r=t[1],a=n,i=r;return n>r&&(a=r,i=n),[a,i]}function c6(e,t,n){if(e.lte(0))return new kt(0);var r=uy.getDigitCount(e.toNumber()),a=new kt(10).pow(r),i=e.div(a),l=r!==1?.05:.1,u=new kt(Math.ceil(i.div(l).toNumber())).add(n).mul(l),d=u.mul(a);return t?d:new kt(Math.ceil(d))}function doe(e,t,n){var r=1,a=new kt(e);if(!a.isint()&&n){var i=Math.abs(e);i<1?(r=new kt(10).pow(uy.getDigitCount(e)-1),a=new kt(Math.floor(a.div(r).toNumber())).mul(r)):i>1&&(a=new kt(Math.floor(e)))}else e===0?a=new kt(Math.floor((t-1)/2)):n||(a=new kt(Math.floor(e)));var l=Math.floor((t-1)/2),u=Jie(Qie(function(d){return a.add(new kt(d-l).mul(r)).toNumber()}),W_);return u(0,t)}function u6(e,t,n,r){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new kt(0),tickMin:new kt(0),tickMax:new kt(0)};var i=c6(new kt(t).sub(e).div(n-1),r,a),l;e<=0&&t>=0?l=new kt(0):(l=new kt(e).add(t).div(2),l=l.sub(new kt(l).mod(i)));var u=Math.ceil(l.sub(e).div(i).toNumber()),d=Math.ceil(new kt(t).sub(l).div(i).toNumber()),f=u+d+1;return f>n?u6(e,t,n,r,a+1):(f0?d+(n-f):d,u=t>0?u:u+(n-f)),{step:i,tickMin:l.sub(new kt(u).mul(i)),tickMax:l.add(new kt(d).mul(i))})}function foe(e){var t=Bf(e,2),n=t[0],r=t[1],a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=Math.max(a,2),u=l6([n,r]),d=Bf(u,2),f=d[0],m=d[1];if(f===-1/0||m===1/0){var p=m===1/0?[f].concat(G_(W_(0,a-1).map(function(){return 1/0}))):[].concat(G_(W_(0,a-1).map(function(){return-1/0})),[m]);return n>r?V_(p):p}if(f===m)return doe(f,a,i);var g=u6(f,m,l,i),x=g.step,j=g.tickMin,b=g.tickMax,w=uy.rangeStep(j,b.add(new kt(.1).mul(x)),x);return n>r?V_(w):w}function hoe(e,t){var n=Bf(e,2),r=n[0],a=n[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=l6([r,a]),u=Bf(l,2),d=u[0],f=u[1];if(d===-1/0||f===1/0)return[r,a];if(d===f)return[d];var m=Math.max(t,2),p=c6(new kt(f).sub(d).div(m-1),i,0),g=[].concat(G_(uy.rangeStep(new kt(d),new kt(f).sub(new kt(.99).mul(p)),p)),[f]);return r>a?V_(g):g}var moe=o6(foe),poe=o6(hoe),voe=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function su(e){"@babel/helpers - typeof";return su=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},su(e)}function Lv(){return Lv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Soe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function _oe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Noe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&arguments[1]!==void 0?arguments[1]:[],a=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,l=-1,u=(n=r?.length)!==null&&n!==void 0?n:0;if(u<=1)return 0;if(i&&i.axisType==="angleAxis"&&Math.abs(Math.abs(i.range[1]-i.range[0])-360)<=1e-6)for(var d=i.range,f=0;f0?a[f-1].coordinate:a[u-1].coordinate,p=a[f].coordinate,g=f>=u-1?a[0].coordinate:a[f+1].coordinate,x=void 0;if(vr(p-m)!==vr(g-p)){var j=[];if(vr(g-p)===vr(d[1]-d[0])){x=g;var b=p+d[1]-d[0];j[0]=Math.min(b,(b+m)/2),j[1]=Math.max(b,(b+m)/2)}else{x=m;var w=g+d[1]-d[0];j[0]=Math.min(p,(w+p)/2),j[1]=Math.max(p,(w+p)/2)}var N=[Math.min(p,(x+p)/2),Math.max(p,(x+p)/2)];if(t>N[0]&&t<=N[1]||t>=j[0]&&t<=j[1]){l=a[f].index;break}}else{var O=Math.min(m,g),C=Math.max(m,g);if(t>(O+p)/2&&t<=(C+p)/2){l=a[f].index;break}}}else for(var A=0;A0&&A(r[A].coordinate+r[A-1].coordinate)/2&&t<=(r[A].coordinate+r[A+1].coordinate)/2||A===u-1&&t>(r[A].coordinate+r[A-1].coordinate)/2){l=r[A].index;break}return l},kC=function(t){var n,r=t,a=r.type.displayName,i=(n=t.type)!==null&&n!==void 0&&n.defaultProps?en(en({},t.type.defaultProps),t.props):t.props,l=i.stroke,u=i.fill,d;switch(a){case"Line":d=l;break;case"Area":case"Radar":d=l&&l!=="none"?l:u;break;default:d=u;break}return d},Foe=function(t){var n=t.barSize,r=t.totalSize,a=t.stackGroups,i=a===void 0?{}:a;if(!i)return{};for(var l={},u=Object.keys(i),d=0,f=u.length;d=0});if(N&&N.length){var O=N[0].type.defaultProps,C=O!==void 0?en(en({},O),N[0].props):N[0].props,A=C.barSize,E=C[w];l[E]||(l[E]=[]);var k=Ge(A)?n:A;l[E].push({item:N[0],stackList:N.slice(1),barSize:Ge(k)?void 0:gr(k,r,0)})}}return l},Uoe=function(t){var n=t.barGap,r=t.barCategoryGap,a=t.bandSize,i=t.sizeList,l=i===void 0?[]:i,u=t.maxBarSize,d=l.length;if(d<1)return null;var f=gr(n,a,0,!0),m,p=[];if(l[0].barSize===+l[0].barSize){var g=!1,x=a/d,j=l.reduce(function(A,E){return A+E.barSize||0},0);j+=(d-1)*f,j>=a&&(j-=(d-1)*f,f=0),j>=a&&x>0&&(g=!0,x*=.9,j=d*x);var b=(a-j)/2>>0,w={offset:b-f,size:0};m=l.reduce(function(A,E){var k={item:E.item,position:{offset:w.offset+w.size+f,size:g?x:E.barSize}},T=[].concat(j4(A),[k]);return w=T[T.length-1].position,E.stackList&&E.stackList.length&&E.stackList.forEach(function(P){T.push({item:P,position:w})}),T},p)}else{var N=gr(r,a,0,!0);a-2*N-(d-1)*f<=0&&(f=0);var O=(a-2*N-(d-1)*f)/d;O>1&&(O>>=0);var C=u===+u?Math.min(O,u):O;m=l.reduce(function(A,E,k){var T=[].concat(j4(A),[{item:E.item,position:{offset:N+(O+f)*k+(O-C)/2,size:C}}]);return E.stackList&&E.stackList.length&&E.stackList.forEach(function(P){T.push({item:P,position:T[T.length-1].position})}),T},p)}return m},Hoe=function(t,n,r,a){var i=r.children,l=r.width,u=r.margin,d=l-(u.left||0)-(u.right||0),f=m6({children:i,legendWidth:d});if(f){var m=a||{},p=m.width,g=m.height,x=f.align,j=f.verticalAlign,b=f.layout;if((b==="vertical"||b==="horizontal"&&j==="middle")&&x!=="center"&&Ne(t[x]))return en(en({},t),{},qc({},x,t[x]+(p||0)));if((b==="horizontal"||b==="vertical"&&x==="center")&&j!=="middle"&&Ne(t[j]))return en(en({},t),{},qc({},j,t[j]+(g||0)))}return t},Woe=function(t,n,r){return Ge(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},p6=function(t,n,r,a,i){var l=n.props.children,u=Jr(l,kh).filter(function(f){return Woe(a,i,f.props.direction)});if(u&&u.length){var d=u.map(function(f){return f.props.dataKey});return t.reduce(function(f,m){var p=wn(m,r);if(Ge(p))return f;var g=Array.isArray(p)?[ly(p),sy(p)]:[p,p],x=d.reduce(function(j,b){var w=wn(m,b,0),N=g[0]-Math.abs(Array.isArray(w)?w[0]:w),O=g[1]+Math.abs(Array.isArray(w)?w[1]:w);return[Math.min(N,j[0]),Math.max(O,j[1])]},[1/0,-1/0]);return[Math.min(x[0],f[0]),Math.max(x[1],f[1])]},[1/0,-1/0])}return null},Voe=function(t,n,r,a,i){var l=n.map(function(u){return p6(t,u,r,i,a)}).filter(function(u){return!Ge(u)});return l&&l.length?l.reduce(function(u,d){return[Math.min(u[0],d[0]),Math.max(u[1],d[1])]},[1/0,-1/0]):null},v6=function(t,n,r,a,i){var l=n.map(function(d){var f=d.props.dataKey;return r==="number"&&f&&p6(t,d,f,a)||yf(t,f,r,i)});if(r==="number")return l.reduce(function(d,f){return[Math.min(d[0],f[0]),Math.max(d[1],f[1])]},[1/0,-1/0]);var u={};return l.reduce(function(d,f){for(var m=0,p=f.length;m=2?vr(u[0]-u[1])*2*f:f,n&&(t.ticks||t.niceTicks)){var m=(t.ticks||t.niceTicks).map(function(p){var g=i?i.indexOf(p):p;return{coordinate:a(g)+f,value:p,offset:f}});return m.filter(function(p){return!_h(p.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(p,g){return{coordinate:a(p)+f,value:p,index:g,offset:f}}):a.ticks&&!r?a.ticks(t.tickCount).map(function(p){return{coordinate:a(p)+f,value:p,offset:f}}):a.domain().map(function(p,g){return{coordinate:a(p)+f,value:i?i[p]:p,index:g,offset:f}})},lS=new WeakMap,Ep=function(t,n){if(typeof n!="function")return t;lS.has(t)||lS.set(t,new WeakMap);var r=lS.get(t);if(r.has(n))return r.get(n);var a=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,a),a},x6=function(t,n,r){var a=t.scale,i=t.type,l=t.layout,u=t.axisType;if(a==="auto")return l==="radial"&&u==="radiusAxis"?{scale:Mf(),realScaleType:"band"}:l==="radial"&&u==="angleAxis"?{scale:Mv(),realScaleType:"linear"}:i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:gf(),realScaleType:"point"}:i==="category"?{scale:Mf(),realScaleType:"band"}:{scale:Mv(),realScaleType:"linear"};if(il(a)){var d="scale".concat(Vg(a));return{scale:(l4[d]||gf)(),realScaleType:l4[d]?d:"point"}}return We(a)?{scale:a}:{scale:gf(),realScaleType:"point"}},_4=1e-4,b6=function(t){var n=t.domain();if(!(!n||n.length<=2)){var r=n.length,a=t.range(),i=Math.min(a[0],a[1])-_4,l=Math.max(a[0],a[1])+_4,u=t(n[0]),d=t(n[r-1]);(ul||dl)&&t.domain([n[0],n[r-1]])}},Goe=function(t,n){if(!t)return null;for(var r=0,a=t.length;ra)&&(i[1]=a),i[0]>a&&(i[0]=a),i[1]=0?(t[u][r][0]=i,t[u][r][1]=i+d,i=t[u][r][1]):(t[u][r][0]=l,t[u][r][1]=l+d,l=t[u][r][1])}},Xoe=function(t){var n=t.length;if(!(n<=0))for(var r=0,a=t[0].length;r=0?(t[l][r][0]=i,t[l][r][1]=i+u,i=t[l][r][1]):(t[l][r][0]=0,t[l][r][1]=0)}},Zoe={sign:Koe,expand:LJ,none:Jc,silhouette:BJ,wiggle:zJ,positive:Xoe},Qoe=function(t,n,r){var a=n.map(function(u){return u.props.dataKey}),i=Zoe[r],l=IJ().keys(a).value(function(u,d){return+wn(u,d,0)}).order(O_).offset(i);return l(t)},Joe=function(t,n,r,a,i,l){if(!t)return null;var u=l?n.reverse():n,d={},f=u.reduce(function(p,g){var x,j=(x=g.type)!==null&&x!==void 0&&x.defaultProps?en(en({},g.type.defaultProps),g.props):g.props,b=j.stackId,w=j.hide;if(w)return p;var N=j[r],O=p[N]||{hasStack:!1,stackGroups:{}};if(jn(b)){var C=O.stackGroups[b]||{numericAxisId:r,cateAxisId:a,items:[]};C.items.push(g),O.hasStack=!0,O.stackGroups[b]=C}else O.stackGroups[$u("_stackId_")]={numericAxisId:r,cateAxisId:a,items:[g]};return en(en({},p),{},qc({},N,O))},d),m={};return Object.keys(f).reduce(function(p,g){var x=f[g];if(x.hasStack){var j={};x.stackGroups=Object.keys(x.stackGroups).reduce(function(b,w){var N=x.stackGroups[w];return en(en({},b),{},qc({},w,{numericAxisId:r,cateAxisId:a,items:N.items,stackedData:Qoe(t,N.items,i)}))},j)}return en(en({},p),{},qc({},g,x))},m)},w6=function(t,n){var r=n.realScaleType,a=n.type,i=n.tickCount,l=n.originalDomain,u=n.allowDecimals,d=r||n.scale;if(d!=="auto"&&d!=="linear")return null;if(i&&a==="number"&&l&&(l[0]==="auto"||l[1]==="auto")){var f=t.domain();if(!f.length)return null;var m=moe(f,i,u);return t.domain([ly(m),sy(m)]),{niceTicks:m}}if(i&&a==="number"){var p=t.domain(),g=poe(p,i,u);return{niceTicks:g}}return null};function N4(e){var t=e.axis,n=e.ticks,r=e.bandSize,a=e.entry,i=e.index,l=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Ge(a[t.dataKey])){var u=pv(n,"value",a[t.dataKey]);if(u)return u.coordinate+r/2}return n[i]?n[i].coordinate+r/2:null}var d=wn(a,Ge(l)?t.dataKey:l);return Ge(d)?null:t.scale(d)}var O4=function(t){var n=t.axis,r=t.ticks,a=t.offset,i=t.bandSize,l=t.entry,u=t.index;if(n.type==="category")return r[u]?r[u].coordinate+a:null;var d=wn(l,n.dataKey,n.domain[u]);return Ge(d)?null:n.scale(d)-i/2+a},ese=function(t){var n=t.numericAxis,r=n.scale.domain();if(n.type==="number"){var a=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]);return a<=0&&i>=0?0:i<0?i:a}return r[0]},tse=function(t,n){var r,a=(r=t.type)!==null&&r!==void 0&&r.defaultProps?en(en({},t.type.defaultProps),t.props):t.props,i=a.stackId;if(jn(i)){var l=n[i];if(l){var u=l.items.indexOf(t);return u>=0?l.stackedData[u]:null}}return null},nse=function(t){return t.reduce(function(n,r){return[ly(r.concat([n[0]]).filter(Ne)),sy(r.concat([n[1]]).filter(Ne))]},[1/0,-1/0])},j6=function(t,n,r){return Object.keys(t).reduce(function(a,i){var l=t[i],u=l.stackedData,d=u.reduce(function(f,m){var p=nse(m.slice(n,r+1));return[Math.min(f[0],p[0]),Math.max(f[1],p[1])]},[1/0,-1/0]);return[Math.min(d[0],a[0]),Math.max(d[1],a[1])]},[1/0,-1/0]).map(function(a){return a===1/0||a===-1/0?0:a})},C4=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,E4=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Z_=function(t,n,r){if(We(t))return t(n,r);if(!Array.isArray(t))return n;var a=[];if(Ne(t[0]))a[0]=r?t[0]:Math.min(t[0],n[0]);else if(C4.test(t[0])){var i=+C4.exec(t[0])[1];a[0]=n[0]-i}else We(t[0])?a[0]=t[0](n[0]):a[0]=n[0];if(Ne(t[1]))a[1]=r?t[1]:Math.max(t[1],n[1]);else if(E4.test(t[1])){var l=+E4.exec(t[1])[1];a[1]=n[1]+l}else We(t[1])?a[1]=t[1](n[1]):a[1]=n[1];return a},zv=function(t,n,r){if(t&&t.scale&&t.scale.bandwidth){var a=t.scale.bandwidth();if(!r||a>0)return a}if(t&&n&&n.length>=2){for(var i=iC(n,function(p){return p.coordinate}),l=1/0,u=1,d=i.length;ue.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},dse=function(t,n,r,a,i){var l=t.width,u=t.height,d=t.startAngle,f=t.endAngle,m=gr(t.cx,l,l/2),p=gr(t.cy,u,u/2),g=N6(l,u,r),x=gr(t.innerRadius,g,0),j=gr(t.outerRadius,g,g*.8),b=Object.keys(n);return b.reduce(function(w,N){var O=n[N],C=O.domain,A=O.reversed,E;if(Ge(O.range))a==="angleAxis"?E=[d,f]:a==="radiusAxis"&&(E=[x,j]),A&&(E=[E[1],E[0]]);else{E=O.range;var k=E,T=ise(k,2);d=T[0],f=T[1]}var P=x6(O,i),$=P.realScaleType,F=P.scale;F.domain(C).range(E),b6(F);var D=w6(F,qi(qi({},O),{},{realScaleType:$})),U=qi(qi(qi({},O),D),{},{range:E,radius:j,realScaleType:$,scale:F,cx:m,cy:p,innerRadius:x,outerRadius:j,startAngle:d,endAngle:f});return qi(qi({},w),{},_6({},N,U))},{})},fse=function(t,n){var r=t.x,a=t.y,i=n.x,l=n.y;return Math.sqrt(Math.pow(r-i,2)+Math.pow(a-l,2))},hse=function(t,n){var r=t.x,a=t.y,i=n.cx,l=n.cy,u=fse({x:r,y:a},{x:i,y:l});if(u<=0)return{radius:u};var d=(r-i)/u,f=Math.acos(d);return a>l&&(f=2*Math.PI-f),{radius:u,angle:use(f),angleInRadian:f}},mse=function(t){var n=t.startAngle,r=t.endAngle,a=Math.floor(n/360),i=Math.floor(r/360),l=Math.min(a,i);return{startAngle:n-l*360,endAngle:r-l*360}},pse=function(t,n){var r=n.startAngle,a=n.endAngle,i=Math.floor(r/360),l=Math.floor(a/360),u=Math.min(i,l);return t+u*360},P4=function(t,n){var r=t.x,a=t.y,i=hse({x:r,y:a},n),l=i.radius,u=i.angle,d=n.innerRadius,f=n.outerRadius;if(lf)return!1;if(l===0)return!0;var m=mse(n),p=m.startAngle,g=m.endAngle,x=u,j;if(p<=g){for(;x>g;)x-=360;for(;x=p&&x<=g}else{for(;x>p;)x-=360;for(;x=g&&x<=p}return j?qi(qi({},n),{},{radius:l,angle:pse(x,n)}):null},O6=function(t){return!y.isValidElement(t)&&!We(t)&&typeof t!="boolean"?t.className:""};function Uf(e){"@babel/helpers - typeof";return Uf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Uf(e)}var vse=["offset"];function gse(e){return wse(e)||bse(e)||xse(e)||yse()}function yse(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xse(e,t){if(e){if(typeof e=="string")return Q_(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Q_(e,t)}}function bse(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function wse(e){if(Array.isArray(e))return Q_(e)}function Q_(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Sse(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function M4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function bn(e){for(var t=1;t=0?1:-1,C,A;a==="insideStart"?(C=x+O*l,A=b):a==="insideEnd"?(C=j-O*l,A=!b):a==="end"&&(C=j+O*l,A=b),A=N<=0?A:!A;var E=Bt(f,m,w,C),k=Bt(f,m,w,C+(A?1:-1)*359),T="M".concat(E.x,",").concat(E.y,` - A`).concat(w,",").concat(w,",0,1,").concat(A?0:1,`, - `).concat(k.x,",").concat(k.y),P=Ge(t.id)?$u("recharts-radial-line-"):t.id;return W.createElement("text",Hf({},r,{dominantBaseline:"central",className:Ye("recharts-radial-bar-label",u)}),W.createElement("defs",null,W.createElement("path",{id:P,d:T})),W.createElement("textPath",{xlinkHref:"#".concat(P)},n))},Tse=function(t){var n=t.viewBox,r=t.offset,a=t.position,i=n,l=i.cx,u=i.cy,d=i.innerRadius,f=i.outerRadius,m=i.startAngle,p=i.endAngle,g=(m+p)/2;if(a==="outside"){var x=Bt(l,u,f+r,g),j=x.x,b=x.y;return{x:j,y:b,textAnchor:j>=l?"start":"end",verticalAnchor:"middle"}}if(a==="center")return{x:l,y:u,textAnchor:"middle",verticalAnchor:"middle"};if(a==="centerTop")return{x:l,y:u,textAnchor:"middle",verticalAnchor:"start"};if(a==="centerBottom")return{x:l,y:u,textAnchor:"middle",verticalAnchor:"end"};var w=(d+f)/2,N=Bt(l,u,w,g),O=N.x,C=N.y;return{x:O,y:C,textAnchor:"middle",verticalAnchor:"middle"}},kse=function(t){var n=t.viewBox,r=t.parentViewBox,a=t.offset,i=t.position,l=n,u=l.x,d=l.y,f=l.width,m=l.height,p=m>=0?1:-1,g=p*a,x=p>0?"end":"start",j=p>0?"start":"end",b=f>=0?1:-1,w=b*a,N=b>0?"end":"start",O=b>0?"start":"end";if(i==="top"){var C={x:u+f/2,y:d-p*a,textAnchor:"middle",verticalAnchor:x};return bn(bn({},C),r?{height:Math.max(d-r.y,0),width:f}:{})}if(i==="bottom"){var A={x:u+f/2,y:d+m+g,textAnchor:"middle",verticalAnchor:j};return bn(bn({},A),r?{height:Math.max(r.y+r.height-(d+m),0),width:f}:{})}if(i==="left"){var E={x:u-w,y:d+m/2,textAnchor:N,verticalAnchor:"middle"};return bn(bn({},E),r?{width:Math.max(E.x-r.x,0),height:m}:{})}if(i==="right"){var k={x:u+f+w,y:d+m/2,textAnchor:O,verticalAnchor:"middle"};return bn(bn({},k),r?{width:Math.max(r.x+r.width-k.x,0),height:m}:{})}var T=r?{width:f,height:m}:{};return i==="insideLeft"?bn({x:u+w,y:d+m/2,textAnchor:O,verticalAnchor:"middle"},T):i==="insideRight"?bn({x:u+f-w,y:d+m/2,textAnchor:N,verticalAnchor:"middle"},T):i==="insideTop"?bn({x:u+f/2,y:d+g,textAnchor:"middle",verticalAnchor:j},T):i==="insideBottom"?bn({x:u+f/2,y:d+m-g,textAnchor:"middle",verticalAnchor:x},T):i==="insideTopLeft"?bn({x:u+w,y:d+g,textAnchor:O,verticalAnchor:j},T):i==="insideTopRight"?bn({x:u+f-w,y:d+g,textAnchor:N,verticalAnchor:j},T):i==="insideBottomLeft"?bn({x:u+w,y:d+m-g,textAnchor:O,verticalAnchor:x},T):i==="insideBottomRight"?bn({x:u+f-w,y:d+m-g,textAnchor:N,verticalAnchor:x},T):Du(i)&&(Ne(i.x)||qs(i.x))&&(Ne(i.y)||qs(i.y))?bn({x:u+gr(i.x,f),y:d+gr(i.y,m),textAnchor:"end",verticalAnchor:"end"},T):bn({x:u+f/2,y:d+m/2,textAnchor:"middle",verticalAnchor:"middle"},T)},Pse=function(t){return"cx"in t&&Ne(t.cx)};function Tn(e){var t=e.offset,n=t===void 0?5:t,r=jse(e,vse),a=bn({offset:n},r),i=a.viewBox,l=a.position,u=a.value,d=a.children,f=a.content,m=a.className,p=m===void 0?"":m,g=a.textBreakAll;if(!i||Ge(u)&&Ge(d)&&!y.isValidElement(f)&&!We(f))return null;if(y.isValidElement(f))return y.cloneElement(f,a);var x;if(We(f)){if(x=y.createElement(f,a),y.isValidElement(x))return x}else x=Cse(a);var j=Pse(i),b=Be(a,!0);if(j&&(l==="insideStart"||l==="insideEnd"||l==="end"))return Ase(a,x,b);var w=j?Tse(a):kse(a);return W.createElement(sl,Hf({className:Ye("recharts-label",p)},b,w,{breakAll:g}),x)}Tn.displayName="Label";var C6=function(t){var n=t.cx,r=t.cy,a=t.angle,i=t.startAngle,l=t.endAngle,u=t.r,d=t.radius,f=t.innerRadius,m=t.outerRadius,p=t.x,g=t.y,x=t.top,j=t.left,b=t.width,w=t.height,N=t.clockWise,O=t.labelViewBox;if(O)return O;if(Ne(b)&&Ne(w)){if(Ne(p)&&Ne(g))return{x:p,y:g,width:b,height:w};if(Ne(x)&&Ne(j))return{x,y:j,width:b,height:w}}return Ne(p)&&Ne(g)?{x:p,y:g,width:0,height:0}:Ne(n)&&Ne(r)?{cx:n,cy:r,startAngle:i||a||0,endAngle:l||a||0,innerRadius:f||0,outerRadius:m||d||u||0,clockWise:N}:t.viewBox?t.viewBox:{}},Mse=function(t,n){return t?t===!0?W.createElement(Tn,{key:"label-implicit",viewBox:n}):jn(t)?W.createElement(Tn,{key:"label-implicit",viewBox:n,value:t}):y.isValidElement(t)?t.type===Tn?y.cloneElement(t,{key:"label-implicit",viewBox:n}):W.createElement(Tn,{key:"label-implicit",content:t,viewBox:n}):We(t)?W.createElement(Tn,{key:"label-implicit",content:t,viewBox:n}):Du(t)?W.createElement(Tn,Hf({viewBox:n},t,{key:"label-implicit"})):null:null},Rse=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var a=t.children,i=C6(t),l=Jr(a,Tn).map(function(d,f){return y.cloneElement(d,{viewBox:n||i,key:"label-".concat(f)})});if(!r)return l;var u=Mse(t.label,n||i);return[u].concat(gse(l))};Tn.parseViewBox=C6;Tn.renderCallByParent=Rse;var cS,R4;function Dse(){if(R4)return cS;R4=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return cS=e,cS}var $se=Dse();const Ise=wt($se);function Wf(e){"@babel/helpers - typeof";return Wf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wf(e)}var Lse=["valueAccessor"],Bse=["data","dataKey","clockWise","id","textBreakAll"];function zse(e){return Hse(e)||Use(e)||Fse(e)||qse()}function qse(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fse(e,t){if(e){if(typeof e=="string")return J_(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return J_(e,t)}}function Use(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Hse(e){if(Array.isArray(e))return J_(e)}function J_(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Yse(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Kse=function(t){return Array.isArray(t.value)?Ise(t.value):t.value};function Zi(e){var t=e.valueAccessor,n=t===void 0?Kse:t,r=I4(e,Lse),a=r.data,i=r.dataKey,l=r.clockWise,u=r.id,d=r.textBreakAll,f=I4(r,Bse);return!a||!a.length?null:W.createElement(ft,{className:"recharts-label-list"},a.map(function(m,p){var g=Ge(i)?n(m,p):wn(m&&m.payload,i),x=Ge(u)?{}:{id:"".concat(u,"-").concat(p)};return W.createElement(Tn,Fv({},Be(m,!0),f,x,{parentViewBox:m.parentViewBox,value:g,textBreakAll:d,viewBox:Tn.parseViewBox(Ge(l)?m:$4($4({},m),{},{clockWise:l})),key:"label-".concat(p),index:p}))}))}Zi.displayName="LabelList";function Xse(e,t){return e?e===!0?W.createElement(Zi,{key:"labelList-implicit",data:t}):W.isValidElement(e)||We(e)?W.createElement(Zi,{key:"labelList-implicit",data:t,content:e}):Du(e)?W.createElement(Zi,Fv({data:t},e,{key:"labelList-implicit"})):null:null}function Zse(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,a=Jr(r,Zi).map(function(l,u){return y.cloneElement(l,{data:t,key:"labelList-".concat(u)})});if(!n)return a;var i=Xse(e.label,t);return[i].concat(zse(a))}Zi.renderCallByParent=Zse;function Vf(e){"@babel/helpers - typeof";return Vf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vf(e)}function eN(){return eN=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(l>f),`, - `).concat(p.x,",").concat(p.y,` - `);if(a>0){var x=Bt(n,r,a,l),j=Bt(n,r,a,f);g+="L ".concat(j.x,",").concat(j.y,` - A `).concat(a,",").concat(a,`,0, - `).concat(+(Math.abs(d)>180),",").concat(+(l<=f),`, - `).concat(x.x,",").concat(x.y," Z")}else g+="L ".concat(n,",").concat(r," Z");return g},nle=function(t){var n=t.cx,r=t.cy,a=t.innerRadius,i=t.outerRadius,l=t.cornerRadius,u=t.forceCornerRadius,d=t.cornerIsExternal,f=t.startAngle,m=t.endAngle,p=vr(m-f),g=Ap({cx:n,cy:r,radius:i,angle:f,sign:p,cornerRadius:l,cornerIsExternal:d}),x=g.circleTangency,j=g.lineTangency,b=g.theta,w=Ap({cx:n,cy:r,radius:i,angle:m,sign:-p,cornerRadius:l,cornerIsExternal:d}),N=w.circleTangency,O=w.lineTangency,C=w.theta,A=d?Math.abs(f-m):Math.abs(f-m)-b-C;if(A<0)return u?"M ".concat(j.x,",").concat(j.y,` - a`).concat(l,",").concat(l,",0,0,1,").concat(l*2,`,0 - a`).concat(l,",").concat(l,",0,0,1,").concat(-l*2,`,0 - `):E6({cx:n,cy:r,innerRadius:a,outerRadius:i,startAngle:f,endAngle:m});var E="M ".concat(j.x,",").concat(j.y,` - A`).concat(l,",").concat(l,",0,0,").concat(+(p<0),",").concat(x.x,",").concat(x.y,` - A`).concat(i,",").concat(i,",0,").concat(+(A>180),",").concat(+(p<0),",").concat(N.x,",").concat(N.y,` - A`).concat(l,",").concat(l,",0,0,").concat(+(p<0),",").concat(O.x,",").concat(O.y,` - `);if(a>0){var k=Ap({cx:n,cy:r,radius:a,angle:f,sign:p,isExternal:!0,cornerRadius:l,cornerIsExternal:d}),T=k.circleTangency,P=k.lineTangency,$=k.theta,F=Ap({cx:n,cy:r,radius:a,angle:m,sign:-p,isExternal:!0,cornerRadius:l,cornerIsExternal:d}),D=F.circleTangency,U=F.lineTangency,V=F.theta,H=d?Math.abs(f-m):Math.abs(f-m)-$-V;if(H<0&&l===0)return"".concat(E,"L").concat(n,",").concat(r,"Z");E+="L".concat(U.x,",").concat(U.y,` - A`).concat(l,",").concat(l,",0,0,").concat(+(p<0),",").concat(D.x,",").concat(D.y,` - A`).concat(a,",").concat(a,",0,").concat(+(H>180),",").concat(+(p>0),",").concat(T.x,",").concat(T.y,` - A`).concat(l,",").concat(l,",0,0,").concat(+(p<0),",").concat(P.x,",").concat(P.y,"Z")}else E+="L".concat(n,",").concat(r,"Z");return E},rle={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},A6=function(t){var n=B4(B4({},rle),t),r=n.cx,a=n.cy,i=n.innerRadius,l=n.outerRadius,u=n.cornerRadius,d=n.forceCornerRadius,f=n.cornerIsExternal,m=n.startAngle,p=n.endAngle,g=n.className;if(l0&&Math.abs(m-p)<360?w=nle({cx:r,cy:a,innerRadius:i,outerRadius:l,cornerRadius:Math.min(b,j/2),forceCornerRadius:d,cornerIsExternal:f,startAngle:m,endAngle:p}):w=E6({cx:r,cy:a,innerRadius:i,outerRadius:l,startAngle:m,endAngle:p}),W.createElement("path",eN({},Be(n,!0),{className:x,d:w,role:"img"}))};function Gf(e){"@babel/helpers - typeof";return Gf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gf(e)}function tN(){return tN=Object.assign?Object.assign.bind():function(e){for(var t=1;t0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function jle(e,t){return bl(e.getTime(),t.getTime())}function Sle(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function _le(e,t){return e===t}function X4(e,t,n){var r=e.size;if(r!==t.size)return!1;if(!r)return!0;for(var a=new Array(r),i=e.entries(),l,u,d=0;(l=i.next())&&!l.done;){for(var f=t.entries(),m=!1,p=0;(u=f.next())&&!u.done;){if(a[p]){p++;continue}var g=l.value,x=u.value;if(n.equals(g[0],x[0],d,p,e,t,n)&&n.equals(g[1],x[1],g[0],x[0],e,t,n)){m=a[p]=!0;break}p++}if(!m)return!1;d++}return!0}var Nle=bl;function Ole(e,t,n){var r=K4(e),a=r.length;if(K4(t).length!==a)return!1;for(;a-- >0;)if(!T6(e,t,n,r[a]))return!1;return!0}function Jd(e,t,n){var r=G4(e),a=r.length;if(G4(t).length!==a)return!1;for(var i,l,u;a-- >0;)if(i=r[a],!T6(e,t,n,i)||(l=Y4(e,i),u=Y4(t,i),(l||u)&&(!l||!u||l.configurable!==u.configurable||l.enumerable!==u.enumerable||l.writable!==u.writable)))return!1;return!0}function Cle(e,t){return bl(e.valueOf(),t.valueOf())}function Ele(e,t){return e.source===t.source&&e.flags===t.flags}function Z4(e,t,n){var r=e.size;if(r!==t.size)return!1;if(!r)return!0;for(var a=new Array(r),i=e.values(),l,u;(l=i.next())&&!l.done;){for(var d=t.values(),f=!1,m=0;(u=d.next())&&!u.done;){if(!a[m]&&n.equals(l.value,u.value,l.value,u.value,e,t,n)){f=a[m]=!0;break}m++}if(!f)return!1}return!0}function Ale(e,t){var n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function Tle(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function T6(e,t,n,r){return(r===ble||r===xle||r===yle)&&(e.$$typeof||t.$$typeof)?!0:gle(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var kle="[object Arguments]",Ple="[object Boolean]",Mle="[object Date]",Rle="[object Error]",Dle="[object Map]",$le="[object Number]",Ile="[object Object]",Lle="[object RegExp]",Ble="[object Set]",zle="[object String]",qle="[object URL]",Fle=Array.isArray,Q4=typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView:null,J4=Object.assign,Ule=Object.prototype.toString.call.bind(Object.prototype.toString);function Hle(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areErrorsEqual,a=e.areFunctionsEqual,i=e.areMapsEqual,l=e.areNumbersEqual,u=e.areObjectsEqual,d=e.arePrimitiveWrappersEqual,f=e.areRegExpsEqual,m=e.areSetsEqual,p=e.areTypedArraysEqual,g=e.areUrlsEqual,x=e.unknownTagComparators;return function(b,w,N){if(b===w)return!0;if(b==null||w==null)return!1;var O=typeof b;if(O!==typeof w)return!1;if(O!=="object")return O==="number"?l(b,w,N):O==="function"?a(b,w,N):!1;var C=b.constructor;if(C!==w.constructor)return!1;if(C===Object)return u(b,w,N);if(Fle(b))return t(b,w,N);if(Q4!=null&&Q4(b))return p(b,w,N);if(C===Date)return n(b,w,N);if(C===RegExp)return f(b,w,N);if(C===Map)return i(b,w,N);if(C===Set)return m(b,w,N);var A=Ule(b);if(A===Mle)return n(b,w,N);if(A===Lle)return f(b,w,N);if(A===Dle)return i(b,w,N);if(A===Ble)return m(b,w,N);if(A===Ile)return typeof b.then!="function"&&typeof w.then!="function"&&u(b,w,N);if(A===qle)return g(b,w,N);if(A===Rle)return r(b,w,N);if(A===kle)return u(b,w,N);if(A===Ple||A===$le||A===zle)return d(b,w,N);if(x){var E=x[A];if(!E){var k=vle(b);k&&(E=x[k])}if(E)return E(b,w,N)}return!1}}function Wle(e){var t=e.circular,n=e.createCustomConfig,r=e.strict,a={areArraysEqual:r?Jd:wle,areDatesEqual:jle,areErrorsEqual:Sle,areFunctionsEqual:_le,areMapsEqual:r?V4(X4,Jd):X4,areNumbersEqual:Nle,areObjectsEqual:r?Jd:Ole,arePrimitiveWrappersEqual:Cle,areRegExpsEqual:Ele,areSetsEqual:r?V4(Z4,Jd):Z4,areTypedArraysEqual:r?Jd:Ale,areUrlsEqual:Tle,unknownTagComparators:void 0};if(n&&(a=J4({},a,n(a))),t){var i=kp(a.areArraysEqual),l=kp(a.areMapsEqual),u=kp(a.areObjectsEqual),d=kp(a.areSetsEqual);a=J4({},a,{areArraysEqual:i,areMapsEqual:l,areObjectsEqual:u,areSetsEqual:d})}return a}function Vle(e){return function(t,n,r,a,i,l,u){return e(t,n,u)}}function Gle(e){var t=e.circular,n=e.comparator,r=e.createState,a=e.equals,i=e.strict;if(r)return function(d,f){var m=r(),p=m.cache,g=p===void 0?t?new WeakMap:void 0:p,x=m.meta;return n(d,f,{cache:g,equals:a,meta:x,strict:i})};if(t)return function(d,f){return n(d,f,{cache:new WeakMap,equals:a,meta:void 0,strict:i})};var l={cache:void 0,equals:a,meta:void 0,strict:i};return function(d,f){return n(d,f,l)}}var Yle=as();as({strict:!0});as({circular:!0});as({circular:!0,strict:!0});as({createInternalComparator:function(){return bl}});as({strict:!0,createInternalComparator:function(){return bl}});as({circular:!0,createInternalComparator:function(){return bl}});as({circular:!0,createInternalComparator:function(){return bl},strict:!0});function as(e){e===void 0&&(e={});var t=e.circular,n=t===void 0?!1:t,r=e.createInternalComparator,a=e.createState,i=e.strict,l=i===void 0?!1:i,u=Wle(e),d=Hle(u),f=r?r(d):Vle(d);return Gle({circular:n,comparator:d,createState:a,equals:f,strict:l})}function Kle(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function eI(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function a(i){n<0&&(n=i),i-n>t?(e(i),n=-1):Kle(a)};requestAnimationFrame(r)}function nN(e){"@babel/helpers - typeof";return nN=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nN(e)}function Xle(e){return ece(e)||Jle(e)||Qle(e)||Zle()}function Zle(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qle(e,t){if(e){if(typeof e=="string")return tI(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tI(e,t)}}function tI(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?1:N<0?0:N},b=function(N){for(var O=N>1?1:N,C=O,A=0;A<8;++A){var E=p(C)-O,k=x(C);if(Math.abs(E-O)0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,r=n===void 0?100:n,a=t.damping,i=a===void 0?8:a,l=t.dt,u=l===void 0?17:l,d=function(m,p,g){var x=-(m-p)*r,j=g*i,b=g+(x-j)*u/1e3,w=g*u/1e3+m;return Math.abs(w-p)e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function kce(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i=0)&&(n[a]=e[a]);return n}function hS(e){return Dce(e)||Rce(e)||Mce(e)||Pce()}function Pce(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mce(e,t){if(e){if(typeof e=="string")return sN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sN(e,t)}}function Rce(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Dce(e){if(Array.isArray(e))return sN(e)}function sN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Vv(e){return Vv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Vv(e)}var hi=(function(e){zce(n,e);var t=qce(n);function n(r,a){var i;$ce(this,n),i=t.call(this,r,a);var l=i.props,u=l.isActive,d=l.attributeName,f=l.from,m=l.to,p=l.steps,g=l.children,x=l.duration;if(i.handleStyleChange=i.handleStyleChange.bind(uN(i)),i.changeStyle=i.changeStyle.bind(uN(i)),!u||x<=0)return i.state={style:{}},typeof g=="function"&&(i.state={style:m}),cN(i);if(p&&p.length)i.state={style:p[0].style};else if(f){if(typeof g=="function")return i.state={style:f},cN(i);i.state={style:d?sf({},d,f):f}}else i.state={style:{}};return i}return Lce(n,[{key:"componentDidMount",value:function(){var a=this.props,i=a.isActive,l=a.canBegin;this.mounted=!0,!(!i||!l)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(a){var i=this.props,l=i.isActive,u=i.canBegin,d=i.attributeName,f=i.shouldReAnimate,m=i.to,p=i.from,g=this.state.style;if(u){if(!l){var x={style:d?sf({},d,m):m};this.state&&g&&(d&&g[d]!==m||!d&&g!==m)&&this.setState(x);return}if(!(Yle(a.to,m)&&a.canBegin&&a.isActive)){var j=!a.canBegin||!a.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var b=j||f?p:a.to;if(this.state&&g){var w={style:d?sf({},d,b):b};(d&&g[d]!==b||!d&&g!==b)&&this.setState(w)}this.runAnimation(Ea(Ea({},this.props),{},{from:b,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var a=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),a&&a()}},{key:"handleStyleChange",value:function(a){this.changeStyle(a)}},{key:"changeStyle",value:function(a){this.mounted&&this.setState({style:a})}},{key:"runJSAnimation",value:function(a){var i=this,l=a.from,u=a.to,d=a.duration,f=a.easing,m=a.begin,p=a.onAnimationEnd,g=a.onAnimationStart,x=Ece(l,u,gce(f),d,this.changeStyle),j=function(){i.stopJSAnimation=x()};this.manager.start([g,m,j,d,p])}},{key:"runStepAnimation",value:function(a){var i=this,l=a.steps,u=a.begin,d=a.onAnimationStart,f=l[0],m=f.style,p=f.duration,g=p===void 0?0:p,x=function(b,w,N){if(N===0)return b;var O=w.duration,C=w.easing,A=C===void 0?"ease":C,E=w.style,k=w.properties,T=w.onAnimationEnd,P=N>0?l[N-1]:w,$=k||Object.keys(E);if(typeof A=="function"||A==="spring")return[].concat(hS(b),[i.runJSAnimation.bind(i,{from:P.style,to:E,duration:O,easing:A}),O]);var F=aI($,O,A),D=Ea(Ea(Ea({},P.style),E),{},{transition:F});return[].concat(hS(b),[D,O,T]).filter(ice)};return this.manager.start([d].concat(hS(l.reduce(x,[m,Math.max(g,u)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=tce());var i=a.begin,l=a.duration,u=a.attributeName,d=a.to,f=a.easing,m=a.onAnimationStart,p=a.onAnimationEnd,g=a.steps,x=a.children,j=this.manager;if(this.unSubscribe=j.subscribe(this.handleStyleChange),typeof f=="function"||typeof x=="function"||f==="spring"){this.runJSAnimation(a);return}if(g.length>1){this.runStepAnimation(a);return}var b=u?sf({},u,d):d,w=aI(Object.keys(b),l,f);j.start([m,i,Ea(Ea({},b),{},{transition:w}),l,p])}},{key:"render",value:function(){var a=this.props,i=a.children;a.begin;var l=a.duration;a.attributeName,a.easing;var u=a.isActive;a.steps,a.from,a.to,a.canBegin,a.onAnimationEnd,a.shouldReAnimate,a.onAnimationReStart;var d=Tce(a,Ace),f=y.Children.count(i),m=this.state.style;if(typeof i=="function")return i(m);if(!u||f===0||l<=0)return i;var p=function(x){var j=x.props,b=j.style,w=b===void 0?{}:b,N=j.className,O=y.cloneElement(x,Ea(Ea({},d),{},{style:Ea(Ea({},w),m),className:N}));return O};return f===1?p(y.Children.only(i)):W.createElement("div",null,y.Children.map(i,function(g){return p(g)}))}}]),n})(y.PureComponent);hi.displayName="Animate";hi.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};hi.propTypes={from:yt.oneOfType([yt.object,yt.string]),to:yt.oneOfType([yt.object,yt.string]),attributeName:yt.string,duration:yt.number,begin:yt.number,easing:yt.oneOfType([yt.string,yt.func]),steps:yt.arrayOf(yt.shape({duration:yt.number.isRequired,style:yt.object.isRequired,easing:yt.oneOfType([yt.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),yt.func]),properties:yt.arrayOf("string"),onAnimationEnd:yt.func})),children:yt.oneOfType([yt.node,yt.func]),isActive:yt.bool,canBegin:yt.bool,onAnimationEnd:yt.func,shouldReAnimate:yt.bool,onAnimationStart:yt.func,onAnimationReStart:yt.func};function Xf(e){"@babel/helpers - typeof";return Xf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xf(e)}function Gv(){return Gv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?1:-1,d=r>=0?1:-1,f=a>=0&&r>=0||a<0&&r<0?1:0,m;if(l>0&&i instanceof Array){for(var p=[0,0,0,0],g=0,x=4;gl?l:i[g];m="M".concat(t,",").concat(n+u*p[0]),p[0]>0&&(m+="A ".concat(p[0],",").concat(p[0],",0,0,").concat(f,",").concat(t+d*p[0],",").concat(n)),m+="L ".concat(t+r-d*p[1],",").concat(n),p[1]>0&&(m+="A ".concat(p[1],",").concat(p[1],",0,0,").concat(f,`, - `).concat(t+r,",").concat(n+u*p[1])),m+="L ".concat(t+r,",").concat(n+a-u*p[2]),p[2]>0&&(m+="A ".concat(p[2],",").concat(p[2],",0,0,").concat(f,`, - `).concat(t+r-d*p[2],",").concat(n+a)),m+="L ".concat(t+d*p[3],",").concat(n+a),p[3]>0&&(m+="A ".concat(p[3],",").concat(p[3],",0,0,").concat(f,`, - `).concat(t,",").concat(n+a-u*p[3])),m+="Z"}else if(l>0&&i===+i&&i>0){var j=Math.min(l,i);m="M ".concat(t,",").concat(n+u*j,` - A `).concat(j,",").concat(j,",0,0,").concat(f,",").concat(t+d*j,",").concat(n,` - L `).concat(t+r-d*j,",").concat(n,` - A `).concat(j,",").concat(j,",0,0,").concat(f,",").concat(t+r,",").concat(n+u*j,` - L `).concat(t+r,",").concat(n+a-u*j,` - A `).concat(j,",").concat(j,",0,0,").concat(f,",").concat(t+r-d*j,",").concat(n+a,` - L `).concat(t+d*j,",").concat(n+a,` - A `).concat(j,",").concat(j,",0,0,").concat(f,",").concat(t,",").concat(n+a-u*j," Z")}else m="M ".concat(t,",").concat(n," h ").concat(r," v ").concat(a," h ").concat(-r," Z");return m},Zce=function(t,n){if(!t||!n)return!1;var r=t.x,a=t.y,i=n.x,l=n.y,u=n.width,d=n.height;if(Math.abs(u)>0&&Math.abs(d)>0){var f=Math.min(i,i+u),m=Math.max(i,i+u),p=Math.min(l,l+d),g=Math.max(l,l+d);return r>=f&&r<=m&&a>=p&&a<=g}return!1},Qce={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},PC=function(t){var n=fI(fI({},Qce),t),r=y.useRef(),a=y.useState(-1),i=Uce(a,2),l=i[0],u=i[1];y.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var A=r.current.getTotalLength();A&&u(A)}catch{}},[]);var d=n.x,f=n.y,m=n.width,p=n.height,g=n.radius,x=n.className,j=n.animationEasing,b=n.animationDuration,w=n.animationBegin,N=n.isAnimationActive,O=n.isUpdateAnimationActive;if(d!==+d||f!==+f||m!==+m||p!==+p||m===0||p===0)return null;var C=Ye("recharts-rectangle",x);return O?W.createElement(hi,{canBegin:l>0,from:{width:m,height:p,x:d,y:f},to:{width:m,height:p,x:d,y:f},duration:b,animationEasing:j,isActive:O},function(A){var E=A.width,k=A.height,T=A.x,P=A.y;return W.createElement(hi,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:w,duration:b,isActive:N,easing:j},W.createElement("path",Gv({},Be(n,!0),{className:C,d:hI(T,P,E,k,g),ref:r})))}):W.createElement("path",Gv({},Be(n,!0),{className:C,d:hI(d,f,m,p,g)}))},Jce=["points","className","baseLinePoints","connectNulls"];function Dc(){return Dc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function tue(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function mI(e){return iue(e)||aue(e)||rue(e)||nue()}function nue(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rue(e,t){if(e){if(typeof e=="string")return dN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return dN(e,t)}}function aue(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function iue(e){if(Array.isArray(e))return dN(e)}function dN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return t.forEach(function(r){pI(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),pI(t[0])&&n[n.length-1].push(t[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},bf=function(t,n){var r=oue(t);n&&(r=[r.reduce(function(i,l){return[].concat(mI(i),mI(l))},[])]);var a=r.map(function(i){return i.reduce(function(l,u,d){return"".concat(l).concat(d===0?"M":"L").concat(u.x,",").concat(u.y)},"")}).join("");return r.length===1?"".concat(a,"Z"):a},sue=function(t,n,r){var a=bf(t,r);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(bf(n.reverse(),r).slice(1))},lue=function(t){var n=t.points,r=t.className,a=t.baseLinePoints,i=t.connectNulls,l=eue(t,Jce);if(!n||!n.length)return null;var u=Ye("recharts-polygon",r);if(a&&a.length){var d=l.stroke&&l.stroke!=="none",f=sue(n,a,i);return W.createElement("g",{className:u},W.createElement("path",Dc({},Be(l,!0),{fill:f.slice(-1)==="Z"?l.fill:"none",stroke:"none",d:f})),d?W.createElement("path",Dc({},Be(l,!0),{fill:"none",d:bf(n,i)})):null,d?W.createElement("path",Dc({},Be(l,!0),{fill:"none",d:bf(a,i)})):null)}var m=bf(n,i);return W.createElement("path",Dc({},Be(l,!0),{fill:m.slice(-1)==="Z"?l.fill:"none",className:u,d:m}))};function fN(){return fN=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function pue(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var vue=function(t,n,r,a,i,l){return"M".concat(t,",").concat(i,"v").concat(a,"M").concat(l,",").concat(n,"h").concat(r)},gue=function(t){var n=t.x,r=n===void 0?0:n,a=t.y,i=a===void 0?0:a,l=t.top,u=l===void 0?0:l,d=t.left,f=d===void 0?0:d,m=t.width,p=m===void 0?0:m,g=t.height,x=g===void 0?0:g,j=t.className,b=mue(t,cue),w=uue({x:r,y:i,top:u,left:f,width:p,height:x},b);return!Ne(r)||!Ne(i)||!Ne(p)||!Ne(x)||!Ne(u)||!Ne(f)?null:W.createElement("path",hN({},Be(w,!0),{className:Ye("recharts-cross",j),d:vue(r,i,p,x,u,f)}))},mS,gI;function yue(){if(gI)return mS;gI=1;var e=oy(),t=Zz(),n=gi();function r(a,i){return a&&a.length?e(a,n(i,2),t):void 0}return mS=r,mS}var xue=yue();const bue=wt(xue);var pS,yI;function wue(){if(yI)return pS;yI=1;var e=oy(),t=gi(),n=Qz();function r(a,i){return a&&a.length?e(a,t(i,2),n):void 0}return pS=r,pS}var jue=wue();const Sue=wt(jue);var _ue=["cx","cy","angle","ticks","axisLine"],Nue=["ticks","tick","angle","tickFormatter","stroke"];function cu(e){"@babel/helpers - typeof";return cu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cu(e)}function wf(){return wf=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Oue(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Cue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wI(e,t){for(var n=0;n_I?l=a==="outer"?"start":"end":i<-_I?l=a==="outer"?"end":"start":l="middle",l}},{key:"renderAxisLine",value:function(){var r=this.props,a=r.cx,i=r.cy,l=r.radius,u=r.axisLine,d=r.axisLineType,f=Ds(Ds({},Be(this.props,!1)),{},{fill:"none"},Be(u,!1));if(d==="circle")return W.createElement(dy,Bs({className:"recharts-polar-angle-axis-line"},f,{cx:a,cy:i,r:l}));var m=this.props.ticks,p=m.map(function(g){return Bt(a,i,l,g.coordinate)});return W.createElement(lue,Bs({className:"recharts-polar-angle-axis-line"},f,{points:p}))}},{key:"renderTicks",value:function(){var r=this,a=this.props,i=a.ticks,l=a.tick,u=a.tickLine,d=a.tickFormatter,f=a.stroke,m=Be(this.props,!1),p=Be(l,!1),g=Ds(Ds({},m),{},{fill:"none"},Be(u,!1)),x=i.map(function(j,b){var w=r.getTickLineCoord(j),N=r.getTickTextAnchor(j),O=Ds(Ds(Ds({textAnchor:N},m),{},{stroke:"none",fill:f},p),{},{index:b,payload:j,x:w.x2,y:w.y2});return W.createElement(ft,Bs({className:Ye("recharts-polar-angle-axis-tick",O6(l)),key:"tick-".concat(j.coordinate)},ol(r.props,j,b)),u&&W.createElement("line",Bs({className:"recharts-polar-angle-axis-tick-line"},g,w)),l&&t.renderTickItem(l,O,d?d(j.value,b):j.value))});return W.createElement(ft,{className:"recharts-polar-angle-axis-ticks"},x)}},{key:"render",value:function(){var r=this.props,a=r.ticks,i=r.radius,l=r.axisLine;return i<=0||!a||!a.length?null:W.createElement(ft,{className:Ye("recharts-polar-angle-axis",this.props.className)},l&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,a,i){var l;return W.isValidElement(r)?l=W.cloneElement(r,a):We(r)?l=r(a):l=W.createElement(sl,Bs({},a,{className:"recharts-polar-angle-axis-tick-value"}),i),l}}])})(y.PureComponent);my(py,"displayName","PolarAngleAxis");my(py,"axisType","angleAxis");my(py,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var vS,NI;function Fue(){if(NI)return vS;NI=1;var e=XB(),t=e(Object.getPrototypeOf,Object);return vS=t,vS}var gS,OI;function Uue(){if(OI)return gS;OI=1;var e=io(),t=Fue(),n=oo(),r="[object Object]",a=Function.prototype,i=Object.prototype,l=a.toString,u=i.hasOwnProperty,d=l.call(Object);function f(m){if(!n(m)||e(m)!=r)return!1;var p=t(m);if(p===null)return!0;var g=u.call(p,"constructor")&&p.constructor;return typeof g=="function"&&g instanceof g&&l.call(g)==d}return gS=f,gS}var Hue=Uue();const Wue=wt(Hue);var yS,CI;function Vue(){if(CI)return yS;CI=1;var e=io(),t=oo(),n="[object Boolean]";function r(a){return a===!0||a===!1||t(a)&&e(a)==n}return yS=r,yS}var Gue=Vue();const Yue=wt(Gue);function Qf(e){"@babel/helpers - typeof";return Qf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qf(e)}function Xv(){return Xv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:g,x:d,y:f},to:{upperWidth:m,lowerWidth:p,height:g,x:d,y:f},duration:b,animationEasing:j,isActive:N},function(C){var A=C.upperWidth,E=C.lowerWidth,k=C.height,T=C.x,P=C.y;return W.createElement(hi,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:w,duration:b,easing:j},W.createElement("path",Xv({},Be(n,!0),{className:O,d:kI(T,P,A,E,k),ref:r})))}):W.createElement("g",null,W.createElement("path",Xv({},Be(n,!0),{className:O,d:kI(d,f,m,p,g)})))},ide=["option","shapeType","propTransformer","activeClassName","isActive"];function Jf(e){"@babel/helpers - typeof";return Jf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jf(e)}function ode(e,t){if(e==null)return{};var n=sde(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function sde(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function PI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Zv(e){for(var t=1;t0?Qr(C,"paddingAngle",0):0;if(E){var T=Kr(E.endAngle-E.startAngle,C.endAngle-C.startAngle),P=It(It({},C),{},{startAngle:O+k,endAngle:O+T(b)+k});w.push(P),O=P.endAngle}else{var $=C.endAngle,F=C.startAngle,D=Kr(0,$-F),U=D(b),V=It(It({},C),{},{startAngle:O+k,endAngle:O+U+k});w.push(V),O=V.endAngle}}),W.createElement(ft,null,r.renderSectorsStatically(w))})}},{key:"attachKeyboardHandlers",value:function(r){var a=this;r.onkeydown=function(i){if(!i.altKey)switch(i.key){case"ArrowLeft":{var l=++a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[l].focus(),a.setState({sectorToFocus:l});break}case"ArrowRight":{var u=--a.state.sectorToFocus<0?a.sectorRefs.length-1:a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[u].focus(),a.setState({sectorToFocus:u});break}case"Escape":{a.sectorRefs[a.state.sectorToFocus].blur(),a.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,a=r.sectors,i=r.isAnimationActive,l=this.state.prevSectors;return i&&a&&a.length&&(!l||!Th(l,a))?this.renderSectorsWithAnimation():this.renderSectorsStatically(a)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,a=this.props,i=a.hide,l=a.sectors,u=a.className,d=a.label,f=a.cx,m=a.cy,p=a.innerRadius,g=a.outerRadius,x=a.isAnimationActive,j=this.state.isAnimationFinished;if(i||!l||!l.length||!Ne(f)||!Ne(m)||!Ne(p)||!Ne(g))return null;var b=Ye("recharts-pie",u);return W.createElement(ft,{tabIndex:this.props.rootTabIndex,className:b,ref:function(N){r.pieRef=N}},this.renderSectors(),d&&this.renderLabels(l),Tn.renderCallByParent(this.props,null,!1),(!x||j)&&Zi.renderCallByParent(this.props,l,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,a){return a.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==a.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:a.curSectors,isAnimationFinished:!0}:r.sectors!==a.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,a){return r>a?"start":r=360?O:O-1)*d,A=w-O*x-C,E=a.reduce(function(P,$){var F=wn($,N,0);return P+(Ne(F)?F:0)},0),k;if(E>0){var T;k=a.map(function(P,$){var F=wn(P,N,0),D=wn(P,m,$),U=(Ne(F)?F:0)/E,V;$?V=T.endAngle+vr(b)*d*(F!==0?1:0):V=l;var H=V+vr(b)*((F!==0?x:0)+U*A),G=(V+H)/2,L=(j.innerRadius+j.outerRadius)/2,R=[{name:D,value:F,payload:P,dataKey:N,type:g}],q=Bt(j.cx,j.cy,L,G);return T=It(It(It({percent:U,cornerRadius:i,name:D,tooltipPayload:R,midAngle:G,middleRadius:L,tooltipPosition:q},P),j),{},{value:wn(P,N),startAngle:V,endAngle:H,payload:P,paddingAngle:vr(b)*d}),T})}return It(It({},j),{},{sectors:k,data:a})});var xS,$I;function Ede(){if($I)return xS;$I=1;var e=Math.ceil,t=Math.max;function n(r,a,i,l){for(var u=-1,d=t(e((a-r)/(i||1)),0),f=Array(d);d--;)f[l?d:++u]=r,r+=i;return f}return xS=n,xS}var bS,II;function H6(){if(II)return bS;II=1;var e=fz(),t=1/0,n=17976931348623157e292;function r(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var i=a<0?-1:1;return i*n}return a===a?a:0}return bS=r,bS}var wS,LI;function Ade(){if(LI)return wS;LI=1;var e=Ede(),t=Qg(),n=H6();function r(a){return function(i,l,u){return u&&typeof u!="number"&&t(i,l,u)&&(l=u=void 0),i=n(i),l===void 0?(l=i,i=0):l=n(l),u=u===void 0?i0&&r.handleDrag(a.changedTouches[0])}),Wr(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var a=r.props,i=a.endIndex,l=a.onDragEnd,u=a.startIndex;l?.({endIndex:i,startIndex:u})}),r.detachDragEndListener()}),Wr(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Wr(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Wr(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Wr(r,"handleSlideDragStart",function(a){var i=HI(a)?a.changedTouches[0]:a;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return qde(t,e),Ide(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var a=r.startX,i=r.endX,l=this.state.scaleValues,u=this.props,d=u.gap,f=u.data,m=f.length-1,p=Math.min(a,i),g=Math.max(a,i),x=t.getIndexInRange(l,p),j=t.getIndexInRange(l,g);return{startIndex:x-x%d,endIndex:j===m?m:j-j%d}}},{key:"getTextOfTick",value:function(r){var a=this.props,i=a.data,l=a.tickFormatter,u=a.dataKey,d=wn(i[r],u,r);return We(l)?l(d,r):d}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var a=this.state,i=a.slideMoveStartX,l=a.startX,u=a.endX,d=this.props,f=d.x,m=d.width,p=d.travellerWidth,g=d.startIndex,x=d.endIndex,j=d.onChange,b=r.pageX-i;b>0?b=Math.min(b,f+m-p-u,f+m-p-l):b<0&&(b=Math.max(b,f-l,f-u));var w=this.getIndex({startX:l+b,endX:u+b});(w.startIndex!==g||w.endIndex!==x)&&j&&j(w),this.setState({startX:l+b,endX:u+b,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,a){var i=HI(a)?a.changedTouches[0]:a;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var a=this.state,i=a.brushMoveStartX,l=a.movingTravellerId,u=a.endX,d=a.startX,f=this.state[l],m=this.props,p=m.x,g=m.width,x=m.travellerWidth,j=m.onChange,b=m.gap,w=m.data,N={startX:this.state.startX,endX:this.state.endX},O=r.pageX-i;O>0?O=Math.min(O,p+g-x-f):O<0&&(O=Math.max(O,p-f)),N[l]=f+O;var C=this.getIndex(N),A=C.startIndex,E=C.endIndex,k=function(){var P=w.length-1;return l==="startX"&&(u>d?A%b===0:E%b===0)||ud?E%b===0:A%b===0)||u>d&&E===P};this.setState(Wr(Wr({},l,f+O),"brushMoveStartX",r.pageX),function(){j&&k()&&j(C)})}},{key:"handleTravellerMoveKeyboard",value:function(r,a){var i=this,l=this.state,u=l.scaleValues,d=l.startX,f=l.endX,m=this.state[a],p=u.indexOf(m);if(p!==-1){var g=p+r;if(!(g===-1||g>=u.length)){var x=u[g];a==="startX"&&x>=f||a==="endX"&&x<=d||this.setState(Wr({},a,x),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,a=r.x,i=r.y,l=r.width,u=r.height,d=r.fill,f=r.stroke;return W.createElement("rect",{stroke:f,fill:d,x:a,y:i,width:l,height:u})}},{key:"renderPanorama",value:function(){var r=this.props,a=r.x,i=r.y,l=r.width,u=r.height,d=r.data,f=r.children,m=r.padding,p=y.Children.only(f);return p?W.cloneElement(p,{x:a,y:i,width:l,height:u,margin:m,compact:!0,data:d}):null}},{key:"renderTravellerLayer",value:function(r,a){var i,l,u=this,d=this.props,f=d.y,m=d.travellerWidth,p=d.height,g=d.traveller,x=d.ariaLabel,j=d.data,b=d.startIndex,w=d.endIndex,N=Math.max(r,this.props.x),O=SS(SS({},Be(this.props,!1)),{},{x:N,y:f,width:m,height:p}),C=x||"Min value: ".concat((i=j[b])===null||i===void 0?void 0:i.name,", Max value: ").concat((l=j[w])===null||l===void 0?void 0:l.name);return W.createElement(ft,{tabIndex:0,role:"slider","aria-label":C,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[a],onTouchStart:this.travellerDragStartHandlers[a],onKeyDown:function(E){["ArrowLeft","ArrowRight"].includes(E.key)&&(E.preventDefault(),E.stopPropagation(),u.handleTravellerMoveKeyboard(E.key==="ArrowRight"?1:-1,a))},onFocus:function(){u.setState({isTravellerFocused:!0})},onBlur:function(){u.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(g,O))}},{key:"renderSlide",value:function(r,a){var i=this.props,l=i.y,u=i.height,d=i.stroke,f=i.travellerWidth,m=Math.min(r,a)+f,p=Math.max(Math.abs(a-r)-f,0);return W.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:d,fillOpacity:.2,x:m,y:l,width:p,height:u})}},{key:"renderText",value:function(){var r=this.props,a=r.startIndex,i=r.endIndex,l=r.y,u=r.height,d=r.travellerWidth,f=r.stroke,m=this.state,p=m.startX,g=m.endX,x=5,j={pointerEvents:"none",fill:f};return W.createElement(ft,{className:"recharts-brush-texts"},W.createElement(sl,eg({textAnchor:"end",verticalAnchor:"middle",x:Math.min(p,g)-x,y:l+u/2},j),this.getTextOfTick(a)),W.createElement(sl,eg({textAnchor:"start",verticalAnchor:"middle",x:Math.max(p,g)+d+x,y:l+u/2},j),this.getTextOfTick(i)))}},{key:"render",value:function(){var r=this.props,a=r.data,i=r.className,l=r.children,u=r.x,d=r.y,f=r.width,m=r.height,p=r.alwaysShowText,g=this.state,x=g.startX,j=g.endX,b=g.isTextActive,w=g.isSlideMoving,N=g.isTravellerMoving,O=g.isTravellerFocused;if(!a||!a.length||!Ne(u)||!Ne(d)||!Ne(f)||!Ne(m)||f<=0||m<=0)return null;var C=Ye("recharts-brush",i),A=W.Children.count(l)===1,E=Dde("userSelect","none");return W.createElement(ft,{className:C,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:E},this.renderBackground(),A&&this.renderPanorama(),this.renderSlide(x,j),this.renderTravellerLayer(x,"startX"),this.renderTravellerLayer(j,"endX"),(b||w||N||O||p)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var a=r.x,i=r.y,l=r.width,u=r.height,d=r.stroke,f=Math.floor(i+u/2)-1;return W.createElement(W.Fragment,null,W.createElement("rect",{x:a,y:i,width:l,height:u,fill:d,stroke:"none"}),W.createElement("line",{x1:a+1,y1:f,x2:a+l-1,y2:f,fill:"none",stroke:"#fff"}),W.createElement("line",{x1:a+1,y1:f+2,x2:a+l-1,y2:f+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,a){var i;return W.isValidElement(r)?i=W.cloneElement(r,a):We(r)?i=r(a):i=t.renderDefaultTraveller(a),i}},{key:"getDerivedStateFromProps",value:function(r,a){var i=r.data,l=r.width,u=r.x,d=r.travellerWidth,f=r.updateId,m=r.startIndex,p=r.endIndex;if(i!==a.prevData||f!==a.prevUpdateId)return SS({prevData:i,prevTravellerWidth:d,prevUpdateId:f,prevX:u,prevWidth:l},i&&i.length?Ude({data:i,width:l,x:u,travellerWidth:d,startIndex:m,endIndex:p}):{scale:null,scaleValues:null});if(a.scale&&(l!==a.prevWidth||u!==a.prevX||d!==a.prevTravellerWidth)){a.scale.range([u,u+l-d]);var g=a.scale.domain().map(function(x){return a.scale(x)});return{prevData:i,prevTravellerWidth:d,prevUpdateId:f,prevX:u,prevWidth:l,startX:a.scale(r.startIndex),endX:a.scale(r.endIndex),scaleValues:g}}return null}},{key:"getIndexInRange",value:function(r,a){for(var i=r.length,l=0,u=i-1;u-l>1;){var d=Math.floor((l+u)/2);r[d]>a?u=d:l=d}return a>=r[u]?u:l}}])})(y.PureComponent);Wr(hu,"displayName","Brush");Wr(hu,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var _S,WI;function Hde(){if(WI)return _S;WI=1;var e=aC();function t(n,r){var a;return e(n,function(i,l,u){return a=r(i,l,u),!a}),!!a}return _S=t,_S}var NS,VI;function Wde(){if(VI)return NS;VI=1;var e=UB(),t=gi(),n=Hde(),r=Rr(),a=Qg();function i(l,u,d){var f=r(l)?e:n;return d&&a(l,u,d)&&(u=void 0),f(l,t(u,3))}return NS=i,NS}var Vde=Wde();const Gde=wt(Vde);var ci=function(t,n){var r=t.alwaysShow,a=t.ifOverflow;return r&&(a="extendDomain"),a===n},OS,GI;function Yde(){if(GI)return OS;GI=1;var e=sz();function t(n,r,a){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[r]=a}return OS=t,OS}var CS,YI;function Kde(){if(YI)return CS;YI=1;var e=Yde(),t=iz(),n=gi();function r(a,i){var l={};return i=n(i,3),t(a,function(u,d,f){e(l,d,i(u,d,f))}),l}return CS=r,CS}var Xde=Kde();const Zde=wt(Xde);var ES,KI;function Qde(){if(KI)return ES;KI=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function sfe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function lfe(e,t){var n=e.x,r=e.y,a=ofe(e,nfe),i="".concat(n),l=parseInt(i,10),u="".concat(r),d=parseInt(u,10),f="".concat(t.height||a.height),m=parseInt(f,10),p="".concat(t.width||a.width),g=parseInt(p,10);return ef(ef(ef(ef(ef({},t),a),l?{x:l}:{}),d?{y:d}:{}),{},{height:m,width:g,name:t.name,radius:t.radius})}function JI(e){return W.createElement(q6,yN({shapeType:"rectangle",propTransformer:lfe,activeClassName:"recharts-active-bar"},e))}var cfe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,a){if(typeof t=="number")return t;var i=Ne(r)||PQ(r);return i?t(r,a):(i||sr(!1),n)}},ufe=["value","background"],K6;function mu(e){"@babel/helpers - typeof";return mu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mu(e)}function dfe(e,t){if(e==null)return{};var n=ffe(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ffe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function ng(){return ng=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(G)0&&Math.abs(H)0&&(V=Math.min((te||0)-(H[oe-1]||0),V))}),Number.isFinite(V)){var G=V/U,L=b.layout==="vertical"?r.height:r.width;if(b.padding==="gap"&&(T=G*L/2),b.padding==="no-gap"){var R=gr(t.barCategoryGap,G*L),q=G*L/2;T=q-R-(q-R)/L*R}}}a==="xAxis"?P=[r.left+(C.left||0)+(T||0),r.left+r.width-(C.right||0)-(T||0)]:a==="yAxis"?P=d==="horizontal"?[r.top+r.height-(C.bottom||0),r.top+(C.top||0)]:[r.top+(C.top||0)+(T||0),r.top+r.height-(C.bottom||0)-(T||0)]:P=b.range,E&&(P=[P[1],P[0]]);var K=x6(b,i,g),ee=K.scale,I=K.realScaleType;ee.domain(N).range(P),b6(ee);var B=w6(ee,Pa(Pa({},b),{},{realScaleType:I}));a==="xAxis"?(D=w==="top"&&!A||w==="bottom"&&A,$=r.left,F=p[k]-D*b.height):a==="yAxis"&&(D=w==="left"&&!A||w==="right"&&A,$=p[k]-D*b.width,F=r.top);var Y=Pa(Pa(Pa({},b),B),{},{realScaleType:I,x:$,y:F,scale:ee,width:a==="xAxis"?r.width:b.width,height:a==="yAxis"?r.height:b.height});return Y.bandSize=zv(Y,B),!b.hide&&a==="xAxis"?p[k]+=(D?-1:1)*Y.height:b.hide||(p[k]+=(D?-1:1)*Y.width),Pa(Pa({},x),{},yy({},j,Y))},{})},eq=function(t,n){var r=t.x,a=t.y,i=n.x,l=n.y;return{x:Math.min(r,i),y:Math.min(a,l),width:Math.abs(i-r),height:Math.abs(l-a)}},Sfe=function(t){var n=t.x1,r=t.y1,a=t.x2,i=t.y2;return eq({x:n,y:r},{x:a,y:i})},tq=(function(){function e(t){bfe(this,e),this.scale=t}return wfe(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=r.bandAware,i=r.position;if(n!==void 0){if(i)switch(i){case"start":return this.scale(n);case"middle":{var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+l}case"end":{var u=this.bandwidth?this.bandwidth():0;return this.scale(n)+u}default:return this.scale(n)}if(a){var d=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+d}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),a=r[0],i=r[r.length-1];return a<=i?n>=a&&n<=i:n>=i&&n<=a}}],[{key:"create",value:function(n){return new e(n)}}])})();yy(tq,"EPS",1e-4);var MC=function(t){var n=Object.keys(t).reduce(function(r,a){return Pa(Pa({},r),{},yy({},a,tq.create(t[a])))},{});return Pa(Pa({},n),{},{apply:function(a){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=i.bandAware,u=i.position;return Zde(a,function(d,f){return n[f].apply(d,{bandAware:l,position:u})})},isInRange:function(a){return Y6(a,function(i,l){return n[l].isInRange(i)})}})};function _fe(e){return(e%180+180)%180}var Nfe=function(t){var n=t.width,r=t.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=_fe(a),l=i*Math.PI/180,u=Math.atan(r/n),d=l>u&&l-1?d[f?i[m]:m]:void 0}}return kS=r,kS}var PS,iL;function Cfe(){if(iL)return PS;iL=1;var e=H6();function t(n){var r=e(n),a=r%1;return r===r?a?r-a:r:0}return PS=t,PS}var MS,oL;function Efe(){if(oL)return MS;oL=1;var e=ez(),t=gi(),n=Cfe(),r=Math.max;function a(i,l,u){var d=i==null?0:i.length;if(!d)return-1;var f=u==null?0:n(u);return f<0&&(f=r(d+f,0)),e(i,t(l,3),f)}return MS=a,MS}var RS,sL;function Afe(){if(sL)return RS;sL=1;var e=Ofe(),t=Efe(),n=e(t);return RS=n,RS}var Tfe=Afe();const kfe=wt(Tfe);var Pfe=vB();const Mfe=wt(Pfe);var Rfe=Mfe(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),RC=y.createContext(void 0),DC=y.createContext(void 0),nq=y.createContext(void 0),rq=y.createContext({}),aq=y.createContext(void 0),iq=y.createContext(0),oq=y.createContext(0),lL=function(t){var n=t.state,r=n.xAxisMap,a=n.yAxisMap,i=n.offset,l=t.clipPathId,u=t.children,d=t.width,f=t.height,m=Rfe(i);return W.createElement(RC.Provider,{value:r},W.createElement(DC.Provider,{value:a},W.createElement(rq.Provider,{value:i},W.createElement(nq.Provider,{value:m},W.createElement(aq.Provider,{value:l},W.createElement(iq.Provider,{value:f},W.createElement(oq.Provider,{value:d},u)))))))},Dfe=function(){return y.useContext(aq)},sq=function(t){var n=y.useContext(RC);n==null&&sr(!1);var r=n[t];return r==null&&sr(!1),r},$fe=function(){var t=y.useContext(RC);return Bo(t)},Ife=function(){var t=y.useContext(DC),n=kfe(t,function(r){return Y6(r.domain,Number.isFinite)});return n||Bo(t)},lq=function(t){var n=y.useContext(DC);n==null&&sr(!1);var r=n[t];return r==null&&sr(!1),r},Lfe=function(){var t=y.useContext(nq);return t},Bfe=function(){return y.useContext(rq)},$C=function(){return y.useContext(oq)},IC=function(){return y.useContext(iq)};function pu(e){"@babel/helpers - typeof";return pu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pu(e)}function zfe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qfe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne*a)return!1;var i=n();return e*(t-e*i/2-r)>=0&&e*(t+e*i/2-a)<=0}function jhe(e,t){return pq(e,t+1)}function She(e,t,n,r,a){for(var i=(r||[]).slice(),l=t.start,u=t.end,d=0,f=1,m=l,p=function(){var j=r?.[d];if(j===void 0)return{v:pq(r,f)};var b=d,w,N=function(){return w===void 0&&(w=n(j,b)),w},O=j.coordinate,C=d===0||sg(e,O,N,m,u);C||(d=0,m=l,f+=1),C&&(m=O+e*(N()/2+a),d+=f)},g;f<=i.length;)if(g=p(),g)return g.v;return[]}function ah(e){"@babel/helpers - typeof";return ah=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ah(e)}function vL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function rr(e){for(var t=1;t0?x.coordinate-w*e:x.coordinate})}else i[g]=x=rr(rr({},x),{},{tickCoord:x.coordinate});var N=sg(e,x.tickCoord,b,u,d);N&&(d=x.tickCoord-e*(b()/2+a),i[g]=rr(rr({},x),{},{isShow:!0}))},m=l-1;m>=0;m--)f(m);return i}function Ehe(e,t,n,r,a,i){var l=(r||[]).slice(),u=l.length,d=t.start,f=t.end;if(i){var m=r[u-1],p=n(m,u-1),g=e*(m.coordinate+e*p/2-f);l[u-1]=m=rr(rr({},m),{},{tickCoord:g>0?m.coordinate-g*e:m.coordinate});var x=sg(e,m.tickCoord,function(){return p},d,f);x&&(f=m.tickCoord-e*(p/2+a),l[u-1]=rr(rr({},m),{},{isShow:!0}))}for(var j=i?u-1:u,b=function(O){var C=l[O],A,E=function(){return A===void 0&&(A=n(C,O)),A};if(O===0){var k=e*(C.coordinate-e*E()/2-d);l[O]=C=rr(rr({},C),{},{tickCoord:k<0?C.coordinate-k*e:C.coordinate})}else l[O]=C=rr(rr({},C),{},{tickCoord:C.coordinate});var T=sg(e,C.tickCoord,E,d,f);T&&(d=C.tickCoord+e*(E()/2+a),l[O]=rr(rr({},C),{},{isShow:!0}))},w=0;w=2?vr(a[1].coordinate-a[0].coordinate):1,N=whe(i,w,x);return d==="equidistantPreserveStart"?She(w,N,b,a,l):(d==="preserveStart"||d==="preserveStartEnd"?g=Ehe(w,N,b,a,l,d==="preserveStartEnd"):g=Che(w,N,b,a,l),g.filter(function(O){return O.isShow}))}var Ahe=["viewBox"],The=["viewBox"],khe=["ticks"];function yu(e){"@babel/helpers - typeof";return yu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yu(e)}function Ic(){return Ic=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Phe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Mhe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yL(e,t){for(var n=0;n0?d(this.props):d(x)),l<=0||u<=0||!j||!j.length?null:W.createElement(ft,{className:Ye("recharts-cartesian-axis",f),ref:function(w){r.layerReference=w}},i&&this.renderAxisLine(),this.renderTicks(j,this.state.fontSize,this.state.letterSpacing),Tn.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,a,i){var l,u=Ye(a.className,"recharts-cartesian-axis-tick-value");return W.isValidElement(r)?l=W.cloneElement(r,xn(xn({},a),{},{className:u})):We(r)?l=r(xn(xn({},a),{},{className:u})):l=W.createElement(sl,Ic({},a,{className:"recharts-cartesian-axis-tick-value"}),i),l}}])})(y.Component);qC(qu,"displayName","CartesianAxis");qC(qu,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var zhe=["x1","y1","x2","y2","key"],qhe=["offset"];function cl(e){"@babel/helpers - typeof";return cl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cl(e)}function xL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ir(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Whe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Vhe=function(t){var n=t.fill;if(!n||n==="none")return null;var r=t.fillOpacity,a=t.x,i=t.y,l=t.width,u=t.height,d=t.ry;return W.createElement("rect",{x:a,y:i,ry:d,width:l,height:u,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function yq(e,t){var n;if(W.isValidElement(e))n=W.cloneElement(e,t);else if(We(e))n=e(t);else{var r=t.x1,a=t.y1,i=t.x2,l=t.y2,u=t.key,d=bL(t,zhe),f=Be(d,!1);f.offset;var m=bL(f,qhe);n=W.createElement("line",Hs({},m,{x1:r,y1:a,x2:i,y2:l,fill:"none",key:u}))}return n}function Ghe(e){var t=e.x,n=e.width,r=e.horizontal,a=r===void 0?!0:r,i=e.horizontalPoints;if(!a||!i||!i.length)return null;var l=i.map(function(u,d){var f=ir(ir({},e),{},{x1:t,y1:u,x2:t+n,y2:u,key:"line-".concat(d),index:d});return yq(a,f)});return W.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function Yhe(e){var t=e.y,n=e.height,r=e.vertical,a=r===void 0?!0:r,i=e.verticalPoints;if(!a||!i||!i.length)return null;var l=i.map(function(u,d){var f=ir(ir({},e),{},{x1:u,y1:t,x2:u,y2:t+n,key:"line-".concat(d),index:d});return yq(a,f)});return W.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function Khe(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,a=e.y,i=e.width,l=e.height,u=e.horizontalPoints,d=e.horizontal,f=d===void 0?!0:d;if(!f||!t||!t.length)return null;var m=u.map(function(g){return Math.round(g+a-a)}).sort(function(g,x){return g-x});a!==m[0]&&m.unshift(0);var p=m.map(function(g,x){var j=!m[x+1],b=j?a+l-g:m[x+1]-g;if(b<=0)return null;var w=x%t.length;return W.createElement("rect",{key:"react-".concat(x),y:g,x:r,height:b,width:i,stroke:"none",fill:t[w],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return W.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},p)}function Xhe(e){var t=e.vertical,n=t===void 0?!0:t,r=e.verticalFill,a=e.fillOpacity,i=e.x,l=e.y,u=e.width,d=e.height,f=e.verticalPoints;if(!n||!r||!r.length)return null;var m=f.map(function(g){return Math.round(g+i-i)}).sort(function(g,x){return g-x});i!==m[0]&&m.unshift(0);var p=m.map(function(g,x){var j=!m[x+1],b=j?i+u-g:m[x+1]-g;if(b<=0)return null;var w=x%r.length;return W.createElement("rect",{key:"react-".concat(x),x:g,y:l,width:b,height:d,stroke:"none",fill:r[w],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return W.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},p)}var Zhe=function(t,n){var r=t.xAxis,a=t.width,i=t.height,l=t.offset;return y6(zC(ir(ir(ir({},qu.defaultProps),r),{},{ticks:Wi(r,!0),viewBox:{x:0,y:0,width:a,height:i}})),l.left,l.left+l.width,n)},Qhe=function(t,n){var r=t.yAxis,a=t.width,i=t.height,l=t.offset;return y6(zC(ir(ir(ir({},qu.defaultProps),r),{},{ticks:Wi(r,!0),viewBox:{x:0,y:0,width:a,height:i}})),l.top,l.top+l.height,n)},bc={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function lf(e){var t,n,r,a,i,l,u=$C(),d=IC(),f=Bfe(),m=ir(ir({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:bc.stroke,fill:(n=e.fill)!==null&&n!==void 0?n:bc.fill,horizontal:(r=e.horizontal)!==null&&r!==void 0?r:bc.horizontal,horizontalFill:(a=e.horizontalFill)!==null&&a!==void 0?a:bc.horizontalFill,vertical:(i=e.vertical)!==null&&i!==void 0?i:bc.vertical,verticalFill:(l=e.verticalFill)!==null&&l!==void 0?l:bc.verticalFill,x:Ne(e.x)?e.x:f.left,y:Ne(e.y)?e.y:f.top,width:Ne(e.width)?e.width:f.width,height:Ne(e.height)?e.height:f.height}),p=m.x,g=m.y,x=m.width,j=m.height,b=m.syncWithTicks,w=m.horizontalValues,N=m.verticalValues,O=$fe(),C=Ife();if(!Ne(x)||x<=0||!Ne(j)||j<=0||!Ne(p)||p!==+p||!Ne(g)||g!==+g)return null;var A=m.verticalCoordinatesGenerator||Zhe,E=m.horizontalCoordinatesGenerator||Qhe,k=m.horizontalPoints,T=m.verticalPoints;if((!k||!k.length)&&We(E)){var P=w&&w.length,$=E({yAxis:C?ir(ir({},C),{},{ticks:P?w:C.ticks}):void 0,width:u,height:d,offset:f},P?!0:b);$a(Array.isArray($),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(cl($),"]")),Array.isArray($)&&(k=$)}if((!T||!T.length)&&We(A)){var F=N&&N.length,D=A({xAxis:O?ir(ir({},O),{},{ticks:F?N:O.ticks}):void 0,width:u,height:d,offset:f},F?!0:b);$a(Array.isArray(D),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(cl(D),"]")),Array.isArray(D)&&(T=D)}return W.createElement("g",{className:"recharts-cartesian-grid"},W.createElement(Vhe,{fill:m.fill,fillOpacity:m.fillOpacity,x:m.x,y:m.y,width:m.width,height:m.height,ry:m.ry}),W.createElement(Ghe,Hs({},m,{offset:f,horizontalPoints:k,xAxis:O,yAxis:C})),W.createElement(Yhe,Hs({},m,{offset:f,verticalPoints:T,xAxis:O,yAxis:C})),W.createElement(Khe,Hs({},m,{horizontalPoints:k})),W.createElement(Xhe,Hs({},m,{verticalPoints:T})))}lf.displayName="CartesianGrid";var Jhe=["type","layout","connectNulls","ref"],eme=["key"];function xu(e){"@babel/helpers - typeof";return xu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xu(e)}function wL(e,t){if(e==null)return{};var n=tme(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function tme(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function jf(){return jf=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);np){x=[].concat(wc(d.slice(0,j)),[p-b]);break}var w=x.length%2===0?[0,g]:[g];return[].concat(wc(t.repeat(d,m)),wc(x),w).map(function(N){return"".concat(N,"px")}).join(", ")}),Ma(n,"id",$u("recharts-line-")),Ma(n,"pathRef",function(l){n.mainCurve=l}),Ma(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),Ma(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return dme(t,e),sme(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,a){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,l=i.points,u=i.xAxis,d=i.yAxis,f=i.layout,m=i.children,p=Jr(m,kh);if(!p)return null;var g=function(b,w){return{x:b.x,y:b.y,value:b.value,errorVal:wn(b.payload,w)}},x={clipPath:r?"url(#clipPath-".concat(a,")"):null};return W.createElement(ft,x,p.map(function(j){return W.cloneElement(j,{key:"bar-".concat(j.props.dataKey),data:l,xAxis:u,yAxis:d,layout:f,dataPointFormatter:g})}))}},{key:"renderDots",value:function(r,a,i){var l=this.props.isAnimationActive;if(l&&!this.state.isAnimationFinished)return null;var u=this.props,d=u.dot,f=u.points,m=u.dataKey,p=Be(this.props,!1),g=Be(d,!0),x=f.map(function(b,w){var N=Hr(Hr(Hr({key:"dot-".concat(w),r:3},p),g),{},{index:w,cx:b.x,cy:b.y,value:b.value,dataKey:m,payload:b.payload,points:f});return t.renderDotItem(d,N)}),j={clipPath:r?"url(#clipPath-".concat(a?"":"dots-").concat(i,")"):null};return W.createElement(ft,jf({className:"recharts-line-dots",key:"dots"},j),x)}},{key:"renderCurveStatically",value:function(r,a,i,l){var u=this.props,d=u.type,f=u.layout,m=u.connectNulls;u.ref;var p=wL(u,Jhe),g=Hr(Hr(Hr({},Be(p,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:a?"url(#clipPath-".concat(i,")"):null,points:r},l),{},{type:d,layout:f,connectNulls:m});return W.createElement(Uv,jf({},g,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,a){var i=this,l=this.props,u=l.points,d=l.strokeDasharray,f=l.isAnimationActive,m=l.animationBegin,p=l.animationDuration,g=l.animationEasing,x=l.animationId,j=l.animateNewValues,b=l.width,w=l.height,N=this.state,O=N.prevPoints,C=N.totalLength;return W.createElement(hi,{begin:m,duration:p,isActive:f,easing:g,from:{t:0},to:{t:1},key:"line-".concat(x),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(A){var E=A.t;if(O){var k=O.length/u.length,T=u.map(function(U,V){var H=Math.floor(V*k);if(O[H]){var G=O[H],L=Kr(G.x,U.x),R=Kr(G.y,U.y);return Hr(Hr({},U),{},{x:L(E),y:R(E)})}if(j){var q=Kr(b*2,U.x),K=Kr(w/2,U.y);return Hr(Hr({},U),{},{x:q(E),y:K(E)})}return Hr(Hr({},U),{},{x:U.x,y:U.y})});return i.renderCurveStatically(T,r,a)}var P=Kr(0,C),$=P(E),F;if(d){var D="".concat(d).split(/[,\s]+/gim).map(function(U){return parseFloat(U)});F=i.getStrokeDasharray($,C,D)}else F=i.generateSimpleStrokeDasharray(C,$);return i.renderCurveStatically(u,r,a,{strokeDasharray:F})})}},{key:"renderCurve",value:function(r,a){var i=this.props,l=i.points,u=i.isAnimationActive,d=this.state,f=d.prevPoints,m=d.totalLength;return u&&l&&l.length&&(!f&&m>0||!Th(f,l))?this.renderCurveWithAnimation(r,a):this.renderCurveStatically(l,r,a)}},{key:"render",value:function(){var r,a=this.props,i=a.hide,l=a.dot,u=a.points,d=a.className,f=a.xAxis,m=a.yAxis,p=a.top,g=a.left,x=a.width,j=a.height,b=a.isAnimationActive,w=a.id;if(i||!u||!u.length)return null;var N=this.state.isAnimationFinished,O=u.length===1,C=Ye("recharts-line",d),A=f&&f.allowDataOverflow,E=m&&m.allowDataOverflow,k=A||E,T=Ge(w)?this.id:w,P=(r=Be(l,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},$=P.r,F=$===void 0?3:$,D=P.strokeWidth,U=D===void 0?2:D,V=HQ(l)?l:{},H=V.clipDot,G=H===void 0?!0:H,L=F*2+U;return W.createElement(ft,{className:C},A||E?W.createElement("defs",null,W.createElement("clipPath",{id:"clipPath-".concat(T)},W.createElement("rect",{x:A?g:g-x/2,y:E?p:p-j/2,width:A?x:x*2,height:E?j:j*2})),!G&&W.createElement("clipPath",{id:"clipPath-dots-".concat(T)},W.createElement("rect",{x:g-L/2,y:p-L/2,width:x+L,height:j+L}))):null,!O&&this.renderCurve(k,T),this.renderErrorBar(k,T),(O||l)&&this.renderDots(k,G,T),(!b||N)&&Zi.renderCallByParent(this.props,u))}}],[{key:"getDerivedStateFromProps",value:function(r,a){return r.animationId!==a.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:a.curPoints}:r.points!==a.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,a){for(var i=r.length%2!==0?[].concat(wc(r),[0]):r,l=[],u=0;ue.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function tpe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function npe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rpe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?l:t&&t.length&&Ne(a)&&Ne(i)?t.slice(a,i+1):[]};function Mq(e){return e==="number"?[0,"auto"]:void 0}var IN=function(t,n,r,a){var i=t.graphicalItems,l=t.tooltipAxis,u=Sy(n,t);return r<0||!i||!i.length||r>=u.length?null:i.reduce(function(d,f){var m,p=(m=f.props.data)!==null&&m!==void 0?m:n;p&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(p=p.slice(t.dataStartIndex,t.dataEndIndex+1));var g;if(l.dataKey&&!l.allowDuplicatedCategory){var x=p===void 0?u:p;g=pv(x,l.dataKey,a)}else g=p&&p[r]||u[r];return g?[].concat(Su(d),[S6(f,g)]):d},[])},TL=function(t,n,r,a){var i=a||{x:t.chartX,y:t.chartY},l=ppe(i,r),u=t.orderedTooltipTicks,d=t.tooltipAxis,f=t.tooltipTicks,m=qoe(l,u,f,d);if(m>=0&&f){var p=f[m]&&f[m].value,g=IN(t,n,m,p),x=vpe(r,u,m,i);return{activeTooltipIndex:m,activeLabel:p,activePayload:g,activeCoordinate:x}}return null},gpe=function(t,n){var r=n.axes,a=n.graphicalItems,i=n.axisType,l=n.axisIdKey,u=n.stackGroups,d=n.dataStartIndex,f=n.dataEndIndex,m=t.layout,p=t.children,g=t.stackOffset,x=g6(m,i);return r.reduce(function(j,b){var w,N=b.type.defaultProps!==void 0?ye(ye({},b.type.defaultProps),b.props):b.props,O=N.type,C=N.dataKey,A=N.allowDataOverflow,E=N.allowDuplicatedCategory,k=N.scale,T=N.ticks,P=N.includeHidden,$=N[l];if(j[$])return j;var F=Sy(t.data,{graphicalItems:a.filter(function(B){var Y,te=l in B.props?B.props[l]:(Y=B.type.defaultProps)===null||Y===void 0?void 0:Y[l];return te===$}),dataStartIndex:d,dataEndIndex:f}),D=F.length,U,V,H;Ume(N.domain,A,O)&&(U=Z_(N.domain,null,A),x&&(O==="number"||k!=="auto")&&(H=yf(F,C,"category")));var G=Mq(O);if(!U||U.length===0){var L,R=(L=N.domain)!==null&&L!==void 0?L:G;if(C){if(U=yf(F,C,O),O==="category"&&x){var q=RQ(U);E&&q?(V=U,U=Jv(0,D)):E||(U=A4(R,U,b).reduce(function(B,Y){return B.indexOf(Y)>=0?B:[].concat(Su(B),[Y])},[]))}else if(O==="category")E?U=U.filter(function(B){return B!==""&&!Ge(B)}):U=A4(R,U,b).reduce(function(B,Y){return B.indexOf(Y)>=0||Y===""||Ge(Y)?B:[].concat(Su(B),[Y])},[]);else if(O==="number"){var K=Voe(F,a.filter(function(B){var Y,te,oe=l in B.props?B.props[l]:(Y=B.type.defaultProps)===null||Y===void 0?void 0:Y[l],xe="hide"in B.props?B.props.hide:(te=B.type.defaultProps)===null||te===void 0?void 0:te.hide;return oe===$&&(P||!xe)}),C,i,m);K&&(U=K)}x&&(O==="number"||k!=="auto")&&(H=yf(F,C,"category"))}else x?U=Jv(0,D):u&&u[$]&&u[$].hasStack&&O==="number"?U=g==="expand"?[0,1]:j6(u[$].stackGroups,d,f):U=v6(F,a.filter(function(B){var Y=l in B.props?B.props[l]:B.type.defaultProps[l],te="hide"in B.props?B.props.hide:B.type.defaultProps.hide;return Y===$&&(P||!te)}),O,m,!0);if(O==="number")U=RN(p,U,$,i,T),R&&(U=Z_(R,U,A));else if(O==="category"&&R){var ee=R,I=U.every(function(B){return ee.indexOf(B)>=0});I&&(U=ee)}}return ye(ye({},j),{},Fe({},$,ye(ye({},N),{},{axisType:i,domain:U,categoricalDomain:H,duplicateDomain:V,originalDomain:(w=N.domain)!==null&&w!==void 0?w:G,isCategorical:x,layout:m})))},{})},ype=function(t,n){var r=n.graphicalItems,a=n.Axis,i=n.axisType,l=n.axisIdKey,u=n.stackGroups,d=n.dataStartIndex,f=n.dataEndIndex,m=t.layout,p=t.children,g=Sy(t.data,{graphicalItems:r,dataStartIndex:d,dataEndIndex:f}),x=g.length,j=g6(m,i),b=-1;return r.reduce(function(w,N){var O=N.type.defaultProps!==void 0?ye(ye({},N.type.defaultProps),N.props):N.props,C=O[l],A=Mq("number");if(!w[C]){b++;var E;return j?E=Jv(0,x):u&&u[C]&&u[C].hasStack?(E=j6(u[C].stackGroups,d,f),E=RN(p,E,C,i)):(E=Z_(A,v6(g,r.filter(function(k){var T,P,$=l in k.props?k.props[l]:(T=k.type.defaultProps)===null||T===void 0?void 0:T[l],F="hide"in k.props?k.props.hide:(P=k.type.defaultProps)===null||P===void 0?void 0:P.hide;return $===C&&!F}),"number",m),a.defaultProps.allowDataOverflow),E=RN(p,E,C,i)),ye(ye({},w),{},Fe({},C,ye(ye({axisType:i},a.defaultProps),{},{hide:!0,orientation:Qr(hpe,"".concat(i,".").concat(b%2),null),domain:E,originalDomain:A,isCategorical:j,layout:m})))}return w},{})},xpe=function(t,n){var r=n.axisType,a=r===void 0?"xAxis":r,i=n.AxisComp,l=n.graphicalItems,u=n.stackGroups,d=n.dataStartIndex,f=n.dataEndIndex,m=t.children,p="".concat(a,"Id"),g=Jr(m,i),x={};return g&&g.length?x=gpe(t,{axes:g,graphicalItems:l,axisType:a,axisIdKey:p,stackGroups:u,dataStartIndex:d,dataEndIndex:f}):l&&l.length&&(x=ype(t,{Axis:i,graphicalItems:l,axisType:a,axisIdKey:p,stackGroups:u,dataStartIndex:d,dataEndIndex:f})),x},bpe=function(t){var n=Bo(t),r=Wi(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:iC(r,function(a){return a.coordinate}),tooltipAxis:n,tooltipAxisBandSize:zv(n,r)}},kL=function(t){var n=t.children,r=t.defaultShowTooltip,a=Vr(n,hu),i=0,l=0;return t.data&&t.data.length!==0&&(l=t.data.length-1),a&&a.props&&(a.props.startIndex>=0&&(i=a.props.startIndex),a.props.endIndex>=0&&(l=a.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:l,activeTooltipIndex:-1,isTooltipActive:!!r}},wpe=function(t){return!t||!t.length?!1:t.some(function(n){var r=Ki(n&&n.type);return r&&r.indexOf("Bar")>=0})},PL=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},jpe=function(t,n){var r=t.props,a=t.graphicalItems,i=t.xAxisMap,l=i===void 0?{}:i,u=t.yAxisMap,d=u===void 0?{}:u,f=r.width,m=r.height,p=r.children,g=r.margin||{},x=Vr(p,hu),j=Vr(p,Xs),b=Object.keys(d).reduce(function(E,k){var T=d[k],P=T.orientation;return!T.mirror&&!T.hide?ye(ye({},E),{},Fe({},P,E[P]+T.width)):E},{left:g.left||0,right:g.right||0}),w=Object.keys(l).reduce(function(E,k){var T=l[k],P=T.orientation;return!T.mirror&&!T.hide?ye(ye({},E),{},Fe({},P,Qr(E,"".concat(P))+T.height)):E},{top:g.top||0,bottom:g.bottom||0}),N=ye(ye({},w),b),O=N.bottom;x&&(N.bottom+=x.props.height||hu.defaultProps.height),j&&n&&(N=Hoe(N,a,r,n));var C=f-N.left-N.right,A=m-N.top-N.bottom;return ye(ye({brushBottom:O},N),{},{width:Math.max(C,0),height:Math.max(A,0)})},Spe=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},FC=function(t){var n=t.chartName,r=t.GraphicalChild,a=t.defaultTooltipEventType,i=a===void 0?"axis":a,l=t.validateTooltipEventTypes,u=l===void 0?["axis"]:l,d=t.axisComponents,f=t.legendContent,m=t.formatAxisMap,p=t.defaultProps,g=function(N,O){var C=O.graphicalItems,A=O.stackGroups,E=O.offset,k=O.updateId,T=O.dataStartIndex,P=O.dataEndIndex,$=N.barSize,F=N.layout,D=N.barGap,U=N.barCategoryGap,V=N.maxBarSize,H=PL(F),G=H.numericAxisName,L=H.cateAxisName,R=wpe(C),q=[];return C.forEach(function(K,ee){var I=Sy(N.data,{graphicalItems:[K],dataStartIndex:T,dataEndIndex:P}),B=K.type.defaultProps!==void 0?ye(ye({},K.type.defaultProps),K.props):K.props,Y=B.dataKey,te=B.maxBarSize,oe=B["".concat(G,"Id")],xe=B["".concat(L,"Id")],J={},ae=d.reduce(function(er,hr){var it=O["".concat(hr.axisType,"Map")],nt=B["".concat(hr.axisType,"Id")];it&&it[nt]||hr.axisType==="zAxis"||sr(!1);var Nn=it[nt];return ye(ye({},er),{},Fe(Fe({},hr.axisType,Nn),"".concat(hr.axisType,"Ticks"),Wi(Nn)))},J),Z=ae[L],pe=ae["".concat(L,"Ticks")],je=A&&A[oe]&&A[oe].hasStack&&tse(K,A[oe].stackGroups),le=Ki(K.type).indexOf("Bar")>=0,Re=zv(Z,pe),_e=[],he=R&&Foe({barSize:$,stackGroups:A,totalSize:Spe(ae,L)});if(le){var ve,Le,Mt=Ge(te)?V:te,vn=(ve=(Le=zv(Z,pe,!0))!==null&&Le!==void 0?Le:Mt)!==null&&ve!==void 0?ve:0;_e=Uoe({barGap:D,barCategoryGap:U,bandSize:vn!==Re?vn:Re,sizeList:he[xe],maxBarSize:Mt}),vn!==Re&&(_e=_e.map(function(er){return ye(ye({},er),{},{position:ye(ye({},er.position),{},{offset:er.position.offset-vn/2})})}))}var fr=K&&K.type&&K.type.getComposedData;fr&&q.push({props:ye(ye({},fr(ye(ye({},ae),{},{displayedData:I,props:N,dataKey:Y,item:K,bandSize:Re,barPosition:_e,offset:E,stackedData:je,layout:F,dataStartIndex:T,dataEndIndex:P}))),{},Fe(Fe(Fe({key:K.key||"item-".concat(ee)},G,ae[G]),L,ae[L]),"animationId",k)),childIndex:GQ(K,N.children),item:K})}),q},x=function(N,O){var C=N.props,A=N.dataStartIndex,E=N.dataEndIndex,k=N.updateId;if(!UM({props:C}))return null;var T=C.children,P=C.layout,$=C.stackOffset,F=C.data,D=C.reverseStackOrder,U=PL(P),V=U.numericAxisName,H=U.cateAxisName,G=Jr(T,r),L=Joe(F,G,"".concat(V,"Id"),"".concat(H,"Id"),$,D),R=d.reduce(function(B,Y){var te="".concat(Y.axisType,"Map");return ye(ye({},B),{},Fe({},te,xpe(C,ye(ye({},Y),{},{graphicalItems:G,stackGroups:Y.axisType===V&&L,dataStartIndex:A,dataEndIndex:E}))))},{}),q=jpe(ye(ye({},R),{},{props:C,graphicalItems:G}),O?.legendBBox);Object.keys(R).forEach(function(B){R[B]=m(C,R[B],q,B.replace("Map",""),n)});var K=R["".concat(H,"Map")],ee=bpe(K),I=g(C,ye(ye({},R),{},{dataStartIndex:A,dataEndIndex:E,updateId:k,graphicalItems:G,stackGroups:L,offset:q}));return ye(ye({formattedGraphicalItems:I,graphicalItems:G,offset:q,stackGroups:L},ee),R)},j=(function(w){function N(O){var C,A,E;return npe(this,N),E=ipe(this,N,[O]),Fe(E,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Fe(E,"accessibilityManager",new Fme),Fe(E,"handleLegendBBoxUpdate",function(k){if(k){var T=E.state,P=T.dataStartIndex,$=T.dataEndIndex,F=T.updateId;E.setState(ye({legendBBox:k},x({props:E.props,dataStartIndex:P,dataEndIndex:$,updateId:F},ye(ye({},E.state),{},{legendBBox:k}))))}}),Fe(E,"handleReceiveSyncEvent",function(k,T,P){if(E.props.syncId===k){if(P===E.eventEmitterSymbol&&typeof E.props.syncMethod!="function")return;E.applySyncEvent(T)}}),Fe(E,"handleBrushChange",function(k){var T=k.startIndex,P=k.endIndex;if(T!==E.state.dataStartIndex||P!==E.state.dataEndIndex){var $=E.state.updateId;E.setState(function(){return ye({dataStartIndex:T,dataEndIndex:P},x({props:E.props,dataStartIndex:T,dataEndIndex:P,updateId:$},E.state))}),E.triggerSyncEvent({dataStartIndex:T,dataEndIndex:P})}}),Fe(E,"handleMouseEnter",function(k){var T=E.getMouseInfo(k);if(T){var P=ye(ye({},T),{},{isTooltipActive:!0});E.setState(P),E.triggerSyncEvent(P);var $=E.props.onMouseEnter;We($)&&$(P,k)}}),Fe(E,"triggeredAfterMouseMove",function(k){var T=E.getMouseInfo(k),P=T?ye(ye({},T),{},{isTooltipActive:!0}):{isTooltipActive:!1};E.setState(P),E.triggerSyncEvent(P);var $=E.props.onMouseMove;We($)&&$(P,k)}),Fe(E,"handleItemMouseEnter",function(k){E.setState(function(){return{isTooltipActive:!0,activeItem:k,activePayload:k.tooltipPayload,activeCoordinate:k.tooltipPosition||{x:k.cx,y:k.cy}}})}),Fe(E,"handleItemMouseLeave",function(){E.setState(function(){return{isTooltipActive:!1}})}),Fe(E,"handleMouseMove",function(k){k.persist(),E.throttleTriggeredAfterMouseMove(k)}),Fe(E,"handleMouseLeave",function(k){E.throttleTriggeredAfterMouseMove.cancel();var T={isTooltipActive:!1};E.setState(T),E.triggerSyncEvent(T);var P=E.props.onMouseLeave;We(P)&&P(T,k)}),Fe(E,"handleOuterEvent",function(k){var T=VQ(k),P=Qr(E.props,"".concat(T));if(T&&We(P)){var $,F;/.*touch.*/i.test(T)?F=E.getMouseInfo(k.changedTouches[0]):F=E.getMouseInfo(k),P(($=F)!==null&&$!==void 0?$:{},k)}}),Fe(E,"handleClick",function(k){var T=E.getMouseInfo(k);if(T){var P=ye(ye({},T),{},{isTooltipActive:!0});E.setState(P),E.triggerSyncEvent(P);var $=E.props.onClick;We($)&&$(P,k)}}),Fe(E,"handleMouseDown",function(k){var T=E.props.onMouseDown;if(We(T)){var P=E.getMouseInfo(k);T(P,k)}}),Fe(E,"handleMouseUp",function(k){var T=E.props.onMouseUp;if(We(T)){var P=E.getMouseInfo(k);T(P,k)}}),Fe(E,"handleTouchMove",function(k){k.changedTouches!=null&&k.changedTouches.length>0&&E.throttleTriggeredAfterMouseMove(k.changedTouches[0])}),Fe(E,"handleTouchStart",function(k){k.changedTouches!=null&&k.changedTouches.length>0&&E.handleMouseDown(k.changedTouches[0])}),Fe(E,"handleTouchEnd",function(k){k.changedTouches!=null&&k.changedTouches.length>0&&E.handleMouseUp(k.changedTouches[0])}),Fe(E,"handleDoubleClick",function(k){var T=E.props.onDoubleClick;if(We(T)){var P=E.getMouseInfo(k);T(P,k)}}),Fe(E,"handleContextMenu",function(k){var T=E.props.onContextMenu;if(We(T)){var P=E.getMouseInfo(k);T(P,k)}}),Fe(E,"triggerSyncEvent",function(k){E.props.syncId!==void 0&&IS.emit(LS,E.props.syncId,k,E.eventEmitterSymbol)}),Fe(E,"applySyncEvent",function(k){var T=E.props,P=T.layout,$=T.syncMethod,F=E.state.updateId,D=k.dataStartIndex,U=k.dataEndIndex;if(k.dataStartIndex!==void 0||k.dataEndIndex!==void 0)E.setState(ye({dataStartIndex:D,dataEndIndex:U},x({props:E.props,dataStartIndex:D,dataEndIndex:U,updateId:F},E.state)));else if(k.activeTooltipIndex!==void 0){var V=k.chartX,H=k.chartY,G=k.activeTooltipIndex,L=E.state,R=L.offset,q=L.tooltipTicks;if(!R)return;if(typeof $=="function")G=$(q,k);else if($==="value"){G=-1;for(var K=0;K=0){var je,le;if(V.dataKey&&!V.allowDuplicatedCategory){var Re=typeof V.dataKey=="function"?pe:"payload.".concat(V.dataKey.toString());je=pv(K,Re,G),le=ee&&I&&pv(I,Re,G)}else je=K?.[H],le=ee&&I&&I[H];if(xe||oe){var _e=k.props.activeIndex!==void 0?k.props.activeIndex:H;return[y.cloneElement(k,ye(ye(ye({},$.props),ae),{},{activeIndex:_e})),null,null]}if(!Ge(je))return[Z].concat(Su(E.renderActivePoints({item:$,activePoint:je,basePoint:le,childIndex:H,isRange:ee})))}else{var he,ve=(he=E.getItemByXY(E.state.activeCoordinate))!==null&&he!==void 0?he:{graphicalItem:Z},Le=ve.graphicalItem,Mt=Le.item,vn=Mt===void 0?k:Mt,fr=Le.childIndex,er=ye(ye(ye({},$.props),ae),{},{activeIndex:fr});return[y.cloneElement(vn,er),null,null]}return ee?[Z,null,null]:[Z,null]}),Fe(E,"renderCustomized",function(k,T,P){return y.cloneElement(k,ye(ye({key:"recharts-customized-".concat(P)},E.props),E.state))}),Fe(E,"renderMap",{CartesianGrid:{handler:Mp,once:!0},ReferenceArea:{handler:E.renderReferenceElement},ReferenceLine:{handler:Mp},ReferenceDot:{handler:E.renderReferenceElement},XAxis:{handler:Mp},YAxis:{handler:Mp},Brush:{handler:E.renderBrush,once:!0},Bar:{handler:E.renderGraphicChild},Line:{handler:E.renderGraphicChild},Area:{handler:E.renderGraphicChild},Radar:{handler:E.renderGraphicChild},RadialBar:{handler:E.renderGraphicChild},Scatter:{handler:E.renderGraphicChild},Pie:{handler:E.renderGraphicChild},Funnel:{handler:E.renderGraphicChild},Tooltip:{handler:E.renderCursor,once:!0},PolarGrid:{handler:E.renderPolarGrid,once:!0},PolarAngleAxis:{handler:E.renderPolarAxis},PolarRadiusAxis:{handler:E.renderPolarAxis},Customized:{handler:E.renderCustomized}}),E.clipPathId="".concat((C=O.id)!==null&&C!==void 0?C:$u("recharts"),"-clip"),E.throttleTriggeredAfterMouseMove=hz(E.triggeredAfterMouseMove,(A=O.throttleDelay)!==null&&A!==void 0?A:1e3/60),E.state={},E}return lpe(N,w),ape(N,[{key:"componentDidMount",value:function(){var C,A;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(C=this.props.margin.left)!==null&&C!==void 0?C:0,top:(A=this.props.margin.top)!==null&&A!==void 0?A:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var C=this.props,A=C.children,E=C.data,k=C.height,T=C.layout,P=Vr(A,Qa);if(P){var $=P.props.defaultIndex;if(!(typeof $!="number"||$<0||$>this.state.tooltipTicks.length-1)){var F=this.state.tooltipTicks[$]&&this.state.tooltipTicks[$].value,D=IN(this.state,E,$,F),U=this.state.tooltipTicks[$].coordinate,V=(this.state.offset.top+k)/2,H=T==="horizontal",G=H?{x:U,y:V}:{y:U,x:V},L=this.state.formattedGraphicalItems.find(function(q){var K=q.item;return K.type.name==="Scatter"});L&&(G=ye(ye({},G),L.props.points[$].tooltipPosition),D=L.props.points[$].tooltipPayload);var R={activeTooltipIndex:$,isTooltipActive:!0,activeLabel:F,activePayload:D,activeCoordinate:G};this.setState(R),this.renderCursor(P),this.accessibilityManager.setIndex($)}}}},{key:"getSnapshotBeforeUpdate",value:function(C,A){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==A.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==C.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==C.margin){var E,k;this.accessibilityManager.setDetails({offset:{left:(E=this.props.margin.left)!==null&&E!==void 0?E:0,top:(k=this.props.margin.top)!==null&&k!==void 0?k:0}})}return null}},{key:"componentDidUpdate",value:function(C){x_([Vr(C.children,Qa)],[Vr(this.props.children,Qa)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var C=Vr(this.props.children,Qa);if(C&&typeof C.props.shared=="boolean"){var A=C.props.shared?"axis":"item";return u.indexOf(A)>=0?A:i}return i}},{key:"getMouseInfo",value:function(C){if(!this.container)return null;var A=this.container,E=A.getBoundingClientRect(),k=Rne(E),T={chartX:Math.round(C.pageX-k.left),chartY:Math.round(C.pageY-k.top)},P=E.width/A.offsetWidth||1,$=this.inRange(T.chartX,T.chartY,P);if(!$)return null;var F=this.state,D=F.xAxisMap,U=F.yAxisMap,V=this.getTooltipEventType(),H=TL(this.state,this.props.data,this.props.layout,$);if(V!=="axis"&&D&&U){var G=Bo(D).scale,L=Bo(U).scale,R=G&&G.invert?G.invert(T.chartX):null,q=L&&L.invert?L.invert(T.chartY):null;return ye(ye({},T),{},{xValue:R,yValue:q},H)}return H?ye(ye({},T),H):null}},{key:"inRange",value:function(C,A){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,k=this.props.layout,T=C/E,P=A/E;if(k==="horizontal"||k==="vertical"){var $=this.state.offset,F=T>=$.left&&T<=$.left+$.width&&P>=$.top&&P<=$.top+$.height;return F?{x:T,y:P}:null}var D=this.state,U=D.angleAxisMap,V=D.radiusAxisMap;if(U&&V){var H=Bo(U);return P4({x:T,y:P},H)}return null}},{key:"parseEventsOfWrapper",value:function(){var C=this.props.children,A=this.getTooltipEventType(),E=Vr(C,Qa),k={};E&&A==="axis"&&(E.props.trigger==="click"?k={onClick:this.handleClick}:k={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var T=vv(this.props,this.handleOuterEvent);return ye(ye({},T),k)}},{key:"addListener",value:function(){IS.on(LS,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){IS.removeListener(LS,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(C,A,E){for(var k=this.state.formattedGraphicalItems,T=0,P=k.length;T");return e}const Ec=y.forwardRef(({id:e,className:t,children:n,config:r,...a},i)=>{const l=y.useId(),u=`chart-${e||l.replace(/:/g,"")}`;return s.jsx(Rq.Provider,{value:{config:r},children:s.jsxs("div",{"data-chart":u,ref:i,className:ue("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",t),...a,children:[s.jsx(Cpe,{id:u,config:r}),s.jsx(Cne,{children:n})]})})});Ec.displayName="Chart";const Cpe=({id:e,config:t})=>{const n=Object.entries(t).filter(([,r])=>r.theme||r.color);return n.length?s.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(Ope).map(([r,a])=>` -${a} [data-chart=${e}] { -${n.map(([i,l])=>{const u=l.theme?.[r]||l.color;return u?` --color-${i}: ${u};`:null}).join(` -`)} -} -`).join(` -`)}}):null},tf=Qa,Ac=y.forwardRef(({active:e,payload:t,className:n,indicator:r="dot",hideLabel:a=!1,hideIndicator:i=!1,label:l,labelFormatter:u,labelClassName:d,formatter:f,color:m,nameKey:p,labelKey:g},x)=>{const{config:j}=Dq(),b=y.useMemo(()=>{if(a||!t?.length)return null;const[N]=t,O=`${g||N?.dataKey||N?.name||"value"}`,C=LN(j,N,O),A=!g&&typeof l=="string"?j[l]?.label||l:C?.label;return u?s.jsx("div",{className:ue("font-medium",d),children:u(A,t)}):A?s.jsx("div",{className:ue("font-medium",d),children:A}):null},[l,u,t,a,d,j,g]);if(!e||!t?.length)return null;const w=t.length===1&&r!=="dot";return s.jsxs("div",{ref:x,className:ue("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[w?null:b,s.jsx("div",{className:"grid gap-1.5",children:t.filter(N=>N.type!=="none").map((N,O)=>{const C=`${p||N.name||N.dataKey||"value"}`,A=LN(j,N,C),E=m||N.payload.fill||N.color;return s.jsx("div",{className:ue("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",r==="dot"&&"items-center"),children:f&&N?.value!==void 0&&N.name?f(N.value,N.name,N,O,N.payload):s.jsxs(s.Fragment,{children:[A?.icon?s.jsx(A.icon,{}):!i&&s.jsx("div",{className:ue("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":w&&r==="dashed"}),style:{"--color-bg":E,"--color-border":E}}),s.jsxs("div",{className:ue("flex flex-1 justify-between leading-none",w?"items-end":"items-center"),children:[s.jsxs("div",{className:"grid gap-1.5",children:[w?b:null,s.jsx("span",{className:"text-muted-foreground",children:A?.label||N.name})]}),N.value&&s.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:N.value.toLocaleString()})]})]})},N.dataKey)})})]})});Ac.displayName="ChartTooltip";const Epe=Xs,$q=y.forwardRef(({className:e,hideIcon:t=!1,payload:n,verticalAlign:r="bottom",nameKey:a},i)=>{const{config:l}=Dq();return n?.length?s.jsx("div",{ref:i,className:ue("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",e),children:n.filter(u=>u.type!=="none").map(u=>{const d=`${a||u.dataKey||"value"}`,f=LN(l,u,d);return s.jsxs("div",{className:ue("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[f?.icon&&!t?s.jsx(f.icon,{}):s.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:u.color}}),f?.label]},u.value)})}):null});$q.displayName="ChartLegend";function LN(e,t,n){if(typeof t!="object"||t===null)return;const r="payload"in t&&typeof t.payload=="object"&&t.payload!==null?t.payload:void 0;let a=n;return n in t&&typeof t[n]=="string"?a=t[n]:r&&n in r&&typeof r[n]=="string"&&(a=r[n]),a in e?e[a]:e[n]}const Ape=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Tpe=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),ML=e=>{const t=Tpe(e);return t.charAt(0).toUpperCase()+t.slice(1)},Iq=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),kpe=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Ppe={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"};const Mpe=y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:i,iconNode:l,...u},d)=>y.createElement("svg",{ref:d,...Ppe,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Iq("lucide",a),...!i&&!kpe(u)&&{"aria-hidden":"true"},...u},[...l.map(([f,m])=>y.createElement(f,m)),...Array.isArray(i)?i:[i]]));const Ce=(e,t)=>{const n=y.forwardRef(({className:r,...a},i)=>y.createElement(Mpe,{ref:i,iconNode:t,className:Iq(`lucide-${Ape(ML(e))}`,`lucide-${e}`,r),...a}));return n.displayName=ML(e),n};const Rpe=[["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"}]],Dpe=Ce("activity",Rpe);const $pe=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Lq=Ce("arrow-left",$pe);const Ipe=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Lpe=Ce("ban",Ipe);const Bpe=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],zpe=Ce("book-open",Bpe);const qpe=[["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"}]],Bq=Ce("boxes",qpe);const Fpe=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],RL=Ce("calendar",Fpe);const Upe=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],zq=Ce("chart-column",Upe);const Hpe=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Js=Ce("check",Hpe);const Wpe=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],sh=Ce("chevron-down",Wpe);const Vpe=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],UC=Ce("chevron-left",Vpe);const Gpe=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],HC=Ce("chevron-right",Gpe);const Ype=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],BN=Ce("chevron-up",Ype);const Kpe=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],Xpe=Ce("chevrons-up-down",Kpe);const Zpe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],hg=Ce("circle-alert",Zpe);const Qpe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],mg=Ce("circle-check",Qpe);const Jpe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],eve=Ce("circle-question-mark",Jpe);const tve=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],qq=Ce("circle-user",tve);const nve=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Fq=Ce("circle-x",nve);const rve=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ave=Ce("circle",rve);const ive=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],el=Ce("clock",ive);const ove=[["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"}]],zN=Ce("copy",ove);const sve=[["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"}]],lve=Ce("database",sve);const cve=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],uve=Ce("dollar-sign",cve);const dve=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],qN=Ce("download",dve);const fve=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Zp=Ce("external-link",fve);const hve=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],FN=Ce("eye-off",hve);const mve=[["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"}]],to=Ce("eye",mve);const pve=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],pg=Ce("file-search",pve);const vve=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],WC=Ce("file-text",vve);const gve=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],UN=Ce("funnel",gve);const yve=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],vg=Ce("hash",yve);const xve=[["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-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],gg=Ce("house",xve);const bve=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],wve=Ce("image",bve);const jve=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Uq=Ce("info",jve);const Sve=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],_ve=Ce("key",Sve);const Nve=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],HN=Ce("loader-circle",Nve);const Ove=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],DL=Ce("lock",Ove);const Cve=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],$L=Ce("log-out",Cve);const Eve=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Ave=Ce("menu",Eve);const Tve=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Mh=Ce("message-square",Tve);const kve=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],WN=Ce("moon",kve);const Pve=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Hq=Ce("package",Pve);const Mve=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["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:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],Rve=Ce("palette",Mve);const Dve=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],$ve=Ce("pause",Dve);const Ive=[["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"}]],_u=Ce("pencil",Ive);const Lve=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Bve=Ce("play",Lve);const zve=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Zn=Ce("plus",zve);const qve=[["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"}]],tl=Ce("refresh-cw",qve);const Fve=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Uve=Ce("rotate-cw",Fve);const Hve=[["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"}]],VC=Ce("save",Hve);const Wve=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],kr=Ce("search",Wve);const Vve=[["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"}]],Wq=Ce("server",Vve);const Gve=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Yve=Ce("settings-2",Gve);const Kve=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Sf=Ce("settings",Kve);const Xve=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Zve=Ce("shield",Xve);const Qve=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],Vq=Ce("smile",Qve);const Jve=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],GC=Ce("square-pen",Jve);const ege=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],IL=Ce("star",ege);const tge=[["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"}]],VN=Ce("sun",tge);const nge=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],rge=Ce("terminal",nge);const age=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],zt=Ce("trash-2",age);const ige=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],oge=Ce("trending-up",ige);const sge=[["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"}]],Fc=Ce("triangle-alert",sge);const lge=[["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"}]],cge=Ce("user",lge);const uge=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],dge=Ce("users",uge);const fge=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],_y=Ce("x",fge);const hge=[["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"}]],GN=Ce("zap",hge);var mge=Symbol.for("react.lazy"),yg=gO[" use ".trim().toString()];function pge(e){return typeof e=="object"&&e!==null&&"then"in e}function Gq(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===mge&&"_payload"in e&&pge(e._payload)}function Ny(e){const t=gge(e),n=y.forwardRef((r,a)=>{let{children:i,...l}=r;Gq(i)&&typeof yg=="function"&&(i=yg(i._payload));const u=y.Children.toArray(i),d=u.find(xge);if(d){const f=d.props.children,m=u.map(p=>p===d?y.Children.count(f)>1?y.Children.only(null):y.isValidElement(f)?f.props.children:null:p);return s.jsx(t,{...l,ref:a,children:y.isValidElement(f)?y.cloneElement(f,void 0,m):null})}return s.jsx(t,{...l,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}var vge=Ny("Slot");function gge(e){const t=y.forwardRef((n,r)=>{let{children:a,...i}=n;if(Gq(a)&&typeof yg=="function"&&(a=yg(a._payload)),y.isValidElement(a)){const l=wge(a),u=bge(i,a.props);return a.type!==y.Fragment&&(u.ref=r?Tr(r,l):l),y.cloneElement(a,u)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var yge=Symbol("radix.slottable");function xge(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===yge}function bge(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...u)=>{const d=i(...u);return a(...u),d}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function wge(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const LL=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,BL=Ye,Rh=(e,t)=>n=>{var r;if(t?.variants==null)return BL(e,n?.class,n?.className);const{variants:a,defaultVariants:i}=t,l=Object.keys(a).map(f=>{const m=n?.[f],p=i?.[f];if(m===null)return null;const g=LL(m)||LL(p);return a[f][g]}),u=n&&Object.entries(n).reduce((f,m)=>{let[p,g]=m;return g===void 0||(f[p]=g),f},{}),d=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,m)=>{let{class:p,className:g,...x}=m;return Object.entries(x).every(j=>{let[b,w]=j;return Array.isArray(w)?w.includes({...i,...u}[b]):{...i,...u}[b]===w})?[...f,p,g]:f},[]);return BL(e,l,d,n?.class,n?.className)},lh=Rh("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),me=y.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...a},i)=>{const l=r?vge:"button";return s.jsx(l,{className:ue(lh({variant:t,size:n,className:e})),ref:i,...a})});me.displayName="Button";function jge(){const[e,t]=y.useState(null),[n,r]=y.useState(!0),[a,i]=y.useState(24),[l,u]=y.useState(!0),d=y.useCallback(async()=>{try{const O=localStorage.getItem("token"),C=await an.get(`/api/webui/statistics/dashboard?hours=${a}`,{headers:{Authorization:`Bearer ${O}`}});t(C.data),r(!1)}catch(O){console.error("Failed to fetch dashboard data:",O),r(!1)}},[a]);if(y.useEffect(()=>{d()},[d]),y.useEffect(()=>{if(!l)return;const O=setInterval(()=>{d()},3e4);return()=>clearInterval(O)},[l,d]),n||!e)return s.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:s.jsxs("div",{className:"text-center space-y-4",children:[s.jsx(tl,{className:"h-12 w-12 animate-spin mx-auto text-muted-foreground"}),s.jsx("p",{className:"text-muted-foreground",children:"加载统计数据中..."})]})});const{summary:f,model_stats:m,hourly_data:p,daily_data:g,recent_activity:x}=e,j=O=>{const C=Math.floor(O/3600),A=Math.floor(O%3600/60);return`${C}小时${A}分钟`},b=O=>new Date(O).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),w=m.slice(0,6).map(O=>({name:O.model_name,value:O.request_count,fill:`hsl(var(--chart-${m.indexOf(O)%5+1}))`})),N={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return s.jsx(Kt,{className:"h-full",children:s.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(al,{value:a.toString(),onValueChange:O=>i(Number(O)),children:s.jsxs(Yo,{className:"grid grid-cols-3 w-full sm:w-auto",children:[s.jsx(Tt,{value:"24",children:"24小时"}),s.jsx(Tt,{value:"168",children:"7天"}),s.jsx(Tt,{value:"720",children:"30天"})]})}),s.jsxs(me,{variant:l?"default":"outline",size:"sm",onClick:()=>u(!l),className:"gap-2",children:[s.jsx(tl,{className:`h-4 w-4 ${l?"animate-spin":""}`}),s.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),s.jsx(me,{variant:"outline",size:"sm",onClick:d,children:s.jsx(tl,{className:"h-4 w-4"})})]})]}),s.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[s.jsxs(ct,{children:[s.jsxs(Ut,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[s.jsx(Ht,{className:"text-sm font-medium",children:"总请求数"}),s.jsx(Dpe,{className:"h-4 w-4 text-muted-foreground"})]}),s.jsxs(un,{children:[s.jsx("div",{className:"text-2xl font-bold",children:f.total_requests.toLocaleString()}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",a<48?a+"小时":Math.floor(a/24)+"天"]})]})]}),s.jsxs(ct,{children:[s.jsxs(Ut,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[s.jsx(Ht,{className:"text-sm font-medium",children:"总花费"}),s.jsx(uve,{className:"h-4 w-4 text-muted-foreground"})]}),s.jsxs(un,{children:[s.jsxs("div",{className:"text-2xl font-bold",children:["¥",f.total_cost.toFixed(2)]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:f.cost_per_hour>0?`¥${f.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),s.jsxs(ct,{children:[s.jsxs(Ut,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[s.jsx(Ht,{className:"text-sm font-medium",children:"Token消耗"}),s.jsx(lve,{className:"h-4 w-4 text-muted-foreground"})]}),s.jsxs(un,{children:[s.jsxs("div",{className:"text-2xl font-bold",children:[(f.total_tokens/1e3).toFixed(1),"K"]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:f.tokens_per_hour>0?`${(f.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),s.jsxs(ct,{children:[s.jsxs(Ut,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[s.jsx(Ht,{className:"text-sm font-medium",children:"平均响应"}),s.jsx(GN,{className:"h-4 w-4 text-muted-foreground"})]}),s.jsxs(un,{children:[s.jsxs("div",{className:"text-2xl font-bold",children:[f.avg_response_time.toFixed(2),"s"]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),s.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[s.jsxs(ct,{children:[s.jsxs(Ut,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[s.jsx(Ht,{className:"text-sm font-medium",children:"在线时长"}),s.jsx(el,{className:"h-4 w-4 text-muted-foreground"})]}),s.jsx(un,{children:s.jsx("div",{className:"text-xl font-bold",children:j(f.online_time)})})]}),s.jsxs(ct,{children:[s.jsxs(Ut,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[s.jsx(Ht,{className:"text-sm font-medium",children:"消息处理"}),s.jsx(Mh,{className:"h-4 w-4 text-muted-foreground"})]}),s.jsxs(un,{children:[s.jsx("div",{className:"text-xl font-bold",children:f.total_messages.toLocaleString()}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",f.total_replies.toLocaleString()," 条"]})]})]}),s.jsxs(ct,{children:[s.jsxs(Ut,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[s.jsx(Ht,{className:"text-sm font-medium",children:"成本效率"}),s.jsx(oge,{className:"h-4 w-4 text-muted-foreground"})]}),s.jsxs(un,{children:[s.jsx("div",{className:"text-xl font-bold",children:f.total_messages>0?`¥${(f.total_cost/f.total_messages*100).toFixed(2)}`:"¥0.00"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),s.jsxs(al,{defaultValue:"trends",className:"space-y-4",children:[s.jsxs(Yo,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[s.jsx(Tt,{value:"trends",children:"趋势"}),s.jsx(Tt,{value:"models",children:"模型"}),s.jsx(Tt,{value:"activity",children:"活动"}),s.jsx(Tt,{value:"daily",children:"日统计"})]}),s.jsxs(Jt,{value:"trends",className:"space-y-4",children:[s.jsxs(ct,{children:[s.jsxs(Ut,{children:[s.jsx(Ht,{children:"请求趋势"}),s.jsxs(Xn,{children:["最近",a,"小时的请求量变化"]})]}),s.jsx(un,{children:s.jsx(Ec,{config:N,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:s.jsxs(_pe,{data:p,children:[s.jsx(lf,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),s.jsx(Fo,{dataKey:"timestamp",tickFormatter:O=>b(O),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),s.jsx(Fi,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),s.jsx(tf,{content:s.jsx(Ac,{labelFormatter:O=>b(O)})}),s.jsx(Ph,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),s.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[s.jsxs(ct,{children:[s.jsxs(Ut,{children:[s.jsx(Ht,{children:"花费趋势"}),s.jsx(Xn,{children:"API调用成本变化"})]}),s.jsx(un,{children:s.jsx(Ec,{config:N,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:s.jsxs(zS,{data:p,children:[s.jsx(lf,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),s.jsx(Fo,{dataKey:"timestamp",tickFormatter:O=>b(O),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),s.jsx(Fi,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),s.jsx(tf,{content:s.jsx(Ac,{labelFormatter:O=>b(O)})}),s.jsx(ai,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),s.jsxs(ct,{children:[s.jsxs(Ut,{children:[s.jsx(Ht,{children:"Token消耗"}),s.jsx(Xn,{children:"Token使用量变化"})]}),s.jsx(un,{children:s.jsx(Ec,{config:N,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:s.jsxs(zS,{data:p,children:[s.jsx(lf,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),s.jsx(Fo,{dataKey:"timestamp",tickFormatter:O=>b(O),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),s.jsx(Fi,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),s.jsx(tf,{content:s.jsx(Ac,{labelFormatter:O=>b(O)})}),s.jsx(ai,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),s.jsx(Jt,{value:"models",className:"space-y-4",children:s.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[s.jsxs(ct,{children:[s.jsxs(Ut,{children:[s.jsx(Ht,{children:"模型请求分布"}),s.jsx(Xn,{children:"各模型使用占比"})]}),s.jsx(un,{children:s.jsx(Ec,{config:Object.fromEntries(m.slice(0,6).map((O,C)=>[O.model_name,{label:O.model_name,color:`hsl(var(--chart-${C%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:s.jsxs(Npe,{children:[s.jsx(tf,{content:s.jsx(Ac,{})}),s.jsx(lo,{data:w,cx:"50%",cy:"50%",labelLine:!1,label:({name:O,percent:C})=>`${O} ${C?(C*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:w.map((O,C)=>s.jsx(Jg,{fill:O.fill},`cell-${C}`))})]})})})]}),s.jsxs(ct,{children:[s.jsxs(Ut,{children:[s.jsx(Ht,{children:"模型详细统计"}),s.jsx(Xn,{children:"请求数、花费和性能"})]}),s.jsx(un,{children:s.jsx(Kt,{className:"h-[300px] sm:h-[400px]",children:s.jsx("div",{className:"space-y-3",children:m.map((O,C)=>s.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:O.model_name}),s.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${C%5+1}))`}})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),s.jsx("span",{className:"ml-1 font-medium",children:O.request_count.toLocaleString()})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"花费:"}),s.jsxs("span",{className:"ml-1 font-medium",children:["¥",O.total_cost.toFixed(2)]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),s.jsxs("span",{className:"ml-1 font-medium",children:[(O.total_tokens/1e3).toFixed(1),"K"]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),s.jsxs("span",{className:"ml-1 font-medium",children:[O.avg_response_time.toFixed(2),"s"]})]})]})]},C))})})})]})]})}),s.jsx(Jt,{value:"activity",children:s.jsxs(ct,{children:[s.jsxs(Ut,{children:[s.jsx(Ht,{children:"最近活动"}),s.jsx(Xn,{children:"最新的API调用记录"})]}),s.jsx(un,{children:s.jsx(Kt,{className:"h-[400px] sm:h-[500px]",children:s.jsx("div",{className:"space-y-2",children:x.map((O,C)=>s.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"font-medium text-sm truncate",children:O.model}),s.jsx("div",{className:"text-xs text-muted-foreground",children:O.request_type})]}),s.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:b(O.timestamp)})]}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),s.jsx("span",{className:"ml-1",children:O.tokens})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"花费:"}),s.jsxs("span",{className:"ml-1",children:["¥",O.cost.toFixed(4)]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),s.jsxs("span",{className:"ml-1",children:[O.time_cost.toFixed(2),"s"]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"状态:"}),s.jsx("span",{className:`ml-1 ${O.status==="success"?"text-green-600":"text-red-600"}`,children:O.status})]})]})]},C))})})})]})}),s.jsx(Jt,{value:"daily",children:s.jsxs(ct,{children:[s.jsxs(Ut,{children:[s.jsx(Ht,{children:"每日统计"}),s.jsx(Xn,{children:"最近7天的数据汇总"})]}),s.jsx(un,{children:s.jsx(Ec,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:s.jsxs(zS,{data:g,children:[s.jsx(lf,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),s.jsx(Fo,{dataKey:"timestamp",tickFormatter:O=>{const C=new Date(O);return`${C.getMonth()+1}/${C.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),s.jsx(Fi,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),s.jsx(Fi,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),s.jsx(tf,{content:s.jsx(Ac,{labelFormatter:O=>new Date(O).toLocaleDateString("zh-CN")})}),s.jsx(Epe,{content:s.jsx($q,{})}),s.jsx(ai,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),s.jsx(ai,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]})]})})}const Sge={theme:"system",setTheme:()=>null},Yq=y.createContext(Sge),YC=()=>{const e=y.useContext(Yq);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},_ge=(e,t,n)=>{const r=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||r){t(e);return}const a=n.clientX,i=n.clientY,l=Math.hypot(Math.max(a,innerWidth-a),Math.max(i,innerHeight-i));document.startViewTransition(()=>{t(e)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${a}px ${i}px)`,`circle(${l}px at ${a}px ${i}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},Kq=y.createContext(void 0),Xq=()=>{const e=y.useContext(Kq);if(e===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return e};function Oy(e){const t=y.useRef({value:e,previous:e});return y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Cy(e){const[t,n]=y.useState(void 0);return Bn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let l,u;if("borderBoxSize"in i){const d=i.borderBoxSize,f=Array.isArray(d)?d[0]:d;l=f.inlineSize,u=f.blockSize}else l=e.offsetWidth,u=e.offsetHeight;n({width:l,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Ey="Switch",[Nge]=ur(Ey),[Oge,Cge]=Nge(Ey),Zq=y.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:i,required:l,disabled:u,value:d="on",onCheckedChange:f,form:m,...p}=e,[g,x]=y.useState(null),j=qe(t,C=>x(C)),b=y.useRef(!1),w=g?m||!!g.closest("form"):!0,[N,O]=wa({prop:a,defaultProp:i??!1,onChange:f,caller:Ey});return s.jsxs(Oge,{scope:n,checked:N,disabled:u,children:[s.jsx(Me.button,{type:"button",role:"switch","aria-checked":N,"aria-required":l,"data-state":tF(N),"data-disabled":u?"":void 0,disabled:u,value:d,...p,ref:j,onClick:Se(e.onClick,C=>{O(A=>!A),w&&(b.current=C.isPropagationStopped(),b.current||C.stopPropagation())})}),w&&s.jsx(eF,{control:g,bubbles:!b.current,name:r,value:d,checked:N,required:l,disabled:u,form:m,style:{transform:"translateX(-100%)"}})]})});Zq.displayName=Ey;var Qq="SwitchThumb",Jq=y.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,a=Cge(Qq,n);return s.jsx(Me.span,{"data-state":tF(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:t})});Jq.displayName=Qq;var Ege="SwitchBubbleInput",eF=y.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...a},i)=>{const l=y.useRef(null),u=qe(l,i),d=Oy(n),f=Cy(t);return y.useEffect(()=>{const m=l.current;if(!m)return;const p=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(p,"checked").set;if(d!==n&&x){const j=new Event("click",{bubbles:r});x.call(m,n),m.dispatchEvent(j)}},[d,n,r]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:u,style:{...a.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});eF.displayName=Ege;function tF(e){return e?"checked":"unchecked"}var nF=Zq,Age=Jq;const ht=y.forwardRef(({className:e,...t},n)=>s.jsx(nF,{className:ue("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:s.jsx(Age,{className:ue("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));ht.displayName=nF.displayName;var Tge=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],kge=Tge.reduce((e,t)=>{const n=Ny(`Primitive.${t}`),r=y.forwardRef((a,i)=>{const{asChild:l,...u}=a,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(d,{...u,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Pge="Label",rF=y.forwardRef((e,t)=>s.jsx(kge.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));rF.displayName=Pge;var aF=rF;const Mge=Rh("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),re=y.forwardRef(({className:e,...t},n)=>s.jsx(aF,{ref:n,className:ue(Mge(),e),...t}));re.displayName=aF.displayName;const Oe=y.forwardRef(({className:e,type:t,...n},r)=>s.jsx("input",{type:t,className:ue("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));Oe.displayName="Input";const Rge=1,Dge=1e6;let qS=0;function $ge(){return qS=(qS+1)%Number.MAX_SAFE_INTEGER,qS.toString()}const FS=new Map,zL=e=>{if(FS.has(e))return;const t=setTimeout(()=>{FS.delete(e),_f({type:"REMOVE_TOAST",toastId:e})},Dge);FS.set(e,t)},Ige=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,Rge)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?zL(n):e.toasts.forEach(r=>{zL(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},Qp=[];let Jp={toasts:[]};function _f(e){Jp=Ige(Jp,e),Qp.forEach(t=>{t(Jp)})}function Lge({...e}){const t=$ge(),n=a=>_f({type:"UPDATE_TOAST",toast:{...a,id:t}}),r=()=>_f({type:"DISMISS_TOAST",toastId:t});return _f({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:a=>{a||r()}}}),{id:t,dismiss:r,update:n}}function Dr(){const[e,t]=y.useState(Jp);return y.useEffect(()=>(Qp.push(t),()=>{const n=Qp.indexOf(t);n>-1&&Qp.splice(n,1)}),[e]),{...e,toast:Lge,dismiss:n=>_f({type:"DISMISS_TOAST",toastId:n})}}const Bge=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:e=>e.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:e=>/[A-Z]/.test(e)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:e=>/[a-z]/.test(e)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:e=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(e)}];function zge(e){const t=Bge.map(r=>({id:r.id,label:r.label,description:r.description,passed:r.validate(e)}));return{isValid:t.every(r=>r.passed),rules:t}}const KC="0.4.0",iF="MaiBot Dashboard",qge=`${iF} v${KC}`,Fge=(e="v")=>`${e}${KC}`;function Uge(e,t=globalThis?.document){const n=Xt(e);y.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Hge="DismissableLayer",YN="dismissableLayer.update",Wge="dismissableLayer.pointerDownOutside",Vge="dismissableLayer.focusOutside",qL,oF=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),wl=y.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:l,onDismiss:u,...d}=e,f=y.useContext(oF),[m,p]=y.useState(null),g=m?.ownerDocument??globalThis?.document,[,x]=y.useState({}),j=qe(t,T=>p(T)),b=Array.from(f.layers),[w]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),N=b.indexOf(w),O=m?b.indexOf(m):-1,C=f.layersWithOutsidePointerEventsDisabled.size>0,A=O>=N,E=Yge(T=>{const P=T.target,$=[...f.branches].some(F=>F.contains(P));!A||$||(a?.(T),l?.(T),T.defaultPrevented||u?.())},g),k=Kge(T=>{const P=T.target;[...f.branches].some(F=>F.contains(P))||(i?.(T),l?.(T),T.defaultPrevented||u?.())},g);return Uge(T=>{O===f.layers.size-1&&(r?.(T),!T.defaultPrevented&&u&&(T.preventDefault(),u()))},g),y.useEffect(()=>{if(m)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(qL=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(m)),f.layers.add(m),FL(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=qL)}},[m,g,n,f]),y.useEffect(()=>()=>{m&&(f.layers.delete(m),f.layersWithOutsidePointerEventsDisabled.delete(m),FL())},[m,f]),y.useEffect(()=>{const T=()=>x({});return document.addEventListener(YN,T),()=>document.removeEventListener(YN,T)},[]),s.jsx(Me.div,{...d,ref:j,style:{pointerEvents:C?A?"auto":"none":void 0,...e.style},onFocusCapture:Se(e.onFocusCapture,k.onFocusCapture),onBlurCapture:Se(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Se(e.onPointerDownCapture,E.onPointerDownCapture)})});wl.displayName=Hge;var Gge="DismissableLayerBranch",sF=y.forwardRef((e,t)=>{const n=y.useContext(oF),r=y.useRef(null),a=qe(t,r);return y.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(Me.div,{...e,ref:a})});sF.displayName=Gge;function Yge(e,t=globalThis?.document){const n=Xt(e),r=y.useRef(!1),a=y.useRef(()=>{});return y.useEffect(()=>{const i=u=>{if(u.target&&!r.current){let d=function(){lF(Wge,n,f,{discrete:!0})};const f={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=d,t.addEventListener("click",a.current,{once:!0})):d()}else t.removeEventListener("click",a.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Kge(e,t=globalThis?.document){const n=Xt(e),r=y.useRef(!1);return y.useEffect(()=>{const a=i=>{i.target&&!r.current&&lF(Vge,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function FL(){const e=new CustomEvent(YN);document.dispatchEvent(e)}function lF(e,t,n,{discrete:r}){const a=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?MO(a,i):a.dispatchEvent(i)}var Xge=wl,Zge=sF,US="focusScope.autoFocusOnMount",HS="focusScope.autoFocusOnUnmount",UL={bubbles:!1,cancelable:!0},Qge="FocusScope",Dh=y.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...l}=e,[u,d]=y.useState(null),f=Xt(a),m=Xt(i),p=y.useRef(null),g=qe(t,b=>d(b)),x=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let b=function(C){if(x.paused||!u)return;const A=C.target;u.contains(A)?p.current=A:Io(p.current,{select:!0})},w=function(C){if(x.paused||!u)return;const A=C.relatedTarget;A!==null&&(u.contains(A)||Io(p.current,{select:!0}))},N=function(C){if(document.activeElement===document.body)for(const E of C)E.removedNodes.length>0&&Io(u)};document.addEventListener("focusin",b),document.addEventListener("focusout",w);const O=new MutationObserver(N);return u&&O.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",w),O.disconnect()}}},[r,u,x.paused]),y.useEffect(()=>{if(u){WL.add(x);const b=document.activeElement;if(!u.contains(b)){const N=new CustomEvent(US,UL);u.addEventListener(US,f),u.dispatchEvent(N),N.defaultPrevented||(Jge(aye(cF(u)),{select:!0}),document.activeElement===b&&Io(u))}return()=>{u.removeEventListener(US,f),setTimeout(()=>{const N=new CustomEvent(HS,UL);u.addEventListener(HS,m),u.dispatchEvent(N),N.defaultPrevented||Io(b??document.body,{select:!0}),u.removeEventListener(HS,m),WL.remove(x)},0)}}},[u,f,m,x]);const j=y.useCallback(b=>{if(!n&&!r||x.paused)return;const w=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,N=document.activeElement;if(w&&N){const O=b.currentTarget,[C,A]=eye(O);C&&A?!b.shiftKey&&N===A?(b.preventDefault(),n&&Io(C,{select:!0})):b.shiftKey&&N===C&&(b.preventDefault(),n&&Io(A,{select:!0})):N===O&&b.preventDefault()}},[n,r,x.paused]);return s.jsx(Me.div,{tabIndex:-1,...l,ref:g,onKeyDown:j})});Dh.displayName=Qge;function Jge(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Io(r,{select:t}),document.activeElement!==n)return}function eye(e){const t=cF(e),n=HL(t,e),r=HL(t.reverse(),e);return[n,r]}function cF(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function HL(e,t){for(const n of e)if(!tye(n,{upTo:t}))return n}function tye(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function nye(e){return e instanceof HTMLInputElement&&"select"in e}function Io(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&nye(e)&&t&&e.select()}}var WL=rye();function rye(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=VL(e,t),e.unshift(t)},remove(t){e=VL(e,t),e[0]?.resume()}}}function VL(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function aye(e){return e.filter(t=>t.tagName!=="A")}var iye="Portal",jl=y.forwardRef((e,t)=>{const{container:n,...r}=e,[a,i]=y.useState(!1);Bn(()=>i(!0),[]);const l=n||a&&globalThis?.document?.body;return l?lY.createPortal(s.jsx(Me.div,{...r,ref:t}),l):null});jl.displayName=iye;var WS=0;function Ay(){y.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??GL()),document.body.insertAdjacentElement("beforeend",e[1]??GL()),WS++,()=>{WS===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),WS--}},[])}function GL(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Ja=function(){return Ja=Object.assign||function(t){for(var n,r=1,a=arguments.length;r"u")return jye;var t=Sye(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Nye=hF(),Uc="data-scroll-locked",Oye=function(e,t,n,r){var a=e.left,i=e.top,l=e.right,u=e.gap;return n===void 0&&(n="margin"),` - .`.concat(sye,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(u,"px ").concat(r,`; - } - body[`).concat(Uc,`] { - overflow: hidden `).concat(r,`; - overscroll-behavior: contain; - `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` - padding-left: `.concat(a,`px; - padding-top: `).concat(i,`px; - padding-right: `).concat(l,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(u,"px ").concat(r,`; - `),n==="padding"&&"padding-right: ".concat(u,"px ").concat(r,";")].filter(Boolean).join(""),` - } - - .`).concat(ev,` { - right: `).concat(u,"px ").concat(r,`; - } - - .`).concat(tv,` { - margin-right: `).concat(u,"px ").concat(r,`; - } - - .`).concat(ev," .").concat(ev,` { - right: 0 `).concat(r,`; - } - - .`).concat(tv," .").concat(tv,` { - margin-right: 0 `).concat(r,`; - } - - body[`).concat(Uc,`] { - `).concat(lye,": ").concat(u,`px; - } -`)},KL=function(){var e=parseInt(document.body.getAttribute(Uc)||"0",10);return isFinite(e)?e:0},Cye=function(){y.useEffect(function(){return document.body.setAttribute(Uc,(KL()+1).toString()),function(){var e=KL()-1;e<=0?document.body.removeAttribute(Uc):document.body.setAttribute(Uc,e.toString())}},[])},Eye=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;Cye();var i=y.useMemo(function(){return _ye(a)},[a]);return y.createElement(Nye,{styles:Oye(i,!t,a,n?"":"!important")})},KN=!1;if(typeof window<"u")try{var Rp=Object.defineProperty({},"passive",{get:function(){return KN=!0,!0}});window.addEventListener("test",Rp,Rp),window.removeEventListener("test",Rp,Rp)}catch{KN=!1}var jc=KN?{passive:!1}:!1,Aye=function(e){return e.tagName==="TEXTAREA"},mF=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Aye(e)&&n[t]==="visible")},Tye=function(e){return mF(e,"overflowY")},kye=function(e){return mF(e,"overflowX")},XL=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=pF(e,r);if(a){var i=vF(e,r),l=i[1],u=i[2];if(l>u)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Pye=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Mye=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},pF=function(e,t){return e==="v"?Tye(t):kye(t)},vF=function(e,t){return e==="v"?Pye(t):Mye(t)},Rye=function(e,t){return e==="h"&&t==="rtl"?-1:1},Dye=function(e,t,n,r,a){var i=Rye(e,window.getComputedStyle(t).direction),l=i*r,u=n.target,d=t.contains(u),f=!1,m=l>0,p=0,g=0;do{if(!u)break;var x=vF(e,u),j=x[0],b=x[1],w=x[2],N=b-w-i*j;(j||N)&&pF(e,u)&&(p+=N,g+=j);var O=u.parentNode;u=O&&O.nodeType===Node.DOCUMENT_FRAGMENT_NODE?O.host:O}while(!d&&u!==document.body||d&&(t.contains(u)||t===u));return(m&&Math.abs(p)<1||!m&&Math.abs(g)<1)&&(f=!0),f},Dp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ZL=function(e){return[e.deltaX,e.deltaY]},QL=function(e){return e&&"current"in e?e.current:e},$ye=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Iye=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},Lye=0,Sc=[];function Bye(e){var t=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),a=y.useState(Lye++)[0],i=y.useState(hF)[0],l=y.useRef(e);y.useEffect(function(){l.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var b=oye([e.lockRef.current],(e.shards||[]).map(QL),!0).filter(Boolean);return b.forEach(function(w){return w.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),b.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var u=y.useCallback(function(b,w){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!l.current.allowPinchZoom;var N=Dp(b),O=n.current,C="deltaX"in b?b.deltaX:O[0]-N[0],A="deltaY"in b?b.deltaY:O[1]-N[1],E,k=b.target,T=Math.abs(C)>Math.abs(A)?"h":"v";if("touches"in b&&T==="h"&&k.type==="range")return!1;var P=XL(T,k);if(!P)return!0;if(P?E=T:(E=T==="v"?"h":"v",P=XL(T,k)),!P)return!1;if(!r.current&&"changedTouches"in b&&(C||A)&&(r.current=E),!E)return!0;var $=r.current||E;return Dye($,w,b,$==="h"?C:A)},[]),d=y.useCallback(function(b){var w=b;if(!(!Sc.length||Sc[Sc.length-1]!==i)){var N="deltaY"in w?ZL(w):Dp(w),O=t.current.filter(function(E){return E.name===w.type&&(E.target===w.target||w.target===E.shadowParent)&&$ye(E.delta,N)})[0];if(O&&O.should){w.cancelable&&w.preventDefault();return}if(!O){var C=(l.current.shards||[]).map(QL).filter(Boolean).filter(function(E){return E.contains(w.target)}),A=C.length>0?u(w,C[0]):!l.current.noIsolation;A&&w.cancelable&&w.preventDefault()}}},[]),f=y.useCallback(function(b,w,N,O){var C={name:b,delta:w,target:N,should:O,shadowParent:zye(N)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(A){return A!==C})},1)},[]),m=y.useCallback(function(b){n.current=Dp(b),r.current=void 0},[]),p=y.useCallback(function(b){f(b.type,ZL(b),b.target,u(b,e.lockRef.current))},[]),g=y.useCallback(function(b){f(b.type,Dp(b),b.target,u(b,e.lockRef.current))},[]);y.useEffect(function(){return Sc.push(i),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:g}),document.addEventListener("wheel",d,jc),document.addEventListener("touchmove",d,jc),document.addEventListener("touchstart",m,jc),function(){Sc=Sc.filter(function(b){return b!==i}),document.removeEventListener("wheel",d,jc),document.removeEventListener("touchmove",d,jc),document.removeEventListener("touchstart",m,jc)}},[]);var x=e.removeScrollBar,j=e.inert;return y.createElement(y.Fragment,null,j?y.createElement(i,{styles:Iye(a)}):null,x?y.createElement(Eye,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function zye(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const qye=pye(fF,Bye);var $h=y.forwardRef(function(e,t){return y.createElement(Ty,Ja({},e,{ref:t,sideCar:qye}))});$h.classNames=Ty.classNames;var Fye=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},_c=new WeakMap,$p=new WeakMap,Ip={},KS=0,gF=function(e){return e&&(e.host||gF(e.parentNode))},Uye=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=gF(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Hye=function(e,t,n,r){var a=Uye(t,Array.isArray(e)?e:[e]);Ip[n]||(Ip[n]=new WeakMap);var i=Ip[n],l=[],u=new Set,d=new Set(a),f=function(p){!p||u.has(p)||(u.add(p),f(p.parentNode))};a.forEach(f);var m=function(p){!p||d.has(p)||Array.prototype.forEach.call(p.children,function(g){if(u.has(g))m(g);else try{var x=g.getAttribute(r),j=x!==null&&x!=="false",b=(_c.get(g)||0)+1,w=(i.get(g)||0)+1;_c.set(g,b),i.set(g,w),l.push(g),b===1&&j&&$p.set(g,!0),w===1&&g.setAttribute(n,"true"),j||g.setAttribute(r,"true")}catch(N){console.error("aria-hidden: cannot operate on ",g,N)}})};return m(t),u.clear(),KS++,function(){l.forEach(function(p){var g=_c.get(p)-1,x=i.get(p)-1;_c.set(p,g),i.set(p,x),g||($p.has(p)||p.removeAttribute(r),$p.delete(p)),x||p.removeAttribute(n)}),KS--,KS||(_c=new WeakMap,_c=new WeakMap,$p=new WeakMap,Ip={})}},ky=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=Fye(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),Hye(r,a,n,"aria-hidden")):function(){return null}};function Wye(e){const t=Vye(e),n=y.forwardRef((r,a)=>{const{children:i,...l}=r,u=y.Children.toArray(i),d=u.find(Yye);if(d){const f=d.props.children,m=u.map(p=>p===d?y.Children.count(f)>1?y.Children.only(null):y.isValidElement(f)?f.props.children:null:p);return s.jsx(t,{...l,ref:a,children:y.isValidElement(f)?y.cloneElement(f,void 0,m):null})}return s.jsx(t,{...l,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}function Vye(e){const t=y.forwardRef((n,r)=>{const{children:a,...i}=n;if(y.isValidElement(a)){const l=Xye(a),u=Kye(i,a.props);return a.type!==y.Fragment&&(u.ref=r?Tr(r,l):l),y.cloneElement(a,u)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Gye=Symbol("radix.slottable");function Yye(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Gye}function Kye(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...u)=>{const d=i(...u);return a(...u),d}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function Xye(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Py="Dialog",[yF,xF]=ur(Py),[Zye,Ha]=yF(Py),bF=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:l=!0}=e,u=y.useRef(null),d=y.useRef(null),[f,m]=wa({prop:r,defaultProp:a??!1,onChange:i,caller:Py});return s.jsx(Zye,{scope:t,triggerRef:u,contentRef:d,contentId:kn(),titleId:kn(),descriptionId:kn(),open:f,onOpenChange:m,onOpenToggle:y.useCallback(()=>m(p=>!p),[m]),modal:l,children:n})};bF.displayName=Py;var wF="DialogTrigger",jF=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Ha(wF,n),i=qe(t,a.triggerRef);return s.jsx(Me.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":QC(a.open),...r,ref:i,onClick:Se(e.onClick,a.onOpenToggle)})});jF.displayName=wF;var XC="DialogPortal",[Qye,SF]=yF(XC,{forceMount:void 0}),_F=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,i=Ha(XC,t);return s.jsx(Qye,{scope:t,forceMount:n,children:y.Children.map(r,l=>s.jsx(Sn,{present:n||i.open,children:s.jsx(jl,{asChild:!0,container:a,children:l})}))})};_F.displayName=XC;var xg="DialogOverlay",NF=y.forwardRef((e,t)=>{const n=SF(xg,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,i=Ha(xg,e.__scopeDialog);return i.modal?s.jsx(Sn,{present:r||i.open,children:s.jsx(exe,{...a,ref:t})}):null});NF.displayName=xg;var Jye=Wye("DialogOverlay.RemoveScroll"),exe=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Ha(xg,n);return s.jsx($h,{as:Jye,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(Me.div,{"data-state":QC(a.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),ul="DialogContent",OF=y.forwardRef((e,t)=>{const n=SF(ul,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,i=Ha(ul,e.__scopeDialog);return s.jsx(Sn,{present:r||i.open,children:i.modal?s.jsx(txe,{...a,ref:t}):s.jsx(nxe,{...a,ref:t})})});OF.displayName=ul;var txe=y.forwardRef((e,t)=>{const n=Ha(ul,e.__scopeDialog),r=y.useRef(null),a=qe(t,n.contentRef,r);return y.useEffect(()=>{const i=r.current;if(i)return ky(i)},[]),s.jsx(CF,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Se(e.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Se(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0;(l.button===2||u)&&i.preventDefault()}),onFocusOutside:Se(e.onFocusOutside,i=>i.preventDefault())})}),nxe=y.forwardRef((e,t)=>{const n=Ha(ul,e.__scopeDialog),r=y.useRef(!1),a=y.useRef(!1);return s.jsx(CF,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=i.target;n.triggerRef.current?.contains(l)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),CF=y.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...l}=e,u=Ha(ul,n),d=y.useRef(null),f=qe(t,d);return Ay(),s.jsxs(s.Fragment,{children:[s.jsx(Dh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(wl,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":QC(u.open),...l,ref:f,onDismiss:()=>u.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(axe,{titleId:u.titleId}),s.jsx(oxe,{contentRef:d,descriptionId:u.descriptionId})]})]})}),ZC="DialogTitle",EF=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Ha(ZC,n);return s.jsx(Me.h2,{id:a.titleId,...r,ref:t})});EF.displayName=ZC;var AF="DialogDescription",TF=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Ha(AF,n);return s.jsx(Me.p,{id:a.descriptionId,...r,ref:t})});TF.displayName=AF;var kF="DialogClose",PF=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Ha(kF,n);return s.jsx(Me.button,{type:"button",...r,ref:t,onClick:Se(e.onClick,()=>a.onOpenChange(!1))})});PF.displayName=kF;function QC(e){return e?"open":"closed"}var MF="DialogTitleWarning",[rxe,RF]=ZX(MF,{contentName:ul,titleName:ZC,docsSlug:"dialog"}),axe=({titleId:e})=>{const t=RF(MF),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return y.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},ixe="DialogDescriptionWarning",oxe=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${RF(ixe).contentName}}.`;return y.useEffect(()=>{const a=e.current?.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},JC=bF,DF=jF,eE=_F,My=NF,Ry=OF,tE=EF,nE=TF,rE=PF;const Jn=JC,$F=DF,sxe=eE,IF=y.forwardRef(({className:e,...t},n)=>s.jsx(My,{ref:n,className:ue("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));IF.displayName=My.displayName;const zn=y.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(sxe,{children:[s.jsx(IF,{}),s.jsxs(Ry,{ref:r,className:ue("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,s.jsxs(rE,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[s.jsx(_y,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));zn.displayName=Ry.displayName;const qn=({className:e,...t})=>s.jsx("div",{className:ue("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});qn.displayName="DialogHeader";const Pr=({className:e,...t})=>s.jsx("div",{className:ue("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Pr.displayName="DialogFooter";const Fn=y.forwardRef(({className:e,...t},n)=>s.jsx(tE,{ref:n,className:ue("text-lg font-semibold leading-none tracking-tight",e),...t}));Fn.displayName=tE.displayName;const lr=y.forwardRef(({className:e,...t},n)=>s.jsx(nE,{ref:n,className:ue("text-sm text-muted-foreground",e),...t}));lr.displayName=nE.displayName;var lxe=Symbol("radix.slottable");function cxe(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=lxe,t}var LF="AlertDialog",[uxe]=ur(LF,[xF]),co=xF(),BF=e=>{const{__scopeAlertDialog:t,...n}=e,r=co(t);return s.jsx(JC,{...r,...n,modal:!0})};BF.displayName=LF;var dxe="AlertDialogTrigger",zF=y.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=co(n);return s.jsx(DF,{...a,...r,ref:t})});zF.displayName=dxe;var fxe="AlertDialogPortal",qF=e=>{const{__scopeAlertDialog:t,...n}=e,r=co(t);return s.jsx(eE,{...r,...n})};qF.displayName=fxe;var hxe="AlertDialogOverlay",FF=y.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=co(n);return s.jsx(My,{...a,...r,ref:t})});FF.displayName=hxe;var Hc="AlertDialogContent",[mxe,pxe]=uxe(Hc),vxe=cxe("AlertDialogContent"),UF=y.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...a}=e,i=co(n),l=y.useRef(null),u=qe(t,l),d=y.useRef(null);return s.jsx(rxe,{contentName:Hc,titleName:HF,docsSlug:"alert-dialog",children:s.jsx(mxe,{scope:n,cancelRef:d,children:s.jsxs(Ry,{role:"alertdialog",...i,...a,ref:u,onOpenAutoFocus:Se(a.onOpenAutoFocus,f=>{f.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[s.jsx(vxe,{children:r}),s.jsx(yxe,{contentRef:l})]})})})});UF.displayName=Hc;var HF="AlertDialogTitle",WF=y.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=co(n);return s.jsx(tE,{...a,...r,ref:t})});WF.displayName=HF;var VF="AlertDialogDescription",GF=y.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=co(n);return s.jsx(nE,{...a,...r,ref:t})});GF.displayName=VF;var gxe="AlertDialogAction",YF=y.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=co(n);return s.jsx(rE,{...a,...r,ref:t})});YF.displayName=gxe;var KF="AlertDialogCancel",XF=y.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=pxe(KF,n),i=co(n),l=qe(t,a);return s.jsx(rE,{...i,...r,ref:l})});XF.displayName=KF;var yxe=({contentRef:e})=>{const t=`\`${Hc}\` requires a description for the component to be accessible for screen reader users. - -You can add a description to the \`${Hc}\` by passing a \`${VF}\` component as a child, which also benefits sighted users by adding visible context to the dialog. - -Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Hc}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. - -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return y.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},xxe=BF,bxe=zF,wxe=qF,ZF=FF,QF=UF,JF=YF,e8=XF,t8=WF,n8=GF;const Qn=xxe,Ia=bxe,jxe=wxe,r8=y.forwardRef(({className:e,...t},n)=>s.jsx(ZF,{className:ue("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));r8.displayName=ZF.displayName;const Pn=y.forwardRef(({className:e,...t},n)=>s.jsxs(jxe,{children:[s.jsx(r8,{}),s.jsx(QF,{ref:n,className:ue("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));Pn.displayName=QF.displayName;const Mn=({className:e,...t})=>s.jsx("div",{className:ue("flex flex-col space-y-2 text-center sm:text-left",e),...t});Mn.displayName="AlertDialogHeader";const Rn=({className:e,...t})=>s.jsx("div",{className:ue("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Rn.displayName="AlertDialogFooter";const Dn=y.forwardRef(({className:e,...t},n)=>s.jsx(t8,{ref:n,className:ue("text-lg font-semibold",e),...t}));Dn.displayName=t8.displayName;const $n=y.forwardRef(({className:e,...t},n)=>s.jsx(n8,{ref:n,className:ue("text-sm text-muted-foreground",e),...t}));$n.displayName=n8.displayName;const In=y.forwardRef(({className:e,...t},n)=>s.jsx(JF,{ref:n,className:ue(lh(),e),...t}));In.displayName=JF.displayName;const Ln=y.forwardRef(({className:e,...t},n)=>s.jsx(e8,{ref:n,className:ue(lh({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Ln.displayName=e8.displayName;function Sxe(){return s.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[s.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),s.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),s.jsxs(al,{defaultValue:"appearance",className:"w-full",children:[s.jsxs(Yo,{className:"grid w-full max-w-full sm:max-w-2xl grid-cols-3",children:[s.jsxs(Tt,{value:"appearance",className:"gap-2",children:[s.jsx(Sf,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"外观"]}),s.jsxs(Tt,{value:"security",className:"gap-2",children:[s.jsx(Zve,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"安全"]}),s.jsxs(Tt,{value:"about",className:"gap-2",children:[s.jsx(Uq,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"关于"]})]}),s.jsxs(Kt,{className:"h-[calc(100vh-280px)] mt-6",children:[s.jsx(Jt,{value:"appearance",className:"mt-0",children:s.jsx(_xe,{})}),s.jsx(Jt,{value:"security",className:"mt-0",children:s.jsx(Nxe,{})}),s.jsx(Jt,{value:"about",className:"mt-0",children:s.jsx(Oxe,{})})]})]})]})}function JL(e){const t=document.documentElement,r={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[e];if(r)t.style.setProperty("--primary",r.hsl),r.gradient?(t.style.setProperty("--primary-gradient",r.gradient),t.classList.add("has-gradient")):(t.style.removeProperty("--primary-gradient"),t.classList.remove("has-gradient"));else if(e.startsWith("#")){const a=i=>{i=i.replace("#","");const l=parseInt(i.substring(0,2),16)/255,u=parseInt(i.substring(2,4),16)/255,d=parseInt(i.substring(4,6),16)/255,f=Math.max(l,u,d),m=Math.min(l,u,d);let p=0,g=0;const x=(f+m)/2;if(f!==m){const j=f-m;switch(g=x>.5?j/(2-f-m):j/(f+m),f){case l:p=((u-d)/j+(ulocalStorage.getItem("accent-color")||"blue");y.useEffect(()=>{const f=localStorage.getItem("accent-color")||"blue";JL(f)},[]);const d=f=>{u(f),localStorage.setItem("accent-color",f),JL(f)};return s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"主题模式"}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[s.jsx(XS,{value:"light",current:e,onChange:t,label:"浅色",description:"始终使用浅色主题"}),s.jsx(XS,{value:"dark",current:e,onChange:t,label:"深色",description:"始终使用深色主题"}),s.jsx(XS,{value:"system",current:e,onChange:t,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"主题色"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm font-medium mb-3",children:"单色"}),s.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-3",children:[s.jsx(va,{value:"blue",current:l,onChange:d,label:"蓝色",colorClass:"bg-blue-500"}),s.jsx(va,{value:"purple",current:l,onChange:d,label:"紫色",colorClass:"bg-purple-500"}),s.jsx(va,{value:"green",current:l,onChange:d,label:"绿色",colorClass:"bg-green-500"}),s.jsx(va,{value:"orange",current:l,onChange:d,label:"橙色",colorClass:"bg-orange-500"}),s.jsx(va,{value:"pink",current:l,onChange:d,label:"粉色",colorClass:"bg-pink-500"}),s.jsx(va,{value:"red",current:l,onChange:d,label:"红色",colorClass:"bg-red-500"})]})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm font-medium mb-3",children:"渐变色"}),s.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-3",children:[s.jsx(va,{value:"gradient-sunset",current:l,onChange:d,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),s.jsx(va,{value:"gradient-ocean",current:l,onChange:d,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),s.jsx(va,{value:"gradient-forest",current:l,onChange:d,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),s.jsx(va,{value:"gradient-aurora",current:l,onChange:d,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),s.jsx(va,{value:"gradient-fire",current:l,onChange:d,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),s.jsx(va,{value:"gradient-twilight",current:l,onChange:d,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm font-medium mb-3",children:"自定义颜色"}),s.jsxs("div",{className:"flex gap-4 items-center",children:[s.jsx("div",{className:"flex-1",children:s.jsx("input",{type:"color",value:l.startsWith("#")?l:"#3b82f6",onChange:f=>d(f.target.value),className:"h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),s.jsx("div",{className:"flex-1",children:s.jsx(Oe,{type:"text",value:l,onChange:f=>d(f.target.value),placeholder:"#3b82f6",className:"font-mono"})})]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"动画效果"}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"rounded-lg border bg-card p-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-0.5 flex-1",children:[s.jsx(re,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),s.jsx(ht,{id:"animations",checked:n,onCheckedChange:r})]})}),s.jsx("div",{className:"rounded-lg border bg-card p-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-0.5 flex-1",children:[s.jsx(re,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),s.jsx(ht,{id:"waves-background",checked:a,onCheckedChange:i})]})})]})]})]})}function Nxe(){const e=qa(),[t,n]=y.useState(""),[r,a]=y.useState(""),[i,l]=y.useState(!1),[u,d]=y.useState(!1),[f,m]=y.useState(!1),[p,g]=y.useState(!1),[x,j]=y.useState(!1),[b,w]=y.useState(!1),[N,O]=y.useState(""),[C,A]=y.useState(!1),{toast:E}=Dr(),k=y.useMemo(()=>zge(r),[r]),T=()=>localStorage.getItem("access-token")||"",P=async H=>{try{await navigator.clipboard.writeText(H),j(!0),E({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>j(!1),2e3)}catch{E({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},$=async()=>{if(!r.trim()){E({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!k.isValid){const H=k.rules.filter(G=>!G.passed).map(G=>G.label).join(", ");E({title:"格式错误",description:`Token 不符合要求: ${H}`,variant:"destructive"});return}m(!0);try{const H=T(),G=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${H}`},body:JSON.stringify({new_token:r.trim()})}),L=await G.json();G.ok&&L.success?(localStorage.setItem("access-token",r.trim()),a(""),t&&n(r.trim()),E({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),e({to:"/auth"})},1500)):E({title:"更新失败",description:L.message||"无法更新 Token",variant:"destructive"})}catch(H){console.error("更新 Token 错误:",H),E({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{m(!1)}},F=async()=>{g(!0);try{const H=T(),G=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${H}`}}),L=await G.json();G.ok&&L.success?(localStorage.setItem("access-token",L.token),n(L.token),O(L.token),w(!0),A(!1),E({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):E({title:"生成失败",description:L.message||"无法生成新 Token",variant:"destructive"})}catch(H){console.error("生成 Token 错误:",H),E({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{g(!1)}},D=async()=>{try{await navigator.clipboard.writeText(N),A(!0),E({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{E({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},U=()=>{w(!1),setTimeout(()=>{O(""),A(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),e({to:"/auth"})},500)},V=H=>{H||U()};return s.jsxs("div",{className:"space-y-6",children:[s.jsx(Jn,{open:b,onOpenChange:V,children:s.jsxs(zn,{className:"sm:max-w-md",children:[s.jsxs(qn,{children:[s.jsxs(Fn,{className:"flex items-center gap-2",children:[s.jsx(Fc,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),s.jsx(lr,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[s.jsx(re,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),s.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:N})]}),s.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Fc,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[s.jsx("p",{className:"font-semibold",children:"重要提示"}),s.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[s.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),s.jsx("li",{children:"请立即复制并保存到安全的位置"}),s.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),s.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),s.jsxs(Pr,{className:"gap-2 sm:gap-0",children:[s.jsx(me,{variant:"outline",onClick:D,className:"gap-2",children:C?s.jsxs(s.Fragment,{children:[s.jsx(Js,{className:"h-4 w-4 text-green-500"}),"已复制"]}):s.jsxs(s.Fragment,{children:[s.jsx(zN,{className:"h-4 w-4"}),"复制 Token"]})}),s.jsx(me,{onClick:U,children:"我已保存,关闭"})]})]})}),s.jsxs("div",{className:"rounded-lg border bg-card p-6",children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"当前 Access Token"}),s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"current-token",children:"您的访问令牌"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(Oe,{id:"current-token",type:i?"text":"password",value:t||T(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),s.jsx("button",{onClick:()=>{t||n(T()),l(!i)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:i?"隐藏":"显示",children:i?s.jsx(FN,{className:"h-4 w-4 text-muted-foreground"}):s.jsx(to,{className:"h-4 w-4 text-muted-foreground"})})]}),s.jsx(me,{variant:"outline",size:"icon",onClick:()=>P(T()),title:"复制到剪贴板",children:x?s.jsx(Js,{className:"h-4 w-4 text-green-500"}):s.jsx(zN,{className:"h-4 w-4"})}),s.jsxs(Qn,{children:[s.jsx(Ia,{asChild:!0,children:s.jsxs(me,{variant:"outline",disabled:p,className:"gap-2",children:[s.jsx(tl,{className:ue("h-4 w-4",p&&"animate-spin")}),"重新生成"]})}),s.jsxs(Pn,{children:[s.jsxs(Mn,{children:[s.jsx(Dn,{children:"确认重新生成 Token"}),s.jsx($n,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),s.jsxs(Rn,{children:[s.jsx(Ln,{children:"取消"}),s.jsx(In,{onClick:F,children:"确认生成"})]})]})]})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),s.jsxs("div",{className:"rounded-lg border bg-card p-6",children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"自定义 Access Token"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"new-token",children:"新的访问令牌"}),s.jsxs("div",{className:"relative",children:[s.jsx(Oe,{id:"new-token",type:u?"text":"password",value:r,onChange:H=>a(H.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),s.jsx("button",{onClick:()=>d(!u),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:u?"隐藏":"显示",children:u?s.jsx(FN,{className:"h-4 w-4 text-muted-foreground"}):s.jsx(to,{className:"h-4 w-4 text-muted-foreground"})})]}),r&&s.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),s.jsx("div",{className:"space-y-1.5",children:k.rules.map(H=>s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[H.passed?s.jsx(mg,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):s.jsx(Fq,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),s.jsx("span",{className:ue(H.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:H.label})]},H.id))}),k.isValid&&s.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:s.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[s.jsx(Js,{className:"h-4 w-4"}),s.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),s.jsx(me,{onClick:$,disabled:f||!k.isValid||!r,className:"w-full sm:w-auto",children:f?"更新中...":"更新自定义 Token"})]})]}),s.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-4",children:[s.jsx("h4",{className:"font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),s.jsxs("ul",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[s.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),s.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),s.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),s.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),s.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),s.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function Oxe(){return s.jsx("div",{className:"space-y-6",children:s.jsxs("div",{className:"rounded-lg border bg-card p-6",children:[s.jsxs("h3",{className:"text-lg font-semibold mb-4",children:["关于 ",iF]}),s.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[s.jsxs("p",{children:["版本: ",KC]}),s.jsx("p",{children:"基于 React 19 + Vite + TanStack Router"})]})]})})}function XS({value:e,current:t,onChange:n,label:r,description:a}){const i=t===e;return s.jsxs("button",{onClick:()=>n(e),className:ue("relative rounded-lg border-2 p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&s.jsx("div",{className:"absolute top-3 right-3 h-2 w-2 rounded-full bg-primary"}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("div",{className:"font-medium",children:r}),s.jsx("div",{className:"text-xs text-muted-foreground",children:a})]}),s.jsxs("div",{className:"mt-3 flex gap-1",children:[e==="light"&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),s.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),s.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),e==="dark"&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),s.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),s.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),e==="system"&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),s.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),s.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function va({value:e,current:t,onChange:n,label:r,colorClass:a}){const i=t===e;return s.jsxs("button",{onClick:()=>n(e),className:ue("relative rounded-lg border-2 p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&s.jsx("div",{className:"absolute top-2 right-2 h-2 w-2 rounded-full bg-primary"}),s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("div",{className:ue("h-10 w-10 rounded-full",a)}),s.jsx("div",{className:"text-xs font-medium",children:r})]})]})}class Cxe{grad3;p;perm;constructor(t=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let n=0;n<256;n++)this.p[n]=Math.floor(Math.random()*256);this.perm=[];for(let n=0;n<512;n++)this.perm[n]=this.p[n&255]}dot(t,n,r){return t[0]*n+t[1]*r}mix(t,n,r){return(1-r)*t+r*n}fade(t){return t*t*t*(t*(t*6-15)+10)}perlin2(t,n){const r=Math.floor(t)&255,a=Math.floor(n)&255;t-=Math.floor(t),n-=Math.floor(n);const i=this.fade(t),l=this.fade(n),u=this.perm[r]+a,d=this.perm[u],f=this.perm[u+1],m=this.perm[r+1]+a,p=this.perm[m],g=this.perm[m+1];return this.mix(this.mix(this.dot(this.grad3[d%12],t,n),this.dot(this.grad3[p%12],t-1,n),i),this.mix(this.dot(this.grad3[f%12],t,n-1),this.dot(this.grad3[g%12],t-1,n-1),i),l)}}function Exe(){const e=y.useRef(null),t=y.useRef(null),n=y.useRef(void 0),r=y.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new Cxe(Math.random()),bounding:null});return y.useEffect(()=>{const a=t.current,i=e.current;if(!a||!i)return;const l=r.current,u=()=>{const b=a.getBoundingClientRect();l.bounding=b,i.style.width=`${b.width}px`,i.style.height=`${b.height}px`},d=()=>{if(!l.bounding)return;const{width:b,height:w}=l.bounding;l.lines=[],l.paths.forEach($=>$.remove()),l.paths=[];const N=10,O=32,C=b+200,A=w+30,E=Math.ceil(C/N),k=Math.ceil(A/O),T=(b-N*E)/2,P=(w-O*k)/2;for(let $=0;$<=E;$++){const F=[];for(let U=0;U<=k;U++){const V={x:T+N*$,y:P+O*U,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};F.push(V)}const D=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild(D),l.paths.push(D),l.lines.push(F)}},f=b=>{const{lines:w,mouse:N,noise:O}=l;w.forEach(C=>{C.forEach(A=>{const E=O.perlin2((A.x+b*.0125)*.002,(A.y+b*.005)*.0015)*12;A.wave.x=Math.cos(E)*32,A.wave.y=Math.sin(E)*16;const k=A.x-N.sx,T=A.y-N.sy,P=Math.hypot(k,T),$=Math.max(175,N.vs);if(P<$){const F=1-P/$,D=Math.cos(P*.001)*F;A.cursor.vx+=Math.cos(N.a)*D*$*N.vs*65e-5,A.cursor.vy+=Math.sin(N.a)*D*$*N.vs*65e-5}A.cursor.vx+=(0-A.cursor.x)*.005,A.cursor.vy+=(0-A.cursor.y)*.005,A.cursor.vx*=.925,A.cursor.vy*=.925,A.cursor.x+=A.cursor.vx*2,A.cursor.y+=A.cursor.vy*2,A.cursor.x=Math.min(100,Math.max(-100,A.cursor.x)),A.cursor.y=Math.min(100,Math.max(-100,A.cursor.y))})})},m=(b,w=!0)=>{const N={x:b.x+b.wave.x+(w?b.cursor.x:0),y:b.y+b.wave.y+(w?b.cursor.y:0)};return N.x=Math.round(N.x*10)/10,N.y=Math.round(N.y*10)/10,N},p=()=>{const{lines:b,paths:w}=l;b.forEach((N,O)=>{let C=m(N[0],!1),A=`M ${C.x} ${C.y}`;N.forEach((E,k)=>{const T=k===N.length-1;C=m(E,!T),A+=`L ${C.x} ${C.y}`}),w[O].setAttribute("d",A)})},g=b=>{const{mouse:w}=l;w.sx+=(w.x-w.sx)*.1,w.sy+=(w.y-w.sy)*.1;const N=w.x-w.lx,O=w.y-w.ly,C=Math.hypot(N,O);w.v=C,w.vs+=(C-w.vs)*.1,w.vs=Math.min(100,w.vs),w.lx=w.x,w.ly=w.y,w.a=Math.atan2(O,N),a&&(a.style.setProperty("--x",`${w.sx}px`),a.style.setProperty("--y",`${w.sy}px`)),f(b),p(),n.current=requestAnimationFrame(g)},x=b=>{if(!l.bounding)return;const{mouse:w}=l;w.x=b.pageX-l.bounding.left,w.y=b.pageY-l.bounding.top+window.scrollY,w.set||(w.sx=w.x,w.sy=w.y,w.lx=w.x,w.ly=w.y,w.set=!0)},j=()=>{u(),d()};return u(),d(),window.addEventListener("resize",j),window.addEventListener("mousemove",x),n.current=requestAnimationFrame(g),()=>{window.removeEventListener("resize",j),window.removeEventListener("mousemove",x),n.current&&cancelAnimationFrame(n.current)}},[]),s.jsxs("div",{ref:t,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[s.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),s.jsx("svg",{ref:e,style:{display:"block",width:"100%",height:"100%"},children:s.jsx("style",{children:` - path { - fill: none; - stroke: hsl(var(--primary) / 0.20); - stroke-width: 1px; - } - `})})]})}function Axe(){const e=qa();y.useEffect(()=>{localStorage.getItem("access-token")||e({to:"/auth"})},[e])}function a8(){return!!localStorage.getItem("access-token")}function Txe(){const[e,t]=y.useState(""),[n,r]=y.useState(!1),[a,i]=y.useState(""),l=qa(),{enableWavesBackground:u,setEnableWavesBackground:d}=Xq(),{theme:f,setTheme:m}=YC();y.useEffect(()=>{a8()&&l({to:"/"})},[l]);const g=f==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":f,x=()=>{m(g==="dark"?"light":"dark")},j=async b=>{if(b.preventDefault(),i(""),!e.trim()){i("请输入 Access Token");return}r(!0);try{const w=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e.trim()})}),N=await w.json();w.ok&&N.valid?(localStorage.setItem("access-token",e.trim()),l({to:"/"})):i(N.message||"Token 验证失败,请检查后重试")}catch(w){console.error("Token 验证错误:",w),i("连接服务器失败,请检查网络连接")}finally{r(!1)}};return s.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[u&&s.jsx(Exe,{}),s.jsxs(ct,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[s.jsx("button",{onClick:x,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:g==="dark"?"切换到浅色模式":"切换到深色模式",children:g==="dark"?s.jsx(VN,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):s.jsx(WN,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),s.jsxs(Ut,{className:"space-y-4 text-center",children:[s.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:s.jsx(DL,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ht,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),s.jsx(Xn,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),s.jsx(un,{children:s.jsxs("form",{onSubmit:j,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),s.jsxs("div",{className:"relative",children:[s.jsx(_ve,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),s.jsx(Oe,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:e,onChange:b=>t(b.target.value),className:ue("pl-10",a&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),a&&s.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[s.jsx(hg,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),s.jsx("span",{children:a})]}),s.jsx(me,{type:"submit",className:"w-full",disabled:n,children:n?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),s.jsxs(Jn,{children:[s.jsx($F,{asChild:!0,children:s.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[s.jsx(eve,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),s.jsxs(zn,{className:"sm:max-w-md",children:[s.jsxs(qn,{children:[s.jsxs(Fn,{className:"flex items-center gap-2",children:[s.jsx(DL,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),s.jsx(lr,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(rge,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),s.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[s.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),s.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),s.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(WC,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),s.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:s.jsx("code",{className:"text-primary",children:"data/webui.json"})}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",s.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),s.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(hg,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),s.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[s.jsx("p",{className:"font-semibold",children:"安全提示"}),s.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[s.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),s.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),s.jsxs(Qn,{children:[s.jsx(Ia,{asChild:!0,children:s.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[s.jsx(GN,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),s.jsxs(Pn,{children:[s.jsxs(Mn,{children:[s.jsxs(Dn,{className:"flex items-center gap-2",children:[s.jsx(GN,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),s.jsx($n,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),s.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),s.jsxs(Rn,{children:[s.jsx(Ln,{children:"取消"}),s.jsx(In,{onClick:()=>d(!1),children:"关闭动画"})]})]})]})]})})]}),s.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:s.jsx("p",{children:qge})})]})}function i8(){const e=qa();return s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsxs("div",{className:"w-full max-w-2xl text-center",children:[s.jsxs("div",{className:"relative mb-8",children:[s.jsx("h1",{className:"text-[150px] font-black leading-none text-primary/10 select-none sm:text-[200px]",children:"404"}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:s.jsx(kr,{className:"h-20 w-20 text-primary/30 sm:h-24 sm:w-24"})})]}),s.jsxs("div",{className:"space-y-4 mb-8",children:[s.jsx("h2",{className:"text-2xl font-bold text-foreground sm:text-3xl",children:"页面未找到"}),s.jsx("p",{className:"text-base text-muted-foreground sm:text-lg max-w-md mx-auto",children:"抱歉,您访问的页面不存在或已被移除。请检查 URL 是否正确,或返回首页继续浏览。"})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4",children:[s.jsxs(me,{size:"lg",onClick:()=>e({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[s.jsx(gg,{className:"h-4 w-4"}),"返回首页"]}),s.jsxs(me,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[s.jsx(Lq,{className:"h-4 w-4"}),"返回上一页"]})]}),s.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}const fn=y.forwardRef(({className:e,...t},n)=>s.jsx("textarea",{className:ue("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));fn.displayName="Textarea";var o8=["PageUp","PageDown"],s8=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],l8={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Fu="Slider",[XN,kxe,Pxe]=wh(Fu),[c8]=ur(Fu,[Pxe]),[Mxe,Dy]=c8(Fu),u8=y.forwardRef((e,t)=>{const{name:n,min:r=0,max:a=100,step:i=1,orientation:l="horizontal",disabled:u=!1,minStepsBetweenThumbs:d=0,defaultValue:f=[r],value:m,onValueChange:p=()=>{},onValueCommit:g=()=>{},inverted:x=!1,form:j,...b}=e,w=y.useRef(new Set),N=y.useRef(0),C=l==="horizontal"?Rxe:Dxe,[A=[],E]=wa({prop:m,defaultProp:f,onChange:D=>{[...w.current][N.current]?.focus(),p(D)}}),k=y.useRef(A);function T(D){const U=zxe(A,D);F(D,U)}function P(D){F(D,N.current)}function $(){const D=k.current[N.current];A[N.current]!==D&&g(A)}function F(D,U,{commit:V}={commit:!1}){const H=Hxe(i),G=Wxe(Math.round((D-r)/i)*i+r,H),L=Nf(G,[r,a]);E((R=[])=>{const q=Lxe(R,L,U);if(Uxe(q,d*i)){N.current=q.indexOf(L);const K=String(q)!==String(R);return K&&V&&g(q),K?q:R}else return R})}return s.jsx(Mxe,{scope:e.__scopeSlider,name:n,disabled:u,min:r,max:a,valueIndexToChangeRef:N,thumbs:w.current,values:A,orientation:l,form:j,children:s.jsx(XN.Provider,{scope:e.__scopeSlider,children:s.jsx(XN.Slot,{scope:e.__scopeSlider,children:s.jsx(C,{"aria-disabled":u,"data-disabled":u?"":void 0,...b,ref:t,onPointerDown:Se(b.onPointerDown,()=>{u||(k.current=A)}),min:r,max:a,inverted:x,onSlideStart:u?void 0:T,onSlideMove:u?void 0:P,onSlideEnd:u?void 0:$,onHomeKeyDown:()=>!u&&F(r,0,{commit:!0}),onEndKeyDown:()=>!u&&F(a,A.length-1,{commit:!0}),onStepKeyDown:({event:D,direction:U})=>{if(!u){const G=o8.includes(D.key)||D.shiftKey&&s8.includes(D.key)?10:1,L=N.current,R=A[L],q=i*G*U;F(R+q,L,{commit:!0})}}})})})})});u8.displayName=Fu;var[d8,f8]=c8(Fu,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Rxe=y.forwardRef((e,t)=>{const{min:n,max:r,dir:a,inverted:i,onSlideStart:l,onSlideMove:u,onSlideEnd:d,onStepKeyDown:f,...m}=e,[p,g]=y.useState(null),x=qe(t,C=>g(C)),j=y.useRef(void 0),b=Mu(a),w=b==="ltr",N=w&&!i||!w&&i;function O(C){const A=j.current||p.getBoundingClientRect(),E=[0,A.width],T=aE(E,N?[n,r]:[r,n]);return j.current=A,T(C-A.left)}return s.jsx(d8,{scope:e.__scopeSlider,startEdge:N?"left":"right",endEdge:N?"right":"left",direction:N?1:-1,size:"width",children:s.jsx(h8,{dir:b,"data-orientation":"horizontal",...m,ref:x,style:{...m.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const A=O(C.clientX);l?.(A)},onSlideMove:C=>{const A=O(C.clientX);u?.(A)},onSlideEnd:()=>{j.current=void 0,d?.()},onStepKeyDown:C=>{const E=l8[N?"from-left":"from-right"].includes(C.key);f?.({event:C,direction:E?-1:1})}})})}),Dxe=y.forwardRef((e,t)=>{const{min:n,max:r,inverted:a,onSlideStart:i,onSlideMove:l,onSlideEnd:u,onStepKeyDown:d,...f}=e,m=y.useRef(null),p=qe(t,m),g=y.useRef(void 0),x=!a;function j(b){const w=g.current||m.current.getBoundingClientRect(),N=[0,w.height],C=aE(N,x?[r,n]:[n,r]);return g.current=w,C(b-w.top)}return s.jsx(d8,{scope:e.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:s.jsx(h8,{"data-orientation":"vertical",...f,ref:p,style:{...f.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:b=>{const w=j(b.clientY);i?.(w)},onSlideMove:b=>{const w=j(b.clientY);l?.(w)},onSlideEnd:()=>{g.current=void 0,u?.()},onStepKeyDown:b=>{const N=l8[x?"from-bottom":"from-top"].includes(b.key);d?.({event:b,direction:N?-1:1})}})})}),h8=y.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:l,onEndKeyDown:u,onStepKeyDown:d,...f}=e,m=Dy(Fu,n);return s.jsx(Me.span,{...f,ref:t,onKeyDown:Se(e.onKeyDown,p=>{p.key==="Home"?(l(p),p.preventDefault()):p.key==="End"?(u(p),p.preventDefault()):o8.concat(s8).includes(p.key)&&(d(p),p.preventDefault())}),onPointerDown:Se(e.onPointerDown,p=>{const g=p.target;g.setPointerCapture(p.pointerId),p.preventDefault(),m.thumbs.has(g)?g.focus():r(p)}),onPointerMove:Se(e.onPointerMove,p=>{p.target.hasPointerCapture(p.pointerId)&&a(p)}),onPointerUp:Se(e.onPointerUp,p=>{const g=p.target;g.hasPointerCapture(p.pointerId)&&(g.releasePointerCapture(p.pointerId),i(p))})})}),m8="SliderTrack",p8=y.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,a=Dy(m8,n);return s.jsx(Me.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:t})});p8.displayName=m8;var ZN="SliderRange",v8=y.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,a=Dy(ZN,n),i=f8(ZN,n),l=y.useRef(null),u=qe(t,l),d=a.values.length,f=a.values.map(g=>x8(g,a.min,a.max)),m=d>1?Math.min(...f):0,p=100-Math.max(...f);return s.jsx(Me.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:u,style:{...e.style,[i.startEdge]:m+"%",[i.endEdge]:p+"%"}})});v8.displayName=ZN;var QN="SliderThumb",g8=y.forwardRef((e,t)=>{const n=kxe(e.__scopeSlider),[r,a]=y.useState(null),i=qe(t,u=>a(u)),l=y.useMemo(()=>r?n().findIndex(u=>u.ref.current===r):-1,[n,r]);return s.jsx($xe,{...e,ref:i,index:l})}),$xe=y.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:a,...i}=e,l=Dy(QN,n),u=f8(QN,n),[d,f]=y.useState(null),m=qe(t,O=>f(O)),p=d?l.form||!!d.closest("form"):!0,g=Cy(d),x=l.values[r],j=x===void 0?0:x8(x,l.min,l.max),b=Bxe(r,l.values.length),w=g?.[u.size],N=w?qxe(w,j,u.direction):0;return y.useEffect(()=>{if(d)return l.thumbs.add(d),()=>{l.thumbs.delete(d)}},[d,l.thumbs]),s.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[u.startEdge]:`calc(${j}% + ${N}px)`},children:[s.jsx(XN.ItemSlot,{scope:e.__scopeSlider,children:s.jsx(Me.span,{role:"slider","aria-label":e["aria-label"]||b,"aria-valuemin":l.min,"aria-valuenow":x,"aria-valuemax":l.max,"aria-orientation":l.orientation,"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,tabIndex:l.disabled?void 0:0,...i,ref:m,style:x===void 0?{display:"none"}:e.style,onFocus:Se(e.onFocus,()=>{l.valueIndexToChangeRef.current=r})})}),p&&s.jsx(y8,{name:a??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:x},r)]})});g8.displayName=QN;var Ixe="RadioBubbleInput",y8=y.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{const a=y.useRef(null),i=qe(a,r),l=Oy(t);return y.useEffect(()=>{const u=a.current;if(!u)return;const d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==t&&m){const p=new Event("input",{bubbles:!0});m.call(u,t),u.dispatchEvent(p)}},[l,t]),s.jsx(Me.input,{style:{display:"none"},...n,ref:i,defaultValue:t})});y8.displayName=Ixe;function Lxe(e=[],t,n){const r=[...e];return r[n]=t,r.sort((a,i)=>a-i)}function x8(e,t,n){const i=100/(n-t)*(e-t);return Nf(i,[0,100])}function Bxe(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function zxe(e,t){if(e.length===1)return 0;const n=e.map(a=>Math.abs(a-t)),r=Math.min(...n);return n.indexOf(r)}function qxe(e,t,n){const r=e/2,i=aE([0,50],[0,r]);return(r-i(t)*n)*n}function Fxe(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Uxe(e,t){if(t>0){const n=Fxe(e);return Math.min(...n)>=t}return!0}function aE(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Hxe(e){return(String(e).split(".")[1]||"").length}function Wxe(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var b8=u8,Vxe=p8,Gxe=v8,Yxe=g8;const iE=y.forwardRef(({className:e,...t},n)=>s.jsxs(b8,{ref:n,className:ue("relative flex w-full touch-none select-none items-center",e),...t,children:[s.jsx(Vxe,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:s.jsx(Gxe,{className:"absolute h-full bg-primary"})}),s.jsx(Yxe,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));iE.displayName=b8.displayName;const Kxe=["top","right","bottom","left"],Ko=Math.min,Xr=Math.max,bg=Math.round,Lp=Math.floor,ui=e=>({x:e,y:e}),Xxe={left:"right",right:"left",bottom:"top",top:"bottom"},Zxe={start:"end",end:"start"};function JN(e,t,n){return Xr(e,Ko(t,n))}function no(e,t){return typeof e=="function"?e(t):e}function ro(e){return e.split("-")[0]}function Uu(e){return e.split("-")[1]}function oE(e){return e==="x"?"y":"x"}function sE(e){return e==="y"?"height":"width"}const Qxe=new Set(["top","bottom"]);function ii(e){return Qxe.has(ro(e))?"y":"x"}function lE(e){return oE(ii(e))}function Jxe(e,t,n){n===void 0&&(n=!1);const r=Uu(e),a=lE(e),i=sE(a);let l=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=wg(l)),[l,wg(l)]}function ebe(e){const t=wg(e);return[eO(e),t,eO(t)]}function eO(e){return e.replace(/start|end/g,t=>Zxe[t])}const e3=["left","right"],t3=["right","left"],tbe=["top","bottom"],nbe=["bottom","top"];function rbe(e,t,n){switch(e){case"top":case"bottom":return n?t?t3:e3:t?e3:t3;case"left":case"right":return t?tbe:nbe;default:return[]}}function abe(e,t,n,r){const a=Uu(e);let i=rbe(ro(e),n==="start",r);return a&&(i=i.map(l=>l+"-"+a),t&&(i=i.concat(i.map(eO)))),i}function wg(e){return e.replace(/left|right|bottom|top/g,t=>Xxe[t])}function ibe(e){return{top:0,right:0,bottom:0,left:0,...e}}function w8(e){return typeof e!="number"?ibe(e):{top:e,right:e,bottom:e,left:e}}function jg(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function n3(e,t,n){let{reference:r,floating:a}=e;const i=ii(t),l=lE(t),u=sE(l),d=ro(t),f=i==="y",m=r.x+r.width/2-a.width/2,p=r.y+r.height/2-a.height/2,g=r[u]/2-a[u]/2;let x;switch(d){case"top":x={x:m,y:r.y-a.height};break;case"bottom":x={x:m,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:p};break;case"left":x={x:r.x-a.width,y:p};break;default:x={x:r.x,y:r.y}}switch(Uu(t)){case"start":x[l]-=g*(n&&f?-1:1);break;case"end":x[l]+=g*(n&&f?-1:1);break}return x}const obe=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:l}=n,u=i.filter(Boolean),d=await(l.isRTL==null?void 0:l.isRTL(t));let f=await l.getElementRects({reference:e,floating:t,strategy:a}),{x:m,y:p}=n3(f,r,d),g=r,x={},j=0;for(let b=0;b({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:i,platform:l,elements:u,middlewareData:d}=t,{element:f,padding:m=0}=no(e,t)||{};if(f==null)return{};const p=w8(m),g={x:n,y:r},x=lE(a),j=sE(x),b=await l.getDimensions(f),w=x==="y",N=w?"top":"left",O=w?"bottom":"right",C=w?"clientHeight":"clientWidth",A=i.reference[j]+i.reference[x]-g[x]-i.floating[j],E=g[x]-i.reference[x],k=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f));let T=k?k[C]:0;(!T||!await(l.isElement==null?void 0:l.isElement(k)))&&(T=u.floating[C]||i.floating[j]);const P=A/2-E/2,$=T/2-b[j]/2-1,F=Ko(p[N],$),D=Ko(p[O],$),U=F,V=T-b[j]-D,H=T/2-b[j]/2+P,G=JN(U,H,V),L=!d.arrow&&Uu(a)!=null&&H!==G&&i.reference[j]/2-(HH<=0)){var D,U;const H=(((D=i.flip)==null?void 0:D.index)||0)+1,G=T[H];if(G&&(!(p==="alignment"?O!==ii(G):!1)||F.every(q=>ii(q.placement)===O?q.overflows[0]>0:!0)))return{data:{index:H,overflows:F},reset:{placement:G}};let L=(U=F.filter(R=>R.overflows[0]<=0).sort((R,q)=>R.overflows[1]-q.overflows[1])[0])==null?void 0:U.placement;if(!L)switch(x){case"bestFit":{var V;const R=(V=F.filter(q=>{if(k){const K=ii(q.placement);return K===O||K==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(K=>K>0).reduce((K,ee)=>K+ee,0)]).sort((q,K)=>q[1]-K[1])[0])==null?void 0:V[0];R&&(L=R);break}case"initialPlacement":L=u;break}if(a!==L)return{reset:{placement:L}}}return{}}}};function r3(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function a3(e){return Kxe.some(t=>e[t]>=0)}const cbe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...a}=no(e,t);switch(r){case"referenceHidden":{const i=await ch(t,{...a,elementContext:"reference"}),l=r3(i,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:a3(l)}}}case"escaped":{const i=await ch(t,{...a,altBoundary:!0}),l=r3(i,n.floating);return{data:{escapedOffsets:l,escaped:a3(l)}}}default:return{}}}}},j8=new Set(["left","top"]);async function ube(e,t){const{placement:n,platform:r,elements:a}=e,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),l=ro(n),u=Uu(n),d=ii(n)==="y",f=j8.has(l)?-1:1,m=i&&d?-1:1,p=no(t,e);let{mainAxis:g,crossAxis:x,alignmentAxis:j}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return u&&typeof j=="number"&&(x=u==="end"?j*-1:j),d?{x:x*m,y:g*f}:{x:g*f,y:x*m}}const dbe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:i,placement:l,middlewareData:u}=t,d=await ube(t,e);return l===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:a+d.x,y:i+d.y,data:{...d,placement:l}}}}},fbe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:u={fn:w=>{let{x:N,y:O}=w;return{x:N,y:O}}},...d}=no(e,t),f={x:n,y:r},m=await ch(t,d),p=ii(ro(a)),g=oE(p);let x=f[g],j=f[p];if(i){const w=g==="y"?"top":"left",N=g==="y"?"bottom":"right",O=x+m[w],C=x-m[N];x=JN(O,x,C)}if(l){const w=p==="y"?"top":"left",N=p==="y"?"bottom":"right",O=j+m[w],C=j-m[N];j=JN(O,j,C)}const b=u.fn({...t,[g]:x,[p]:j});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[g]:i,[p]:l}}}}}},hbe=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:a,rects:i,middlewareData:l}=t,{offset:u=0,mainAxis:d=!0,crossAxis:f=!0}=no(e,t),m={x:n,y:r},p=ii(a),g=oE(p);let x=m[g],j=m[p];const b=no(u,t),w=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(d){const C=g==="y"?"height":"width",A=i.reference[g]-i.floating[C]+w.mainAxis,E=i.reference[g]+i.reference[C]-w.mainAxis;xE&&(x=E)}if(f){var N,O;const C=g==="y"?"width":"height",A=j8.has(ro(a)),E=i.reference[p]-i.floating[C]+(A&&((N=l.offset)==null?void 0:N[p])||0)+(A?0:w.crossAxis),k=i.reference[p]+i.reference[C]+(A?0:((O=l.offset)==null?void 0:O[p])||0)-(A?w.crossAxis:0);jk&&(j=k)}return{[g]:x,[p]:j}}}},mbe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:i,platform:l,elements:u}=t,{apply:d=()=>{},...f}=no(e,t),m=await ch(t,f),p=ro(a),g=Uu(a),x=ii(a)==="y",{width:j,height:b}=i.floating;let w,N;p==="top"||p==="bottom"?(w=p,N=g===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(N=p,w=g==="end"?"top":"bottom");const O=b-m.top-m.bottom,C=j-m.left-m.right,A=Ko(b-m[w],O),E=Ko(j-m[N],C),k=!t.middlewareData.shift;let T=A,P=E;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=C),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=O),k&&!g){const F=Xr(m.left,0),D=Xr(m.right,0),U=Xr(m.top,0),V=Xr(m.bottom,0);x?P=j-2*(F!==0||D!==0?F+D:Xr(m.left,m.right)):T=b-2*(U!==0||V!==0?U+V:Xr(m.top,m.bottom))}await d({...t,availableWidth:P,availableHeight:T});const $=await l.getDimensions(u.floating);return j!==$.width||b!==$.height?{reset:{rects:!0}}:{}}}};function $y(){return typeof window<"u"}function Hu(e){return S8(e)?(e.nodeName||"").toLowerCase():"#document"}function ea(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function yi(e){var t;return(t=(S8(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function S8(e){return $y()?e instanceof Node||e instanceof ea(e).Node:!1}function Ba(e){return $y()?e instanceof Element||e instanceof ea(e).Element:!1}function mi(e){return $y()?e instanceof HTMLElement||e instanceof ea(e).HTMLElement:!1}function i3(e){return!$y()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ea(e).ShadowRoot}const pbe=new Set(["inline","contents"]);function Ih(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=za(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!pbe.has(a)}const vbe=new Set(["table","td","th"]);function gbe(e){return vbe.has(Hu(e))}const ybe=[":popover-open",":modal"];function Iy(e){return ybe.some(t=>{try{return e.matches(t)}catch{return!1}})}const xbe=["transform","translate","scale","rotate","perspective"],bbe=["transform","translate","scale","rotate","perspective","filter"],wbe=["paint","layout","strict","content"];function cE(e){const t=uE(),n=Ba(e)?za(e):e;return xbe.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||bbe.some(r=>(n.willChange||"").includes(r))||wbe.some(r=>(n.contain||"").includes(r))}function jbe(e){let t=Xo(e);for(;mi(t)&&!Nu(t);){if(cE(t))return t;if(Iy(t))return null;t=Xo(t)}return null}function uE(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Sbe=new Set(["html","body","#document"]);function Nu(e){return Sbe.has(Hu(e))}function za(e){return ea(e).getComputedStyle(e)}function Ly(e){return Ba(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xo(e){if(Hu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||i3(e)&&e.host||yi(e);return i3(t)?t.host:t}function _8(e){const t=Xo(e);return Nu(t)?e.ownerDocument?e.ownerDocument.body:e.body:mi(t)&&Ih(t)?t:_8(t)}function uh(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=_8(e),i=a===((r=e.ownerDocument)==null?void 0:r.body),l=ea(a);if(i){const u=tO(l);return t.concat(l,l.visualViewport||[],Ih(a)?a:[],u&&n?uh(u):[])}return t.concat(a,uh(a,[],n))}function tO(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function N8(e){const t=za(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=mi(e),i=a?e.offsetWidth:n,l=a?e.offsetHeight:r,u=bg(n)!==i||bg(r)!==l;return u&&(n=i,r=l),{width:n,height:r,$:u}}function dE(e){return Ba(e)?e:e.contextElement}function Wc(e){const t=dE(e);if(!mi(t))return ui(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:i}=N8(t);let l=(i?bg(n.width):n.width)/r,u=(i?bg(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const _be=ui(0);function O8(e){const t=ea(e);return!uE()||!t.visualViewport?_be:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Nbe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ea(e)?!1:t}function dl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),i=dE(e);let l=ui(1);t&&(r?Ba(r)&&(l=Wc(r)):l=Wc(e));const u=Nbe(i,n,r)?O8(i):ui(0);let d=(a.left+u.x)/l.x,f=(a.top+u.y)/l.y,m=a.width/l.x,p=a.height/l.y;if(i){const g=ea(i),x=r&&Ba(r)?ea(r):r;let j=g,b=tO(j);for(;b&&r&&x!==j;){const w=Wc(b),N=b.getBoundingClientRect(),O=za(b),C=N.left+(b.clientLeft+parseFloat(O.paddingLeft))*w.x,A=N.top+(b.clientTop+parseFloat(O.paddingTop))*w.y;d*=w.x,f*=w.y,m*=w.x,p*=w.y,d+=C,f+=A,j=ea(b),b=tO(j)}}return jg({width:m,height:p,x:d,y:f})}function By(e,t){const n=Ly(e).scrollLeft;return t?t.left+n:dl(yi(e)).left+n}function C8(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-By(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function Obe(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const i=a==="fixed",l=yi(r),u=t?Iy(t.floating):!1;if(r===l||u&&i)return n;let d={scrollLeft:0,scrollTop:0},f=ui(1);const m=ui(0),p=mi(r);if((p||!p&&!i)&&((Hu(r)!=="body"||Ih(l))&&(d=Ly(r)),mi(r))){const x=dl(r);f=Wc(r),m.x=x.x+r.clientLeft,m.y=x.y+r.clientTop}const g=l&&!p&&!i?C8(l,d):ui(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-d.scrollLeft*f.x+m.x+g.x,y:n.y*f.y-d.scrollTop*f.y+m.y+g.y}}function Cbe(e){return Array.from(e.getClientRects())}function Ebe(e){const t=yi(e),n=Ly(e),r=e.ownerDocument.body,a=Xr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Xr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+By(e);const u=-n.scrollTop;return za(r).direction==="rtl"&&(l+=Xr(t.clientWidth,r.clientWidth)-a),{width:a,height:i,x:l,y:u}}const o3=25;function Abe(e,t){const n=ea(e),r=yi(e),a=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,u=0,d=0;if(a){i=a.width,l=a.height;const m=uE();(!m||m&&t==="fixed")&&(u=a.offsetLeft,d=a.offsetTop)}const f=By(r);if(f<=0){const m=r.ownerDocument,p=m.body,g=getComputedStyle(p),x=m.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,j=Math.abs(r.clientWidth-p.clientWidth-x);j<=o3&&(i-=j)}else f<=o3&&(i+=f);return{width:i,height:l,x:u,y:d}}const Tbe=new Set(["absolute","fixed"]);function kbe(e,t){const n=dl(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,i=mi(e)?Wc(e):ui(1),l=e.clientWidth*i.x,u=e.clientHeight*i.y,d=a*i.x,f=r*i.y;return{width:l,height:u,x:d,y:f}}function s3(e,t,n){let r;if(t==="viewport")r=Abe(e,n);else if(t==="document")r=Ebe(yi(e));else if(Ba(t))r=kbe(t,n);else{const a=O8(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return jg(r)}function E8(e,t){const n=Xo(e);return n===t||!Ba(n)||Nu(n)?!1:za(n).position==="fixed"||E8(n,t)}function Pbe(e,t){const n=t.get(e);if(n)return n;let r=uh(e,[],!1).filter(u=>Ba(u)&&Hu(u)!=="body"),a=null;const i=za(e).position==="fixed";let l=i?Xo(e):e;for(;Ba(l)&&!Nu(l);){const u=za(l),d=cE(l);!d&&u.position==="fixed"&&(a=null),(i?!d&&!a:!d&&u.position==="static"&&!!a&&Tbe.has(a.position)||Ih(l)&&!d&&E8(e,l))?r=r.filter(m=>m!==l):a=u,l=Xo(l)}return t.set(e,r),r}function Mbe(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const l=[...n==="clippingAncestors"?Iy(t)?[]:Pbe(t,this._c):[].concat(n),r],u=l[0],d=l.reduce((f,m)=>{const p=s3(t,m,a);return f.top=Xr(p.top,f.top),f.right=Ko(p.right,f.right),f.bottom=Ko(p.bottom,f.bottom),f.left=Xr(p.left,f.left),f},s3(t,u,a));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function Rbe(e){const{width:t,height:n}=N8(e);return{width:t,height:n}}function Dbe(e,t,n){const r=mi(t),a=yi(t),i=n==="fixed",l=dl(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const d=ui(0);function f(){d.x=By(a)}if(r||!r&&!i)if((Hu(t)!=="body"||Ih(a))&&(u=Ly(t)),r){const x=dl(t,!0,i,t);d.x=x.x+t.clientLeft,d.y=x.y+t.clientTop}else a&&f();i&&!r&&a&&f();const m=a&&!r&&!i?C8(a,u):ui(0),p=l.left+u.scrollLeft-d.x-m.x,g=l.top+u.scrollTop-d.y-m.y;return{x:p,y:g,width:l.width,height:l.height}}function ZS(e){return za(e).position==="static"}function l3(e,t){if(!mi(e)||za(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return yi(e)===n&&(n=n.ownerDocument.body),n}function A8(e,t){const n=ea(e);if(Iy(e))return n;if(!mi(e)){let a=Xo(e);for(;a&&!Nu(a);){if(Ba(a)&&!ZS(a))return a;a=Xo(a)}return n}let r=l3(e,t);for(;r&&gbe(r)&&ZS(r);)r=l3(r,t);return r&&Nu(r)&&ZS(r)&&!cE(r)?n:r||jbe(e)||n}const $be=async function(e){const t=this.getOffsetParent||A8,n=this.getDimensions,r=await n(e.floating);return{reference:Dbe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ibe(e){return za(e).direction==="rtl"}const Lbe={convertOffsetParentRelativeRectToViewportRelativeRect:Obe,getDocumentElement:yi,getClippingRect:Mbe,getOffsetParent:A8,getElementRects:$be,getClientRects:Cbe,getDimensions:Rbe,getScale:Wc,isElement:Ba,isRTL:Ibe};function T8(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Bbe(e,t){let n=null,r;const a=yi(e);function i(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function l(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),i();const f=e.getBoundingClientRect(),{left:m,top:p,width:g,height:x}=f;if(u||t(),!g||!x)return;const j=Lp(p),b=Lp(a.clientWidth-(m+g)),w=Lp(a.clientHeight-(p+x)),N=Lp(m),C={rootMargin:-j+"px "+-b+"px "+-w+"px "+-N+"px",threshold:Xr(0,Ko(1,d))||1};let A=!0;function E(k){const T=k[0].intersectionRatio;if(T!==d){if(!A)return l();T?l(!1,T):r=setTimeout(()=>{l(!1,1e-7)},1e3)}T===1&&!T8(f,e.getBoundingClientRect())&&l(),A=!1}try{n=new IntersectionObserver(E,{...C,root:a.ownerDocument})}catch{n=new IntersectionObserver(E,C)}n.observe(e)}return l(!0),i}function zbe(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,f=dE(e),m=a||i?[...f?uh(f):[],...uh(t)]:[];m.forEach(N=>{a&&N.addEventListener("scroll",n,{passive:!0}),i&&N.addEventListener("resize",n)});const p=f&&u?Bbe(f,n):null;let g=-1,x=null;l&&(x=new ResizeObserver(N=>{let[O]=N;O&&O.target===f&&x&&(x.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var C;(C=x)==null||C.observe(t)})),n()}),f&&!d&&x.observe(f),x.observe(t));let j,b=d?dl(e):null;d&&w();function w(){const N=dl(e);b&&!T8(b,N)&&n(),b=N,j=requestAnimationFrame(w)}return n(),()=>{var N;m.forEach(O=>{a&&O.removeEventListener("scroll",n),i&&O.removeEventListener("resize",n)}),p?.(),(N=x)==null||N.disconnect(),x=null,d&&cancelAnimationFrame(j)}}const qbe=dbe,Fbe=fbe,Ube=lbe,Hbe=mbe,Wbe=cbe,c3=sbe,Vbe=hbe,Gbe=(e,t,n)=>{const r=new Map,a={platform:Lbe,...n},i={...a.platform,_c:r};return obe(e,t,{...a,platform:i})};var Ybe=typeof document<"u",Kbe=function(){},nv=Ybe?y.useLayoutEffect:Kbe;function Sg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Sg(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const i=a[r];if(!(i==="_owner"&&e.$$typeof)&&!Sg(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function k8(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function u3(e,t){const n=k8(e);return Math.round(t*n)/n}function QS(e){const t=y.useRef(e);return nv(()=>{t.current=e}),t}function Xbe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:l}={},transform:u=!0,whileElementsMounted:d,open:f}=e,[m,p]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,x]=y.useState(r);Sg(g,r)||x(r);const[j,b]=y.useState(null),[w,N]=y.useState(null),O=y.useCallback(q=>{q!==k.current&&(k.current=q,b(q))},[]),C=y.useCallback(q=>{q!==T.current&&(T.current=q,N(q))},[]),A=i||j,E=l||w,k=y.useRef(null),T=y.useRef(null),P=y.useRef(m),$=d!=null,F=QS(d),D=QS(a),U=QS(f),V=y.useCallback(()=>{if(!k.current||!T.current)return;const q={placement:t,strategy:n,middleware:g};D.current&&(q.platform=D.current),Gbe(k.current,T.current,q).then(K=>{const ee={...K,isPositioned:U.current!==!1};H.current&&!Sg(P.current,ee)&&(P.current=ee,pl.flushSync(()=>{p(ee)}))})},[g,t,n,D,U]);nv(()=>{f===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,p(q=>({...q,isPositioned:!1})))},[f]);const H=y.useRef(!1);nv(()=>(H.current=!0,()=>{H.current=!1}),[]),nv(()=>{if(A&&(k.current=A),E&&(T.current=E),A&&E){if(F.current)return F.current(A,E,V);V()}},[A,E,V,F,$]);const G=y.useMemo(()=>({reference:k,floating:T,setReference:O,setFloating:C}),[O,C]),L=y.useMemo(()=>({reference:A,floating:E}),[A,E]),R=y.useMemo(()=>{const q={position:n,left:0,top:0};if(!L.floating)return q;const K=u3(L.floating,m.x),ee=u3(L.floating,m.y);return u?{...q,transform:"translate("+K+"px, "+ee+"px)",...k8(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:K,top:ee}},[n,u,L.floating,m.x,m.y]);return y.useMemo(()=>({...m,update:V,refs:G,elements:L,floatingStyles:R}),[m,V,G,L,R])}const Zbe=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?c3({element:r.current,padding:a}).fn(n):{}:r?c3({element:r,padding:a}).fn(n):{}}}},Qbe=(e,t)=>({...qbe(e),options:[e,t]}),Jbe=(e,t)=>({...Fbe(e),options:[e,t]}),e0e=(e,t)=>({...Vbe(e),options:[e,t]}),t0e=(e,t)=>({...Ube(e),options:[e,t]}),n0e=(e,t)=>({...Hbe(e),options:[e,t]}),r0e=(e,t)=>({...Wbe(e),options:[e,t]}),a0e=(e,t)=>({...Zbe(e),options:[e,t]});var i0e="Arrow",P8=y.forwardRef((e,t)=>{const{children:n,width:r=10,height:a=5,...i}=e;return s.jsx(Me.svg,{...i,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});P8.displayName=i0e;var o0e=P8,fE="Popper",[M8,is]=ur(fE),[s0e,R8]=M8(fE),D8=e=>{const{__scopePopper:t,children:n}=e,[r,a]=y.useState(null);return s.jsx(s0e,{scope:t,anchor:r,onAnchorChange:a,children:n})};D8.displayName=fE;var $8="PopperAnchor",I8=y.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...a}=e,i=R8($8,n),l=y.useRef(null),u=qe(t,l),d=y.useRef(null);return y.useEffect(()=>{const f=d.current;d.current=r?.current||l.current,f!==d.current&&i.onAnchorChange(d.current)}),r?null:s.jsx(Me.div,{...a,ref:u})});I8.displayName=$8;var hE="PopperContent",[l0e,c0e]=M8(hE),L8=y.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:m=0,sticky:p="partial",hideWhenDetached:g=!1,updatePositionStrategy:x="optimized",onPlaced:j,...b}=e,w=R8(hE,n),[N,O]=y.useState(null),C=qe(t,J=>O(J)),[A,E]=y.useState(null),k=Cy(A),T=k?.width??0,P=k?.height??0,$=r+(i!=="center"?"-"+i:""),F=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},D=Array.isArray(f)?f:[f],U=D.length>0,V={padding:F,boundary:D.filter(d0e),altBoundary:U},{refs:H,floatingStyles:G,placement:L,isPositioned:R,middlewareData:q}=Xbe({strategy:"fixed",placement:$,whileElementsMounted:(...J)=>zbe(...J,{animationFrame:x==="always"}),elements:{reference:w.anchor},middleware:[Qbe({mainAxis:a+P,alignmentAxis:l}),d&&Jbe({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?e0e():void 0,...V}),d&&t0e({...V}),n0e({...V,apply:({elements:J,rects:ae,availableWidth:Z,availableHeight:pe})=>{const{width:je,height:le}=ae.reference,Re=J.floating.style;Re.setProperty("--radix-popper-available-width",`${Z}px`),Re.setProperty("--radix-popper-available-height",`${pe}px`),Re.setProperty("--radix-popper-anchor-width",`${je}px`),Re.setProperty("--radix-popper-anchor-height",`${le}px`)}}),A&&a0e({element:A,padding:u}),f0e({arrowWidth:T,arrowHeight:P}),g&&r0e({strategy:"referenceHidden",...V})]}),[K,ee]=q8(L),I=Xt(j);Bn(()=>{R&&I?.()},[R,I]);const B=q.arrow?.x,Y=q.arrow?.y,te=q.arrow?.centerOffset!==0,[oe,xe]=y.useState();return Bn(()=>{N&&xe(window.getComputedStyle(N).zIndex)},[N]),s.jsx("div",{ref:H.setFloating,"data-radix-popper-content-wrapper":"",style:{...G,transform:R?G.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[q.transformOrigin?.x,q.transformOrigin?.y].join(" "),...q.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(l0e,{scope:n,placedSide:K,onArrowChange:E,arrowX:B,arrowY:Y,shouldHideArrow:te,children:s.jsx(Me.div,{"data-side":K,"data-align":ee,...b,ref:C,style:{...b.style,animation:R?void 0:"none"}})})})});L8.displayName=hE;var B8="PopperArrow",u0e={top:"bottom",right:"left",bottom:"top",left:"right"},z8=y.forwardRef(function(t,n){const{__scopePopper:r,...a}=t,i=c0e(B8,r),l=u0e[i.placedSide];return s.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:s.jsx(o0e,{...a,ref:n,style:{...a.style,display:"block"}})})});z8.displayName=B8;function d0e(e){return e!==null}var f0e=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:a}=t,l=a.arrow?.centerOffset!==0,u=l?0:e.arrowWidth,d=l?0:e.arrowHeight,[f,m]=q8(n),p={start:"0%",center:"50%",end:"100%"}[m],g=(a.arrow?.x??0)+u/2,x=(a.arrow?.y??0)+d/2;let j="",b="";return f==="bottom"?(j=l?p:`${g}px`,b=`${-d}px`):f==="top"?(j=l?p:`${g}px`,b=`${r.floating.height+d}px`):f==="right"?(j=`${-d}px`,b=l?p:`${x}px`):f==="left"&&(j=`${r.floating.width+d}px`,b=l?p:`${x}px`),{data:{x:j,y:b}}}});function q8(e){const[t,n="center"]=e.split("-");return[t,n]}var Lh=D8,Bh=I8,zy=L8,qy=z8;function h0e(e){const t=m0e(e),n=y.forwardRef((r,a)=>{const{children:i,...l}=r,u=y.Children.toArray(i),d=u.find(v0e);if(d){const f=d.props.children,m=u.map(p=>p===d?y.Children.count(f)>1?y.Children.only(null):y.isValidElement(f)?f.props.children:null:p);return s.jsx(t,{...l,ref:a,children:y.isValidElement(f)?y.cloneElement(f,void 0,m):null})}return s.jsx(t,{...l,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}function m0e(e){const t=y.forwardRef((n,r)=>{const{children:a,...i}=n;if(y.isValidElement(a)){const l=y0e(a),u=g0e(i,a.props);return a.type!==y.Fragment&&(u.ref=r?Tr(r,l):l),y.cloneElement(a,u)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var p0e=Symbol("radix.slottable");function v0e(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===p0e}function g0e(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...u)=>{const d=i(...u);return a(...u),d}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function y0e(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var F8=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),x0e="VisuallyHidden",Fy=y.forwardRef((e,t)=>s.jsx(Me.span,{...e,ref:t,style:{...F8,...e.style}}));Fy.displayName=x0e;var b0e=Fy,w0e=[" ","Enter","ArrowUp","ArrowDown"],j0e=[" ","Enter"],fl="Select",[Uy,Hy,S0e]=wh(fl),[Wu]=ur(fl,[S0e,is]),Wy=is(),[_0e,os]=Wu(fl),[N0e,O0e]=Wu(fl),U8=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:i,value:l,defaultValue:u,onValueChange:d,dir:f,name:m,autoComplete:p,disabled:g,required:x,form:j}=e,b=Wy(t),[w,N]=y.useState(null),[O,C]=y.useState(null),[A,E]=y.useState(!1),k=Mu(f),[T,P]=wa({prop:r,defaultProp:a??!1,onChange:i,caller:fl}),[$,F]=wa({prop:l,defaultProp:u,onChange:d,caller:fl}),D=y.useRef(null),U=w?j||!!w.closest("form"):!0,[V,H]=y.useState(new Set),G=Array.from(V).map(L=>L.props.value).join(";");return s.jsx(Lh,{...b,children:s.jsxs(_0e,{required:x,scope:t,trigger:w,onTriggerChange:N,valueNode:O,onValueNodeChange:C,valueNodeHasChildren:A,onValueNodeHasChildrenChange:E,contentId:kn(),value:$,onValueChange:F,open:T,onOpenChange:P,dir:k,triggerPointerDownPosRef:D,disabled:g,children:[s.jsx(Uy.Provider,{scope:t,children:s.jsx(N0e,{scope:e.__scopeSelect,onNativeOptionAdd:y.useCallback(L=>{H(R=>new Set(R).add(L))},[]),onNativeOptionRemove:y.useCallback(L=>{H(R=>{const q=new Set(R);return q.delete(L),q})},[]),children:n})}),U?s.jsxs(hU,{"aria-hidden":!0,required:x,tabIndex:-1,name:m,autoComplete:p,value:$,onChange:L=>F(L.target.value),disabled:g,form:j,children:[$===void 0?s.jsx("option",{value:""}):null,Array.from(V)]},G):null]})})};U8.displayName=fl;var H8="SelectTrigger",W8=y.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...a}=e,i=Wy(n),l=os(H8,n),u=l.disabled||r,d=qe(t,l.onTriggerChange),f=Hy(n),m=y.useRef("touch"),[p,g,x]=pU(b=>{const w=f().filter(C=>!C.disabled),N=w.find(C=>C.value===l.value),O=vU(w,b,N);O!==void 0&&l.onValueChange(O.value)}),j=b=>{u||(l.onOpenChange(!0),x()),b&&(l.triggerPointerDownPosRef.current={x:Math.round(b.pageX),y:Math.round(b.pageY)})};return s.jsx(Bh,{asChild:!0,...i,children:s.jsx(Me.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":mU(l.value)?"":void 0,...a,ref:d,onClick:Se(a.onClick,b=>{b.currentTarget.focus(),m.current!=="mouse"&&j(b)}),onPointerDown:Se(a.onPointerDown,b=>{m.current=b.pointerType;const w=b.target;w.hasPointerCapture(b.pointerId)&&w.releasePointerCapture(b.pointerId),b.button===0&&b.ctrlKey===!1&&b.pointerType==="mouse"&&(j(b),b.preventDefault())}),onKeyDown:Se(a.onKeyDown,b=>{const w=p.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&g(b.key),!(w&&b.key===" ")&&w0e.includes(b.key)&&(j(),b.preventDefault())})})})});W8.displayName=H8;var V8="SelectValue",G8=y.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:l="",...u}=e,d=os(V8,n),{onValueNodeHasChildrenChange:f}=d,m=i!==void 0,p=qe(t,d.onValueNodeChange);return Bn(()=>{f(m)},[f,m]),s.jsx(Me.span,{...u,ref:p,style:{pointerEvents:"none"},children:mU(d.value)?s.jsx(s.Fragment,{children:l}):i})});G8.displayName=V8;var C0e="SelectIcon",Y8=y.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...a}=e;return s.jsx(Me.span,{"aria-hidden":!0,...a,ref:t,children:r||"▼"})});Y8.displayName=C0e;var E0e="SelectPortal",K8=e=>s.jsx(jl,{asChild:!0,...e});K8.displayName=E0e;var hl="SelectContent",X8=y.forwardRef((e,t)=>{const n=os(hl,e.__scopeSelect),[r,a]=y.useState();if(Bn(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?pl.createPortal(s.jsx(Z8,{scope:e.__scopeSelect,children:s.jsx(Uy.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),i):null}return s.jsx(Q8,{...e,ref:t})});X8.displayName=hl;var ka=10,[Z8,ss]=Wu(hl),A0e="SelectContentImpl",T0e=h0e("SelectContent.RemoveScroll"),Q8=y.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:l,side:u,sideOffset:d,align:f,alignOffset:m,arrowPadding:p,collisionBoundary:g,collisionPadding:x,sticky:j,hideWhenDetached:b,avoidCollisions:w,...N}=e,O=os(hl,n),[C,A]=y.useState(null),[E,k]=y.useState(null),T=qe(t,J=>A(J)),[P,$]=y.useState(null),[F,D]=y.useState(null),U=Hy(n),[V,H]=y.useState(!1),G=y.useRef(!1);y.useEffect(()=>{if(C)return ky(C)},[C]),Ay();const L=y.useCallback(J=>{const[ae,...Z]=U().map(le=>le.ref.current),[pe]=Z.slice(-1),je=document.activeElement;for(const le of J)if(le===je||(le?.scrollIntoView({block:"nearest"}),le===ae&&E&&(E.scrollTop=0),le===pe&&E&&(E.scrollTop=E.scrollHeight),le?.focus(),document.activeElement!==je))return},[U,E]),R=y.useCallback(()=>L([P,C]),[L,P,C]);y.useEffect(()=>{V&&R()},[V,R]);const{onOpenChange:q,triggerPointerDownPosRef:K}=O;y.useEffect(()=>{if(C){let J={x:0,y:0};const ae=pe=>{J={x:Math.abs(Math.round(pe.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(pe.pageY)-(K.current?.y??0))}},Z=pe=>{J.x<=10&&J.y<=10?pe.preventDefault():C.contains(pe.target)||q(!1),document.removeEventListener("pointermove",ae),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",ae),document.addEventListener("pointerup",Z,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ae),document.removeEventListener("pointerup",Z,{capture:!0})}}},[C,q,K]),y.useEffect(()=>{const J=()=>q(!1);return window.addEventListener("blur",J),window.addEventListener("resize",J),()=>{window.removeEventListener("blur",J),window.removeEventListener("resize",J)}},[q]);const[ee,I]=pU(J=>{const ae=U().filter(je=>!je.disabled),Z=ae.find(je=>je.ref.current===document.activeElement),pe=vU(ae,J,Z);pe&&setTimeout(()=>pe.ref.current.focus())}),B=y.useCallback((J,ae,Z)=>{const pe=!G.current&&!Z;(O.value!==void 0&&O.value===ae||pe)&&($(J),pe&&(G.current=!0))},[O.value]),Y=y.useCallback(()=>C?.focus(),[C]),te=y.useCallback((J,ae,Z)=>{const pe=!G.current&&!Z;(O.value!==void 0&&O.value===ae||pe)&&D(J)},[O.value]),oe=r==="popper"?nO:J8,xe=oe===nO?{side:u,sideOffset:d,align:f,alignOffset:m,arrowPadding:p,collisionBoundary:g,collisionPadding:x,sticky:j,hideWhenDetached:b,avoidCollisions:w}:{};return s.jsx(Z8,{scope:n,content:C,viewport:E,onViewportChange:k,itemRefCallback:B,selectedItem:P,onItemLeave:Y,itemTextRefCallback:te,focusSelectedItem:R,selectedItemText:F,position:r,isPositioned:V,searchRef:ee,children:s.jsx($h,{as:T0e,allowPinchZoom:!0,children:s.jsx(Dh,{asChild:!0,trapped:O.open,onMountAutoFocus:J=>{J.preventDefault()},onUnmountAutoFocus:Se(a,J=>{O.trigger?.focus({preventScroll:!0}),J.preventDefault()}),children:s.jsx(wl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:J=>J.preventDefault(),onDismiss:()=>O.onOpenChange(!1),children:s.jsx(oe,{role:"listbox",id:O.contentId,"data-state":O.open?"open":"closed",dir:O.dir,onContextMenu:J=>J.preventDefault(),...N,...xe,onPlaced:()=>H(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...N.style},onKeyDown:Se(N.onKeyDown,J=>{const ae=J.ctrlKey||J.altKey||J.metaKey;if(J.key==="Tab"&&J.preventDefault(),!ae&&J.key.length===1&&I(J.key),["ArrowUp","ArrowDown","Home","End"].includes(J.key)){let pe=U().filter(je=>!je.disabled).map(je=>je.ref.current);if(["ArrowUp","End"].includes(J.key)&&(pe=pe.slice().reverse()),["ArrowUp","ArrowDown"].includes(J.key)){const je=J.target,le=pe.indexOf(je);pe=pe.slice(le+1)}setTimeout(()=>L(pe)),J.preventDefault()}})})})})})})});Q8.displayName=A0e;var k0e="SelectItemAlignedPosition",J8=y.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...a}=e,i=os(hl,n),l=ss(hl,n),[u,d]=y.useState(null),[f,m]=y.useState(null),p=qe(t,T=>m(T)),g=Hy(n),x=y.useRef(!1),j=y.useRef(!0),{viewport:b,selectedItem:w,selectedItemText:N,focusSelectedItem:O}=l,C=y.useCallback(()=>{if(i.trigger&&i.valueNode&&u&&f&&b&&w&&N){const T=i.trigger.getBoundingClientRect(),P=f.getBoundingClientRect(),$=i.valueNode.getBoundingClientRect(),F=N.getBoundingClientRect();if(i.dir!=="rtl"){const je=F.left-P.left,le=$.left-je,Re=T.left-le,_e=T.width+Re,he=Math.max(_e,P.width),ve=window.innerWidth-ka,Le=Nf(le,[ka,Math.max(ka,ve-he)]);u.style.minWidth=_e+"px",u.style.left=Le+"px"}else{const je=P.right-F.right,le=window.innerWidth-$.right-je,Re=window.innerWidth-T.right-le,_e=T.width+Re,he=Math.max(_e,P.width),ve=window.innerWidth-ka,Le=Nf(le,[ka,Math.max(ka,ve-he)]);u.style.minWidth=_e+"px",u.style.right=Le+"px"}const D=g(),U=window.innerHeight-ka*2,V=b.scrollHeight,H=window.getComputedStyle(f),G=parseInt(H.borderTopWidth,10),L=parseInt(H.paddingTop,10),R=parseInt(H.borderBottomWidth,10),q=parseInt(H.paddingBottom,10),K=G+L+V+q+R,ee=Math.min(w.offsetHeight*5,K),I=window.getComputedStyle(b),B=parseInt(I.paddingTop,10),Y=parseInt(I.paddingBottom,10),te=T.top+T.height/2-ka,oe=U-te,xe=w.offsetHeight/2,J=w.offsetTop+xe,ae=G+L+J,Z=K-ae;if(ae<=te){const je=D.length>0&&w===D[D.length-1].ref.current;u.style.bottom="0px";const le=f.clientHeight-b.offsetTop-b.offsetHeight,Re=Math.max(oe,xe+(je?Y:0)+le+R),_e=ae+Re;u.style.height=_e+"px"}else{const je=D.length>0&&w===D[0].ref.current;u.style.top="0px";const Re=Math.max(te,G+b.offsetTop+(je?B:0)+xe)+Z;u.style.height=Re+"px",b.scrollTop=ae-te+b.offsetTop}u.style.margin=`${ka}px 0`,u.style.minHeight=ee+"px",u.style.maxHeight=U+"px",r?.(),requestAnimationFrame(()=>x.current=!0)}},[g,i.trigger,i.valueNode,u,f,b,w,N,i.dir,r]);Bn(()=>C(),[C]);const[A,E]=y.useState();Bn(()=>{f&&E(window.getComputedStyle(f).zIndex)},[f]);const k=y.useCallback(T=>{T&&j.current===!0&&(C(),O?.(),j.current=!1)},[C,O]);return s.jsx(M0e,{scope:n,contentWrapper:u,shouldExpandOnScrollRef:x,onScrollButtonChange:k,children:s.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:A},children:s.jsx(Me.div,{...a,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});J8.displayName=k0e;var P0e="SelectPopperPosition",nO=y.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=ka,...i}=e,l=Wy(n);return s.jsx(zy,{...l,...i,ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});nO.displayName=P0e;var[M0e,mE]=Wu(hl,{}),rO="SelectViewport",eU=y.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...a}=e,i=ss(rO,n),l=mE(rO,n),u=qe(t,i.onViewportChange),d=y.useRef(0);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),s.jsx(Uy.Slot,{scope:n,children:s.jsx(Me.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Se(a.onScroll,f=>{const m=f.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:g}=l;if(g?.current&&p){const x=Math.abs(d.current-m.scrollTop);if(x>0){const j=window.innerHeight-ka*2,b=parseFloat(p.style.minHeight),w=parseFloat(p.style.height),N=Math.max(b,w);if(N0?A:0,p.style.justifyContent="flex-end")}}}d.current=m.scrollTop})})})]})});eU.displayName=rO;var tU="SelectGroup",[R0e,D0e]=Wu(tU),$0e=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=kn();return s.jsx(R0e,{scope:n,id:a,children:s.jsx(Me.div,{role:"group","aria-labelledby":a,...r,ref:t})})});$0e.displayName=tU;var nU="SelectLabel",rU=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=D0e(nU,n);return s.jsx(Me.div,{id:a.id,...r,ref:t})});rU.displayName=nU;var _g="SelectItem",[I0e,aU]=Wu(_g),iU=y.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...l}=e,u=os(_g,n),d=ss(_g,n),f=u.value===r,[m,p]=y.useState(i??""),[g,x]=y.useState(!1),j=qe(t,O=>d.itemRefCallback?.(O,r,a)),b=kn(),w=y.useRef("touch"),N=()=>{a||(u.onValueChange(r),u.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return s.jsx(I0e,{scope:n,value:r,disabled:a,textId:b,isSelected:f,onItemTextChange:y.useCallback(O=>{p(C=>C||(O?.textContent??"").trim())},[]),children:s.jsx(Uy.ItemSlot,{scope:n,value:r,disabled:a,textValue:m,children:s.jsx(Me.div,{role:"option","aria-labelledby":b,"data-highlighted":g?"":void 0,"aria-selected":f&&g,"data-state":f?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:j,onFocus:Se(l.onFocus,()=>x(!0)),onBlur:Se(l.onBlur,()=>x(!1)),onClick:Se(l.onClick,()=>{w.current!=="mouse"&&N()}),onPointerUp:Se(l.onPointerUp,()=>{w.current==="mouse"&&N()}),onPointerDown:Se(l.onPointerDown,O=>{w.current=O.pointerType}),onPointerMove:Se(l.onPointerMove,O=>{w.current=O.pointerType,a?d.onItemLeave?.():w.current==="mouse"&&O.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Se(l.onPointerLeave,O=>{O.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:Se(l.onKeyDown,O=>{d.searchRef?.current!==""&&O.key===" "||(j0e.includes(O.key)&&N(),O.key===" "&&O.preventDefault())})})})})});iU.displayName=_g;var cf="SelectItemText",oU=y.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,...i}=e,l=os(cf,n),u=ss(cf,n),d=aU(cf,n),f=O0e(cf,n),[m,p]=y.useState(null),g=qe(t,N=>p(N),d.onItemTextChange,N=>u.itemTextRefCallback?.(N,d.value,d.disabled)),x=m?.textContent,j=y.useMemo(()=>s.jsx("option",{value:d.value,disabled:d.disabled,children:x},d.value),[d.disabled,d.value,x]),{onNativeOptionAdd:b,onNativeOptionRemove:w}=f;return Bn(()=>(b(j),()=>w(j)),[b,w,j]),s.jsxs(s.Fragment,{children:[s.jsx(Me.span,{id:d.textId,...i,ref:g}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren?pl.createPortal(i.children,l.valueNode):null]})});oU.displayName=cf;var sU="SelectItemIndicator",lU=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return aU(sU,n).isSelected?s.jsx(Me.span,{"aria-hidden":!0,...r,ref:t}):null});lU.displayName=sU;var aO="SelectScrollUpButton",cU=y.forwardRef((e,t)=>{const n=ss(aO,e.__scopeSelect),r=mE(aO,e.__scopeSelect),[a,i]=y.useState(!1),l=qe(t,r.onScrollButtonChange);return Bn(()=>{if(n.viewport&&n.isPositioned){let u=function(){const f=d.scrollTop>0;i(f)};const d=n.viewport;return u(),d.addEventListener("scroll",u),()=>d.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),a?s.jsx(dU,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=n;u&&d&&(u.scrollTop=u.scrollTop-d.offsetHeight)}}):null});cU.displayName=aO;var iO="SelectScrollDownButton",uU=y.forwardRef((e,t)=>{const n=ss(iO,e.__scopeSelect),r=mE(iO,e.__scopeSelect),[a,i]=y.useState(!1),l=qe(t,r.onScrollButtonChange);return Bn(()=>{if(n.viewport&&n.isPositioned){let u=function(){const f=d.scrollHeight-d.clientHeight,m=Math.ceil(d.scrollTop)d.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),a?s.jsx(dU,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=n;u&&d&&(u.scrollTop=u.scrollTop+d.offsetHeight)}}):null});uU.displayName=iO;var dU=y.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=e,i=ss("SelectScrollButton",n),l=y.useRef(null),u=Hy(n),d=y.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return y.useEffect(()=>()=>d(),[d]),Bn(()=>{u().find(m=>m.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[u]),s.jsx(Me.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Se(a.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:Se(a.onPointerMove,()=>{i.onItemLeave?.(),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:Se(a.onPointerLeave,()=>{d()})})}),L0e="SelectSeparator",fU=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return s.jsx(Me.div,{"aria-hidden":!0,...r,ref:t})});fU.displayName=L0e;var oO="SelectArrow",B0e=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=Wy(n),i=os(oO,n),l=ss(oO,n);return i.open&&l.position==="popper"?s.jsx(qy,{...a,...r,ref:t}):null});B0e.displayName=oO;var z0e="SelectBubbleInput",hU=y.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const a=y.useRef(null),i=qe(r,a),l=Oy(t);return y.useEffect(()=>{const u=a.current;if(!u)return;const d=window.HTMLSelectElement.prototype,m=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==t&&m){const p=new Event("change",{bubbles:!0});m.call(u,t),u.dispatchEvent(p)}},[l,t]),s.jsx(Me.select,{...n,style:{...F8,...n.style},ref:i,defaultValue:t})});hU.displayName=z0e;function mU(e){return e===""||e===void 0}function pU(e){const t=Xt(e),n=y.useRef(""),r=y.useRef(0),a=y.useCallback(l=>{const u=n.current+l;t(u),(function d(f){n.current=f,window.clearTimeout(r.current),f!==""&&(r.current=window.setTimeout(()=>d(""),1e3))})(u)},[t]),i=y.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,i]}function vU(e,t,n){const a=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let l=q0e(e,Math.max(i,0));a.length===1&&(l=l.filter(f=>f!==n));const d=l.find(f=>f.textValue.toLowerCase().startsWith(a.toLowerCase()));return d!==n?d:void 0}function q0e(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var F0e=U8,gU=W8,U0e=G8,H0e=Y8,W0e=K8,yU=X8,V0e=eU,xU=rU,bU=iU,G0e=oU,Y0e=lU,wU=cU,jU=uU,SU=fU;const Nt=F0e,Ot=U0e,xt=y.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(gU,{ref:r,className:ue("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,s.jsx(H0e,{asChild:!0,children:s.jsx(sh,{className:"h-4 w-4 opacity-50"})})]}));xt.displayName=gU.displayName;const _U=y.forwardRef(({className:e,...t},n)=>s.jsx(wU,{ref:n,className:ue("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(BN,{className:"h-4 w-4"})}));_U.displayName=wU.displayName;const NU=y.forwardRef(({className:e,...t},n)=>s.jsx(jU,{ref:n,className:ue("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(sh,{className:"h-4 w-4"})}));NU.displayName=jU.displayName;const bt=y.forwardRef(({className:e,children:t,position:n="popper",...r},a)=>s.jsx(W0e,{children:s.jsxs(yU,{ref:a,className:ue("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[s.jsx(_U,{}),s.jsx(V0e,{className:ue("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(NU,{})]})}));bt.displayName=yU.displayName;const K0e=y.forwardRef(({className:e,...t},n)=>s.jsx(xU,{ref:n,className:ue("px-2 py-1.5 text-sm font-semibold",e),...t}));K0e.displayName=xU.displayName;const Pe=y.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(bU,{ref:r,className:ue("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[s.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(Y0e,{children:s.jsx(Js,{className:"h-4 w-4"})})}),s.jsx(G0e,{children:t})]}));Pe.displayName=bU.displayName;const X0e=y.forwardRef(({className:e,...t},n)=>s.jsx(SU,{ref:n,className:ue("-mx-1 my-1 h-px bg-muted",e),...t}));X0e.displayName=SU.displayName;function Z0e(e){const t=Q0e(e),n=y.forwardRef((r,a)=>{const{children:i,...l}=r,u=y.Children.toArray(i),d=u.find(ewe);if(d){const f=d.props.children,m=u.map(p=>p===d?y.Children.count(f)>1?y.Children.only(null):y.isValidElement(f)?f.props.children:null:p);return s.jsx(t,{...l,ref:a,children:y.isValidElement(f)?y.cloneElement(f,void 0,m):null})}return s.jsx(t,{...l,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}function Q0e(e){const t=y.forwardRef((n,r)=>{const{children:a,...i}=n;if(y.isValidElement(a)){const l=nwe(a),u=twe(i,a.props);return a.type!==y.Fragment&&(u.ref=r?Tr(r,l):l),y.cloneElement(a,u)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var J0e=Symbol("radix.slottable");function ewe(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===J0e}function twe(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...u)=>{const d=i(...u);return a(...u),d}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function nwe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Vy="Popover",[OU]=ur(Vy,[is]),zh=is(),[rwe,ls]=OU(Vy),CU=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:l=!1}=e,u=zh(t),d=y.useRef(null),[f,m]=y.useState(!1),[p,g]=wa({prop:r,defaultProp:a??!1,onChange:i,caller:Vy});return s.jsx(Lh,{...u,children:s.jsx(rwe,{scope:t,contentId:kn(),triggerRef:d,open:p,onOpenChange:g,onOpenToggle:y.useCallback(()=>g(x=>!x),[g]),hasCustomAnchor:f,onCustomAnchorAdd:y.useCallback(()=>m(!0),[]),onCustomAnchorRemove:y.useCallback(()=>m(!1),[]),modal:l,children:n})})};CU.displayName=Vy;var EU="PopoverAnchor",awe=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=ls(EU,n),i=zh(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:u}=a;return y.useEffect(()=>(l(),()=>u()),[l,u]),s.jsx(Bh,{...i,...r,ref:t})});awe.displayName=EU;var AU="PopoverTrigger",TU=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=ls(AU,n),i=zh(n),l=qe(t,a.triggerRef),u=s.jsx(Me.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":DU(a.open),...r,ref:l,onClick:Se(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?u:s.jsx(Bh,{asChild:!0,...i,children:u})});TU.displayName=AU;var pE="PopoverPortal",[iwe,owe]=OU(pE,{forceMount:void 0}),kU=e=>{const{__scopePopover:t,forceMount:n,children:r,container:a}=e,i=ls(pE,t);return s.jsx(iwe,{scope:t,forceMount:n,children:s.jsx(Sn,{present:n||i.open,children:s.jsx(jl,{asChild:!0,container:a,children:r})})})};kU.displayName=pE;var Ou="PopoverContent",PU=y.forwardRef((e,t)=>{const n=owe(Ou,e.__scopePopover),{forceMount:r=n.forceMount,...a}=e,i=ls(Ou,e.__scopePopover);return s.jsx(Sn,{present:r||i.open,children:i.modal?s.jsx(lwe,{...a,ref:t}):s.jsx(cwe,{...a,ref:t})})});PU.displayName=Ou;var swe=Z0e("PopoverContent.RemoveScroll"),lwe=y.forwardRef((e,t)=>{const n=ls(Ou,e.__scopePopover),r=y.useRef(null),a=qe(t,r),i=y.useRef(!1);return y.useEffect(()=>{const l=r.current;if(l)return ky(l)},[]),s.jsx($h,{as:swe,allowPinchZoom:!0,children:s.jsx(MU,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Se(e.onCloseAutoFocus,l=>{l.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Se(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,f=u.button===2||d;i.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:Se(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),cwe=y.forwardRef((e,t)=>{const n=ls(Ou,e.__scopePopover),r=y.useRef(!1),a=y.useRef(!1);return s.jsx(MU,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=i.target;n.triggerRef.current?.contains(l)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),MU=y.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,...p}=e,g=ls(Ou,n),x=zh(n);return Ay(),s.jsx(Dh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(wl,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:m,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onDismiss:()=>g.onOpenChange(!1),children:s.jsx(zy,{"data-state":DU(g.open),role:"dialog",id:g.contentId,...x,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),RU="PopoverClose",uwe=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=ls(RU,n);return s.jsx(Me.button,{type:"button",...r,ref:t,onClick:Se(e.onClick,()=>a.onOpenChange(!1))})});uwe.displayName=RU;var dwe="PopoverArrow",fwe=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=zh(n);return s.jsx(qy,{...a,...r,ref:t})});fwe.displayName=dwe;function DU(e){return e?"open":"closed"}var hwe=CU,mwe=TU,pwe=kU,$U=PU;const Zo=hwe,Qo=mwe,ao=y.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},a)=>s.jsx(pwe,{children:s.jsx($U,{ref:a,align:t,sideOffset:n,className:ue("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",e),...r})}));ao.displayName=$U.displayName;const Vu="/api/webui/config";async function vwe(){const t=await(await fetch(`${Vu}/bot`)).json();if(!t.success)throw new Error("获取配置数据失败");return t.config}async function Ng(){const t=await(await fetch(`${Vu}/model`)).json();if(!t.success)throw new Error("获取模型配置数据失败");return t.config}async function gwe(e){const t=localStorage.getItem("access-token"),r=await(await fetch(`${Vu}/bot`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function IU(e){const t=localStorage.getItem("access-token"),r=await(await fetch(`${Vu}/model`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function ywe(e,t){const n=localStorage.getItem("access-token"),a=await(await fetch(`${Vu}/bot/section/${e}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(t)})).json();if(!a.success)throw new Error(a.message||`保存配置节 ${e} 失败`)}async function sO(e,t){const n=localStorage.getItem("access-token"),a=await(await fetch(`${Vu}/model/section/${e}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(t)})).json();if(!a.success)throw new Error(a.message||`保存配置节 ${e} 失败`)}function xwe(){const[e,t]=y.useState(!0),[n,r]=y.useState(!1),[a,i]=y.useState(!1),[l,u]=y.useState(!1),{toast:d}=Dr(),[f,m]=y.useState(null),[p,g]=y.useState(null),[x,j]=y.useState(null),[b,w]=y.useState(null),[N,O]=y.useState(null),[C,A]=y.useState(null),[E,k]=y.useState(null),[T,P]=y.useState(null),[$,F]=y.useState(null),[D,U]=y.useState(null),[V,H]=y.useState(null),[G,L]=y.useState(null),[R,q]=y.useState(null),[K,ee]=y.useState(null),[I,B]=y.useState(null),[Y,te]=y.useState(null),[oe,xe]=y.useState(null),[J,ae]=y.useState(null),Z=y.useRef(null),pe=y.useRef(!0),je=y.useRef({}),le=y.useCallback(async()=>{try{t(!0);const ve=await vwe();je.current=ve,m(ve.bot),g(ve.personality);const Le=ve.chat;Le.talk_value_rules||(Le.talk_value_rules=[]),j(Le),w(ve.expression),O(ve.emoji),A(ve.memory),k(ve.tool),P(ve.mood),F(ve.voice),U(ve.lpmm_knowledge),H(ve.keyword_reaction),L(ve.response_post_process),q(ve.chinese_typo),ee(ve.response_splitter),B(ve.log),te(ve.debug),xe(ve.maim_message),ae(ve.telemetry),u(!1),pe.current=!1}catch(ve){console.error("加载配置失败:",ve),d({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{t(!1)}},[d]);y.useEffect(()=>{le()},[le]);const Re=y.useCallback(async(ve,Le)=>{if(!pe.current)try{i(!0),await ywe(ve,Le),u(!1)}catch(Mt){console.error(`自动保存 ${ve} 失败:`,Mt),u(!0)}finally{i(!1)}},[]),_e=y.useCallback((ve,Le)=>{pe.current||(u(!0),Z.current&&clearTimeout(Z.current),Z.current=setTimeout(()=>{Re(ve,Le)},2e3))},[Re]);y.useEffect(()=>{f&&!pe.current&&_e("bot",f)},[f,_e]),y.useEffect(()=>{p&&!pe.current&&_e("personality",p)},[p,_e]),y.useEffect(()=>{x&&!pe.current&&_e("chat",x)},[x,_e]),y.useEffect(()=>{b&&!pe.current&&_e("expression",b)},[b,_e]),y.useEffect(()=>{N&&!pe.current&&_e("emoji",N)},[N,_e]),y.useEffect(()=>{C&&!pe.current&&_e("memory",C)},[C,_e]),y.useEffect(()=>{E&&!pe.current&&_e("tool",E)},[E,_e]),y.useEffect(()=>{T&&!pe.current&&_e("mood",T)},[T,_e]),y.useEffect(()=>{$&&!pe.current&&_e("voice",$)},[$,_e]),y.useEffect(()=>{D&&!pe.current&&_e("lpmm_knowledge",D)},[D,_e]),y.useEffect(()=>{V&&!pe.current&&_e("keyword_reaction",V)},[V,_e]),y.useEffect(()=>{G&&!pe.current&&_e("response_post_process",G)},[G,_e]),y.useEffect(()=>{R&&!pe.current&&_e("chinese_typo",R)},[R,_e]),y.useEffect(()=>{K&&!pe.current&&_e("response_splitter",K)},[K,_e]),y.useEffect(()=>{I&&!pe.current&&_e("log",I)},[I,_e]),y.useEffect(()=>{Y&&!pe.current&&_e("debug",Y)},[Y,_e]),y.useEffect(()=>{oe&&!pe.current&&_e("maim_message",oe)},[oe,_e]),y.useEffect(()=>{J&&!pe.current&&_e("telemetry",J)},[J,_e]);const he=async()=>{try{r(!0),Z.current&&clearTimeout(Z.current);const ve={...je.current,bot:f,personality:p,chat:x,expression:b,emoji:N,memory:C,tool:E,mood:T,voice:$,lpmm_knowledge:D,keyword_reaction:V,response_post_process:G,chinese_typo:R,response_splitter:K,log:I,debug:Y,maim_message:oe,telemetry:J};await gwe(ve),u(!1),d({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(ve){console.error("保存配置失败:",ve),d({title:"保存失败",description:ve.message,variant:"destructive"})}finally{r(!1)}};return e?s.jsx(Kt,{className:"h-full",children:s.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):s.jsx(Kt,{className:"h-full",children:s.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),s.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),s.jsxs(me,{onClick:he,disabled:n||a||!l,size:"sm",className:"w-full sm:w-auto",children:[s.jsx(VC,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":a?"自动保存中...":l?"保存配置":"已保存"]})]}),s.jsxs(al,{defaultValue:"bot",className:"w-full",children:[s.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:s.jsxs(Yo,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[s.jsx(Tt,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),s.jsx(Tt,{value:"personality",className:"flex-shrink-0",children:"人格"}),s.jsx(Tt,{value:"chat",className:"flex-shrink-0",children:"聊天"}),s.jsx(Tt,{value:"expression",className:"flex-shrink-0",children:"表达"}),s.jsx(Tt,{value:"features",className:"flex-shrink-0",children:"功能"}),s.jsx(Tt,{value:"processing",className:"flex-shrink-0",children:"处理"}),s.jsx(Tt,{value:"mood",className:"flex-shrink-0",children:"情绪"}),s.jsx(Tt,{value:"voice",className:"flex-shrink-0",children:"语音"}),s.jsx(Tt,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),s.jsx(Tt,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),s.jsx(Jt,{value:"bot",className:"space-y-4",children:f&&s.jsx(bwe,{config:f,onChange:m})}),s.jsx(Jt,{value:"personality",className:"space-y-4",children:p&&s.jsx(wwe,{config:p,onChange:g})}),s.jsx(Jt,{value:"chat",className:"space-y-4",children:x&&s.jsx(jwe,{config:x,onChange:j})}),s.jsx(Jt,{value:"expression",className:"space-y-4",children:b&&s.jsx(Swe,{config:b,onChange:w})}),s.jsx(Jt,{value:"features",className:"space-y-4",children:N&&C&&E&&s.jsx(_we,{emojiConfig:N,memoryConfig:C,toolConfig:E,onEmojiChange:O,onMemoryChange:A,onToolChange:k})}),s.jsx(Jt,{value:"processing",className:"space-y-4",children:V&&G&&R&&K&&s.jsx(Nwe,{keywordReactionConfig:V,responsePostProcessConfig:G,chineseTypoConfig:R,responseSplitterConfig:K,onKeywordReactionChange:H,onResponsePostProcessChange:L,onChineseTypoChange:q,onResponseSplitterChange:ee})}),s.jsx(Jt,{value:"mood",className:"space-y-4",children:T&&s.jsx(Owe,{config:T,onChange:P})}),s.jsx(Jt,{value:"voice",className:"space-y-4",children:$&&s.jsx(Cwe,{config:$,onChange:F})}),s.jsx(Jt,{value:"lpmm",className:"space-y-4",children:D&&s.jsx(Ewe,{config:D,onChange:U})}),s.jsxs(Jt,{value:"other",className:"space-y-4",children:[I&&s.jsx(Awe,{config:I,onChange:B}),Y&&s.jsx(Twe,{config:Y,onChange:te}),oe&&s.jsx(kwe,{config:oe,onChange:xe}),J&&s.jsx(Pwe,{config:J,onChange:ae})]})]})]})})}function bwe({config:e,onChange:t}){const n=()=>{t({...e,platforms:[...e.platforms,""]})},r=d=>{t({...e,platforms:e.platforms.filter((f,m)=>m!==d)})},a=(d,f)=>{const m=[...e.platforms];m[d]=f,t({...e,platforms:m})},i=()=>{t({...e,alias_names:[...e.alias_names,""]})},l=d=>{t({...e,alias_names:e.alias_names.filter((f,m)=>m!==d)})},u=(d,f)=>{const m=[...e.alias_names];m[d]=f,t({...e,alias_names:m})};return s.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),s.jsxs("div",{className:"grid gap-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"platform",children:"平台"}),s.jsx(Oe,{id:"platform",value:e.platform,onChange:d=>t({...e,platform:d.target.value}),placeholder:"qq"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"qq_account",children:"QQ账号"}),s.jsx(Oe,{id:"qq_account",value:e.qq_account,onChange:d=>t({...e,qq_account:d.target.value}),placeholder:"123456789"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"nickname",children:"昵称"}),s.jsx(Oe,{id:"nickname",value:e.nickname,onChange:d=>t({...e,nickname:d.target.value}),placeholder:"麦麦"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(re,{children:"其他平台账号"}),s.jsxs(me,{onClick:n,size:"sm",variant:"outline",children:[s.jsx(Zn,{className:"h-4 w-4 mr-1"}),"添加"]})]}),s.jsxs("div",{className:"space-y-2",children:[e.platforms.map((d,f)=>s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Oe,{value:d,onChange:m=>a(f,m.target.value),placeholder:"wx:114514"}),s.jsxs(Qn,{children:[s.jsx(Ia,{asChild:!0,children:s.jsx(me,{size:"icon",variant:"outline",children:s.jsx(zt,{className:"h-4 w-4"})})}),s.jsxs(Pn,{children:[s.jsxs(Mn,{children:[s.jsx(Dn,{children:"确认删除"}),s.jsxs($n,{children:['确定要删除平台账号 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),s.jsxs(Rn,{children:[s.jsx(Ln,{children:"取消"}),s.jsx(In,{onClick:()=>r(f),children:"删除"})]})]})]})]},f)),e.platforms.length===0&&s.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(re,{children:"别名"}),s.jsxs(me,{onClick:i,size:"sm",variant:"outline",children:[s.jsx(Zn,{className:"h-4 w-4 mr-1"}),"添加"]})]}),s.jsxs("div",{className:"space-y-2",children:[e.alias_names.map((d,f)=>s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Oe,{value:d,onChange:m=>u(f,m.target.value),placeholder:"小麦"}),s.jsxs(Qn,{children:[s.jsx(Ia,{asChild:!0,children:s.jsx(me,{size:"icon",variant:"outline",children:s.jsx(zt,{className:"h-4 w-4"})})}),s.jsxs(Pn,{children:[s.jsxs(Mn,{children:[s.jsx(Dn,{children:"确认删除"}),s.jsxs($n,{children:['确定要删除别名 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),s.jsxs(Rn,{children:[s.jsx(Ln,{children:"取消"}),s.jsx(In,{onClick:()=>l(f),children:"删除"})]})]})]})]},f)),e.alias_names.length===0&&s.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function wwe({config:e,onChange:t}){const n=()=>{t({...e,states:[...e.states,""]})},r=i=>{t({...e,states:e.states.filter((l,u)=>u!==i)})},a=(i,l)=>{const u=[...e.states];u[i]=l,t({...e,states:u})};return s.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),s.jsxs("div",{className:"grid gap-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"personality",children:"人格特质"}),s.jsx(fn,{id:"personality",value:e.personality,onChange:i=>t({...e,personality:i.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"reply_style",children:"表达风格"}),s.jsx(fn,{id:"reply_style",value:e.reply_style,onChange:i=>t({...e,reply_style:i.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"interest",children:"兴趣"}),s.jsx(fn,{id:"interest",value:e.interest,onChange:i=>t({...e,interest:i.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"plan_style",children:"说话规则与行为风格"}),s.jsx(fn,{id:"plan_style",value:e.plan_style,onChange:i=>t({...e,plan_style:i.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"visual_style",children:"识图规则"}),s.jsx(fn,{id:"visual_style",value:e.visual_style,onChange:i=>t({...e,visual_style:i.target.value}),placeholder:"识图时的处理规则",rows:3})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"private_plan_style",children:"私聊规则"}),s.jsx(fn,{id:"private_plan_style",value:e.private_plan_style,onChange:i=>t({...e,private_plan_style:i.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(re,{children:"状态列表(人格多样性)"}),s.jsxs(me,{onClick:n,size:"sm",variant:"outline",children:[s.jsx(Zn,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),s.jsx("div",{className:"space-y-2",children:e.states.map((i,l)=>s.jsxs("div",{className:"flex gap-2",children:[s.jsx(fn,{value:i,onChange:u=>a(l,u.target.value),placeholder:"描述一个人格状态",rows:2}),s.jsxs(Qn,{children:[s.jsx(Ia,{asChild:!0,children:s.jsx(me,{size:"icon",variant:"outline",children:s.jsx(zt,{className:"h-4 w-4"})})}),s.jsxs(Pn,{children:[s.jsxs(Mn,{children:[s.jsx(Dn,{children:"确认删除"}),s.jsx($n,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),s.jsxs(Rn,{children:[s.jsx(Ln,{children:"取消"}),s.jsx(In,{onClick:()=>r(l),children:"删除"})]})]})]})]},l))})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"state_probability",children:"状态替换概率"}),s.jsx(Oe,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:e.state_probability,onChange:i=>t({...e,state_probability:parseFloat(i.target.value)})}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function jwe({config:e,onChange:t}){const n=()=>{t({...e,talk_value_rules:[...e.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},r=u=>{t({...e,talk_value_rules:e.talk_value_rules.filter((d,f)=>f!==u)})},a=(u,d,f)=>{const m=[...e.talk_value_rules];m[u]={...m[u],[d]:f},t({...e,talk_value_rules:m})},i=({value:u,onChange:d})=>{const[f,m]=y.useState("00"),[p,g]=y.useState("00"),[x,j]=y.useState("23"),[b,w]=y.useState("59");y.useEffect(()=>{const O=u.split("-");if(O.length===2){const[C,A]=O,[E,k]=C.split(":"),[T,P]=A.split(":");E&&m(E.padStart(2,"0")),k&&g(k.padStart(2,"0")),T&&j(T.padStart(2,"0")),P&&w(P.padStart(2,"0"))}},[u]);const N=(O,C,A,E)=>{const k=`${O}:${C}-${A}:${E}`;d(k)};return s.jsxs(Zo,{children:[s.jsx(Qo,{asChild:!0,children:s.jsxs(me,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[s.jsx(el,{className:"h-4 w-4 mr-2"}),u||"选择时间段"]})}),s.jsx(ao,{className:"w-80",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[s.jsxs("div",{children:[s.jsx(re,{className:"text-xs",children:"小时"}),s.jsxs(Nt,{value:f,onValueChange:O=>{m(O),N(O,p,x,b)},children:[s.jsx(xt,{children:s.jsx(Ot,{})}),s.jsx(bt,{children:Array.from({length:24},(O,C)=>C).map(O=>s.jsx(Pe,{value:O.toString().padStart(2,"0"),children:O.toString().padStart(2,"0")},O))})]})]}),s.jsxs("div",{children:[s.jsx(re,{className:"text-xs",children:"分钟"}),s.jsxs(Nt,{value:p,onValueChange:O=>{g(O),N(f,O,x,b)},children:[s.jsx(xt,{children:s.jsx(Ot,{})}),s.jsx(bt,{children:Array.from({length:60},(O,C)=>C).map(O=>s.jsx(Pe,{value:O.toString().padStart(2,"0"),children:O.toString().padStart(2,"0")},O))})]})]})]})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[s.jsxs("div",{children:[s.jsx(re,{className:"text-xs",children:"小时"}),s.jsxs(Nt,{value:x,onValueChange:O=>{j(O),N(f,p,O,b)},children:[s.jsx(xt,{children:s.jsx(Ot,{})}),s.jsx(bt,{children:Array.from({length:24},(O,C)=>C).map(O=>s.jsx(Pe,{value:O.toString().padStart(2,"0"),children:O.toString().padStart(2,"0")},O))})]})]}),s.jsxs("div",{children:[s.jsx(re,{className:"text-xs",children:"分钟"}),s.jsxs(Nt,{value:b,onValueChange:O=>{w(O),N(f,p,x,O)},children:[s.jsx(xt,{children:s.jsx(Ot,{})}),s.jsx(bt,{children:Array.from({length:60},(O,C)=>C).map(O=>s.jsx(Pe,{value:O.toString().padStart(2,"0"),children:O.toString().padStart(2,"0")},O))})]})]})]})]})]})})]})},l=({rule:u})=>{const d=`{ target = "${u.target}", time = "${u.time}", value = ${u.value.toFixed(1)} }`;return s.jsxs(Zo,{children:[s.jsx(Qo,{asChild:!0,children:s.jsxs(me,{variant:"outline",size:"sm",children:[s.jsx(to,{className:"h-4 w-4 mr-1"}),"预览"]})}),s.jsx(ao,{className:"w-96",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),s.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:d}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return s.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),s.jsxs("div",{className:"grid gap-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),s.jsx(Oe,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:e.talk_value,onChange:u=>t({...e,talk_value:parseFloat(u.target.value)})}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"mentioned_bot_reply",children:"提及回复增幅"}),s.jsx(Oe,{id:"mentioned_bot_reply",type:"number",step:"0.1",min:"0",max:"1",value:e.mentioned_bot_reply,onChange:u=>t({...e,mentioned_bot_reply:parseFloat(u.target.value)})}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"提及时回复概率增幅,1 为 100% 回复"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"max_context_size",children:"上下文长度"}),s.jsx(Oe,{id:"max_context_size",type:"number",min:"1",value:e.max_context_size,onChange:u=>t({...e,max_context_size:parseInt(u.target.value)})})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"planner_smooth",children:"规划器平滑"}),s.jsx(Oe,{id:"planner_smooth",type:"number",step:"1",min:"0",value:e.planner_smooth,onChange:u=>t({...e,planner_smooth:parseFloat(u.target.value)})}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(ht,{id:"enable_talk_value_rules",checked:e.enable_talk_value_rules,onCheckedChange:u=>t({...e,enable_talk_value_rules:u})}),s.jsx(re,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(ht,{id:"include_planner_reasoning",checked:e.include_planner_reasoning,onCheckedChange:u=>t({...e,include_planner_reasoning:u})}),s.jsx(re,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),e.enable_talk_value_rules&&s.jsxs("div",{className:"border-t pt-6",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),s.jsxs(me,{onClick:n,size:"sm",children:[s.jsx(Zn,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),e.talk_value_rules&&e.talk_value_rules.length>0?s.jsx("div",{className:"space-y-4",children:e.talk_value_rules.map((u,d)=>s.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",d+1]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(l,{rule:u}),s.jsxs(Qn,{children:[s.jsx(Ia,{asChild:!0,children:s.jsx(me,{variant:"ghost",size:"sm",children:s.jsx(zt,{className:"h-4 w-4 text-destructive"})})}),s.jsxs(Pn,{children:[s.jsxs(Mn,{children:[s.jsx(Dn,{children:"确认删除"}),s.jsxs($n,{children:["确定要删除规则 #",d+1," 吗?此操作无法撤销。"]})]}),s.jsxs(Rn,{children:[s.jsx(Ln,{children:"取消"}),s.jsx(In,{onClick:()=>r(d),children:"删除"})]})]})]})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{className:"text-xs font-medium",children:"配置类型"}),s.jsxs(Nt,{value:u.target===""?"global":"specific",onValueChange:f=>{f==="global"?a(d,"target",""):a(d,"target","qq::group")},children:[s.jsx(xt,{children:s.jsx(Ot,{})}),s.jsxs(bt,{children:[s.jsx(Pe,{value:"global",children:"全局配置"}),s.jsx(Pe,{value:"specific",children:"详细配置"})]})]})]}),u.target!==""&&(()=>{const f=u.target.split(":"),m=f[0]||"qq",p=f[1]||"",g=f[2]||"group";return s.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{className:"text-xs font-medium",children:"平台"}),s.jsxs(Nt,{value:m,onValueChange:x=>{a(d,"target",`${x}:${p}:${g}`)},children:[s.jsx(xt,{children:s.jsx(Ot,{})}),s.jsxs(bt,{children:[s.jsx(Pe,{value:"qq",children:"QQ"}),s.jsx(Pe,{value:"wx",children:"微信"})]})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{className:"text-xs font-medium",children:"群 ID"}),s.jsx(Oe,{value:p,onChange:x=>{a(d,"target",`${m}:${x.target.value}:${g}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{className:"text-xs font-medium",children:"类型"}),s.jsxs(Nt,{value:g,onValueChange:x=>{a(d,"target",`${m}:${p}:${x}`)},children:[s.jsx(xt,{children:s.jsx(Ot,{})}),s.jsxs(bt,{children:[s.jsx(Pe,{value:"group",children:"群组(group)"}),s.jsx(Pe,{value:"private",children:"私聊(private)"})]})]})]})]}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",u.target||"(未设置)"]})]})})(),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{className:"text-xs font-medium",children:"时间段 (Time)"}),s.jsx(i,{value:u.time,onChange:f=>a(d,"time",f)}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),s.jsxs("div",{className:"grid gap-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(re,{htmlFor:`rule-value-${d}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),s.jsx(Oe,{id:`rule-value-${d}`,type:"number",step:"0.01",min:"0",max:"1",value:u.value,onChange:f=>{const m=parseFloat(f.target.value);isNaN(m)||a(d,"value",Math.max(0,Math.min(1,m)))},className:"w-20 h-8 text-xs"})]}),s.jsx(iE,{value:[u.value],onValueChange:f=>a(d,"value",f[0]),min:0,max:1,step:.01,className:"w-full"}),s.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[s.jsx("span",{children:"0 (完全沉默)"}),s.jsx("span",{children:"0.5"}),s.jsx("span",{children:"1.0 (正常)"})]})]})]})]},d))}):s.jsx("div",{className:"text-center py-8 text-muted-foreground",children:s.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),s.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[s.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),s.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[s.jsxs("li",{children:["• ",s.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),s.jsxs("li",{children:["• ",s.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),s.jsxs("li",{children:["• ",s.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),s.jsxs("li",{children:["• ",s.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),s.jsxs("li",{children:["• ",s.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function Swe({config:e,onChange:t}){const n=()=>{t({...e,learning_list:[...e.learning_list,["","enable","enable","1.0"]]})},r=g=>{t({...e,learning_list:e.learning_list.filter((x,j)=>j!==g)})},a=(g,x,j)=>{const b=[...e.learning_list];b[g][x]=j,t({...e,learning_list:b})},i=({rule:g})=>{const x=`["${g[0]}", "${g[1]}", "${g[2]}", "${g[3]}"]`;return s.jsxs(Zo,{children:[s.jsx(Qo,{asChild:!0,children:s.jsxs(me,{variant:"outline",size:"sm",children:[s.jsx(to,{className:"h-4 w-4 mr-1"}),"预览"]})}),s.jsx(ao,{className:"w-96",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),s.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:x}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},l=({member:g,groupIndex:x,memberIndex:j,availableChatIds:b})=>{const w=b.includes(g)||g==="*",[N,O]=y.useState(!w);return s.jsxs("div",{className:"flex gap-2",children:[s.jsx("div",{className:"flex-1 flex gap-2",children:N?s.jsxs(s.Fragment,{children:[s.jsx(Oe,{value:g,onChange:C=>p(x,j,C.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),b.length>0&&s.jsx(me,{size:"sm",variant:"outline",onClick:()=>O(!1),title:"切换到下拉选择",children:"下拉"})]}):s.jsxs(s.Fragment,{children:[s.jsxs(Nt,{value:g,onValueChange:C=>p(x,j,C),children:[s.jsx(xt,{className:"flex-1",children:s.jsx(Ot,{placeholder:"选择聊天流"})}),s.jsxs(bt,{children:[s.jsx(Pe,{value:"*",children:"* (全局共享)"}),b.map((C,A)=>s.jsx(Pe,{value:C,children:C},A))]})]}),s.jsx(me,{size:"sm",variant:"outline",onClick:()=>O(!0),title:"切换到手动输入",children:"输入"})]})}),s.jsxs(Qn,{children:[s.jsx(Ia,{asChild:!0,children:s.jsx(me,{size:"icon",variant:"outline",children:s.jsx(zt,{className:"h-4 w-4"})})}),s.jsxs(Pn,{children:[s.jsxs(Mn,{children:[s.jsx(Dn,{children:"确认删除"}),s.jsxs($n,{children:['确定要删除组成员 "',g||"(空)",'" 吗?此操作无法撤销。']})]}),s.jsxs(Rn,{children:[s.jsx(Ln,{children:"取消"}),s.jsx(In,{onClick:()=>m(x,j),children:"删除"})]})]})]})]})},u=()=>{t({...e,expression_groups:[...e.expression_groups,[]]})},d=g=>{t({...e,expression_groups:e.expression_groups.filter((x,j)=>j!==g)})},f=g=>{const x=[...e.expression_groups];x[g]=[...x[g],""],t({...e,expression_groups:x})},m=(g,x)=>{const j=[...e.expression_groups];j[g]=j[g].filter((b,w)=>w!==x),t({...e,expression_groups:j})},p=(g,x,j)=>{const b=[...e.expression_groups];b[g][x]=j,t({...e,expression_groups:b})};return s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),s.jsxs(me,{onClick:n,size:"sm",variant:"outline",children:[s.jsx(Zn,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),s.jsxs("div",{className:"space-y-4",children:[e.learning_list.map((g,x)=>{const j=e.learning_list.some((A,E)=>E!==x&&A[0]===""),b=g[0]==="",w=g[0].split(":"),N=w[0]||"qq",O=w[1]||"",C=w[2]||"group";return s.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-sm font-medium",children:["规则 ",x+1," ",b&&"(全局配置)"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(i,{rule:g}),s.jsxs(Qn,{children:[s.jsx(Ia,{asChild:!0,children:s.jsx(me,{size:"sm",variant:"ghost",children:s.jsx(zt,{className:"h-4 w-4"})})}),s.jsxs(Pn,{children:[s.jsxs(Mn,{children:[s.jsx(Dn,{children:"确认删除"}),s.jsxs($n,{children:["确定要删除学习规则 ",x+1," 吗?此操作无法撤销。"]})]}),s.jsxs(Rn,{children:[s.jsx(Ln,{children:"取消"}),s.jsx(In,{onClick:()=>r(x),children:"删除"})]})]})]})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{className:"text-xs font-medium",children:"配置类型"}),s.jsxs(Nt,{value:b?"global":"specific",onValueChange:A=>{A==="global"?a(x,0,""):a(x,0,"qq::group")},disabled:j&&!b,children:[s.jsx(xt,{children:s.jsx(Ot,{})}),s.jsxs(bt,{children:[s.jsx(Pe,{value:"global",children:"全局配置"}),s.jsx(Pe,{value:"specific",disabled:j&&!b,children:"详细配置"})]})]}),j&&!b&&s.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!b&&s.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{className:"text-xs font-medium",children:"平台"}),s.jsxs(Nt,{value:N,onValueChange:A=>{a(x,0,`${A}:${O}:${C}`)},children:[s.jsx(xt,{children:s.jsx(Ot,{})}),s.jsxs(bt,{children:[s.jsx(Pe,{value:"qq",children:"QQ"}),s.jsx(Pe,{value:"wx",children:"微信"})]})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{className:"text-xs font-medium",children:"群 ID"}),s.jsx(Oe,{value:O,onChange:A=>{a(x,0,`${N}:${A.target.value}:${C}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{className:"text-xs font-medium",children:"类型"}),s.jsxs(Nt,{value:C,onValueChange:A=>{a(x,0,`${N}:${O}:${A}`)},children:[s.jsx(xt,{children:s.jsx(Ot,{})}),s.jsxs(bt,{children:[s.jsx(Pe,{value:"group",children:"群组(group)"}),s.jsx(Pe,{value:"private",children:"私聊(private)"})]})]})]})]}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",g[0]||"(未设置)"]})]}),s.jsx("div",{className:"grid gap-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx(re,{className:"text-xs font-medium",children:"使用学到的表达"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),s.jsx(ht,{checked:g[1]==="enable",onCheckedChange:A=>a(x,1,A?"enable":"disable")})]})}),s.jsx("div",{className:"grid gap-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx(re,{className:"text-xs font-medium",children:"学习表达"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),s.jsx(ht,{checked:g[2]==="enable",onCheckedChange:A=>a(x,2,A?"enable":"disable")})]})}),s.jsxs("div",{className:"grid gap-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(re,{className:"text-xs font-medium",children:"学习强度"}),s.jsx(Oe,{type:"number",step:"0.1",min:"0",max:"5",value:g[3],onChange:A=>{const E=parseFloat(A.target.value);isNaN(E)||a(x,3,Math.max(0,Math.min(5,E)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),s.jsx(iE,{value:[parseFloat(g[3])||1],onValueChange:A=>a(x,3,A[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),s.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[s.jsx("span",{children:"0 (不学习)"}),s.jsx("span",{children:"2.5"}),s.jsx("span",{children:"5.0 (快速学习)"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},x)}),e.learning_list.length===0&&s.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),s.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),s.jsxs(me,{onClick:u,size:"sm",variant:"outline",children:[s.jsx(Zn,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),s.jsxs("div",{className:"space-y-4",children:[e.expression_groups.map((g,x)=>{const j=e.learning_list.map(b=>b[0]).filter(b=>b!=="");return s.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",x+1,g.length===1&&g[0]==="*"&&"(全局共享)"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(me,{onClick:()=>f(x),size:"sm",variant:"outline",children:s.jsx(Zn,{className:"h-4 w-4"})}),s.jsxs(Qn,{children:[s.jsx(Ia,{asChild:!0,children:s.jsx(me,{size:"sm",variant:"ghost",children:s.jsx(zt,{className:"h-4 w-4"})})}),s.jsxs(Pn,{children:[s.jsxs(Mn,{children:[s.jsx(Dn,{children:"确认删除"}),s.jsxs($n,{children:["确定要删除共享组 ",x+1," 吗?此操作无法撤销。"]})]}),s.jsxs(Rn,{children:[s.jsx(Ln,{children:"取消"}),s.jsx(In,{onClick:()=>d(x),children:"删除"})]})]})]})]})]}),s.jsx("div",{className:"space-y-2",children:g.map((b,w)=>s.jsx(l,{member:b,groupIndex:x,memberIndex:w,availableChatIds:j},w))}),s.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},x)}),e.expression_groups.length===0&&s.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function _we({emojiConfig:e,memoryConfig:t,toolConfig:n,onEmojiChange:r,onMemoryChange:a,onToolChange:i}){return s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(ht,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:l=>i({...n,enable_tool:l})}),s.jsx(re,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),s.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),s.jsx(Oe,{id:"max_agent_iterations",type:"number",min:"1",value:t.max_agent_iterations,onChange:l=>a({...t,max_agent_iterations:parseInt(l.target.value)})}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),s.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),s.jsxs("div",{className:"grid gap-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"emoji_chance",children:"表情包激活概率"}),s.jsx(Oe,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:e.emoji_chance,onChange:l=>r({...e,emoji_chance:parseFloat(l.target.value)})}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"max_reg_num",children:"最大注册数量"}),s.jsx(Oe,{id:"max_reg_num",type:"number",min:"1",value:e.max_reg_num,onChange:l=>r({...e,max_reg_num:parseInt(l.target.value)})}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),s.jsx(Oe,{id:"check_interval",type:"number",min:"1",value:e.check_interval,onChange:l=>r({...e,check_interval:parseInt(l.target.value)})}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(ht,{id:"do_replace",checked:e.do_replace,onCheckedChange:l=>r({...e,do_replace:l})}),s.jsx(re,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(ht,{id:"steal_emoji",checked:e.steal_emoji,onCheckedChange:l=>r({...e,steal_emoji:l})}),s.jsx(re,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),s.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(ht,{id:"content_filtration",checked:e.content_filtration,onCheckedChange:l=>r({...e,content_filtration:l})}),s.jsx(re,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),e.content_filtration&&s.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[s.jsx(re,{htmlFor:"filtration_prompt",children:"过滤要求"}),s.jsx(Oe,{id:"filtration_prompt",value:e.filtration_prompt,onChange:l=>r({...e,filtration_prompt:l.target.value}),placeholder:"符合公序良俗"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function Nwe({keywordReactionConfig:e,responsePostProcessConfig:t,chineseTypoConfig:n,responseSplitterConfig:r,onKeywordReactionChange:a,onResponsePostProcessChange:i,onChineseTypoChange:l,onResponseSplitterChange:u}){const d=()=>{a({...e,regex_rules:[...e.regex_rules,{regex:[""],reaction:""}]})},f=A=>{a({...e,regex_rules:e.regex_rules.filter((E,k)=>k!==A)})},m=(A,E,k)=>{const T=[...e.regex_rules];E==="regex"&&typeof k=="string"?T[A]={...T[A],regex:[k]}:E==="reaction"&&typeof k=="string"&&(T[A]={...T[A],reaction:k}),a({...e,regex_rules:T})},p=({regex:A,reaction:E,onRegexChange:k,onReactionChange:T})=>{const[P,$]=y.useState(!1),[F,D]=y.useState(""),[U,V]=y.useState(null),[H,G]=y.useState(""),[L,R]=y.useState({}),[q,K]=y.useState(""),ee=y.useRef(null),[I,B]=y.useState("build"),Y=J=>J.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),te=(J,ae=0)=>{const Z=ee.current;if(!Z)return;const pe=Z.selectionStart||0,je=Z.selectionEnd||0,le=A.substring(0,pe)+J+A.substring(je);k(le),setTimeout(()=>{const Re=pe+J.length+ae;Z.setSelectionRange(Re,Re),Z.focus()},0)};y.useEffect(()=>{if(!A||!F){V(null),R({}),K(E),G("");return}try{const J=Y(A),ae=new RegExp(J,"g"),Z=F.match(ae);V(Z),G("");const je=new RegExp(J).exec(F);if(je&&je.groups){R(je.groups);let le=E;Object.entries(je.groups).forEach(([Re,_e])=>{le=le.replace(new RegExp(`\\[${Re}\\]`,"g"),_e||"")}),K(le)}else R({}),K(E)}catch(J){G(J.message),V(null),R({}),K(E)}},[A,F,E]);const oe=()=>{if(!F||!U||U.length===0)return s.jsx("span",{className:"text-muted-foreground",children:F||"请输入测试文本"});try{const J=Y(A),ae=new RegExp(J,"g");let Z=0;const pe=[];let je;for(;(je=ae.exec(F))!==null;)je.index>Z&&pe.push(s.jsx("span",{children:F.substring(Z,je.index)},`text-${Z}`)),pe.push(s.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:je[0]},`match-${je.index}`)),Z=je.index+je[0].length;return Z)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return s.jsxs(Jn,{open:P,onOpenChange:$,children:[s.jsx($F,{asChild:!0,children:s.jsxs(me,{variant:"outline",size:"sm",children:[s.jsx(pg,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),s.jsxs(zn,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[s.jsxs(qn,{children:[s.jsx(Fn,{children:"正则表达式编辑器"}),s.jsx(lr,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),s.jsx(Kt,{className:"max-h-[calc(90vh-120px)]",children:s.jsxs(al,{value:I,onValueChange:J=>B(J),className:"w-full",children:[s.jsxs(Yo,{className:"grid w-full grid-cols-2",children:[s.jsx(Tt,{value:"build",children:"🔧 构建器"}),s.jsx(Tt,{value:"test",children:"🧪 测试器"})]}),s.jsxs(Jt,{value:"build",className:"space-y-4 mt-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{className:"text-sm font-medium",children:"正则表达式"}),s.jsx(Oe,{ref:ee,value:A,onChange:J=>k(J.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{className:"text-sm font-medium",children:"Reaction 内容"}),s.jsx(fn,{value:E,onChange:J=>T(J.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),s.jsxs("div",{className:"space-y-4 border-t pt-4",children:[xe.map(J=>s.jsxs("div",{className:"space-y-2",children:[s.jsx("h5",{className:"text-xs font-semibold text-primary",children:J.category}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:J.items.map(ae=>s.jsx(me,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>te(ae.pattern,ae.moveCursor||0),children:s.jsxs("div",{className:"flex flex-col items-start w-full",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsx("span",{className:"text-xs font-medium",children:ae.label}),s.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:ae.pattern})]}),s.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:ae.desc})]})},ae.label))})]},J.category)),s.jsxs("div",{className:"space-y-2 border-t pt-4",children:[s.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(me,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>k("^(?P\\S{1,20})是这样的$"),children:s.jsxs("div",{className:"flex flex-col items-start w-full",children:[s.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),s.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),s.jsx(me,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>k("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:s.jsxs("div",{className:"flex flex-col items-start w-full",children:[s.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),s.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),s.jsx(me,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>k("(?P.+?)(?:是|为什么|怎么)"),children:s.jsxs("div",{className:"flex flex-col items-start w-full",children:[s.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),s.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),s.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[s.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),s.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[s.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),s.jsxs("li",{children:["命名捕获组格式:",s.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),s.jsxs("li",{children:["在 reaction 中使用 ",s.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),s.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),s.jsxs(Jt,{value:"test",className:"space-y-4 mt-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{className:"text-sm font-medium",children:"当前正则表达式"}),s.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:A||"(未设置)"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),s.jsx(fn,{id:"test-text",value:F,onChange:J=>D(J.target.value),placeholder:`在此输入要测试的文本... -例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),H&&s.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[s.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),s.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:H})]}),!H&&F&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"flex items-center gap-2",children:U&&U.length>0?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),s.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",U.length," 处)"]})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),s.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{className:"text-sm font-medium",children:"匹配高亮"}),s.jsx(Kt,{className:"h-40 rounded-md bg-muted p-3",children:s.jsx("div",{className:"text-sm break-words",children:oe()})})]}),Object.keys(L).length>0&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{className:"text-sm font-medium",children:"命名捕获组"}),s.jsx(Kt,{className:"h-32 rounded-md border p-3",children:s.jsx("div",{className:"space-y-2",children:Object.entries(L).map(([J,ae])=>s.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[s.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",J,"]"]}),s.jsx("span",{className:"text-muted-foreground",children:"="}),s.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:ae})]},J))})})]}),Object.keys(L).length>0&&E&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{className:"text-sm font-medium",children:"Reaction 替换预览"}),s.jsx(Kt,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:s.jsx("div",{className:"text-sm break-words",children:q})}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),s.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[s.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),s.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[s.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),s.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),s.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),s.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},g=()=>{a({...e,keyword_rules:[...e.keyword_rules,{keywords:[],reaction:""}]})},x=A=>{a({...e,keyword_rules:e.keyword_rules.filter((E,k)=>k!==A)})},j=(A,E,k)=>{const T=[...e.keyword_rules];typeof k=="string"&&(T[A]={...T[A],reaction:k}),a({...e,keyword_rules:T})},b=A=>{const E=[...e.keyword_rules];E[A]={...E[A],keywords:[...E[A].keywords||[],""]},a({...e,keyword_rules:E})},w=(A,E)=>{const k=[...e.keyword_rules];k[A]={...k[A],keywords:(k[A].keywords||[]).filter((T,P)=>P!==E)},a({...e,keyword_rules:k})},N=(A,E,k)=>{const T=[...e.keyword_rules],P=[...T[A].keywords||[]];P[E]=k,T[A]={...T[A],keywords:P},a({...e,keyword_rules:T})},O=({rule:A})=>{const E=`{ regex = [${(A.regex||[]).map(k=>`"${k}"`).join(", ")}], reaction = "${A.reaction}" }`;return s.jsxs(Zo,{children:[s.jsx(Qo,{asChild:!0,children:s.jsxs(me,{variant:"outline",size:"sm",children:[s.jsx(to,{className:"h-4 w-4 mr-1"}),"预览"]})}),s.jsx(ao,{className:"w-[95vw] sm:w-[500px]",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),s.jsx(Kt,{className:"h-60 rounded-md bg-muted p-3",children:s.jsx("pre",{className:"font-mono text-xs break-all",children:E})}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},C=({rule:A})=>{const E=`[[keyword_reaction.keyword_rules]] -keywords = [${(A.keywords||[]).map(k=>`"${k}"`).join(", ")}] -reaction = "${A.reaction}"`;return s.jsxs(Zo,{children:[s.jsx(Qo,{asChild:!0,children:s.jsxs(me,{variant:"outline",size:"sm",children:[s.jsx(to,{className:"h-4 w-4 mr-1"}),"预览"]})}),s.jsx(ao,{className:"w-[95vw] sm:w-[500px]",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),s.jsx(Kt,{className:"h-60 rounded-md bg-muted p-3",children:s.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:E})}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),s.jsxs(me,{onClick:d,size:"sm",variant:"outline",children:[s.jsx(Zn,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),s.jsxs("div",{className:"space-y-3",children:[e.regex_rules.map((A,E)=>s.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",E+1]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(p,{regex:A.regex&&A.regex[0]||"",reaction:A.reaction,onRegexChange:k=>m(E,"regex",k),onReactionChange:k=>m(E,"reaction",k)}),s.jsx(O,{rule:A}),s.jsxs(Qn,{children:[s.jsx(Ia,{asChild:!0,children:s.jsx(me,{size:"sm",variant:"ghost",children:s.jsx(zt,{className:"h-4 w-4"})})}),s.jsxs(Pn,{children:[s.jsxs(Mn,{children:[s.jsx(Dn,{children:"确认删除"}),s.jsxs($n,{children:["确定要删除正则规则 ",E+1," 吗?此操作无法撤销。"]})]}),s.jsxs(Rn,{children:[s.jsx(Ln,{children:"取消"}),s.jsx(In,{onClick:()=>f(E),children:"删除"})]})]})]})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),s.jsx(Oe,{value:A.regex&&A.regex[0]||"",onChange:k=>m(E,"regex",k.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{className:"text-xs font-medium",children:"反应内容"}),s.jsx(fn,{value:A.reaction,onChange:k=>m(E,"reaction",k.target.value),placeholder:`触发后麦麦的反应... -可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},E)),e.regex_rules.length===0&&s.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),s.jsxs("div",{className:"space-y-4 border-t pt-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),s.jsxs(me,{onClick:g,size:"sm",variant:"outline",children:[s.jsx(Zn,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),s.jsxs("div",{className:"space-y-3",children:[e.keyword_rules.map((A,E)=>s.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",E+1]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(C,{rule:A}),s.jsxs(Qn,{children:[s.jsx(Ia,{asChild:!0,children:s.jsx(me,{size:"sm",variant:"ghost",children:s.jsx(zt,{className:"h-4 w-4"})})}),s.jsxs(Pn,{children:[s.jsxs(Mn,{children:[s.jsx(Dn,{children:"确认删除"}),s.jsxs($n,{children:["确定要删除关键词规则 ",E+1," 吗?此操作无法撤销。"]})]}),s.jsxs(Rn,{children:[s.jsx(Ln,{children:"取消"}),s.jsx(In,{onClick:()=>x(E),children:"删除"})]})]})]})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(re,{className:"text-xs font-medium",children:"关键词列表"}),s.jsxs(me,{onClick:()=>b(E),size:"sm",variant:"ghost",children:[s.jsx(Zn,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),s.jsxs("div",{className:"space-y-2",children:[(A.keywords||[]).map((k,T)=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Oe,{value:k,onChange:P=>N(E,T,P.target.value),placeholder:"关键词",className:"flex-1"}),s.jsx(me,{onClick:()=>w(E,T),size:"sm",variant:"ghost",children:s.jsx(zt,{className:"h-4 w-4"})})]},T)),(!A.keywords||A.keywords.length===0)&&s.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{className:"text-xs font-medium",children:"反应内容"}),s.jsx(fn,{value:A.reaction,onChange:k=>j(E,"reaction",k.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},E)),e.keyword_rules.length===0&&s.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),s.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(ht,{id:"enable_response_post_process",checked:t.enable_response_post_process,onCheckedChange:A=>i({...t,enable_response_post_process:A})}),s.jsx(re,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),t.enable_response_post_process&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"border-t pt-6 space-y-4",children:s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[s.jsx(ht,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:A=>l({...n,enable:A})}),s.jsx(re,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),s.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&s.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),s.jsx(Oe,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:A=>l({...n,error_rate:parseFloat(A.target.value)})})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),s.jsx(Oe,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:A=>l({...n,min_freq:parseInt(A.target.value)})})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),s.jsx(Oe,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:A=>l({...n,tone_error_rate:parseFloat(A.target.value)})})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),s.jsx(Oe,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:A=>l({...n,word_replace_rate:parseFloat(A.target.value)})})]})]})]})}),s.jsx("div",{className:"border-t pt-6 space-y-4",children:s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[s.jsx(ht,{id:"enable_response_splitter",checked:r.enable,onCheckedChange:A=>u({...r,enable:A})}),s.jsx(re,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),s.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),r.enable&&s.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),s.jsx(Oe,{id:"max_length",type:"number",min:"1",value:r.max_length,onChange:A=>u({...r,max_length:parseInt(A.target.value)})}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),s.jsx(Oe,{id:"max_sentence_num",type:"number",min:"1",value:r.max_sentence_num,onChange:A=>u({...r,max_sentence_num:parseInt(A.target.value)})}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(ht,{id:"enable_kaomoji_protection",checked:r.enable_kaomoji_protection,onCheckedChange:A=>u({...r,enable_kaomoji_protection:A})}),s.jsx(re,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(ht,{id:"enable_overflow_return_all",checked:r.enable_overflow_return_all,onCheckedChange:A=>u({...r,enable_overflow_return_all:A})}),s.jsx(re,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),s.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function Owe({config:e,onChange:t}){return s.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[s.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),s.jsxs("div",{className:"grid gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(ht,{checked:e.enable_mood,onCheckedChange:n=>t({...e,enable_mood:n})}),s.jsx(re,{className:"cursor-pointer",children:"启用情绪系统"})]}),e.enable_mood&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"情绪更新阈值"}),s.jsx(Oe,{type:"number",min:"1",value:e.mood_update_threshold,onChange:n=>t({...e,mood_update_threshold:parseInt(n.target.value)})}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"情感特征"}),s.jsx(fn,{value:e.emotion_style,onChange:n=>t({...e,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function Cwe({config:e,onChange:t}){return s.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[s.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(ht,{checked:e.enable_asr,onCheckedChange:n=>t({...e,enable_asr:n})}),s.jsx(re,{className:"cursor-pointer",children:"启用语音识别"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function Ewe({config:e,onChange:t}){return s.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[s.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),s.jsxs("div",{className:"grid gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(ht,{checked:e.enable,onCheckedChange:n=>t({...e,enable:n})}),s.jsx(re,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),e.enable&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"LPMM 模式"}),s.jsxs(Nt,{value:e.lpmm_mode,onValueChange:n=>t({...e,lpmm_mode:n}),children:[s.jsx(xt,{children:s.jsx(Ot,{placeholder:"选择 LPMM 模式"})}),s.jsxs(bt,{children:[s.jsx(Pe,{value:"classic",children:"经典模式"}),s.jsx(Pe,{value:"agent",children:"Agent 模式"})]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"同义词搜索 TopK"}),s.jsx(Oe,{type:"number",min:"1",value:e.rag_synonym_search_top_k,onChange:n=>t({...e,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"同义词阈值"}),s.jsx(Oe,{type:"number",step:"0.1",min:"0",max:"1",value:e.rag_synonym_threshold,onChange:n=>t({...e,rag_synonym_threshold:parseFloat(n.target.value)})})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"实体提取线程数"}),s.jsx(Oe,{type:"number",min:"1",value:e.info_extraction_workers,onChange:n=>t({...e,info_extraction_workers:parseInt(n.target.value)})})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"嵌入向量维度"}),s.jsx(Oe,{type:"number",min:"1",value:e.embedding_dimension,onChange:n=>t({...e,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function Awe({config:e,onChange:t}){const[n,r]=y.useState(""),[a,i]=y.useState("WARNING"),l=()=>{n&&!e.suppress_libraries.includes(n)&&(t({...e,suppress_libraries:[...e.suppress_libraries,n]}),r(""))},u=x=>{t({...e,suppress_libraries:e.suppress_libraries.filter(j=>j!==x)})},d=()=>{n&&!e.library_log_levels[n]&&(t({...e,library_log_levels:{...e.library_log_levels,[n]:a}}),r(""),i("WARNING"))},f=x=>{const j={...e.library_log_levels};delete j[x],t({...e,library_log_levels:j})},m=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],p=["FULL","compact","lite"],g=["none","title","full"];return s.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"日期格式"}),s.jsx(Oe,{value:e.date_style,onChange:x=>t({...e,date_style:x.target.value}),placeholder:"例如: m-d H:i:s"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"日志级别样式"}),s.jsxs(Nt,{value:e.log_level_style,onValueChange:x=>t({...e,log_level_style:x}),children:[s.jsx(xt,{children:s.jsx(Ot,{})}),s.jsx(bt,{children:p.map(x=>s.jsx(Pe,{value:x,children:x},x))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"日志文本颜色"}),s.jsxs(Nt,{value:e.color_text,onValueChange:x=>t({...e,color_text:x}),children:[s.jsx(xt,{children:s.jsx(Ot,{})}),s.jsx(bt,{children:g.map(x=>s.jsx(Pe,{value:x,children:x},x))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"全局日志级别"}),s.jsxs(Nt,{value:e.log_level,onValueChange:x=>t({...e,log_level:x}),children:[s.jsx(xt,{children:s.jsx(Ot,{})}),s.jsx(bt,{children:m.map(x=>s.jsx(Pe,{value:x,children:x},x))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"控制台日志级别"}),s.jsxs(Nt,{value:e.console_log_level,onValueChange:x=>t({...e,console_log_level:x}),children:[s.jsx(xt,{children:s.jsx(Ot,{})}),s.jsx(bt,{children:m.map(x=>s.jsx(Pe,{value:x,children:x},x))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"文件日志级别"}),s.jsxs(Nt,{value:e.file_log_level,onValueChange:x=>t({...e,file_log_level:x}),children:[s.jsx(xt,{children:s.jsx(Ot,{})}),s.jsx(bt,{children:m.map(x=>s.jsx(Pe,{value:x,children:x},x))})]})]})]})]}),s.jsxs("div",{children:[s.jsx(re,{className:"mb-2 block",children:"完全屏蔽的库"}),s.jsxs("div",{className:"flex gap-2 mb-2",children:[s.jsx(Oe,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),l())}}),s.jsx(me,{onClick:l,size:"sm",className:"flex-shrink-0",children:s.jsx(Zn,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:e.suppress_libraries.map(x=>s.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[s.jsx("span",{className:"text-sm",children:x}),s.jsx(me,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>u(x),children:s.jsx(zt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},x))})]}),s.jsxs("div",{children:[s.jsx(re,{className:"mb-2 block",children:"特定库的日志级别"}),s.jsxs("div",{className:"flex gap-2 mb-2",children:[s.jsx(Oe,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1"}),s.jsxs(Nt,{value:a,onValueChange:i,children:[s.jsx(xt,{className:"w-32",children:s.jsx(Ot,{})}),s.jsx(bt,{children:m.map(x=>s.jsx(Pe,{value:x,children:x},x))})]}),s.jsx(me,{onClick:d,size:"sm",children:s.jsx(Zn,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),s.jsx("div",{className:"space-y-2",children:Object.entries(e.library_log_levels).map(([x,j])=>s.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[s.jsx("span",{className:"text-sm font-medium",children:x}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-muted-foreground",children:j}),s.jsx(me,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>f(x),children:s.jsx(zt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},x))})]})]})}function Twe({config:e,onChange:t}){return s.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[s.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(re,{children:"显示 Prompt"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),s.jsx(ht,{checked:e.show_prompt,onCheckedChange:n=>t({...e,show_prompt:n})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(re,{children:"显示回复器 Prompt"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),s.jsx(ht,{checked:e.show_replyer_prompt,onCheckedChange:n=>t({...e,show_replyer_prompt:n})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(re,{children:"显示回复器推理"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),s.jsx(ht,{checked:e.show_replyer_reasoning,onCheckedChange:n=>t({...e,show_replyer_reasoning:n})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(re,{children:"显示 Jargon Prompt"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),s.jsx(ht,{checked:e.show_jargon_prompt,onCheckedChange:n=>t({...e,show_jargon_prompt:n})})]})]})]})}function kwe({config:e,onChange:t}){const[n,r]=y.useState(""),a=()=>{n&&!e.auth_token.includes(n)&&(t({...e,auth_token:[...e.auth_token,n]}),r(""))},i=l=>{t({...e,auth_token:e.auth_token.filter((u,d)=>d!==l)})};return s.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(re,{children:"启用自定义服务器"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),s.jsx(ht,{checked:e.use_custom,onCheckedChange:l=>t({...e,use_custom:l})})]}),e.use_custom&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"主机地址"}),s.jsx(Oe,{value:e.host,onChange:l=>t({...e,host:l.target.value}),placeholder:"127.0.0.1"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"端口号"}),s.jsx(Oe,{type:"number",value:e.port,onChange:l=>t({...e,port:parseInt(l.target.value)}),placeholder:"8090"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"连接模式"}),s.jsxs(Nt,{value:e.mode,onValueChange:l=>t({...e,mode:l}),children:[s.jsx(xt,{children:s.jsx(Ot,{})}),s.jsxs(bt,{children:[s.jsx(Pe,{value:"ws",children:"WebSocket (ws)"}),s.jsx(Pe,{value:"tcp",children:"TCP"})]})]})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(ht,{checked:e.use_wss,onCheckedChange:l=>t({...e,use_wss:l}),disabled:e.mode!=="ws"}),s.jsx(re,{children:"使用 WSS 安全连接"})]})]}),e.use_wss&&e.mode==="ws"&&s.jsxs("div",{className:"grid gap-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"SSL 证书文件路径"}),s.jsx(Oe,{value:e.cert_file,onChange:l=>t({...e,cert_file:l.target.value}),placeholder:"cert.pem"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"SSL 密钥文件路径"}),s.jsx(Oe,{value:e.key_file,onChange:l=>t({...e,key_file:l.target.value}),placeholder:"key.pem"})]})]})]})]})]}),s.jsxs("div",{children:[s.jsx(re,{className:"mb-2 block",children:"认证令牌"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),s.jsxs("div",{className:"flex gap-2 mb-2",children:[s.jsx(Oe,{value:n,onChange:l=>r(l.target.value),placeholder:"输入认证令牌",onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),a())}}),s.jsx(me,{onClick:a,size:"sm",children:s.jsx(Zn,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),s.jsx("div",{className:"space-y-2",children:e.auth_token.map((l,u)=>s.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[s.jsx("span",{className:"text-sm font-mono",children:l}),s.jsx(me,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>i(u),children:s.jsx(zt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},u))})]})]})}function Pwe({config:e,onChange:t}){return s.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[s.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(re,{children:"启用统计信息发送"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),s.jsx(ht,{checked:e.enable,onCheckedChange:n=>t({...e,enable:n})})]})]})}const Sl=y.forwardRef(({className:e,...t},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:ue("w-full caption-bottom text-sm",e),...t})}));Sl.displayName="Table";const _l=y.forwardRef(({className:e,...t},n)=>s.jsx("thead",{ref:n,className:ue("[&_tr]:border-b",e),...t}));_l.displayName="TableHeader";const Nl=y.forwardRef(({className:e,...t},n)=>s.jsx("tbody",{ref:n,className:ue("[&_tr:last-child]:border-0",e),...t}));Nl.displayName="TableBody";const Mwe=y.forwardRef(({className:e,...t},n)=>s.jsx("tfoot",{ref:n,className:ue("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));Mwe.displayName="TableFooter";const hn=y.forwardRef(({className:e,...t},n)=>s.jsx("tr",{ref:n,className:ue("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));hn.displayName="TableRow";const Qe=y.forwardRef(({className:e,...t},n)=>s.jsx("th",{ref:n,className:ue("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));Qe.displayName="TableHead";const Ue=y.forwardRef(({className:e,...t},n)=>s.jsx("td",{ref:n,className:ue("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));Ue.displayName="TableCell";const Rwe=y.forwardRef(({className:e,...t},n)=>s.jsx("caption",{ref:n,className:ue("mt-4 text-sm text-muted-foreground",e),...t}));Rwe.displayName="TableCaption";var Gy="Checkbox",[Dwe]=ur(Gy),[$we,vE]=Dwe(Gy);function Iwe(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:a,disabled:i,form:l,name:u,onCheckedChange:d,required:f,value:m="on",internal_do_not_use_render:p}=e,[g,x]=wa({prop:n,defaultProp:a??!1,onChange:d,caller:Gy}),[j,b]=y.useState(null),[w,N]=y.useState(null),O=y.useRef(!1),C=j?!!l||!!j.closest("form"):!0,A={checked:g,disabled:i,setChecked:x,control:j,setControl:b,name:u,form:l,value:m,hasConsumerStoppedPropagationRef:O,required:f,defaultChecked:Go(a)?!1:a,isFormControl:C,bubbleInput:w,setBubbleInput:N};return s.jsx($we,{scope:t,...A,children:Lwe(p)?p(A):r})}var LU="CheckboxTrigger",BU=y.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},a)=>{const{control:i,value:l,disabled:u,checked:d,required:f,setControl:m,setChecked:p,hasConsumerStoppedPropagationRef:g,isFormControl:x,bubbleInput:j}=vE(LU,e),b=qe(a,m),w=y.useRef(d);return y.useEffect(()=>{const N=i?.form;if(N){const O=()=>p(w.current);return N.addEventListener("reset",O),()=>N.removeEventListener("reset",O)}},[i,p]),s.jsx(Me.button,{type:"button",role:"checkbox","aria-checked":Go(d)?"mixed":d,"aria-required":f,"data-state":HU(d),"data-disabled":u?"":void 0,disabled:u,value:l,...r,ref:b,onKeyDown:Se(t,N=>{N.key==="Enter"&&N.preventDefault()}),onClick:Se(n,N=>{p(O=>Go(O)?!0:!O),j&&x&&(g.current=N.isPropagationStopped(),g.current||N.stopPropagation())})})});BU.displayName=LU;var gE=y.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:a,defaultChecked:i,required:l,disabled:u,value:d,onCheckedChange:f,form:m,...p}=e;return s.jsx(Iwe,{__scopeCheckbox:n,checked:a,defaultChecked:i,disabled:u,required:l,onCheckedChange:f,name:r,form:m,value:d,internal_do_not_use_render:({isFormControl:g})=>s.jsxs(s.Fragment,{children:[s.jsx(BU,{...p,ref:t,__scopeCheckbox:n}),g&&s.jsx(UU,{__scopeCheckbox:n})]})})});gE.displayName=Gy;var zU="CheckboxIndicator",qU=y.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...a}=e,i=vE(zU,n);return s.jsx(Sn,{present:r||Go(i.checked)||i.checked===!0,children:s.jsx(Me.span,{"data-state":HU(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});qU.displayName=zU;var FU="CheckboxBubbleInput",UU=y.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:a,checked:i,defaultChecked:l,required:u,disabled:d,name:f,value:m,form:p,bubbleInput:g,setBubbleInput:x}=vE(FU,e),j=qe(n,x),b=Oy(i),w=Cy(r);y.useEffect(()=>{const O=g;if(!O)return;const C=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(C,"checked").set,k=!a.current;if(b!==i&&E){const T=new Event("click",{bubbles:k});O.indeterminate=Go(i),E.call(O,Go(i)?!1:i),O.dispatchEvent(T)}},[g,b,i,a]);const N=y.useRef(Go(i)?!1:i);return s.jsx(Me.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??N.current,required:u,disabled:d,name:f,value:m,form:p,...t,tabIndex:-1,ref:j,style:{...t.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});UU.displayName=FU;function Lwe(e){return typeof e=="function"}function Go(e){return e==="indeterminate"}function HU(e){return Go(e)?"indeterminate":e?"checked":"unchecked"}const Cu=y.forwardRef(({className:e,...t},n)=>s.jsx(gE,{ref:n,className:ue("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:s.jsx(qU,{className:ue("grid place-content-center text-current"),children:s.jsx(Js,{className:"h-4 w-4"})})}));Cu.displayName=gE.displayName;function Bwe(){const[e,t]=y.useState([]),[n,r]=y.useState(!0),[a,i]=y.useState(!1),[l,u]=y.useState(!1),[d,f]=y.useState(!1),[m,p]=y.useState(!1),[g,x]=y.useState(null),[j,b]=y.useState(null),[w,N]=y.useState(!1),[O,C]=y.useState(null),[A,E]=y.useState(!1),[k,T]=y.useState(""),[P,$]=y.useState(new Set),[F,D]=y.useState(!1),{toast:U}=Dr(),V=y.useRef(null),H=y.useRef(!0);y.useEffect(()=>{G()},[]);const G=async()=>{try{r(!0);const ae=await Ng();t(ae.api_providers||[]),f(!1),H.current=!1}catch(ae){console.error("加载配置失败:",ae)}finally{r(!1)}},L=y.useCallback(async ae=>{if(!H.current)try{u(!0),await sO("api_providers",ae),f(!1)}catch(Z){console.error("自动保存失败:",Z),f(!0)}finally{u(!1)}},[]);y.useEffect(()=>{if(!H.current)return f(!0),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{L(e)},2e3),()=>{V.current&&clearTimeout(V.current)}},[e,L]);const R=async()=>{try{i(!0),V.current&&clearTimeout(V.current);const ae=await Ng();ae.api_providers=e,await IU(ae),f(!1),U({title:"保存成功",description:"模型提供商配置已保存"})}catch(ae){console.error("保存配置失败:",ae),U({title:"保存失败",description:ae.message,variant:"destructive"})}finally{i(!1)}},q=(ae,Z)=>{x(ae||{name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),b(Z),E(!1),p(!0)},K=async()=>{if(g?.api_key)try{await navigator.clipboard.writeText(g.api_key),U({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{U({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},ee=()=>{if(g){if(j!==null){const ae=[...e];ae[j]=g,t(ae)}else t([...e,g]);p(!1),x(null),b(null)}},I=ae=>{C(ae),N(!0)},B=()=>{if(O!==null){const ae=e.filter((Z,pe)=>pe!==O);t(ae),U({title:"删除成功",description:"提供商已从列表中移除"})}N(!1),C(null)},Y=ae=>{const Z=new Set(P);Z.has(ae)?Z.delete(ae):Z.add(ae),$(Z)},te=()=>{if(P.size===J.length)$(new Set);else{const ae=J.map((Z,pe)=>e.findIndex(je=>je===J[pe]));$(new Set(ae))}},oe=()=>{if(P.size===0){U({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}D(!0)},xe=()=>{const ae=e.filter((Z,pe)=>!P.has(pe));t(ae),$(new Set),D(!1),U({title:"批量删除成功",description:`已删除 ${P.size} 个提供商`})},J=e.filter(ae=>{if(!k)return!0;const Z=k.toLowerCase();return ae.name.toLowerCase().includes(Z)||ae.base_url.toLowerCase().includes(Z)||ae.client_type.toLowerCase().includes(Z)});return n?s.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):s.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型提供商配置"}),s.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 API 提供商配置"})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[P.size>0&&s.jsxs(me,{onClick:oe,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[s.jsx(zt,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",P.size,")"]}),s.jsxs(me,{onClick:()=>q(null,null),size:"sm",className:"w-full sm:w-auto",children:[s.jsx(Zn,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),s.jsxs(me,{onClick:R,disabled:a||l||!d,size:"sm",variant:"default",className:"w-full sm:w-auto",children:[s.jsx(VC,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),a?"保存中...":l?"自动保存中...":d?"保存配置":"已保存"]})]})]}),s.jsxs(Kt,{className:"h-[calc(100vh-260px)]",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[s.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[s.jsx(kr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Oe,{placeholder:"搜索提供商名称、URL 或类型...",value:k,onChange:ae=>T(ae.target.value),className:"pl-9"})]}),k&&s.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",J.length," 个结果"]})]}),s.jsx("div",{className:"md:hidden space-y-3",children:J.length===0?s.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:k?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):J.map((ae,Z)=>s.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"font-semibold text-base truncate",children:ae.name}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:ae.base_url})]}),s.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[s.jsx(me,{variant:"ghost",size:"sm",onClick:()=>q(ae,Z),children:s.jsx(_u,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),s.jsx(me,{variant:"ghost",size:"sm",onClick:()=>I(Z),children:s.jsx(zt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),s.jsx("p",{className:"font-medium",children:ae.client_type})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),s.jsx("p",{className:"font-medium",children:ae.max_retry})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),s.jsx("p",{className:"font-medium",children:ae.timeout})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),s.jsx("p",{className:"font-medium",children:ae.retry_interval})]})]})]},Z))}),s.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:s.jsxs(Sl,{children:[s.jsx(_l,{children:s.jsxs(hn,{children:[s.jsx(Qe,{className:"w-12",children:s.jsx(Cu,{checked:P.size===J.length&&J.length>0,onCheckedChange:te})}),s.jsx(Qe,{children:"名称"}),s.jsx(Qe,{children:"基础URL"}),s.jsx(Qe,{children:"客户端类型"}),s.jsx(Qe,{className:"text-right",children:"最大重试"}),s.jsx(Qe,{className:"text-right",children:"超时(秒)"}),s.jsx(Qe,{className:"text-right",children:"重试间隔(秒)"}),s.jsx(Qe,{className:"text-right",children:"操作"})]})}),s.jsx(Nl,{children:J.length===0?s.jsx(hn,{children:s.jsx(Ue,{colSpan:8,className:"text-center text-muted-foreground py-8",children:k?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):J.map((ae,Z)=>{const pe=e.findIndex(je=>je===ae);return s.jsxs(hn,{children:[s.jsx(Ue,{children:s.jsx(Cu,{checked:P.has(pe),onCheckedChange:()=>Y(pe)})}),s.jsx(Ue,{className:"font-medium",children:ae.name}),s.jsx(Ue,{className:"max-w-xs truncate",title:ae.base_url,children:ae.base_url}),s.jsx(Ue,{children:ae.client_type}),s.jsx(Ue,{className:"text-right",children:ae.max_retry}),s.jsx(Ue,{className:"text-right",children:ae.timeout}),s.jsx(Ue,{className:"text-right",children:ae.retry_interval}),s.jsx(Ue,{className:"text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(me,{variant:"ghost",size:"sm",onClick:()=>q(ae,pe),children:s.jsx(_u,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),s.jsx(me,{variant:"ghost",size:"sm",onClick:()=>I(pe),children:s.jsx(zt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]})})]},Z)})})]})})]}),s.jsx(Jn,{open:m,onOpenChange:p,children:s.jsxs(zn,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(qn,{children:[s.jsx(Fn,{children:j!==null?"编辑提供商":"添加提供商"}),s.jsx(lr,{children:"配置 API 提供商的连接信息和参数"})]}),s.jsxs("div",{className:"grid gap-4 py-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"name",children:"名称 *"}),s.jsx(Oe,{id:"name",value:g?.name||"",onChange:ae=>x(Z=>Z?{...Z,name:ae.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"base_url",children:"基础 URL *"}),s.jsx(Oe,{id:"base_url",value:g?.base_url||"",onChange:ae=>x(Z=>Z?{...Z,base_url:ae.target.value}:null),placeholder:"https://api.example.com/v1"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"api_key",children:"API Key *"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Oe,{id:"api_key",type:A?"text":"password",value:g?.api_key||"",onChange:ae=>x(Z=>Z?{...Z,api_key:ae.target.value}:null),placeholder:"sk-...",className:"flex-1"}),s.jsx(me,{type:"button",variant:"outline",size:"icon",onClick:()=>E(!A),title:A?"隐藏密钥":"显示密钥",children:A?s.jsx(FN,{className:"h-4 w-4"}):s.jsx(to,{className:"h-4 w-4"})}),s.jsx(me,{type:"button",variant:"outline",size:"icon",onClick:K,title:"复制密钥",children:s.jsx(zN,{className:"h-4 w-4"})})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"client_type",children:"客户端类型"}),s.jsxs(Nt,{value:g?.client_type||"openai",onValueChange:ae=>x(Z=>Z?{...Z,client_type:ae}:null),children:[s.jsx(xt,{id:"client_type",children:s.jsx(Ot,{placeholder:"选择客户端类型"})}),s.jsxs(bt,{children:[s.jsx(Pe,{value:"openai",children:"OpenAI"}),s.jsx(Pe,{value:"gemini",children:"Gemini"})]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"max_retry",children:"最大重试"}),s.jsx(Oe,{id:"max_retry",type:"number",min:"0",value:g?.max_retry||2,onChange:ae=>x(Z=>Z?{...Z,max_retry:parseInt(ae.target.value)}:null)})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"timeout",children:"超时(秒)"}),s.jsx(Oe,{id:"timeout",type:"number",min:"1",value:g?.timeout||30,onChange:ae=>x(Z=>Z?{...Z,timeout:parseInt(ae.target.value)}:null)})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),s.jsx(Oe,{id:"retry_interval",type:"number",min:"1",value:g?.retry_interval||10,onChange:ae=>x(Z=>Z?{...Z,retry_interval:parseInt(ae.target.value)}:null)})]})]})]}),s.jsxs(Pr,{children:[s.jsx(me,{variant:"outline",onClick:()=>p(!1),children:"取消"}),s.jsx(me,{onClick:ee,children:"保存"})]})]})}),s.jsx(Qn,{open:w,onOpenChange:N,children:s.jsxs(Pn,{children:[s.jsxs(Mn,{children:[s.jsx(Dn,{children:"确认删除"}),s.jsxs($n,{children:['确定要删除提供商 "',O!==null?e[O]?.name:"",'" 吗? 此操作无法撤销。']})]}),s.jsxs(Rn,{children:[s.jsx(Ln,{children:"取消"}),s.jsx(In,{onClick:B,children:"删除"})]})]})}),s.jsx(Qn,{open:F,onOpenChange:D,children:s.jsxs(Pn,{children:[s.jsxs(Mn,{children:[s.jsx(Dn,{children:"确认批量删除"}),s.jsxs($n,{children:["确定要删除选中的 ",P.size," 个提供商吗? 此操作无法撤销。"]})]}),s.jsxs(Rn,{children:[s.jsx(Ln,{children:"取消"}),s.jsx(In,{onClick:xe,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}const zwe=Rh("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function tn({className:e,variant:t,...n}){return s.jsx("div",{className:ue(zwe({variant:t}),e),...n})}var d3=1,qwe=.9,Fwe=.8,Uwe=.17,JS=.1,e_=.999,Hwe=.9999,Wwe=.99,Vwe=/[\\\/_+.#"@\[\(\{&]/,Gwe=/[\\\/_+.#"@\[\(\{&]/g,Ywe=/[\s-]/,WU=/[\s-]/g;function lO(e,t,n,r,a,i,l){if(i===t.length)return a===e.length?d3:Wwe;var u=`${a},${i}`;if(l[u]!==void 0)return l[u];for(var d=r.charAt(i),f=n.indexOf(d,a),m=0,p,g,x,j;f>=0;)p=lO(e,t,n,r,f+1,i+1,l),p>m&&(f===a?p*=d3:Vwe.test(e.charAt(f-1))?(p*=Fwe,x=e.slice(a,f-1).match(Gwe),x&&a>0&&(p*=Math.pow(e_,x.length))):Ywe.test(e.charAt(f-1))?(p*=qwe,j=e.slice(a,f-1).match(WU),j&&a>0&&(p*=Math.pow(e_,j.length))):(p*=Uwe,a>0&&(p*=Math.pow(e_,f-a))),e.charAt(f)!==t.charAt(i)&&(p*=Hwe)),(pp&&(p=g*JS)),p>m&&(m=p),f=n.indexOf(d,f+1);return l[u]=m,m}function f3(e){return e.toLowerCase().replace(WU," ")}function Kwe(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,lO(e,t,f3(e),f3(t),0,0,{})}var Xwe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],cs=Xwe.reduce((e,t)=>{const n=Ny(`Primitive.${t}`),r=y.forwardRef((a,i)=>{const{asChild:l,...u}=a,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(d,{...u,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),nf='[cmdk-group=""]',t_='[cmdk-group-items=""]',Zwe='[cmdk-group-heading=""]',VU='[cmdk-item=""]',h3=`${VU}:not([aria-disabled="true"])`,cO="cmdk-item-select",Tc="data-value",Qwe=(e,t,n)=>Kwe(e,t,n),GU=y.createContext(void 0),qh=()=>y.useContext(GU),YU=y.createContext(void 0),yE=()=>y.useContext(YU),KU=y.createContext(void 0),XU=y.forwardRef((e,t)=>{let n=kc(()=>{var B,Y;return{search:"",value:(Y=(B=e.value)!=null?B:e.defaultValue)!=null?Y:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=kc(()=>new Set),a=kc(()=>new Map),i=kc(()=>new Map),l=kc(()=>new Set),u=ZU(e),{label:d,children:f,value:m,onValueChange:p,filter:g,shouldFilter:x,loop:j,disablePointerSelection:b=!1,vimBindings:w=!0,...N}=e,O=kn(),C=kn(),A=kn(),E=y.useRef(null),k=c1e();ml(()=>{if(m!==void 0){let B=m.trim();n.current.value=B,T.emit()}},[m]),ml(()=>{k(6,V)},[]);let T=y.useMemo(()=>({subscribe:B=>(l.current.add(B),()=>l.current.delete(B)),snapshot:()=>n.current,setState:(B,Y,te)=>{var oe,xe,J,ae;if(!Object.is(n.current[B],Y)){if(n.current[B]=Y,B==="search")U(),F(),k(1,D);else if(B==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Z=document.getElementById(A);Z?Z.focus():(oe=document.getElementById(O))==null||oe.focus()}if(k(7,()=>{var Z;n.current.selectedItemId=(Z=H())==null?void 0:Z.id,T.emit()}),te||k(5,V),((xe=u.current)==null?void 0:xe.value)!==void 0){let Z=Y??"";(ae=(J=u.current).onValueChange)==null||ae.call(J,Z);return}}T.emit()}},emit:()=>{l.current.forEach(B=>B())}}),[]),P=y.useMemo(()=>({value:(B,Y,te)=>{var oe;Y!==((oe=i.current.get(B))==null?void 0:oe.value)&&(i.current.set(B,{value:Y,keywords:te}),n.current.filtered.items.set(B,$(Y,te)),k(2,()=>{F(),T.emit()}))},item:(B,Y)=>(r.current.add(B),Y&&(a.current.has(Y)?a.current.get(Y).add(B):a.current.set(Y,new Set([B]))),k(3,()=>{U(),F(),n.current.value||D(),T.emit()}),()=>{i.current.delete(B),r.current.delete(B),n.current.filtered.items.delete(B);let te=H();k(4,()=>{U(),te?.getAttribute("id")===B&&D(),T.emit()})}),group:B=>(a.current.has(B)||a.current.set(B,new Set),()=>{i.current.delete(B),a.current.delete(B)}),filter:()=>u.current.shouldFilter,label:d||e["aria-label"],getDisablePointerSelection:()=>u.current.disablePointerSelection,listId:O,inputId:A,labelId:C,listInnerRef:E}),[]);function $(B,Y){var te,oe;let xe=(oe=(te=u.current)==null?void 0:te.filter)!=null?oe:Qwe;return B?xe(B,n.current.search,Y):0}function F(){if(!n.current.search||u.current.shouldFilter===!1)return;let B=n.current.filtered.items,Y=[];n.current.filtered.groups.forEach(oe=>{let xe=a.current.get(oe),J=0;xe.forEach(ae=>{let Z=B.get(ae);J=Math.max(Z,J)}),Y.push([oe,J])});let te=E.current;G().sort((oe,xe)=>{var J,ae;let Z=oe.getAttribute("id"),pe=xe.getAttribute("id");return((J=B.get(pe))!=null?J:0)-((ae=B.get(Z))!=null?ae:0)}).forEach(oe=>{let xe=oe.closest(t_);xe?xe.appendChild(oe.parentElement===xe?oe:oe.closest(`${t_} > *`)):te.appendChild(oe.parentElement===te?oe:oe.closest(`${t_} > *`))}),Y.sort((oe,xe)=>xe[1]-oe[1]).forEach(oe=>{var xe;let J=(xe=E.current)==null?void 0:xe.querySelector(`${nf}[${Tc}="${encodeURIComponent(oe[0])}"]`);J?.parentElement.appendChild(J)})}function D(){let B=G().find(te=>te.getAttribute("aria-disabled")!=="true"),Y=B?.getAttribute(Tc);T.setState("value",Y||void 0)}function U(){var B,Y,te,oe;if(!n.current.search||u.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let xe=0;for(let J of r.current){let ae=(Y=(B=i.current.get(J))==null?void 0:B.value)!=null?Y:"",Z=(oe=(te=i.current.get(J))==null?void 0:te.keywords)!=null?oe:[],pe=$(ae,Z);n.current.filtered.items.set(J,pe),pe>0&&xe++}for(let[J,ae]of a.current)for(let Z of ae)if(n.current.filtered.items.get(Z)>0){n.current.filtered.groups.add(J);break}n.current.filtered.count=xe}function V(){var B,Y,te;let oe=H();oe&&(((B=oe.parentElement)==null?void 0:B.firstChild)===oe&&((te=(Y=oe.closest(nf))==null?void 0:Y.querySelector(Zwe))==null||te.scrollIntoView({block:"nearest"})),oe.scrollIntoView({block:"nearest"}))}function H(){var B;return(B=E.current)==null?void 0:B.querySelector(`${VU}[aria-selected="true"]`)}function G(){var B;return Array.from(((B=E.current)==null?void 0:B.querySelectorAll(h3))||[])}function L(B){let Y=G()[B];Y&&T.setState("value",Y.getAttribute(Tc))}function R(B){var Y;let te=H(),oe=G(),xe=oe.findIndex(ae=>ae===te),J=oe[xe+B];(Y=u.current)!=null&&Y.loop&&(J=xe+B<0?oe[oe.length-1]:xe+B===oe.length?oe[0]:oe[xe+B]),J&&T.setState("value",J.getAttribute(Tc))}function q(B){let Y=H(),te=Y?.closest(nf),oe;for(;te&&!oe;)te=B>0?s1e(te,nf):l1e(te,nf),oe=te?.querySelector(h3);oe?T.setState("value",oe.getAttribute(Tc)):R(B)}let K=()=>L(G().length-1),ee=B=>{B.preventDefault(),B.metaKey?K():B.altKey?q(1):R(1)},I=B=>{B.preventDefault(),B.metaKey?L(0):B.altKey?q(-1):R(-1)};return y.createElement(cs.div,{ref:t,tabIndex:-1,...N,"cmdk-root":"",onKeyDown:B=>{var Y;(Y=N.onKeyDown)==null||Y.call(N,B);let te=B.nativeEvent.isComposing||B.keyCode===229;if(!(B.defaultPrevented||te))switch(B.key){case"n":case"j":{w&&B.ctrlKey&&ee(B);break}case"ArrowDown":{ee(B);break}case"p":case"k":{w&&B.ctrlKey&&I(B);break}case"ArrowUp":{I(B);break}case"Home":{B.preventDefault(),L(0);break}case"End":{B.preventDefault(),K();break}case"Enter":{B.preventDefault();let oe=H();if(oe){let xe=new Event(cO);oe.dispatchEvent(xe)}}}}},y.createElement("label",{"cmdk-label":"",htmlFor:P.inputId,id:P.labelId,style:d1e},d),Yy(e,B=>y.createElement(YU.Provider,{value:T},y.createElement(GU.Provider,{value:P},B))))}),Jwe=y.forwardRef((e,t)=>{var n,r;let a=kn(),i=y.useRef(null),l=y.useContext(KU),u=qh(),d=ZU(e),f=(r=(n=d.current)==null?void 0:n.forceMount)!=null?r:l?.forceMount;ml(()=>{if(!f)return u.item(a,l?.id)},[f]);let m=QU(a,i,[e.value,e.children,i],e.keywords),p=yE(),g=Jo(k=>k.value&&k.value===m.current),x=Jo(k=>f||u.filter()===!1?!0:k.search?k.filtered.items.get(a)>0:!0);y.useEffect(()=>{let k=i.current;if(!(!k||e.disabled))return k.addEventListener(cO,j),()=>k.removeEventListener(cO,j)},[x,e.onSelect,e.disabled]);function j(){var k,T;b(),(T=(k=d.current).onSelect)==null||T.call(k,m.current)}function b(){p.setState("value",m.current,!0)}if(!x)return null;let{disabled:w,value:N,onSelect:O,forceMount:C,keywords:A,...E}=e;return y.createElement(cs.div,{ref:Tr(i,t),...E,id:a,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!g,"data-disabled":!!w,"data-selected":!!g,onPointerMove:w||u.getDisablePointerSelection()?void 0:b,onClick:w?void 0:j},e.children)}),e1e=y.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:a,...i}=e,l=kn(),u=y.useRef(null),d=y.useRef(null),f=kn(),m=qh(),p=Jo(x=>a||m.filter()===!1?!0:x.search?x.filtered.groups.has(l):!0);ml(()=>m.group(l),[]),QU(l,u,[e.value,e.heading,d]);let g=y.useMemo(()=>({id:l,forceMount:a}),[a]);return y.createElement(cs.div,{ref:Tr(u,t),...i,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},n&&y.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),Yy(e,x=>y.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},y.createElement(KU.Provider,{value:g},x))))}),t1e=y.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,a=y.useRef(null),i=Jo(l=>!l.search);return!n&&!i?null:y.createElement(cs.div,{ref:Tr(a,t),...r,"cmdk-separator":"",role:"separator"})}),n1e=y.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,a=e.value!=null,i=yE(),l=Jo(f=>f.search),u=Jo(f=>f.selectedItemId),d=qh();return y.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),y.createElement(cs.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":u,id:d.inputId,type:"text",value:a?e.value:l,onChange:f=>{a||i.setState("search",f.target.value),n?.(f.target.value)}})}),r1e=y.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...a}=e,i=y.useRef(null),l=y.useRef(null),u=Jo(f=>f.selectedItemId),d=qh();return y.useEffect(()=>{if(l.current&&i.current){let f=l.current,m=i.current,p,g=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let x=f.offsetHeight;m.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return g.observe(f),()=>{cancelAnimationFrame(p),g.unobserve(f)}}},[]),y.createElement(cs.div,{ref:Tr(i,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":u,"aria-label":r,id:d.listId},Yy(e,f=>y.createElement("div",{ref:Tr(l,d.listInnerRef),"cmdk-list-sizer":""},f)))}),a1e=y.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:i,container:l,...u}=e;return y.createElement(JC,{open:n,onOpenChange:r},y.createElement(eE,{container:l},y.createElement(My,{"cmdk-overlay":"",className:a}),y.createElement(Ry,{"aria-label":e.label,"cmdk-dialog":"",className:i},y.createElement(XU,{ref:t,...u}))))}),i1e=y.forwardRef((e,t)=>Jo(n=>n.filtered.count===0)?y.createElement(cs.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),o1e=y.forwardRef((e,t)=>{let{progress:n,children:r,label:a="Loading...",...i}=e;return y.createElement(cs.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Yy(e,l=>y.createElement("div",{"aria-hidden":!0},l)))}),$r=Object.assign(XU,{List:r1e,Item:Jwe,Input:n1e,Group:e1e,Separator:t1e,Dialog:a1e,Empty:i1e,Loading:o1e});function s1e(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function l1e(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ZU(e){let t=y.useRef(e);return ml(()=>{t.current=e}),t}var ml=typeof window>"u"?y.useEffect:y.useLayoutEffect;function kc(e){let t=y.useRef();return t.current===void 0&&(t.current=e()),t}function Jo(e){let t=yE(),n=()=>e(t.snapshot());return y.useSyncExternalStore(t.subscribe,n,n)}function QU(e,t,n,r=[]){let a=y.useRef(),i=qh();return ml(()=>{var l;let u=(()=>{var f;for(let m of n){if(typeof m=="string")return m.trim();if(typeof m=="object"&&"current"in m)return m.current?(f=m.current.textContent)==null?void 0:f.trim():a.current}})(),d=r.map(f=>f.trim());i.value(e,u,d),(l=t.current)==null||l.setAttribute(Tc,u),a.current=u}),a}var c1e=()=>{let[e,t]=y.useState(),n=kc(()=>new Map);return ml(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,a)=>{n.current.set(r,a),t({})}};function u1e(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Yy({asChild:e,children:t},n){return e&&y.isValidElement(t)?y.cloneElement(u1e(t),{ref:t.ref},n(t.props.children)):n(t)}var d1e={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const JU=y.forwardRef(({className:e,...t},n)=>s.jsx($r,{ref:n,className:ue("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));JU.displayName=$r.displayName;const eH=y.forwardRef(({className:e,...t},n)=>s.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[s.jsx(kr,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),s.jsx($r.Input,{ref:n,className:ue("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));eH.displayName=$r.Input.displayName;const tH=y.forwardRef(({className:e,...t},n)=>s.jsx($r.List,{ref:n,className:ue("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));tH.displayName=$r.List.displayName;const nH=y.forwardRef((e,t)=>s.jsx($r.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));nH.displayName=$r.Empty.displayName;const rH=y.forwardRef(({className:e,...t},n)=>s.jsx($r.Group,{ref:n,className:ue("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));rH.displayName=$r.Group.displayName;const f1e=y.forwardRef(({className:e,...t},n)=>s.jsx($r.Separator,{ref:n,className:ue("-mx-1 h-px bg-border",e),...t}));f1e.displayName=$r.Separator.displayName;const aH=y.forwardRef(({className:e,...t},n)=>s.jsx($r.Item,{ref:n,className:ue("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));aH.displayName=$r.Item.displayName;function h1e({options:e,selected:t,onChange:n,placeholder:r="选择选项...",emptyText:a="未找到选项",className:i}){const[l,u]=y.useState(!1),d=m=>{t.includes(m)?n(t.filter(p=>p!==m)):n([...t,m])},f=m=>{n(t.filter(p=>p!==m))};return s.jsxs(Zo,{open:l,onOpenChange:u,children:[s.jsx(Qo,{asChild:!0,children:s.jsxs(me,{variant:"outline",role:"combobox","aria-expanded":l,className:ue("w-full justify-between min-h-10 h-auto",i),children:[s.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:t.length===0?s.jsx("span",{className:"text-muted-foreground",children:r}):t.map(m=>{const p=e.find(g=>g.value===m);return s.jsxs(tn,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80",onClick:g=>{g.stopPropagation(),f(m)},children:[p?.label||m,s.jsx(_y,{className:"ml-1 h-3 w-3",strokeWidth:2,fill:"none"})]},m)})}),s.jsx(Xpe,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),s.jsx(ao,{className:"w-full p-0",align:"start",children:s.jsxs(JU,{children:[s.jsx(eH,{placeholder:"搜索...",className:"h-9"}),s.jsxs(tH,{children:[s.jsx(nH,{children:a}),s.jsx(rH,{children:e.map(m=>{const p=t.includes(m.value);return s.jsxs(aH,{value:m.value,onSelect:()=>d(m.value),children:[s.jsx("div",{className:ue("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",p?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:s.jsx(Js,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),s.jsx("span",{children:m.label})]},m.value)})})]})]})})]})}function m1e(){const[e,t]=y.useState([]),[n,r]=y.useState([]),[a,i]=y.useState([]),[l,u]=y.useState(null),[d,f]=y.useState(!0),[m,p]=y.useState(!1),[g,x]=y.useState(!1),[j,b]=y.useState(!1),[w,N]=y.useState(!1),[O,C]=y.useState(null),[A,E]=y.useState(null),[k,T]=y.useState(!1),[P,$]=y.useState(null),[F,D]=y.useState(""),[U,V]=y.useState(new Set),[H,G]=y.useState(!1),{toast:L}=Dr(),R=y.useRef(null),q=y.useRef(null),K=y.useRef(!0);y.useEffect(()=>{ee()},[]);const ee=async()=>{try{f(!0);const he=await Ng(),ve=he.models||[];t(ve),i(ve.map(Mt=>Mt.name));const Le=he.api_providers||[];r(Le.map(Mt=>Mt.name)),u(he.model_task_config||null),b(!1),K.current=!1}catch(he){console.error("加载配置失败:",he)}finally{f(!1)}},I=y.useCallback(async he=>{if(!K.current)try{x(!0),await sO("models",he),b(!1)}catch(ve){console.error("自动保存模型列表失败:",ve),b(!0)}finally{x(!1)}},[]),B=y.useCallback(async he=>{if(!K.current)try{x(!0),await sO("model_task_config",he),b(!1)}catch(ve){console.error("自动保存任务配置失败:",ve),b(!0)}finally{x(!1)}},[]);y.useEffect(()=>{if(!K.current)return b(!0),R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{I(e)},2e3),()=>{R.current&&clearTimeout(R.current)}},[e,I]),y.useEffect(()=>{if(!(K.current||!l))return b(!0),q.current&&clearTimeout(q.current),q.current=setTimeout(()=>{B(l)},2e3),()=>{q.current&&clearTimeout(q.current)}},[l,B]);const Y=async()=>{try{p(!0),R.current&&clearTimeout(R.current),q.current&&clearTimeout(q.current);const he=await Ng();he.models=e,he.model_task_config=l,await IU(he),b(!1),L({title:"保存成功",description:"模型配置已保存"}),await ee()}catch(he){console.error("保存配置失败:",he),L({title:"保存失败",description:he.message,variant:"destructive"})}finally{p(!1)}},te=(he,ve)=>{C(he||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),E(ve),N(!0)},oe=()=>{if(O){if(A!==null){const he=[...e];he[A]=O,t(he)}else t([...e,O]);N(!1),C(null),E(null)}},xe=he=>{$(he),T(!0)},J=()=>{if(P!==null){const he=e.filter((ve,Le)=>Le!==P);t(he),L({title:"删除成功",description:"模型已从列表中移除"})}T(!1),$(null)},ae=he=>{const ve=new Set(U);ve.has(he)?ve.delete(he):ve.add(he),V(ve)},Z=()=>{if(U.size===Re.length)V(new Set);else{const he=Re.map((ve,Le)=>e.findIndex(Mt=>Mt===Re[Le]));V(new Set(he))}},pe=()=>{if(U.size===0){L({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}G(!0)},je=()=>{const he=e.filter((ve,Le)=>!U.has(Le));t(he),V(new Set),G(!1),L({title:"批量删除成功",description:`已删除 ${U.size} 个模型`})},le=(he,ve,Le)=>{l&&u({...l,[he]:{...l[he],[ve]:Le}})},Re=e.filter(he=>{if(!F)return!0;const ve=F.toLowerCase();return he.name.toLowerCase().includes(ve)||he.model_identifier.toLowerCase().includes(ve)||he.api_provider.toLowerCase().includes(ve)}),_e=he=>l?[l.utils?.model_list||[],l.utils_small?.model_list||[],l.tool_use?.model_list||[],l.replyer?.model_list||[],l.planner?.model_list||[],l.vlm?.model_list||[],l.voice?.model_list||[],l.embedding?.model_list||[],l.lpmm_entity_extract?.model_list||[],l.lpmm_rdf_build?.model_list||[],l.lpmm_qa?.model_list||[]].some(Le=>Le.includes(he)):!1;return d?s.jsx(Kt,{className:"h-full",children:s.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):s.jsx(Kt,{className:"h-full",children:s.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型配置"}),s.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理模型和任务配置"})]}),s.jsxs(me,{onClick:Y,disabled:m||g||!j,size:"sm",className:"w-full sm:w-auto",children:[s.jsx(VC,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),m?"保存中...":g?"自动保存中...":j?"保存配置":"已保存"]})]}),s.jsxs(al,{defaultValue:"models",className:"w-full",children:[s.jsxs(Yo,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[s.jsx(Tt,{value:"models",children:"模型配置"}),s.jsx(Tt,{value:"tasks",children:"模型任务配置"})]}),s.jsxs(Jt,{value:"models",className:"space-y-4 mt-0",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),s.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[U.size>0&&s.jsxs(me,{onClick:pe,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[s.jsx(zt,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",U.size,")"]}),s.jsxs(me,{onClick:()=>te(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[s.jsx(Zn,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[s.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[s.jsx(kr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Oe,{placeholder:"搜索模型名称、标识符或提供商...",value:F,onChange:he=>D(he.target.value),className:"pl-9"})]}),F&&s.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Re.length," 个结果"]})]}),s.jsx("div",{className:"md:hidden space-y-3",children:Re.length===0?s.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:F?"未找到匹配的模型":"暂无模型配置"}):Re.map((he,ve)=>{const Le=_e(he.name);return s.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("h3",{className:"font-semibold text-base",children:he.name}),s.jsx(tn,{variant:Le?"default":"secondary",className:Le?"bg-green-600 hover:bg-green-700":"",children:Le?"已使用":"未使用"})]}),s.jsx("p",{className:"text-xs text-muted-foreground break-all",title:he.model_identifier,children:he.model_identifier})]}),s.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[s.jsx(me,{variant:"ghost",size:"sm",onClick:()=>te(he,ve),children:s.jsx(_u,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),s.jsx(me,{variant:"ghost",size:"sm",onClick:()=>xe(ve),children:s.jsx(zt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),s.jsx("p",{className:"font-medium",children:he.api_provider})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),s.jsx("p",{className:"font-medium",children:he.force_stream_mode?"是":"否"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),s.jsxs("p",{className:"font-medium",children:["¥",he.price_in,"/M"]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),s.jsxs("p",{className:"font-medium",children:["¥",he.price_out,"/M"]})]})]})]},ve)})}),s.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:s.jsxs(Sl,{children:[s.jsx(_l,{children:s.jsxs(hn,{children:[s.jsx(Qe,{className:"w-12",children:s.jsx(Cu,{checked:U.size===Re.length&&Re.length>0,onCheckedChange:Z})}),s.jsx(Qe,{className:"w-24",children:"使用状态"}),s.jsx(Qe,{children:"模型名称"}),s.jsx(Qe,{children:"模型标识符"}),s.jsx(Qe,{children:"提供商"}),s.jsx(Qe,{className:"text-right",children:"输入价格"}),s.jsx(Qe,{className:"text-right",children:"输出价格"}),s.jsx(Qe,{className:"text-center",children:"强制流式"}),s.jsx(Qe,{className:"text-right",children:"操作"})]})}),s.jsx(Nl,{children:Re.length===0?s.jsx(hn,{children:s.jsx(Ue,{colSpan:9,className:"text-center text-muted-foreground py-8",children:F?"未找到匹配的模型":"暂无模型配置"})}):Re.map((he,ve)=>{const Le=e.findIndex(vn=>vn===he),Mt=_e(he.name);return s.jsxs(hn,{children:[s.jsx(Ue,{children:s.jsx(Cu,{checked:U.has(Le),onCheckedChange:()=>ae(Le)})}),s.jsx(Ue,{children:s.jsx(tn,{variant:Mt?"default":"secondary",className:Mt?"bg-green-600 hover:bg-green-700":"",children:Mt?"已使用":"未使用"})}),s.jsx(Ue,{className:"font-medium",children:he.name}),s.jsx(Ue,{className:"max-w-xs truncate",title:he.model_identifier,children:he.model_identifier}),s.jsx(Ue,{children:he.api_provider}),s.jsxs(Ue,{className:"text-right",children:["¥",he.price_in,"/M"]}),s.jsxs(Ue,{className:"text-right",children:["¥",he.price_out,"/M"]}),s.jsx(Ue,{className:"text-center",children:he.force_stream_mode?"是":"否"}),s.jsx(Ue,{className:"text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(me,{variant:"ghost",size:"sm",onClick:()=>te(he,Le),children:s.jsx(_u,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),s.jsx(me,{variant:"ghost",size:"sm",onClick:()=>xe(Le),children:s.jsx(zt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]})})]},ve)})})]})})]}),s.jsxs(Jt,{value:"tasks",className:"space-y-6 mt-0",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),l&&s.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[s.jsx(Aa,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:l.utils,modelNames:a,onChange:(he,ve)=>le("utils",he,ve)}),s.jsx(Aa,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:l.utils_small,modelNames:a,onChange:(he,ve)=>le("utils_small",he,ve)}),s.jsx(Aa,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:l.tool_use,modelNames:a,onChange:(he,ve)=>le("tool_use",he,ve)}),s.jsx(Aa,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:l.replyer,modelNames:a,onChange:(he,ve)=>le("replyer",he,ve)}),s.jsx(Aa,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:l.planner,modelNames:a,onChange:(he,ve)=>le("planner",he,ve)}),s.jsx(Aa,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:l.vlm,modelNames:a,onChange:(he,ve)=>le("vlm",he,ve),hideTemperature:!0}),s.jsx(Aa,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:l.voice,modelNames:a,onChange:(he,ve)=>le("voice",he,ve),hideTemperature:!0,hideMaxTokens:!0}),s.jsx(Aa,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:l.embedding,modelNames:a,onChange:(he,ve)=>le("embedding",he,ve),hideTemperature:!0,hideMaxTokens:!0}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),s.jsx(Aa,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:l.lpmm_entity_extract,modelNames:a,onChange:(he,ve)=>le("lpmm_entity_extract",he,ve)}),s.jsx(Aa,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:l.lpmm_rdf_build,modelNames:a,onChange:(he,ve)=>le("lpmm_rdf_build",he,ve)}),s.jsx(Aa,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:l.lpmm_qa,modelNames:a,onChange:(he,ve)=>le("lpmm_qa",he,ve)})]})]})]})]}),s.jsx(Jn,{open:w,onOpenChange:N,children:s.jsxs(zn,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(qn,{children:[s.jsx(Fn,{children:A!==null?"编辑模型":"添加模型"}),s.jsx(lr,{children:"配置模型的基本信息和参数"})]}),s.jsxs("div",{className:"grid gap-4 py-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"model_name",children:"模型名称 *"}),s.jsx(Oe,{id:"model_name",value:O?.name||"",onChange:he=>C(ve=>ve?{...ve,name:he.target.value}:null),placeholder:"例如: qwen3-30b"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"model_identifier",children:"模型标识符 *"}),s.jsx(Oe,{id:"model_identifier",value:O?.model_identifier||"",onChange:he=>C(ve=>ve?{...ve,model_identifier:he.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"API 提供商提供的模型 ID"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"api_provider",children:"API 提供商 *"}),s.jsxs(Nt,{value:O?.api_provider||"",onValueChange:he=>C(ve=>ve?{...ve,api_provider:he}:null),children:[s.jsx(xt,{id:"api_provider",children:s.jsx(Ot,{placeholder:"选择提供商"})}),s.jsx(bt,{children:n.map(he=>s.jsx(Pe,{value:he,children:he},he))})]})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),s.jsx(Oe,{id:"price_in",type:"number",step:"0.1",min:"0",value:O?.price_in||0,onChange:he=>C(ve=>ve?{...ve,price_in:parseFloat(he.target.value)}:null)})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),s.jsx(Oe,{id:"price_out",type:"number",step:"0.1",min:"0",value:O?.price_out||0,onChange:he=>C(ve=>ve?{...ve,price_out:parseFloat(he.target.value)}:null)})]})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(ht,{id:"force_stream_mode",checked:O?.force_stream_mode||!1,onCheckedChange:he=>C(ve=>ve?{...ve,force_stream_mode:he}:null)}),s.jsx(re,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),s.jsxs(Pr,{children:[s.jsx(me,{variant:"outline",onClick:()=>N(!1),children:"取消"}),s.jsx(me,{onClick:oe,children:"保存"})]})]})}),s.jsx(Qn,{open:k,onOpenChange:T,children:s.jsxs(Pn,{children:[s.jsxs(Mn,{children:[s.jsx(Dn,{children:"确认删除"}),s.jsxs($n,{children:['确定要删除模型 "',P!==null?e[P]?.name:"",'" 吗? 此操作无法撤销。']})]}),s.jsxs(Rn,{children:[s.jsx(Ln,{children:"取消"}),s.jsx(In,{onClick:J,children:"删除"})]})]})}),s.jsx(Qn,{open:H,onOpenChange:G,children:s.jsxs(Pn,{children:[s.jsxs(Mn,{children:[s.jsx(Dn,{children:"确认批量删除"}),s.jsxs($n,{children:["确定要删除选中的 ",U.size," 个模型吗? 此操作无法撤销。"]})]}),s.jsxs(Rn,{children:[s.jsx(Ln,{children:"取消"}),s.jsx(In,{onClick:je,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})})}function Aa({title:e,description:t,taskConfig:n,modelNames:r,onChange:a,hideTemperature:i=!1,hideMaxTokens:l=!1}){const u=d=>{a("model_list",d)};return s.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:e}),s.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:t})]}),s.jsxs("div",{className:"grid gap-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"模型列表"}),s.jsx(h1e,{options:r.map(d=>({label:d,value:d})),selected:n.model_list||[],onChange:u,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!i&&s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"温度"}),s.jsx(Oe,{type:"number",step:"0.1",min:"0",max:"2",value:n.temperature||.3,onChange:d=>a("temperature",parseFloat(d.target.value))})]}),!l&&s.jsxs("div",{className:"grid gap-2",children:[s.jsx(re,{children:"最大 Token"}),s.jsx(Oe,{type:"number",step:"1",min:"1",value:n.max_tokens||1024,onChange:d=>a("max_tokens",parseInt(d.target.value))})]})]})]})]})}const Ol="/api/webui/emoji";function Cl(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function p1e(e){const t=new URLSearchParams;e.page&&t.append("page",e.page.toString()),e.page_size&&t.append("page_size",e.page_size.toString()),e.search&&t.append("search",e.search),e.is_registered!==void 0&&t.append("is_registered",e.is_registered.toString()),e.is_banned!==void 0&&t.append("is_banned",e.is_banned.toString()),e.format&&t.append("format",e.format),e.sort_by&&t.append("sort_by",e.sort_by),e.sort_order&&t.append("sort_order",e.sort_order);const n=await fetch(`${Ol}/list?${t}`,{headers:Cl()});if(!n.ok)throw new Error(`获取表情包列表失败: ${n.statusText}`);return n.json()}async function v1e(e){const t=await fetch(`${Ol}/${e}`,{headers:Cl()});if(!t.ok)throw new Error(`获取表情包详情失败: ${t.statusText}`);return t.json()}async function g1e(e,t){const n=await fetch(`${Ol}/${e}`,{method:"PATCH",headers:Cl(),body:JSON.stringify(t)});if(!n.ok)throw new Error(`更新表情包失败: ${n.statusText}`);return n.json()}async function y1e(e){const t=await fetch(`${Ol}/${e}`,{method:"DELETE",headers:Cl()});if(!t.ok)throw new Error(`删除表情包失败: ${t.statusText}`);return t.json()}async function x1e(){const e=await fetch(`${Ol}/stats/summary`,{headers:Cl()});if(!e.ok)throw new Error(`获取统计数据失败: ${e.statusText}`);return e.json()}async function b1e(e){const t=await fetch(`${Ol}/${e}/register`,{method:"POST",headers:Cl()});if(!t.ok)throw new Error(`注册表情包失败: ${t.statusText}`);return t.json()}async function w1e(e){const t=await fetch(`${Ol}/${e}/ban`,{method:"POST",headers:Cl()});if(!t.ok)throw new Error(`封禁表情包失败: ${t.statusText}`);return t.json()}function j1e(){const[e,t]=y.useState([]),[n,r]=y.useState(null),[a,i]=y.useState(!1),[l,u]=y.useState(1),[d,f]=y.useState(0),[m]=y.useState(20),[p,g]=y.useState(""),[x,j]=y.useState("all"),[b,w]=y.useState("all"),[N,O]=y.useState("all"),[C,A]=y.useState(null),[E,k]=y.useState(!1),[T,P]=y.useState(!1),[$,F]=y.useState(!1),{toast:D}=Dr(),U=y.useCallback(async()=>{try{i(!0);const I=await p1e({page:l,page_size:m,search:p||void 0,is_registered:x==="all"?void 0:x==="registered",is_banned:b==="all"?void 0:b==="banned",format:N==="all"?void 0:N,sort_by:"usage_count",sort_order:"desc"});t(I.data),f(I.total)}catch(I){const B=I instanceof Error?I.message:"加载表情包列表失败";D({title:"错误",description:B,variant:"destructive"})}finally{i(!1)}},[l,m,p,x,b,N,D]),V=async()=>{try{const I=await x1e();r(I.data)}catch(I){console.error("加载统计数据失败:",I)}};y.useEffect(()=>{U()},[U]),y.useEffect(()=>{V()},[]);const H=async I=>{try{const B=await v1e(I.id);A(B.data),k(!0)}catch(B){const Y=B instanceof Error?B.message:"加载详情失败";D({title:"错误",description:Y,variant:"destructive"})}},G=I=>{A(I),P(!0)},L=I=>{A(I),F(!0)},R=async()=>{if(C)try{await y1e(C.id),D({title:"成功",description:"表情包已删除"}),F(!1),A(null),U(),V()}catch(I){const B=I instanceof Error?I.message:"删除失败";D({title:"错误",description:B,variant:"destructive"})}},q=async I=>{try{await b1e(I.id),D({title:"成功",description:"表情包已注册"}),U(),V()}catch(B){const Y=B instanceof Error?B.message:"注册失败";D({title:"错误",description:Y,variant:"destructive"})}},K=async I=>{try{await w1e(I.id),D({title:"成功",description:"表情包已封禁"}),U(),V()}catch(B){const Y=B instanceof Error?B.message:"封禁失败";D({title:"错误",description:Y,variant:"destructive"})}},ee=n?.formats?Object.keys(n.formats):[];return s.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),n&&s.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[s.jsx(ct,{children:s.jsxs(Ut,{className:"pb-2",children:[s.jsx(Xn,{children:"总数"}),s.jsx(Ht,{className:"text-2xl",children:n.total})]})}),s.jsx(ct,{children:s.jsxs(Ut,{className:"pb-2",children:[s.jsx(Xn,{children:"已注册"}),s.jsx(Ht,{className:"text-2xl text-green-600",children:n.registered})]})}),s.jsx(ct,{children:s.jsxs(Ut,{className:"pb-2",children:[s.jsx(Xn,{children:"已封禁"}),s.jsx(Ht,{className:"text-2xl text-red-600",children:n.banned})]})}),s.jsx(ct,{children:s.jsxs(Ut,{className:"pb-2",children:[s.jsx(Xn,{children:"未注册"}),s.jsx(Ht,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),s.jsxs(ct,{children:[s.jsx(Ut,{children:s.jsxs(Ht,{className:"flex items-center gap-2",children:[s.jsx(UN,{className:"h-5 w-5"}),"搜索和筛选"]})}),s.jsxs(un,{className:"space-y-4",children:[s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{children:"搜索"}),s.jsxs("div",{className:"relative",children:[s.jsx(kr,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),s.jsx(Oe,{placeholder:"描述或哈希值...",value:p,onChange:I=>{g(I.target.value),u(1)},className:"pl-8"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{children:"注册状态"}),s.jsxs(Nt,{value:x,onValueChange:I=>{j(I),u(1)},children:[s.jsx(xt,{children:s.jsx(Ot,{})}),s.jsxs(bt,{children:[s.jsx(Pe,{value:"all",children:"全部"}),s.jsx(Pe,{value:"registered",children:"已注册"}),s.jsx(Pe,{value:"unregistered",children:"未注册"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{children:"封禁状态"}),s.jsxs(Nt,{value:b,onValueChange:I=>{w(I),u(1)},children:[s.jsx(xt,{children:s.jsx(Ot,{})}),s.jsxs(bt,{children:[s.jsx(Pe,{value:"all",children:"全部"}),s.jsx(Pe,{value:"banned",children:"已封禁"}),s.jsx(Pe,{value:"unbanned",children:"未封禁"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{children:"格式"}),s.jsxs(Nt,{value:N,onValueChange:I=>{O(I),u(1)},children:[s.jsx(xt,{children:s.jsx(Ot,{})}),s.jsxs(bt,{children:[s.jsx(Pe,{value:"all",children:"全部"}),ee.map(I=>s.jsxs(Pe,{value:I,children:[I.toUpperCase()," (",n?.formats[I],")"]},I))]})]})]})]}),s.jsx("div",{className:"flex justify-end",children:s.jsxs(me,{variant:"outline",size:"sm",onClick:U,disabled:a,children:[s.jsx(tl,{className:`h-4 w-4 mr-2 ${a?"animate-spin":""}`}),"刷新"]})})]})]}),s.jsxs(ct,{children:[s.jsxs(Ut,{children:[s.jsx(Ht,{children:"表情包列表"}),s.jsxs(Xn,{children:["共 ",d," 个表情包,当前第 ",l," 页"]})]}),s.jsxs(un,{children:[s.jsx("div",{className:"rounded-md border",children:s.jsxs(Sl,{children:[s.jsx(_l,{children:s.jsxs(hn,{children:[s.jsx(Qe,{className:"w-16",children:"预览"}),s.jsx(Qe,{children:"描述"}),s.jsx(Qe,{children:"格式"}),s.jsx(Qe,{className:"text-center",children:"状态"}),s.jsx(Qe,{className:"text-right",children:"使用次数"}),s.jsx(Qe,{className:"text-right",children:"操作"})]})}),s.jsx(Nl,{children:e.length===0?s.jsx(hn,{children:s.jsx(Ue,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):e.map(I=>s.jsxs(hn,{children:[s.jsx(Ue,{children:s.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:s.jsx(wve,{className:"h-6 w-6 text-muted-foreground"})})}),s.jsx(Ue,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsx("div",{className:"font-medium",children:I.description||"无描述"}),s.jsxs("div",{className:"text-xs text-muted-foreground font-mono",children:[I.emoji_hash.slice(0,16),"..."]})]})}),s.jsx(Ue,{children:s.jsx(tn,{variant:"outline",children:I.format.toUpperCase()})}),s.jsx(Ue,{children:s.jsxs("div",{className:"flex gap-2 justify-center",children:[I.is_registered&&s.jsxs(tn,{variant:"default",className:"bg-green-600",children:[s.jsx(mg,{className:"h-3 w-3 mr-1"}),"已注册"]}),I.is_banned&&s.jsxs(tn,{variant:"destructive",children:[s.jsx(Fq,{className:"h-3 w-3 mr-1"}),"已封禁"]})]})}),s.jsx(Ue,{className:"text-right font-mono",children:I.usage_count}),s.jsx(Ue,{children:s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx(me,{variant:"ghost",size:"sm",onClick:()=>H(I),children:s.jsx(Uq,{className:"h-4 w-4"})}),s.jsx(me,{variant:"ghost",size:"sm",onClick:()=>G(I),children:s.jsx(GC,{className:"h-4 w-4"})}),!I.is_registered&&s.jsx(me,{variant:"ghost",size:"sm",onClick:()=>q(I),className:"text-green-600 hover:text-green-700",children:s.jsx(mg,{className:"h-4 w-4"})}),!I.is_banned&&s.jsx(me,{variant:"ghost",size:"sm",onClick:()=>K(I),className:"text-orange-600 hover:text-orange-700",children:s.jsx(Lpe,{className:"h-4 w-4"})}),s.jsx(me,{variant:"ghost",size:"sm",onClick:()=>L(I),className:"text-red-600 hover:text-red-700",children:s.jsx(zt,{className:"h-4 w-4"})})]})})]},I.id))})]})}),d>m&&s.jsxs("div",{className:"flex items-center justify-between mt-4",children:[s.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(l-1)*m+1," 到"," ",Math.min(l*m,d)," 条,共 ",d," 条"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(me,{variant:"outline",size:"sm",onClick:()=>u(I=>Math.max(1,I-1)),disabled:l===1,children:[s.jsx(UC,{className:"h-4 w-4"}),"上一页"]}),s.jsxs("div",{className:"text-sm",children:["第 ",l," / ",Math.ceil(d/m)," 页"]}),s.jsxs(me,{variant:"outline",size:"sm",onClick:()=>u(I=>I+1),disabled:l>=Math.ceil(d/m),children:["下一页",s.jsx(HC,{className:"h-4 w-4"})]})]})]})]})]}),s.jsx(S1e,{emoji:C,open:E,onOpenChange:k}),s.jsx(_1e,{emoji:C,open:T,onOpenChange:P,onSuccess:()=>{U(),V()}}),s.jsx(Jn,{open:$,onOpenChange:F,children:s.jsxs(zn,{children:[s.jsxs(qn,{children:[s.jsx(Fn,{children:"确认删除"}),s.jsx(lr,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),s.jsxs(Pr,{children:[s.jsx(me,{variant:"outline",onClick:()=>F(!1),children:"取消"}),s.jsx(me,{variant:"destructive",onClick:R,children:"删除"})]})]})})]})}function S1e({emoji:e,open:t,onOpenChange:n}){if(!e)return null;const r=a=>a?new Date(a*1e3).toLocaleString("zh-CN"):"-";return s.jsx(Jn,{open:t,onOpenChange:n,children:s.jsxs(zn,{className:"max-w-2xl",children:[s.jsx(qn,{children:s.jsx(Fn,{children:"表情包详情"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{children:[s.jsx(re,{className:"text-muted-foreground",children:"ID"}),s.jsx("div",{className:"mt-1 font-mono",children:e.id})]}),s.jsxs("div",{children:[s.jsx(re,{className:"text-muted-foreground",children:"格式"}),s.jsx("div",{className:"mt-1",children:s.jsx(tn,{variant:"outline",children:e.format.toUpperCase()})})]})]}),s.jsxs("div",{children:[s.jsx(re,{className:"text-muted-foreground",children:"文件路径"}),s.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:e.full_path})]}),s.jsxs("div",{children:[s.jsx(re,{className:"text-muted-foreground",children:"哈希值"}),s.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:e.emoji_hash})]}),s.jsxs("div",{children:[s.jsx(re,{className:"text-muted-foreground",children:"描述"}),s.jsx("div",{className:"mt-1",children:e.description||"-"})]}),s.jsxs("div",{children:[s.jsx(re,{className:"text-muted-foreground",children:"情绪标签"}),s.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:e.emotion&&e.emotion.length>0?e.emotion.map((a,i)=>s.jsx(tn,{variant:"secondary",children:a},i)):s.jsx("span",{className:"text-sm text-muted-foreground",children:"无"})})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{children:[s.jsx(re,{className:"text-muted-foreground",children:"状态"}),s.jsxs("div",{className:"mt-2 flex gap-2",children:[e.is_registered&&s.jsx(tn,{variant:"default",className:"bg-green-600",children:"已注册"}),e.is_banned&&s.jsx(tn,{variant:"destructive",children:"已封禁"}),!e.is_registered&&!e.is_banned&&s.jsx(tn,{variant:"outline",children:"未注册"})]})]}),s.jsxs("div",{children:[s.jsx(re,{className:"text-muted-foreground",children:"使用次数"}),s.jsx("div",{className:"mt-1 font-mono text-lg",children:e.usage_count})]})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{children:[s.jsx(re,{className:"text-muted-foreground",children:"记录时间"}),s.jsx("div",{className:"mt-1 text-sm",children:r(e.record_time)})]}),s.jsxs("div",{children:[s.jsx(re,{className:"text-muted-foreground",children:"注册时间"}),s.jsx("div",{className:"mt-1 text-sm",children:r(e.register_time)})]})]}),s.jsxs("div",{children:[s.jsx(re,{className:"text-muted-foreground",children:"最后使用"}),s.jsx("div",{className:"mt-1 text-sm",children:r(e.last_used_time)})]})]})]})})}function _1e({emoji:e,open:t,onOpenChange:n,onSuccess:r}){const[a,i]=y.useState(""),[l,u]=y.useState(""),[d,f]=y.useState(!1),[m,p]=y.useState(!1),[g,x]=y.useState(!1),{toast:j}=Dr();y.useEffect(()=>{e&&(i(e.description||""),u(e.emotion?e.emotion.join(", "):""),f(e.is_registered),p(e.is_banned))},[e]);const b=async()=>{if(e)try{x(!0);const w=l.split(",").map(N=>N.trim()).filter(Boolean);await g1e(e.id,{description:a||void 0,emotion:w.length>0?w:void 0,is_registered:d,is_banned:m}),j({title:"成功",description:"表情包信息已更新"}),n(!1),r()}catch(w){const N=w instanceof Error?w.message:"保存失败";j({title:"错误",description:N,variant:"destructive"})}finally{x(!1)}};return e?s.jsx(Jn,{open:t,onOpenChange:n,children:s.jsxs(zn,{className:"max-w-2xl",children:[s.jsxs(qn,{children:[s.jsx(Fn,{children:"编辑表情包"}),s.jsx(lr,{children:"修改表情包的描述和标签信息"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(re,{children:"描述"}),s.jsx(fn,{value:a,onChange:w=>i(w.target.value),placeholder:"输入表情包描述...",rows:3,className:"mt-1"})]}),s.jsxs("div",{children:[s.jsx(re,{children:"情绪标签"}),s.jsx(Oe,{value:l,onChange:w=>u(w.target.value),placeholder:"使用逗号分隔多个标签,如:开心, 微笑, 快乐",className:"mt-1"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入多个标签时使用逗号分隔"})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"checkbox",id:"is_registered",checked:d,onChange:w=>f(w.target.checked),className:"rounded border-gray-300"}),s.jsx(re,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("input",{type:"checkbox",id:"is_banned",checked:m,onChange:w=>p(w.target.checked),className:"rounded border-gray-300"}),s.jsx(re,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),s.jsxs(Pr,{children:[s.jsx(me,{variant:"outline",onClick:()=>n(!1),children:"取消"}),s.jsx(me,{onClick:b,disabled:g,children:g?"保存中...":"保存"})]})]})}):null}const Gu="/api/webui/expression";function Yu(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function N1e(e){const t=new URLSearchParams;e.page&&t.append("page",e.page.toString()),e.page_size&&t.append("page_size",e.page_size.toString()),e.search&&t.append("search",e.search),e.chat_id&&t.append("chat_id",e.chat_id);const n=await fetch(`${Gu}/list?${t}`,{headers:Yu()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取表达方式列表失败")}return n.json()}async function O1e(e){const t=await fetch(`${Gu}/${e}`,{headers:Yu()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"获取表达方式详情失败")}return t.json()}async function C1e(e){const t=await fetch(`${Gu}/`,{method:"POST",headers:Yu(),body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.detail||"创建表达方式失败")}return t.json()}async function E1e(e,t){const n=await fetch(`${Gu}/${e}`,{method:"PATCH",headers:Yu(),body:JSON.stringify(t)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新表达方式失败")}return n.json()}async function A1e(e){const t=await fetch(`${Gu}/${e}`,{method:"DELETE",headers:Yu()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"删除表达方式失败")}return t.json()}async function T1e(){const e=await fetch(`${Gu}/stats/summary`,{headers:Yu()});if(!e.ok){const t=await e.json();throw new Error(t.detail||"获取统计数据失败")}return e.json()}function k1e(){const[e,t]=y.useState([]),[n,r]=y.useState(!0),[a,i]=y.useState(0),[l,u]=y.useState(1),[d]=y.useState(20),[f,m]=y.useState(""),[p,g]=y.useState(null),[x,j]=y.useState(!1),[b,w]=y.useState(!1),[N,O]=y.useState(!1),[C,A]=y.useState(null),[E,k]=y.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),{toast:T}=Dr(),P=async()=>{try{r(!0);const H=await N1e({page:l,page_size:d,search:f||void 0});t(H.data),i(H.total)}catch(H){T({title:"加载失败",description:H instanceof Error?H.message:"无法加载表达方式",variant:"destructive"})}finally{r(!1)}},$=async()=>{try{const H=await T1e();k(H.data)}catch(H){console.error("加载统计数据失败:",H)}};y.useEffect(()=>{P(),$()},[l,d,f]);const F=async H=>{try{const G=await O1e(H.id);g(G.data),j(!0)}catch(G){T({title:"加载详情失败",description:G instanceof Error?G.message:"无法加载表达方式详情",variant:"destructive"})}},D=H=>{g(H),w(!0)},U=async H=>{try{await A1e(H.id),T({title:"删除成功",description:`已删除表达方式: ${H.situation}`}),A(null),P(),$()}catch(G){T({title:"删除失败",description:G instanceof Error?G.message:"无法删除表达方式",variant:"destructive"})}},V=H=>H?new Date(H*1e3).toLocaleString("zh-CN"):"-";return s.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[s.jsx(Mh,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),s.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),s.jsxs(me,{onClick:()=>O(!0),className:"gap-2",children:[s.jsx(Zn,{className:"h-4 w-4"}),"新增表达方式"]})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[s.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[s.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),s.jsx("div",{className:"text-2xl font-bold mt-1",children:E.total})]}),s.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[s.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),s.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:E.recent_7days})]}),s.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[s.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),s.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:E.chat_count})]})]}),s.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[s.jsx(re,{htmlFor:"search",children:"搜索"}),s.jsxs("div",{className:"relative mt-1.5",children:[s.jsx(kr,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),s.jsx(Oe,{id:"search",placeholder:"搜索情境、风格或上下文...",value:f,onChange:H=>m(H.target.value),className:"pl-9"})]})]}),s.jsxs("div",{className:"rounded-lg border bg-card",children:[s.jsx(Kt,{className:"h-[calc(100vh-500px)]",children:s.jsxs(Sl,{children:[s.jsx(_l,{children:s.jsxs(hn,{children:[s.jsx(Qe,{children:"情境"}),s.jsx(Qe,{children:"风格"}),s.jsx(Qe,{children:"聊天ID"}),s.jsx(Qe,{children:"最后活跃"}),s.jsx(Qe,{className:"text-right",children:"操作"})]})}),s.jsx(Nl,{children:n?s.jsx(hn,{children:s.jsx(Ue,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):e.length===0?s.jsx(hn,{children:s.jsx(Ue,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):e.map(H=>s.jsxs(hn,{children:[s.jsx(Ue,{className:"font-medium max-w-xs truncate",children:H.situation}),s.jsx(Ue,{className:"max-w-xs truncate",children:H.style}),s.jsx(Ue,{className:"font-mono text-sm",children:H.chat_id}),s.jsx(Ue,{className:"text-sm text-muted-foreground",children:V(H.last_active_time)}),s.jsx(Ue,{className:"text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(me,{variant:"ghost",size:"sm",onClick:()=>F(H),children:s.jsx(to,{className:"h-4 w-4"})}),s.jsx(me,{variant:"ghost",size:"sm",onClick:()=>D(H),children:s.jsx(GC,{className:"h-4 w-4"})}),s.jsx(me,{variant:"ghost",size:"sm",onClick:()=>A(H),children:s.jsx(zt,{className:"h-4 w-4 text-destructive"})})]})})]},H.id))})]})}),a>d&&s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t",children:[s.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",a," 条记录,第 ",l," / ",Math.ceil(a/d)," 页"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(me,{variant:"outline",size:"sm",onClick:()=>u(l-1),disabled:l===1,children:"上一页"}),s.jsx(me,{variant:"outline",size:"sm",onClick:()=>u(l+1),disabled:l>=Math.ceil(a/d),children:"下一页"})]})]})]}),s.jsx(P1e,{expression:p,open:x,onOpenChange:j}),s.jsx(M1e,{open:N,onOpenChange:O,onSuccess:()=>{P(),$(),O(!1)}}),s.jsx(R1e,{expression:p,open:b,onOpenChange:w,onSuccess:()=>{P(),$(),w(!1)}}),s.jsx(Qn,{open:!!C,onOpenChange:()=>A(null),children:s.jsxs(Pn,{children:[s.jsxs(Mn,{children:[s.jsx(Dn,{children:"确认删除"}),s.jsxs($n,{children:['确定要删除表达方式 "',C?.situation,'" 吗? 此操作不可撤销。']})]}),s.jsxs(Rn,{children:[s.jsx(Ln,{children:"取消"}),s.jsx(In,{onClick:()=>C&&U(C),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})})]})}function P1e({expression:e,open:t,onOpenChange:n}){if(!e)return null;const r=a=>a?new Date(a*1e3).toLocaleString("zh-CN"):"-";return s.jsx(Jn,{open:t,onOpenChange:n,children:s.jsxs(zn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsxs(qn,{children:[s.jsx(Fn,{children:"表达方式详情"}),s.jsx(lr,{children:"查看表达方式的完整信息"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Nc,{label:"情境",value:e.situation}),s.jsx(Nc,{label:"风格",value:e.style}),s.jsx(Nc,{icon:vg,label:"聊天ID",value:e.chat_id,mono:!0}),s.jsx(Nc,{icon:vg,label:"记录ID",value:e.id.toString(),mono:!0})]}),e.context&&s.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[s.jsx(re,{className:"text-xs text-muted-foreground",children:"上下文"}),s.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:e.context})]}),e.up_content&&s.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[s.jsx(re,{className:"text-xs text-muted-foreground",children:"上文内容"}),s.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:e.up_content})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Nc,{icon:el,label:"最后活跃",value:r(e.last_active_time)}),s.jsx(Nc,{icon:el,label:"创建时间",value:r(e.create_date)})]})]}),s.jsx(Pr,{children:s.jsx(me,{onClick:()=>n(!1),children:"关闭"})})]})})}function Nc({icon:e,label:t,value:n,mono:r=!1}){return s.jsxs("div",{className:"space-y-1",children:[s.jsxs(re,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e&&s.jsx(e,{className:"h-3 w-3"}),t]}),s.jsx("div",{className:ue("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function M1e({open:e,onOpenChange:t,onSuccess:n}){const[r,a]=y.useState({situation:"",style:"",context:"",up_content:"",chat_id:""}),[i,l]=y.useState(!1),{toast:u}=Dr(),d=async()=>{if(!r.situation||!r.style||!r.chat_id){u({title:"验证失败",description:"请填写必填字段:情境、风格和聊天ID",variant:"destructive"});return}try{l(!0),await C1e(r),u({title:"创建成功",description:"表达方式已创建"}),a({situation:"",style:"",context:"",up_content:"",chat_id:""}),n()}catch(f){u({title:"创建失败",description:f instanceof Error?f.message:"无法创建表达方式",variant:"destructive"})}finally{l(!1)}};return s.jsx(Jn,{open:e,onOpenChange:t,children:s.jsxs(zn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsxs(qn,{children:[s.jsx(Fn,{children:"新增表达方式"}),s.jsx(lr,{children:"创建新的表达方式记录"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(re,{htmlFor:"situation",children:["情境 ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx(Oe,{id:"situation",value:r.situation,onChange:f=>a({...r,situation:f.target.value}),placeholder:"描述使用场景"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(re,{htmlFor:"style",children:["风格 ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx(Oe,{id:"style",value:r.style,onChange:f=>a({...r,style:f.target.value}),placeholder:"描述表达风格"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(re,{htmlFor:"chat_id",children:["聊天ID ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx(Oe,{id:"chat_id",value:r.chat_id,onChange:f=>a({...r,chat_id:f.target.value}),placeholder:"关联的聊天ID"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"context",children:"上下文"}),s.jsx(fn,{id:"context",value:r.context,onChange:f=>a({...r,context:f.target.value}),placeholder:"上下文信息(可选)",rows:3})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"up_content",children:"上文内容"}),s.jsx(fn,{id:"up_content",value:r.up_content,onChange:f=>a({...r,up_content:f.target.value}),placeholder:"上文内容(可选)",rows:3})]})]}),s.jsxs(Pr,{children:[s.jsx(me,{variant:"outline",onClick:()=>t(!1),children:"取消"}),s.jsx(me,{onClick:d,disabled:i,children:i?"创建中...":"创建"})]})]})})}function R1e({expression:e,open:t,onOpenChange:n,onSuccess:r}){const[a,i]=y.useState({}),[l,u]=y.useState(!1),{toast:d}=Dr();y.useEffect(()=>{e&&i({situation:e.situation,style:e.style,context:e.context||"",up_content:e.up_content||"",chat_id:e.chat_id})},[e]);const f=async()=>{if(e)try{u(!0),await E1e(e.id,a),d({title:"保存成功",description:"表达方式已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新表达方式",variant:"destructive"})}finally{u(!1)}};return e?s.jsx(Jn,{open:t,onOpenChange:n,children:s.jsxs(zn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsxs(qn,{children:[s.jsx(Fn,{children:"编辑表达方式"}),s.jsx(lr,{children:"修改表达方式的信息"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"edit_situation",children:"情境"}),s.jsx(Oe,{id:"edit_situation",value:a.situation||"",onChange:m=>i({...a,situation:m.target.value}),placeholder:"描述使用场景"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"edit_style",children:"风格"}),s.jsx(Oe,{id:"edit_style",value:a.style||"",onChange:m=>i({...a,style:m.target.value}),placeholder:"描述表达风格"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"edit_chat_id",children:"聊天ID"}),s.jsx(Oe,{id:"edit_chat_id",value:a.chat_id||"",onChange:m=>i({...a,chat_id:m.target.value}),placeholder:"关联的聊天ID"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"edit_context",children:"上下文"}),s.jsx(fn,{id:"edit_context",value:a.context||"",onChange:m=>i({...a,context:m.target.value}),placeholder:"上下文信息",rows:3})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"edit_up_content",children:"上文内容"}),s.jsx(fn,{id:"edit_up_content",value:a.up_content||"",onChange:m=>i({...a,up_content:m.target.value}),placeholder:"上文内容",rows:3})]})]}),s.jsxs(Pr,{children:[s.jsx(me,{variant:"outline",onClick:()=>n(!1),children:"取消"}),s.jsx(me,{onClick:f,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}const Fh="/api/webui/person";function Uh(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function D1e(e){const t=new URLSearchParams;e.page&&t.append("page",e.page.toString()),e.page_size&&t.append("page_size",e.page_size.toString()),e.search&&t.append("search",e.search),e.is_known!==void 0&&t.append("is_known",e.is_known.toString()),e.platform&&t.append("platform",e.platform);const n=await fetch(`${Fh}/list?${t}`,{headers:Uh()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取人物列表失败")}return n.json()}async function $1e(e){const t=await fetch(`${Fh}/${e}`,{headers:Uh()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"获取人物详情失败")}return t.json()}async function I1e(e,t){const n=await fetch(`${Fh}/${e}`,{method:"PATCH",headers:Uh(),body:JSON.stringify(t)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新人物信息失败")}return n.json()}async function L1e(e){const t=await fetch(`${Fh}/${e}`,{method:"DELETE",headers:Uh()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"删除人物信息失败")}return t.json()}async function B1e(){const e=await fetch(`${Fh}/stats/summary`,{headers:Uh()});if(!e.ok){const t=await e.json();throw new Error(t.detail||"获取统计数据失败")}return e.json()}function z1e(){const[e,t]=y.useState([]),[n,r]=y.useState(!0),[a,i]=y.useState(0),[l,u]=y.useState(1),[d]=y.useState(20),[f,m]=y.useState(""),[p,g]=y.useState(void 0),[x,j]=y.useState(void 0),[b,w]=y.useState(null),[N,O]=y.useState(!1),[C,A]=y.useState(!1),[E,k]=y.useState(null),[T,P]=y.useState({total:0,known:0,unknown:0,platforms:{}}),{toast:$}=Dr(),F=async()=>{try{r(!0);const R=await D1e({page:l,page_size:d,search:f||void 0,is_known:p,platform:x});t(R.data),i(R.total)}catch(R){$({title:"加载失败",description:R instanceof Error?R.message:"无法加载人物信息",variant:"destructive"})}finally{r(!1)}},D=async()=>{try{const R=await B1e();P(R.data)}catch(R){console.error("加载统计数据失败:",R)}};y.useEffect(()=>{F(),D()},[l,d,f,p,x]);const U=async R=>{try{const q=await $1e(R.person_id);w(q.data),O(!0)}catch(q){$({title:"加载详情失败",description:q instanceof Error?q.message:"无法加载人物详情",variant:"destructive"})}},V=R=>{w(R),A(!0)},H=async R=>{try{await L1e(R.person_id),$({title:"删除成功",description:`已删除人物信息: ${R.person_name||R.nickname||R.user_id}`}),k(null),F(),D()}catch(q){$({title:"删除失败",description:q instanceof Error?q.message:"无法删除人物信息",variant:"destructive"})}},G=y.useMemo(()=>Object.keys(T.platforms),[T.platforms]),L=R=>R?new Date(R*1e3).toLocaleString("zh-CN"):"-";return s.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[s.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:s.jsxs("div",{children:[s.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[s.jsx(dge,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),s.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[s.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[s.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),s.jsx("div",{className:"text-2xl font-bold mt-1",children:T.total})]}),s.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[s.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),s.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:T.known})]}),s.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[s.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),s.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:T.unknown})]})]}),s.jsx("div",{className:"rounded-lg border bg-card p-4",children:s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[s.jsxs("div",{className:"sm:col-span-2",children:[s.jsx(re,{htmlFor:"search",children:"搜索"}),s.jsxs("div",{className:"relative mt-1.5",children:[s.jsx(kr,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),s.jsx(Oe,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:f,onChange:R=>m(R.target.value),className:"pl-9"})]})]}),s.jsxs("div",{children:[s.jsx(re,{htmlFor:"filter-known",children:"认识状态"}),s.jsxs(Nt,{value:p===void 0?"all":p.toString(),onValueChange:R=>{g(R==="all"?void 0:R==="true"),u(1)},children:[s.jsx(xt,{id:"filter-known",className:"mt-1.5",children:s.jsx(Ot,{})}),s.jsxs(bt,{children:[s.jsx(Pe,{value:"all",children:"全部"}),s.jsx(Pe,{value:"true",children:"已认识"}),s.jsx(Pe,{value:"false",children:"未认识"})]})]})]}),s.jsxs("div",{children:[s.jsx(re,{htmlFor:"filter-platform",children:"平台"}),s.jsxs(Nt,{value:x||"all",onValueChange:R=>{j(R==="all"?void 0:R),u(1)},children:[s.jsx(xt,{id:"filter-platform",className:"mt-1.5",children:s.jsx(Ot,{})}),s.jsxs(bt,{children:[s.jsx(Pe,{value:"all",children:"全部平台"}),G.map(R=>s.jsxs(Pe,{value:R,children:[R," (",T.platforms[R],")"]},R))]})]})]})]})}),s.jsxs("div",{className:"rounded-lg border bg-card",children:[s.jsx(Kt,{className:"h-[calc(100vh-500px)]",children:s.jsxs(Sl,{children:[s.jsx(_l,{children:s.jsxs(hn,{children:[s.jsx(Qe,{children:"状态"}),s.jsx(Qe,{children:"名称"}),s.jsx(Qe,{children:"昵称"}),s.jsx(Qe,{children:"平台"}),s.jsx(Qe,{children:"用户ID"}),s.jsx(Qe,{children:"最后更新"}),s.jsx(Qe,{className:"text-right",children:"操作"})]})}),s.jsx(Nl,{children:n?s.jsx(hn,{children:s.jsx(Ue,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):e.length===0?s.jsx(hn,{children:s.jsx(Ue,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):e.map(R=>s.jsxs(hn,{children:[s.jsx(Ue,{children:s.jsx("div",{className:ue("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",R.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:R.is_known?"已认识":"未认识"})}),s.jsx(Ue,{className:"font-medium",children:R.person_name||s.jsx("span",{className:"text-muted-foreground",children:"-"})}),s.jsx(Ue,{children:R.nickname||"-"}),s.jsx(Ue,{children:R.platform}),s.jsx(Ue,{className:"font-mono text-sm",children:R.user_id}),s.jsx(Ue,{className:"text-sm text-muted-foreground",children:L(R.last_know)}),s.jsx(Ue,{className:"text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(me,{variant:"ghost",size:"sm",onClick:()=>U(R),children:s.jsx(to,{className:"h-4 w-4"})}),s.jsx(me,{variant:"ghost",size:"sm",onClick:()=>V(R),children:s.jsx(GC,{className:"h-4 w-4"})}),s.jsx(me,{variant:"ghost",size:"sm",onClick:()=>k(R),children:s.jsx(zt,{className:"h-4 w-4 text-destructive"})})]})})]},R.id))})]})}),a>d&&s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t",children:[s.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",a," 条记录,第 ",l," / ",Math.ceil(a/d)," 页"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(me,{variant:"outline",size:"sm",onClick:()=>u(l-1),disabled:l===1,children:"上一页"}),s.jsx(me,{variant:"outline",size:"sm",onClick:()=>u(l+1),disabled:l>=Math.ceil(a/d),children:"下一页"})]})]})]}),s.jsx(q1e,{person:b,open:N,onOpenChange:O}),s.jsx(F1e,{person:b,open:C,onOpenChange:A,onSuccess:()=>{F(),D(),A(!1)}}),s.jsx(Qn,{open:!!E,onOpenChange:()=>k(null),children:s.jsxs(Pn,{children:[s.jsxs(Mn,{children:[s.jsx(Dn,{children:"确认删除"}),s.jsxs($n,{children:['确定要删除人物信息 "',E?.person_name||E?.nickname||E?.user_id,'" 吗? 此操作不可撤销。']})]}),s.jsxs(Rn,{children:[s.jsx(Ln,{children:"取消"}),s.jsx(In,{onClick:()=>E&&H(E),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})})]})}function q1e({person:e,open:t,onOpenChange:n}){if(!e)return null;const r=a=>a?new Date(a*1e3).toLocaleString("zh-CN"):"-";return s.jsx(Jn,{open:t,onOpenChange:n,children:s.jsxs(zn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsxs(qn,{children:[s.jsx(Fn,{children:"人物详情"}),s.jsxs(lr,{children:["查看 ",e.person_name||e.nickname||e.user_id," 的完整信息"]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(zi,{icon:cge,label:"人物名称",value:e.person_name}),s.jsx(zi,{icon:Mh,label:"昵称",value:e.nickname}),s.jsx(zi,{icon:vg,label:"用户ID",value:e.user_id,mono:!0}),s.jsx(zi,{icon:vg,label:"人物ID",value:e.person_id,mono:!0}),s.jsx(zi,{label:"平台",value:e.platform}),s.jsx(zi,{label:"状态",value:e.is_known?"已认识":"未认识"})]}),e.name_reason&&s.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[s.jsx(re,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),s.jsx("p",{className:"mt-1 text-sm",children:e.name_reason})]}),e.memory_points&&s.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[s.jsx(re,{className:"text-xs text-muted-foreground",children:"个人印象"}),s.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:e.memory_points})]}),e.group_nick_name&&e.group_nick_name.length>0&&s.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[s.jsx(re,{className:"text-xs text-muted-foreground",children:"群昵称"}),s.jsx("div",{className:"mt-2 space-y-1",children:e.group_nick_name.map((a,i)=>s.jsxs("div",{className:"text-sm flex items-center gap-2",children:[s.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:a.group_id}),s.jsx("span",{children:"→"}),s.jsx("span",{children:a.group_nick_name})]},i))})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsx(zi,{icon:el,label:"认识时间",value:r(e.know_times)}),s.jsx(zi,{icon:el,label:"首次记录",value:r(e.know_since)}),s.jsx(zi,{icon:el,label:"最后更新",value:r(e.last_know)})]})]}),s.jsx(Pr,{children:s.jsx(me,{onClick:()=>n(!1),children:"关闭"})})]})})}function zi({icon:e,label:t,value:n,mono:r=!1}){return s.jsxs("div",{className:"space-y-1",children:[s.jsxs(re,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e&&s.jsx(e,{className:"h-3 w-3"}),t]}),s.jsx("div",{className:ue("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function F1e({person:e,open:t,onOpenChange:n,onSuccess:r}){const[a,i]=y.useState({}),[l,u]=y.useState(!1),{toast:d}=Dr();y.useEffect(()=>{e&&i({person_name:e.person_name||"",name_reason:e.name_reason||"",nickname:e.nickname||"",memory_points:e.memory_points||"",is_known:e.is_known})},[e]);const f=async()=>{if(e)try{u(!0),await I1e(e.person_id,a),d({title:"保存成功",description:"人物信息已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新人物信息",variant:"destructive"})}finally{u(!1)}};return e?s.jsx(Jn,{open:t,onOpenChange:n,children:s.jsxs(zn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsxs(qn,{children:[s.jsx(Fn,{children:"编辑人物信息"}),s.jsxs(lr,{children:["修改 ",e.person_name||e.nickname||e.user_id," 的信息"]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"person_name",children:"人物名称"}),s.jsx(Oe,{id:"person_name",value:a.person_name||"",onChange:m=>i({...a,person_name:m.target.value}),placeholder:"为这个人设置一个名称"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"nickname",children:"昵称"}),s.jsx(Oe,{id:"nickname",value:a.nickname||"",onChange:m=>i({...a,nickname:m.target.value}),placeholder:"昵称"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"name_reason",children:"名称设定原因"}),s.jsx(fn,{id:"name_reason",value:a.name_reason||"",onChange:m=>i({...a,name_reason:m.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"memory_points",children:"个人印象"}),s.jsx(fn,{id:"memory_points",value:a.memory_points||"",onChange:m=>i({...a,memory_points:m.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),s.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[s.jsxs("div",{children:[s.jsx(re,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),s.jsx(ht,{id:"is_known",checked:a.is_known,onCheckedChange:m=>i({...a,is_known:m})})]})]}),s.jsxs(Pr,{children:[s.jsx(me,{variant:"outline",onClick:()=>n(!1),children:"取消"}),s.jsx(me,{onClick:f,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function U1e(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}const H1e={},uf={};function Ws(e,t){try{const r=(H1e[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];return r in uf?uf[r]:m3(r,r.split(":"))}catch{if(e in uf)return uf[e];const n=e?.match(W1e);return n?m3(e,n.slice(1)):NaN}}const W1e=/([+-]\d\d):?(\d\d)?/;function m3(e,t){const n=+(t[0]||0),r=+(t[1]||0),a=+(t[2]||0)/60;return uf[e]=n*60+r>0?n*60+r+a:n*60-r-a}class oi extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(Ws(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),iH(this),uO(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new oi(...n,t):new oi(Date.now(),t)}withTimeZone(t){return new oi(+this,t)}getTimezoneOffset(){const t=-Ws(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),uO(this),+this}[Symbol.for("constructDateFrom")](t){return new oi(+new Date(t),this.timeZone)}}const p3=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!p3.test(e))return;const t=e.replace(p3,"$1UTC");oi.prototype[t]&&(e.startsWith("get")?oi.prototype[e]=function(){return this.internal[t]()}:(oi.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),V1e(this),+this},oi.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),uO(this),+this}))});function uO(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-Ws(e.timeZone,e)*60))}function V1e(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),iH(e)}function iH(e){const t=Ws(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);const a=-new Date(+e).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),l=a-i,u=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();l&&u&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+l);const d=a-n;d&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+d);const f=new Date(+e);f.setUTCSeconds(0);const m=a>0?f.getSeconds():(f.getSeconds()-60)%60,p=Math.round(-(Ws(e.timeZone,e)*60))%60;(p||m)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+p),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+p+m));const g=Ws(e.timeZone,e),x=g>0?Math.floor(g):Math.ceil(g),b=-new Date(+e).getTimezoneOffset()-x,w=x!==n,N=b-d;if(w&&N){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+N);const O=Ws(e.timeZone,e),C=O>0?Math.floor(O):Math.ceil(O),A=x-C;A&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+A),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+A))}}class ar extends oi{static tz(t,...n){return n.length?new ar(...n,t):new ar(Date.now(),t)}toISOString(){const[t,n,r]=this.tzComponents(),a=`${t}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+a}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,r,a]=this.internal.toUTCString().split(" ");return`${t?.slice(0,-1)} ${r} ${n} ${a}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,r,a]=this.tzComponents();return`${t} GMT${n}${r}${a} (${U1e(this.timeZone,this)})`}toLocaleString(t,n){return Date.prototype.toLocaleString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(t,n){return Date.prototype.toLocaleDateString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(t,n){return Date.prototype.toLocaleTimeString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),n=t>0?"-":"+",r=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),a=String(Math.abs(t)%60).padStart(2,"0");return[n,r,a]}withTimeZone(t){return new ar(+this,t)}[Symbol.for("constructDateFrom")](t){return new ar(+new Date(t),this.timeZone)}}const oH=6048e5,G1e=864e5,v3=Symbol.for("constructDateFrom");function pn(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&v3 in e?e[v3](t):e instanceof Date?new e.constructor(t):new Date(t)}function Pt(e,t){return pn(t||e,e)}function sH(e,t,n){const r=Pt(e,n?.in);return isNaN(t)?pn(e,NaN):(t&&r.setDate(r.getDate()+t),r)}function lH(e,t,n){const r=Pt(e,n?.in);if(isNaN(t))return pn(e,NaN);if(!t)return r;const a=r.getDate(),i=pn(e,r.getTime());i.setMonth(r.getMonth()+t+1,0);const l=i.getDate();return a>=l?i:(r.setFullYear(i.getFullYear(),i.getMonth(),a),r)}let Y1e={};function Hh(){return Y1e}function es(e,t){const n=Hh(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,a=Pt(e,t?.in),i=a.getDay(),l=(i=i.getTime()?r+1:n.getTime()>=u.getTime()?r:r-1}function g3(e){const t=Pt(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function El(e,...t){const n=pn.bind(null,e||t.find(r=>typeof r=="object"));return t.map(n)}function fh(e,t){const n=Pt(e,t?.in);return n.setHours(0,0,0,0),n}function uH(e,t,n){const[r,a]=El(n?.in,e,t),i=fh(r),l=fh(a),u=+i-g3(i),d=+l-g3(l);return Math.round((u-d)/G1e)}function K1e(e,t){const n=cH(e,t),r=pn(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),dh(r)}function X1e(e,t,n){return sH(e,t*7,n)}function Z1e(e,t,n){return lH(e,t*12,n)}function Q1e(e,t){let n,r=t?.in;return e.forEach(a=>{!r&&typeof a=="object"&&(r=pn.bind(null,a));const i=Pt(a,r);(!n||n{!r&&typeof a=="object"&&(r=pn.bind(null,a));const i=Pt(a,r);(!n||n>i||isNaN(+i))&&(n=i)}),pn(r,n||NaN)}function eje(e,t,n){const[r,a]=El(n?.in,e,t);return+fh(r)==+fh(a)}function dH(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function tje(e){return!(!dH(e)&&typeof e!="number"||isNaN(+Pt(e)))}function nje(e,t,n){const[r,a]=El(n?.in,e,t),i=r.getFullYear()-a.getFullYear(),l=r.getMonth()-a.getMonth();return i*12+l}function rje(e,t){const n=Pt(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function fH(e,t){const[n,r]=El(e,t.start,t.end);return{start:n,end:r}}function aje(e,t){const{start:n,end:r}=fH(t?.in,e);let a=+n>+r;const i=a?+n:+r,l=a?r:n;l.setHours(0,0,0,0),l.setDate(1);let u=1;const d=[];for(;+l<=i;)d.push(pn(n,l)),l.setMonth(l.getMonth()+u);return a?d.reverse():d}function ije(e,t){const n=Pt(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function oje(e,t){const n=Pt(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function hH(e,t){const n=Pt(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function sje(e,t){const{start:n,end:r}=fH(t?.in,e);let a=+n>+r;const i=a?+n:+r,l=a?r:n;l.setHours(0,0,0,0),l.setMonth(0,1);let u=1;const d=[];for(;+l<=i;)d.push(pn(n,l)),l.setFullYear(l.getFullYear()+u);return a?d.reverse():d}function mH(e,t){const n=Hh(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,a=Pt(e,t?.in),i=a.getDay(),l=(i{let r;const a=cje[e];return typeof a=="string"?r=a:t===1?r=a.one:r=a.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Vc(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const dje={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},fje={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},hje={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},mje={date:Vc({formats:dje,defaultWidth:"full"}),time:Vc({formats:fje,defaultWidth:"full"}),dateTime:Vc({formats:hje,defaultWidth:"full"})},pje={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},vje=(e,t,n,r)=>pje[e];function ei(e){return(t,n)=>{const r=n?.context?String(n.context):"standalone";let a;if(r==="formatting"&&e.formattingValues){const l=e.defaultFormattingWidth||e.defaultWidth,u=n?.width?String(n.width):l;a=e.formattingValues[u]||e.formattingValues[l]}else{const l=e.defaultWidth,u=n?.width?String(n.width):e.defaultWidth;a=e.values[u]||e.values[l]}const i=e.argumentCallback?e.argumentCallback(t):t;return a[i]}}const gje={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},yje={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},xje={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},bje={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},wje={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},jje={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Sje=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},_je={ordinalNumber:Sje,era:ei({values:gje,defaultWidth:"wide"}),quarter:ei({values:yje,defaultWidth:"wide",argumentCallback:e=>e-1}),month:ei({values:xje,defaultWidth:"wide"}),day:ei({values:bje,defaultWidth:"wide"}),dayPeriod:ei({values:wje,defaultWidth:"wide",formattingValues:jje,defaultFormattingWidth:"wide"})};function ti(e){return(t,n={})=>{const r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(a);if(!i)return null;const l=i[0],u=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],d=Array.isArray(u)?Oje(u,p=>p.test(l)):Nje(u,p=>p.test(l));let f;f=e.valueCallback?e.valueCallback(d):d,f=n.valueCallback?n.valueCallback(f):f;const m=t.slice(l.length);return{value:f,rest:m}}}function Nje(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Oje(e,t){for(let n=0;n{const r=t.match(e.matchPattern);if(!r)return null;const a=r[0],i=t.match(e.parsePattern);if(!i)return null;let l=e.valueCallback?e.valueCallback(i[0]):i[0];l=n.valueCallback?n.valueCallback(l):l;const u=t.slice(a.length);return{value:l,rest:u}}}const Cje=/^(\d+)(th|st|nd|rd)?/i,Eje=/\d+/i,Aje={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Tje={any:[/^b/i,/^(a|c)/i]},kje={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Pje={any:[/1/i,/2/i,/3/i,/4/i]},Mje={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Rje={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Dje={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},$je={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Ije={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Lje={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Bje={ordinalNumber:pH({matchPattern:Cje,parsePattern:Eje,valueCallback:e=>parseInt(e,10)}),era:ti({matchPatterns:Aje,defaultMatchWidth:"wide",parsePatterns:Tje,defaultParseWidth:"any"}),quarter:ti({matchPatterns:kje,defaultMatchWidth:"wide",parsePatterns:Pje,defaultParseWidth:"any",valueCallback:e=>e+1}),month:ti({matchPatterns:Mje,defaultMatchWidth:"wide",parsePatterns:Rje,defaultParseWidth:"any"}),day:ti({matchPatterns:Dje,defaultMatchWidth:"wide",parsePatterns:$je,defaultParseWidth:"any"}),dayPeriod:ti({matchPatterns:Ije,defaultMatchWidth:"any",parsePatterns:Lje,defaultParseWidth:"any"})},xE={code:"en-US",formatDistance:uje,formatLong:mje,formatRelative:vje,localize:_je,match:Bje,options:{weekStartsOn:0,firstWeekContainsDate:1}};function zje(e,t){const n=Pt(e,t?.in);return uH(n,hH(n))+1}function vH(e,t){const n=Pt(e,t?.in),r=+dh(n)-+K1e(n);return Math.round(r/oH)+1}function gH(e,t){const n=Pt(e,t?.in),r=n.getFullYear(),a=Hh(),i=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,l=pn(t?.in||e,0);l.setFullYear(r+1,0,i),l.setHours(0,0,0,0);const u=es(l,t),d=pn(t?.in||e,0);d.setFullYear(r,0,i),d.setHours(0,0,0,0);const f=es(d,t);return+n>=+u?r+1:+n>=+f?r:r-1}function qje(e,t){const n=Hh(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=gH(e,t),i=pn(t?.in||e,0);return i.setFullYear(a,0,r),i.setHours(0,0,0,0),es(i,t)}function yH(e,t){const n=Pt(e,t?.in),r=+es(n,t)-+qje(n,t);return Math.round(r/oH)+1}function _t(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const $o={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return _t(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):_t(n+1,2)},d(e,t){return _t(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return _t(e.getHours()%12||12,t.length)},H(e,t){return _t(e.getHours(),t.length)},m(e,t){return _t(e.getMinutes(),t.length)},s(e,t){return _t(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return _t(a,t.length)}},Oc={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},y3={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return $o.y(e,t)},Y:function(e,t,n,r){const a=gH(e,r),i=a>0?a:1-a;if(t==="YY"){const l=i%100;return _t(l,2)}return t==="Yo"?n.ordinalNumber(i,{unit:"year"}):_t(i,t.length)},R:function(e,t){const n=cH(e);return _t(n,t.length)},u:function(e,t){const n=e.getFullYear();return _t(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return _t(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return _t(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return $o.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return _t(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const a=yH(e,r);return t==="wo"?n.ordinalNumber(a,{unit:"week"}):_t(a,t.length)},I:function(e,t,n){const r=vH(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):_t(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):$o.d(e,t)},D:function(e,t,n){const r=zje(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):_t(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const a=e.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return _t(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const a=e.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return _t(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),a=r===0?7:r;switch(t){case"i":return String(a);case"ii":return _t(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let a;switch(r===12?a=Oc.noon:r===0?a=Oc.midnight:a=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let a;switch(r>=17?a=Oc.evening:r>=12?a=Oc.afternoon:r>=4?a=Oc.morning:a=Oc.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return $o.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):$o.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):_t(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):_t(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):$o.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):$o.s(e,t)},S:function(e,t){return $o.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return b3(r);case"XXXX":case"XX":return Ls(r);case"XXXXX":case"XXX":default:return Ls(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return b3(r);case"xxxx":case"xx":return Ls(r);case"xxxxx":case"xxx":default:return Ls(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+x3(r,":");case"OOOO":default:return"GMT"+Ls(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+x3(r,":");case"zzzz":default:return"GMT"+Ls(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return _t(r,t.length)},T:function(e,t,n){return _t(+e,t.length)}};function x3(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=Math.trunc(r/60),i=r%60;return i===0?n+String(a):n+String(a)+t+_t(i,2)}function b3(e,t){return e%60===0?(e>0?"-":"+")+_t(Math.abs(e)/60,2):Ls(e,t)}function Ls(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=_t(Math.trunc(r/60),2),i=_t(r%60,2);return n+a+t+i}const w3=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},xH=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},Fje=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return w3(e,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",w3(r,t)).replace("{{time}}",xH(a,t))},Uje={p:xH,P:Fje},Hje=/^D+$/,Wje=/^Y+$/,Vje=["D","DD","YY","YYYY"];function Gje(e){return Hje.test(e)}function Yje(e){return Wje.test(e)}function Kje(e,t,n){const r=Xje(e,t,n);if(console.warn(r),Vje.includes(e))throw new RangeError(r)}function Xje(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Zje=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Qje=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Jje=/^'([^]*?)'?$/,eSe=/''/g,tSe=/[a-zA-Z]/;function rv(e,t,n){const r=Hh(),a=n?.locale??r.locale??xE,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,l=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,u=Pt(e,n?.in);if(!tje(u))throw new RangeError("Invalid time value");let d=t.match(Qje).map(m=>{const p=m[0];if(p==="p"||p==="P"){const g=Uje[p];return g(m,a.formatLong)}return m}).join("").match(Zje).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const p=m[0];if(p==="'")return{isToken:!1,value:nSe(m)};if(y3[p])return{isToken:!0,value:m};if(p.match(tSe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+p+"`");return{isToken:!1,value:m}});a.localize.preprocessor&&(d=a.localize.preprocessor(u,d));const f={firstWeekContainsDate:i,weekStartsOn:l,locale:a};return d.map(m=>{if(!m.isToken)return m.value;const p=m.value;(!n?.useAdditionalWeekYearTokens&&Yje(p)||!n?.useAdditionalDayOfYearTokens&&Gje(p))&&Kje(p,t,String(e));const g=y3[p[0]];return g(u,p,a.localize,f)}).join("")}function nSe(e){const t=e.match(Jje);return t?t[1].replace(eSe,"'"):e}function rSe(e,t){const n=Pt(e,t?.in),r=n.getFullYear(),a=n.getMonth(),i=pn(n,0);return i.setFullYear(r,a+1,0),i.setHours(0,0,0,0),i.getDate()}function aSe(e,t){return Pt(e,t?.in).getMonth()}function iSe(e,t){return Pt(e,t?.in).getFullYear()}function oSe(e,t){return+Pt(e)>+Pt(t)}function sSe(e,t){return+Pt(e)<+Pt(t)}function lSe(e,t,n){const[r,a]=El(n?.in,e,t);return+es(r,n)==+es(a,n)}function cSe(e,t,n){const[r,a]=El(n?.in,e,t);return r.getFullYear()===a.getFullYear()&&r.getMonth()===a.getMonth()}function uSe(e,t,n){const[r,a]=El(n?.in,e,t);return r.getFullYear()===a.getFullYear()}function dSe(e,t,n){const r=Pt(e,n?.in),a=r.getFullYear(),i=r.getDate(),l=pn(e,0);l.setFullYear(a,t,15),l.setHours(0,0,0,0);const u=rSe(l);return r.setMonth(t,Math.min(i,u)),r}function fSe(e,t,n){const r=Pt(e,n?.in);return isNaN(+r)?pn(e,NaN):(r.setFullYear(t),r)}const j3=5,hSe=4;function mSe(e,t){const n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,a=t.addDays(e,-r+1),i=t.addDays(a,j3*7-1);return t.getMonth(e)===t.getMonth(i)?j3:hSe}function bH(e,t){const n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function pSe(e,t){const n=bH(e,t),r=mSe(e,t);return t.addDays(n,r*7-1)}class ta{constructor(t,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?ar.tz(this.options.timeZone):new this.Date,this.newDate=(r,a,i)=>this.overrides?.newDate?this.overrides.newDate(r,a,i):this.options.timeZone?new ar(r,a,i,this.options.timeZone):new Date(r,a,i),this.addDays=(r,a)=>this.overrides?.addDays?this.overrides.addDays(r,a):sH(r,a),this.addMonths=(r,a)=>this.overrides?.addMonths?this.overrides.addMonths(r,a):lH(r,a),this.addWeeks=(r,a)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,a):X1e(r,a),this.addYears=(r,a)=>this.overrides?.addYears?this.overrides.addYears(r,a):Z1e(r,a),this.differenceInCalendarDays=(r,a)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,a):uH(r,a),this.differenceInCalendarMonths=(r,a)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,a):nje(r,a),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):aje(r),this.eachYearOfInterval=r=>{const a=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):sje(r),i=new Set(a.map(u=>this.getYear(u)));if(i.size===a.length)return a;const l=[];return i.forEach(u=>{l.push(new Date(u,0,1))}),l},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):pSe(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):lje(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):rje(r),this.endOfWeek=(r,a)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,a):mH(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):oje(r),this.format=(r,a,i)=>{const l=this.overrides?.format?this.overrides.format(r,a,this.options):rv(r,a,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(l):l},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):vH(r),this.getMonth=(r,a)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):aSe(r,this.options),this.getYear=(r,a)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):iSe(r,this.options),this.getWeek=(r,a)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):yH(r,this.options),this.isAfter=(r,a)=>this.overrides?.isAfter?this.overrides.isAfter(r,a):oSe(r,a),this.isBefore=(r,a)=>this.overrides?.isBefore?this.overrides.isBefore(r,a):sSe(r,a),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):dH(r),this.isSameDay=(r,a)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,a):eje(r,a),this.isSameMonth=(r,a)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,a):cSe(r,a),this.isSameYear=(r,a)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,a):uSe(r,a),this.max=r=>this.overrides?.max?this.overrides.max(r):Q1e(r),this.min=r=>this.overrides?.min?this.overrides.min(r):J1e(r),this.setMonth=(r,a)=>this.overrides?.setMonth?this.overrides.setMonth(r,a):dSe(r,a),this.setYear=(r,a)=>this.overrides?.setYear?this.overrides.setYear(r,a):fSe(r,a),this.startOfBroadcastWeek=(r,a)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):bH(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):fh(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):dh(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):ije(r),this.startOfWeek=(r,a)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):es(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):hH(r),this.options={locale:xE,...t},this.overrides=n}getDigitMap(){const{numerals:t="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:t}),r={};for(let a=0;a<10;a++)r[a.toString()]=n.format(a);return r}replaceDigits(t){const n=this.getDigitMap();return t.replace(/\d/g,r=>n[r]||r)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){const t=this.options.locale?.code;return t&&ta.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:n,timeZone:r,numerals:a}=this.options,i=n?.code;if(i&&ta.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:a}).format(t)}catch{}const l=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,l)}}ta.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const xi=new ta;class wH{constructor(t,n,r=xi){this.date=t,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(t,n)),this.dateLib=r}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class vSe{constructor(t,n){this.date=t,this.weeks=n}}class gSe{constructor(t,n){this.days=n,this.weekNumber=t}}function ySe(e){return W.createElement("button",{...e})}function xSe(e){return W.createElement("span",{...e})}function bSe(e){const{size:t=24,orientation:n="left",className:r}=e;return W.createElement("svg",{className:r,width:t,height:t,viewBox:"0 0 24 24"},n==="up"&&W.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&W.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&W.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&W.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function wSe(e){const{day:t,modifiers:n,...r}=e;return W.createElement("td",{...r})}function jSe(e){const{day:t,modifiers:n,...r}=e,a=W.useRef(null);return W.useEffect(()=>{n.focused&&a.current?.focus()},[n.focused]),W.createElement("button",{ref:a,...r})}var $e;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})($e||($e={}));var Yt;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(Yt||(Yt={}));var Da;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(Da||(Da={}));var Gr;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(Gr||(Gr={}));function SSe(e){const{options:t,className:n,components:r,classNames:a,...i}=e,l=[a[$e.Dropdown],n].join(" "),u=t?.find(({value:d})=>d===i.value);return W.createElement("span",{"data-disabled":i.disabled,className:a[$e.DropdownRoot]},W.createElement(r.Select,{className:l,...i},t?.map(({value:d,label:f,disabled:m})=>W.createElement(r.Option,{key:d,value:d,disabled:m},f))),W.createElement("span",{className:a[$e.CaptionLabel],"aria-hidden":!0},u?.label,W.createElement(r.Chevron,{orientation:"down",size:18,className:a[$e.Chevron]})))}function _Se(e){return W.createElement("div",{...e})}function NSe(e){return W.createElement("div",{...e})}function OSe(e){const{calendarMonth:t,displayIndex:n,...r}=e;return W.createElement("div",{...r},e.children)}function CSe(e){const{calendarMonth:t,displayIndex:n,...r}=e;return W.createElement("div",{...r})}function ESe(e){return W.createElement("table",{...e})}function ASe(e){return W.createElement("div",{...e})}const jH=y.createContext(void 0);function Wh(){const e=y.useContext(jH);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function TSe(e){const{components:t}=Wh();return W.createElement(t.Dropdown,{...e})}function kSe(e){const{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:a,...i}=e,{components:l,classNames:u,labels:{labelPrevious:d,labelNext:f}}=Wh(),m=y.useCallback(g=>{a&&n?.(g)},[a,n]),p=y.useCallback(g=>{r&&t?.(g)},[r,t]);return W.createElement("nav",{...i},W.createElement(l.PreviousMonthButton,{type:"button",className:u[$e.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":d(r),onClick:p},W.createElement(l.Chevron,{disabled:r?void 0:!0,className:u[$e.Chevron],orientation:"left"})),W.createElement(l.NextMonthButton,{type:"button",className:u[$e.NextMonthButton],tabIndex:a?void 0:-1,"aria-disabled":a?void 0:!0,"aria-label":f(a),onClick:m},W.createElement(l.Chevron,{disabled:a?void 0:!0,orientation:"right",className:u[$e.Chevron]})))}function PSe(e){const{components:t}=Wh();return W.createElement(t.Button,{...e})}function MSe(e){return W.createElement("option",{...e})}function RSe(e){const{components:t}=Wh();return W.createElement(t.Button,{...e})}function DSe(e){const{rootRef:t,...n}=e;return W.createElement("div",{...n,ref:t})}function $Se(e){return W.createElement("select",{...e})}function ISe(e){const{week:t,...n}=e;return W.createElement("tr",{...n})}function LSe(e){return W.createElement("th",{...e})}function BSe(e){return W.createElement("thead",{"aria-hidden":!0},W.createElement("tr",{...e}))}function zSe(e){const{week:t,...n}=e;return W.createElement("th",{...n})}function qSe(e){return W.createElement("th",{...e})}function FSe(e){return W.createElement("tbody",{...e})}function USe(e){const{components:t}=Wh();return W.createElement(t.Dropdown,{...e})}const HSe=Object.freeze(Object.defineProperty({__proto__:null,Button:ySe,CaptionLabel:xSe,Chevron:bSe,Day:wSe,DayButton:jSe,Dropdown:SSe,DropdownNav:_Se,Footer:NSe,Month:OSe,MonthCaption:CSe,MonthGrid:ESe,Months:ASe,MonthsDropdown:TSe,Nav:kSe,NextMonthButton:PSe,Option:MSe,PreviousMonthButton:RSe,Root:DSe,Select:$Se,Week:ISe,WeekNumber:zSe,WeekNumberHeader:qSe,Weekday:LSe,Weekdays:BSe,Weeks:FSe,YearsDropdown:USe},Symbol.toStringTag,{value:"Module"}));function Vi(e,t,n=!1,r=xi){let{from:a,to:i}=e;const{differenceInCalendarDays:l,isSameDay:u}=r;return a&&i?(l(i,a)<0&&([a,i]=[i,a]),l(t,a)>=(n?1:0)&&l(i,t)>=(n?1:0)):!n&&i?u(i,t):!n&&a?u(a,t):!1}function SH(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function bE(e){return!!(e&&typeof e=="object"&&"from"in e)}function _H(e){return!!(e&&typeof e=="object"&&"after"in e)}function NH(e){return!!(e&&typeof e=="object"&&"before"in e)}function OH(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function CH(e,t){return Array.isArray(e)&&e.every(t.isDate)}function Gi(e,t,n=xi){const r=Array.isArray(t)?t:[t],{isSameDay:a,differenceInCalendarDays:i,isAfter:l}=n;return r.some(u=>{if(typeof u=="boolean")return u;if(n.isDate(u))return a(e,u);if(CH(u,n))return u.includes(e);if(bE(u))return Vi(u,e,!1,n);if(OH(u))return Array.isArray(u.dayOfWeek)?u.dayOfWeek.includes(e.getDay()):u.dayOfWeek===e.getDay();if(SH(u)){const d=i(u.before,e),f=i(u.after,e),m=d>0,p=f<0;return l(u.before,u.after)?p&&m:m||p}return _H(u)?i(e,u.after)>0:NH(u)?i(u.before,e)>0:typeof u=="function"?u(e):!1})}function WSe(e,t,n,r,a){const{disabled:i,hidden:l,modifiers:u,showOutsideDays:d,broadcastCalendar:f,today:m}=t,{isSameDay:p,isSameMonth:g,startOfMonth:x,isBefore:j,endOfMonth:b,isAfter:w}=a,N=n&&x(n),O=r&&b(r),C={[Yt.focused]:[],[Yt.outside]:[],[Yt.disabled]:[],[Yt.hidden]:[],[Yt.today]:[]},A={};for(const E of e){const{date:k,displayMonth:T}=E,P=!!(T&&!g(k,T)),$=!!(N&&j(k,N)),F=!!(O&&w(k,O)),D=!!(i&&Gi(k,i,a)),U=!!(l&&Gi(k,l,a))||$||F||!f&&!d&&P||f&&d===!1&&P,V=p(k,m??a.today());P&&C.outside.push(E),D&&C.disabled.push(E),U&&C.hidden.push(E),V&&C.today.push(E),u&&Object.keys(u).forEach(H=>{const G=u?.[H];G&&Gi(k,G,a)&&(A[H]?A[H].push(E):A[H]=[E])})}return E=>{const k={[Yt.focused]:!1,[Yt.disabled]:!1,[Yt.hidden]:!1,[Yt.outside]:!1,[Yt.today]:!1},T={};for(const P in C){const $=C[P];k[P]=$.some(F=>F===E)}for(const P in A)T[P]=A[P].some($=>$===E);return{...k,...T}}}function VSe(e,t,n={}){return Object.entries(e).filter(([,a])=>a===!0).reduce((a,[i])=>(n[i]?a.push(n[i]):t[Yt[i]]?a.push(t[Yt[i]]):t[Da[i]]&&a.push(t[Da[i]]),a),[t[$e.Day]])}function GSe(e){return{...HSe,...e}}function YSe(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([n,r])=>{n.startsWith("data-")&&(t[n]=r)}),t}function wE(){const e={};for(const t in $e)e[$e[t]]=`rdp-${$e[t]}`;for(const t in Yt)e[Yt[t]]=`rdp-${Yt[t]}`;for(const t in Da)e[Da[t]]=`rdp-${Da[t]}`;for(const t in Gr)e[Gr[t]]=`rdp-${Gr[t]}`;return e}function EH(e,t,n){return(n??new ta(t)).formatMonthYear(e)}const KSe=EH;function XSe(e,t,n){return(n??new ta(t)).format(e,"d")}function ZSe(e,t=xi){return t.format(e,"LLLL")}function QSe(e,t,n){return(n??new ta(t)).format(e,"cccccc")}function JSe(e,t=xi){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function e_e(){return""}function AH(e,t=xi){return t.format(e,"yyyy")}const t_e=AH,n_e=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:EH,formatDay:XSe,formatMonthCaption:KSe,formatMonthDropdown:ZSe,formatWeekNumber:JSe,formatWeekNumberHeader:e_e,formatWeekdayName:QSe,formatYearCaption:t_e,formatYearDropdown:AH},Symbol.toStringTag,{value:"Module"}));function r_e(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...n_e,...e}}function a_e(e,t,n,r,a){const{startOfMonth:i,startOfYear:l,endOfYear:u,eachMonthOfInterval:d,getMonth:f}=a;return d({start:l(e),end:u(e)}).map(g=>{const x=r.formatMonthDropdown(g,a),j=f(g),b=t&&gi(n)||!1;return{value:j,label:x,disabled:b}})}function i_e(e,t={},n={}){let r={...t?.[$e.Day]};return Object.entries(e).filter(([,a])=>a===!0).forEach(([a])=>{r={...r,...n?.[a]}}),r}function o_e(e,t,n){const r=e.today(),a=t?e.startOfISOWeek(r):e.startOfWeek(r),i=[];for(let l=0;l<7;l++){const u=e.addDays(a,l);i.push(u)}return i}function s_e(e,t,n,r,a=!1){if(!e||!t)return;const{startOfYear:i,endOfYear:l,eachYearOfInterval:u,getYear:d}=r,f=i(e),m=l(t),p=u({start:f,end:m});return a&&p.reverse(),p.map(g=>{const x=n.formatYearDropdown(g,r);return{value:d(g),label:x,disabled:!1}})}function TH(e,t,n,r){let a=(r??new ta(n)).format(e,"PPPP");return t.today&&(a=`Today, ${a}`),t.selected&&(a=`${a}, selected`),a}const l_e=TH;function kH(e,t,n){return(n??new ta(t)).formatMonthYear(e)}const c_e=kH;function u_e(e,t,n,r){let a=(r??new ta(n)).format(e,"PPPP");return t?.today&&(a=`Today, ${a}`),a}function d_e(e){return"Choose the Month"}function f_e(){return""}function h_e(e){return"Go to the Next Month"}function m_e(e){return"Go to the Previous Month"}function p_e(e,t,n){return(n??new ta(t)).format(e,"cccc")}function v_e(e,t){return`Week ${e}`}function g_e(e){return"Week Number"}function y_e(e){return"Choose the Year"}const x_e=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:c_e,labelDay:l_e,labelDayButton:TH,labelGrid:kH,labelGridcell:u_e,labelMonthDropdown:d_e,labelNav:f_e,labelNext:h_e,labelPrevious:m_e,labelWeekNumber:v_e,labelWeekNumberHeader:g_e,labelWeekday:p_e,labelYearDropdown:y_e},Symbol.toStringTag,{value:"Module"})),Vh=e=>e instanceof HTMLElement?e:null,n_=e=>[...e.querySelectorAll("[data-animated-month]")??[]],b_e=e=>Vh(e.querySelector("[data-animated-month]")),r_=e=>Vh(e.querySelector("[data-animated-caption]")),a_=e=>Vh(e.querySelector("[data-animated-weeks]")),w_e=e=>Vh(e.querySelector("[data-animated-nav]")),j_e=e=>Vh(e.querySelector("[data-animated-weekdays]"));function S_e(e,t,{classNames:n,months:r,focused:a,dateLib:i}){const l=y.useRef(null),u=y.useRef(r),d=y.useRef(!1);y.useLayoutEffect(()=>{const f=u.current;if(u.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||f.length===0||r.length!==f.length)return;const m=i.isSameMonth(r[0].date,f[0].date),p=i.isAfter(r[0].date,f[0].date),g=p?n[Gr.caption_after_enter]:n[Gr.caption_before_enter],x=p?n[Gr.weeks_after_enter]:n[Gr.weeks_before_enter],j=l.current,b=e.current.cloneNode(!0);if(b instanceof HTMLElement?(n_(b).forEach(C=>{if(!(C instanceof HTMLElement))return;const A=b_e(C);A&&C.contains(A)&&C.removeChild(A);const E=r_(C);E&&E.classList.remove(g);const k=a_(C);k&&k.classList.remove(x)}),l.current=b):l.current=null,d.current||m||a)return;const w=j instanceof HTMLElement?n_(j):[],N=n_(e.current);if(N?.every(O=>O instanceof HTMLElement)&&w&&w.every(O=>O instanceof HTMLElement)){d.current=!0,e.current.style.isolation="isolate";const O=w_e(e.current);O&&(O.style.zIndex="1"),N.forEach((C,A)=>{const E=w[A];if(!E)return;C.style.position="relative",C.style.overflow="hidden";const k=r_(C);k&&k.classList.add(g);const T=a_(C);T&&T.classList.add(x);const P=()=>{d.current=!1,e.current&&(e.current.style.isolation=""),O&&(O.style.zIndex=""),k&&k.classList.remove(g),T&&T.classList.remove(x),C.style.position="",C.style.overflow="",C.contains(E)&&C.removeChild(E)};E.style.pointerEvents="none",E.style.position="absolute",E.style.overflow="hidden",E.setAttribute("aria-hidden","true");const $=j_e(E);$&&($.style.opacity="0");const F=r_(E);F&&(F.classList.add(p?n[Gr.caption_before_exit]:n[Gr.caption_after_exit]),F.addEventListener("animationend",P));const D=a_(E);D&&D.classList.add(p?n[Gr.weeks_before_exit]:n[Gr.weeks_after_exit]),C.insertBefore(E,C.firstChild)})}})}function __e(e,t,n,r){const a=e[0],i=e[e.length-1],{ISOWeek:l,fixedWeeks:u,broadcastCalendar:d}=n??{},{addDays:f,differenceInCalendarDays:m,differenceInCalendarMonths:p,endOfBroadcastWeek:g,endOfISOWeek:x,endOfMonth:j,endOfWeek:b,isAfter:w,startOfBroadcastWeek:N,startOfISOWeek:O,startOfWeek:C}=r,A=d?N(a,r):l?O(a):C(a),E=d?g(i):l?x(j(i)):b(j(i)),k=m(E,A),T=p(i,a)+1,P=[];for(let D=0;D<=k;D++){const U=f(A,D);if(t&&w(U,t))break;P.push(U)}const F=(d?35:42)*T;if(u&&P.length{const a=r.weeks.reduce((i,l)=>i.concat(l.days.slice()),t.slice());return n.concat(a.slice())},t.slice())}function O_e(e,t,n,r){const{numberOfMonths:a=1}=n,i=[];for(let l=0;lt)break;i.push(u)}return i}function S3(e,t,n,r){const{month:a,defaultMonth:i,today:l=r.today(),numberOfMonths:u=1}=e;let d=a||i||l;const{differenceInCalendarMonths:f,addMonths:m,startOfMonth:p}=r;if(n&&f(n,d){const N=n.broadcastCalendar?p(w,r):n.ISOWeek?g(w):x(w),O=n.broadcastCalendar?i(w):n.ISOWeek?l(u(w)):d(u(w)),C=t.filter(T=>T>=N&&T<=O),A=n.broadcastCalendar?35:42;if(n.fixedWeeks&&C.length{const $=A-C.length;return P>O&&P<=a(O,$)});C.push(...T)}const E=C.reduce((T,P)=>{const $=n.ISOWeek?f(P):m(P),F=T.find(U=>U.weekNumber===$),D=new wH(P,w,r);return F?F.days.push(D):T.push(new gSe($,[D])),T},[]),k=new vSe(w,E);return b.push(k),b},[]);return n.reverseMonths?j.reverse():j}function E_e(e,t){let{startMonth:n,endMonth:r}=e;const{startOfYear:a,startOfDay:i,startOfMonth:l,endOfMonth:u,addYears:d,endOfYear:f,newDate:m,today:p}=t,{fromYear:g,toYear:x,fromMonth:j,toMonth:b}=e;!n&&j&&(n=j),!n&&g&&(n=t.newDate(g,0,1)),!r&&b&&(r=b),!r&&x&&(r=m(x,11,31));const w=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return n?n=l(n):g?n=m(g,0,1):!n&&w&&(n=a(d(e.today??p(),-100))),r?r=u(r):x?r=m(x,11,31):!r&&w&&(r=f(e.today??p())),[n&&i(n),r&&i(r)]}function A_e(e,t,n,r){if(n.disableNavigation)return;const{pagedNavigation:a,numberOfMonths:i=1}=n,{startOfMonth:l,addMonths:u,differenceInCalendarMonths:d}=r,f=a?i:1,m=l(e);if(!t)return u(m,f);if(!(d(t,e)n.concat(r.weeks.slice()),t.slice())}function Ky(e,t){const[n,r]=y.useState(e);return[t===void 0?n:t,r]}function P_e(e,t){const[n,r]=E_e(e,t),{startOfMonth:a,endOfMonth:i}=t,l=S3(e,n,r,t),[u,d]=Ky(l,e.month?l:void 0);y.useEffect(()=>{const k=S3(e,n,r,t);d(k)},[e.timeZone]);const f=O_e(u,r,e,t),m=__e(f,e.endMonth?i(e.endMonth):void 0,e,t),p=C_e(f,m,e,t),g=k_e(p),x=N_e(p),j=T_e(u,n,e,t),b=A_e(u,r,e,t),{disableNavigation:w,onMonthChange:N}=e,O=k=>g.some(T=>T.days.some(P=>P.isEqualTo(k))),C=k=>{if(w)return;let T=a(k);n&&Ta(r)&&(T=a(r)),d(T),N?.(T)};return{months:p,weeks:g,days:x,navStart:n,navEnd:r,previousMonth:j,nextMonth:b,goToMonth:C,goToDay:k=>{O(k)||C(k.date)}}}var Za;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(Za||(Za={}));function _3(e){return!e[Yt.disabled]&&!e[Yt.hidden]&&!e[Yt.outside]}function M_e(e,t,n,r){let a,i=-1;for(const l of e){const u=t(l);_3(u)&&(u[Yt.focused]&&i_3(t(l)))),a}function R_e(e,t,n,r,a,i,l){const{ISOWeek:u,broadcastCalendar:d}=i,{addDays:f,addMonths:m,addWeeks:p,addYears:g,endOfBroadcastWeek:x,endOfISOWeek:j,endOfWeek:b,max:w,min:N,startOfBroadcastWeek:O,startOfISOWeek:C,startOfWeek:A}=l;let k={day:f,week:p,month:m,year:g,startOfWeek:T=>d?O(T,l):u?C(T):A(T),endOfWeek:T=>d?x(T):u?j(T):b(T)}[e](n,t==="after"?1:-1);return t==="before"&&r?k=w([r,k]):t==="after"&&a&&(k=N([a,k])),k}function PH(e,t,n,r,a,i,l,u=0){if(u>365)return;const d=R_e(e,t,n.date,r,a,i,l),f=!!(i.disabled&&Gi(d,i.disabled,l)),m=!!(i.hidden&&Gi(d,i.hidden,l)),p=d,g=new wH(d,p,l);return!f&&!m?g:PH(e,t,g,r,a,i,l,u+1)}function D_e(e,t,n,r,a){const{autoFocus:i}=e,[l,u]=y.useState(),d=M_e(t.days,n,r||(()=>!1),l),[f,m]=y.useState(i?d:void 0);return{isFocusTarget:b=>!!d?.isEqualTo(b),setFocused:m,focused:f,blur:()=>{u(f),m(void 0)},moveFocus:(b,w)=>{if(!f)return;const N=PH(b,w,f,t.navStart,t.navEnd,e,a);N&&(e.disableNavigation&&!t.days.some(C=>C.isEqualTo(N))||(t.goToDay(N),m(N)))}}}function $_e(e,t){const{selected:n,required:r,onSelect:a}=e,[i,l]=Ky(n,a?n:void 0),u=a?n:i,{isSameDay:d}=t,f=x=>u?.some(j=>d(j,x))??!1,{min:m,max:p}=e;return{selected:u,select:(x,j,b)=>{let w=[...u??[]];if(f(x)){if(u?.length===m||r&&u?.length===1)return;w=u?.filter(N=>!d(N,x))}else u?.length===p?w=[x]:w=[...w,x];return a||l(w),a?.(w,x,j,b),w},isSelected:f}}function I_e(e,t,n=0,r=0,a=!1,i=xi){const{from:l,to:u}=t||{},{isSameDay:d,isAfter:f,isBefore:m}=i;let p;if(!l&&!u)p={from:e,to:n>0?void 0:e};else if(l&&!u)d(l,e)?n===0?p={from:l,to:e}:a?p={from:l,to:void 0}:p=void 0:m(e,l)?p={from:e,to:l}:p={from:l,to:e};else if(l&&u)if(d(l,e)&&d(u,e))a?p={from:l,to:u}:p=void 0;else if(d(l,e))p={from:l,to:n>0?void 0:e};else if(d(u,e))p={from:e,to:n>0?void 0:e};else if(m(e,l))p={from:e,to:u};else if(f(e,l))p={from:l,to:e};else if(f(e,u))p={from:l,to:e};else throw new Error("Invalid range");if(p?.from&&p?.to){const g=i.differenceInCalendarDays(p.to,p.from);r>0&&g>r?p={from:e,to:void 0}:n>1&&gtypeof u!="function").some(u=>typeof u=="boolean"?u:n.isDate(u)?Vi(e,u,!1,n):CH(u,n)?u.some(d=>Vi(e,d,!1,n)):bE(u)?u.from&&u.to?N3(e,{from:u.from,to:u.to},n):!1:OH(u)?L_e(e,u.dayOfWeek,n):SH(u)?n.isAfter(u.before,u.after)?N3(e,{from:n.addDays(u.after,1),to:n.addDays(u.before,-1)},n):Gi(e.from,u,n)||Gi(e.to,u,n):_H(u)||NH(u)?Gi(e.from,u,n)||Gi(e.to,u,n):!1))return!0;const l=r.filter(u=>typeof u=="function");if(l.length){let u=e.from;const d=n.differenceInCalendarDays(e.to,e.from);for(let f=0;f<=d;f++){if(l.some(m=>m(u)))return!0;u=n.addDays(u,1)}}return!1}function z_e(e,t){const{disabled:n,excludeDisabled:r,selected:a,required:i,onSelect:l}=e,[u,d]=Ky(a,l?a:void 0),f=l?a:u;return{selected:f,select:(g,x,j)=>{const{min:b,max:w}=e,N=g?I_e(g,f,b,w,i,t):void 0;return r&&n&&N?.from&&N.to&&B_e({from:N.from,to:N.to},n,t)&&(N.from=g,N.to=void 0),l||d(N),l?.(N,g,x,j),N},isSelected:g=>f&&Vi(f,g,!1,t)}}function q_e(e,t){const{selected:n,required:r,onSelect:a}=e,[i,l]=Ky(n,a?n:void 0),u=a?n:i,{isSameDay:d}=t;return{selected:u,select:(p,g,x)=>{let j=p;return!r&&u&&u&&d(p,u)&&(j=void 0),a||l(j),a?.(j,p,g,x),j},isSelected:p=>u?d(u,p):!1}}function F_e(e,t){const n=q_e(e,t),r=$_e(e,t),a=z_e(e,t);switch(e.mode){case"single":return n;case"multiple":return r;case"range":return a;default:return}}function U_e(e){let t=e;t.timeZone&&(t={...e},t.today&&(t.today=new ar(t.today,t.timeZone)),t.month&&(t.month=new ar(t.month,t.timeZone)),t.defaultMonth&&(t.defaultMonth=new ar(t.defaultMonth,t.timeZone)),t.startMonth&&(t.startMonth=new ar(t.startMonth,t.timeZone)),t.endMonth&&(t.endMonth=new ar(t.endMonth,t.timeZone)),t.mode==="single"&&t.selected?t.selected=new ar(t.selected,t.timeZone):t.mode==="multiple"&&t.selected?t.selected=t.selected?.map(Je=>new ar(Je,t.timeZone)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?new ar(t.selected.from,t.timeZone):void 0,to:t.selected.to?new ar(t.selected.to,t.timeZone):void 0}));const{components:n,formatters:r,labels:a,dateLib:i,locale:l,classNames:u}=y.useMemo(()=>{const Je={...xE,...t.locale};return{dateLib:new ta({locale:Je,weekStartsOn:t.broadcastCalendar?1:t.weekStartsOn,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},t.dateLib),components:GSe(t.components),formatters:r_e(t.formatters),labels:{...x_e,...t.labels},locale:Je,classNames:{...wE(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.components,t.formatters,t.labels,t.classNames]),{captionLayout:d,mode:f,navLayout:m,numberOfMonths:p=1,onDayBlur:g,onDayClick:x,onDayFocus:j,onDayKeyDown:b,onDayMouseEnter:w,onDayMouseLeave:N,onNextClick:O,onPrevClick:C,showWeekNumber:A,styles:E}=t,{formatCaption:k,formatDay:T,formatMonthDropdown:P,formatWeekNumber:$,formatWeekNumberHeader:F,formatWeekdayName:D,formatYearDropdown:U}=r,V=P_e(t,i),{days:H,months:G,navStart:L,navEnd:R,previousMonth:q,nextMonth:K,goToMonth:ee}=V,I=WSe(H,t,L,R,i),{isSelected:B,select:Y,selected:te}=F_e(t,i)??{},{blur:oe,focused:xe,isFocusTarget:J,moveFocus:ae,setFocused:Z}=D_e(t,V,I,B??(()=>!1),i),{labelDayButton:pe,labelGridcell:je,labelGrid:le,labelMonthDropdown:Re,labelNav:_e,labelPrevious:he,labelNext:ve,labelWeekday:Le,labelWeekNumber:Mt,labelWeekNumberHeader:vn,labelYearDropdown:fr}=a,er=y.useMemo(()=>o_e(i,t.ISOWeek),[i,t.ISOWeek]),hr=f!==void 0||x!==void 0,it=y.useCallback(()=>{q&&(ee(q),C?.(q))},[q,ee,C]),nt=y.useCallback(()=>{K&&(ee(K),O?.(K))},[ee,K,O]),Nn=y.useCallback((Je,$t)=>He=>{He.preventDefault(),He.stopPropagation(),Z(Je),Y?.(Je.date,$t,He),x?.(Je.date,$t,He)},[Y,x,Z]),ds=y.useCallback((Je,$t)=>He=>{Z(Je),j?.(Je.date,$t,He)},[j,Z]),Qh=y.useCallback((Je,$t)=>He=>{oe(),g?.(Je.date,$t,He)},[oe,g]),Tl=y.useCallback((Je,$t)=>He=>{const pt={ArrowLeft:[He.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[He.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[He.shiftKey?"year":"week","after"],ArrowUp:[He.shiftKey?"year":"week","before"],PageUp:[He.shiftKey?"year":"month","before"],PageDown:[He.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(pt[He.key]){He.preventDefault(),He.stopPropagation();const[On,et]=pt[He.key];ae(On,et)}b?.(Je.date,$t,He)},[ae,b,t.dir]),tx=y.useCallback((Je,$t)=>He=>{w?.(Je.date,$t,He)},[w]),Jh=y.useCallback((Je,$t)=>He=>{N?.(Je.date,$t,He)},[N]),nx=y.useCallback(Je=>$t=>{const He=Number($t.target.value),pt=i.setMonth(i.startOfMonth(Je),He);ee(pt)},[i,ee]),rx=y.useCallback(Je=>$t=>{const He=Number($t.target.value),pt=i.setYear(i.startOfMonth(Je),He);ee(pt)},[i,ee]),{className:fs,style:mr}=y.useMemo(()=>({className:[u[$e.Root],t.className].filter(Boolean).join(" "),style:{...E?.[$e.Root],...t.style}}),[u,t.className,t.style,E]),Wa=YSe(t),tr=y.useRef(null);S_e(tr,!!t.animate,{classNames:u,months:G,focused:xe,dateLib:i});const ax={dayPickerProps:t,selected:te,select:Y,isSelected:B,months:G,nextMonth:K,previousMonth:q,goToMonth:ee,getModifiers:I,components:n,classNames:u,styles:E,labels:a,formatters:r};return W.createElement(jH.Provider,{value:ax},W.createElement(n.Root,{rootRef:t.animate?tr:void 0,className:fs,style:mr,dir:t.dir,id:t.id,lang:t.lang,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...Wa},W.createElement(n.Months,{className:u[$e.Months],style:E?.[$e.Months]},!t.hideNavigation&&!m&&W.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:u[$e.Nav],style:E?.[$e.Nav],"aria-label":_e(),onPreviousClick:it,onNextClick:nt,previousMonth:q,nextMonth:K}),G.map((Je,$t)=>W.createElement(n.Month,{"data-animated-month":t.animate?"true":void 0,className:u[$e.Month],style:E?.[$e.Month],key:$t,displayIndex:$t,calendarMonth:Je},m==="around"&&!t.hideNavigation&&$t===0&&W.createElement(n.PreviousMonthButton,{type:"button",className:u[$e.PreviousMonthButton],tabIndex:q?void 0:-1,"aria-disabled":q?void 0:!0,"aria-label":he(q),onClick:it,"data-animated-button":t.animate?"true":void 0},W.createElement(n.Chevron,{disabled:q?void 0:!0,className:u[$e.Chevron],orientation:t.dir==="rtl"?"right":"left"})),W.createElement(n.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:u[$e.MonthCaption],style:E?.[$e.MonthCaption],calendarMonth:Je,displayIndex:$t},d?.startsWith("dropdown")?W.createElement(n.DropdownNav,{className:u[$e.Dropdowns],style:E?.[$e.Dropdowns]},(()=>{const He=d==="dropdown"||d==="dropdown-months"?W.createElement(n.MonthsDropdown,{key:"month",className:u[$e.MonthsDropdown],"aria-label":Re(),classNames:u,components:n,disabled:!!t.disableNavigation,onChange:nx(Je.date),options:a_e(Je.date,L,R,r,i),style:E?.[$e.Dropdown],value:i.getMonth(Je.date)}):W.createElement("span",{key:"month"},P(Je.date,i)),pt=d==="dropdown"||d==="dropdown-years"?W.createElement(n.YearsDropdown,{key:"year",className:u[$e.YearsDropdown],"aria-label":fr(i.options),classNames:u,components:n,disabled:!!t.disableNavigation,onChange:rx(Je.date),options:s_e(L,R,r,i,!!t.reverseYears),style:E?.[$e.Dropdown],value:i.getYear(Je.date)}):W.createElement("span",{key:"year"},U(Je.date,i));return i.getMonthYearOrder()==="year-first"?[pt,He]:[He,pt]})(),W.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},k(Je.date,i.options,i))):W.createElement(n.CaptionLabel,{className:u[$e.CaptionLabel],role:"status","aria-live":"polite"},k(Je.date,i.options,i))),m==="around"&&!t.hideNavigation&&$t===p-1&&W.createElement(n.NextMonthButton,{type:"button",className:u[$e.NextMonthButton],tabIndex:K?void 0:-1,"aria-disabled":K?void 0:!0,"aria-label":ve(K),onClick:nt,"data-animated-button":t.animate?"true":void 0},W.createElement(n.Chevron,{disabled:K?void 0:!0,className:u[$e.Chevron],orientation:t.dir==="rtl"?"left":"right"})),$t===p-1&&m==="after"&&!t.hideNavigation&&W.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:u[$e.Nav],style:E?.[$e.Nav],"aria-label":_e(),onPreviousClick:it,onNextClick:nt,previousMonth:q,nextMonth:K}),W.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":f==="multiple"||f==="range","aria-label":le(Je.date,i.options,i)||void 0,className:u[$e.MonthGrid],style:E?.[$e.MonthGrid]},!t.hideWeekdays&&W.createElement(n.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:u[$e.Weekdays],style:E?.[$e.Weekdays]},A&&W.createElement(n.WeekNumberHeader,{"aria-label":vn(i.options),className:u[$e.WeekNumberHeader],style:E?.[$e.WeekNumberHeader],scope:"col"},F()),er.map(He=>W.createElement(n.Weekday,{"aria-label":Le(He,i.options,i),className:u[$e.Weekday],key:String(He),style:E?.[$e.Weekday],scope:"col"},D(He,i.options,i)))),W.createElement(n.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:u[$e.Weeks],style:E?.[$e.Weeks]},Je.weeks.map(He=>W.createElement(n.Week,{className:u[$e.Week],key:He.weekNumber,style:E?.[$e.Week],week:He},A&&W.createElement(n.WeekNumber,{week:He,style:E?.[$e.WeekNumber],"aria-label":Mt(He.weekNumber,{locale:l}),className:u[$e.WeekNumber],scope:"row",role:"rowheader"},$(He.weekNumber,i)),He.days.map(pt=>{const{date:On}=pt,et=I(pt);if(et[Yt.focused]=!et.hidden&&!!xe?.isEqualTo(pt),et[Da.selected]=B?.(On)||et.selected,bE(te)){const{from:Pl,to:ms}=te;et[Da.range_start]=!!(Pl&&ms&&i.isSameDay(On,Pl)),et[Da.range_end]=!!(Pl&&ms&&i.isSameDay(On,ms)),et[Da.range_middle]=Vi(te,On,!0,i)}const kl=i_e(et,E,t.modifiersStyles),hs=VSe(et,u,t.modifiersClassNames),ix=!hr&&!et.hidden?je(On,et,i.options,i):void 0;return W.createElement(n.Day,{key:`${i.format(On,"yyyy-MM-dd")}_${i.format(pt.displayMonth,"yyyy-MM")}`,day:pt,modifiers:et,className:hs.join(" "),style:kl,role:"gridcell","aria-selected":et.selected||void 0,"aria-label":ix,"data-day":i.format(On,"yyyy-MM-dd"),"data-month":pt.outside?i.format(On,"yyyy-MM"):void 0,"data-selected":et.selected||void 0,"data-disabled":et.disabled||void 0,"data-hidden":et.hidden||void 0,"data-outside":pt.outside||void 0,"data-focused":et.focused||void 0,"data-today":et.today||void 0},!et.hidden&&hr?W.createElement(n.DayButton,{className:u[$e.DayButton],style:E?.[$e.DayButton],type:"button",day:pt,modifiers:et,disabled:et.disabled||void 0,tabIndex:J(pt)?0:-1,"aria-label":pe(On,et,i.options,i),onClick:Nn(pt,et),onBlur:Qh(pt,et),onFocus:ds(pt,et),onKeyDown:Tl(pt,et),onMouseEnter:tx(pt,et),onMouseLeave:Jh(pt,et)},T(On,i.options,i)):!et.hidden&&T(pt.date,i.options,i))})))))))),t.footer&&W.createElement(n.Footer,{className:u[$e.Footer],style:E?.[$e.Footer],role:"status","aria-live":"polite"},t.footer)))}function O3({className:e,classNames:t,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:a="ghost",formatters:i,components:l,...u}){const d=wE();return s.jsx(U_e,{showOutsideDays:n,className:ue("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:r,formatters:{formatMonthDropdown:f=>f.toLocaleString("default",{month:"short"}),...i},classNames:{root:ue("w-fit",d.root),months:ue("relative flex flex-col gap-4 md:flex-row",d.months),month:ue("flex w-full flex-col gap-4",d.month),nav:ue("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",d.nav),button_previous:ue(lh({variant:a}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_previous),button_next:ue(lh({variant:a}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_next),month_caption:ue("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",d.month_caption),dropdowns:ue("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",d.dropdowns),dropdown_root:ue("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",d.dropdown_root),dropdown:ue("bg-popover absolute inset-0 opacity-0",d.dropdown),caption_label:ue("select-none font-medium",r==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",d.caption_label),table:"w-full border-collapse",weekdays:ue("flex",d.weekdays),weekday:ue("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",d.weekday),week:ue("mt-2 flex w-full",d.week),week_number_header:ue("w-[--cell-size] select-none",d.week_number_header),week_number:ue("text-muted-foreground select-none text-[0.8rem]",d.week_number),day:ue("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",d.day),range_start:ue("bg-accent rounded-l-md",d.range_start),range_middle:ue("rounded-none",d.range_middle),range_end:ue("bg-accent rounded-r-md",d.range_end),today:ue("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",d.today),outside:ue("text-muted-foreground aria-selected:text-muted-foreground",d.outside),disabled:ue("text-muted-foreground opacity-50",d.disabled),hidden:ue("invisible",d.hidden),...t},components:{Root:({className:f,rootRef:m,...p})=>s.jsx("div",{"data-slot":"calendar",ref:m,className:ue(f),...p}),Chevron:({className:f,orientation:m,...p})=>m==="left"?s.jsx(UC,{className:ue("size-4",f),...p}):m==="right"?s.jsx(HC,{className:ue("size-4",f),...p}):s.jsx(sh,{className:ue("size-4",f),...p}),DayButton:H_e,WeekNumber:({children:f,...m})=>s.jsx("td",{...m,children:s.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:f})}),...l},...u})}function H_e({className:e,day:t,modifiers:n,...r}){const a=wE(),i=y.useRef(null);return y.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),s.jsx(me,{ref:i,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:ue("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",a.day,e),...r})}class W_e{ws=null;reconnectTimeout=null;reconnectAttempts=0;maxReconnectAttempts=10;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];maxCacheSize=1e3;getWebSocketUrl(){{const t=window.location.protocol==="https:"?"wss:":"ws:",n=window.location.host;return`${t}//${n}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const t=this.getWebSocketUrl();try{this.ws=new WebSocket(t),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=n=>{try{if(n.data==="pong")return;const r=JSON.parse(n.data);this.notifyLog(r)}catch(r){console.error("解析日志消息失败:",r)}},this.ws.onerror=n=>{console.error("❌ WebSocket 错误:",n),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(n){console.error("创建 WebSocket 连接失败:",n),this.attemptReconnect()}}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return;this.reconnectAttempts+=1;const t=Math.min(1e3*this.reconnectAttempts,1e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},t)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(t){return this.logCallbacks.add(t),()=>this.logCallbacks.delete(t)}onConnectionChange(t){return this.connectionCallbacks.add(t),t(this.isConnected),()=>this.connectionCallbacks.delete(t)}notifyLog(t){this.logCache.some(r=>r.id===t.id)||(this.logCache.push(t),this.logCache.length>this.maxCacheSize&&(this.logCache=this.logCache.slice(-this.maxCacheSize)),this.logCallbacks.forEach(r=>{try{r(t)}catch(a){console.error("日志回调执行失败:",a)}}))}notifyConnection(t){this.connectionCallbacks.forEach(n=>{try{n(t)}catch(r){console.error("连接状态回调执行失败:",r)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const Pc=new W_e;typeof window<"u"&&Pc.connect();const V_e={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},G_e=(e,t,n)=>{let r;const a=V_e[e];return typeof a=="string"?r=a:t===1?r=a.one:r=a.other.replace("{{count}}",String(t)),n?.addSuffix?n.comparison&&n.comparison>0?r+"内":r+"前":r},Y_e={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},K_e={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},X_e={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Z_e={date:Vc({formats:Y_e,defaultWidth:"full"}),time:Vc({formats:K_e,defaultWidth:"full"}),dateTime:Vc({formats:X_e,defaultWidth:"full"})};function C3(e,t,n){const r="eeee p";return lSe(e,t,n)?r:e.getTime()>t.getTime()?"'下个'"+r:"'上个'"+r}const Q_e={lastWeek:C3,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:C3,other:"PP p"},J_e=(e,t,n,r)=>{const a=Q_e[e];return typeof a=="function"?a(t,n,r):a},eNe={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},tNe={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},nNe={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},rNe={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},aNe={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},iNe={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},oNe=(e,t)=>{const n=Number(e);switch(t?.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},sNe={ordinalNumber:oNe,era:ei({values:eNe,defaultWidth:"wide"}),quarter:ei({values:tNe,defaultWidth:"wide",argumentCallback:e=>e-1}),month:ei({values:nNe,defaultWidth:"wide"}),day:ei({values:rNe,defaultWidth:"wide"}),dayPeriod:ei({values:aNe,defaultWidth:"wide",formattingValues:iNe,defaultFormattingWidth:"wide"})},lNe=/^(第\s*)?\d+(日|时|分|秒)?/i,cNe=/\d+/i,uNe={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},dNe={any:[/^(前)/i,/^(公元)/i]},fNe={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},hNe={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},mNe={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},pNe={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},vNe={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},gNe={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},yNe={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},xNe={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},bNe={ordinalNumber:pH({matchPattern:lNe,parsePattern:cNe,valueCallback:e=>parseInt(e,10)}),era:ti({matchPatterns:uNe,defaultMatchWidth:"wide",parsePatterns:dNe,defaultParseWidth:"any"}),quarter:ti({matchPatterns:fNe,defaultMatchWidth:"wide",parsePatterns:hNe,defaultParseWidth:"any",valueCallback:e=>e+1}),month:ti({matchPatterns:mNe,defaultMatchWidth:"wide",parsePatterns:pNe,defaultParseWidth:"any"}),day:ti({matchPatterns:vNe,defaultMatchWidth:"wide",parsePatterns:gNe,defaultParseWidth:"any"}),dayPeriod:ti({matchPatterns:yNe,defaultMatchWidth:"any",parsePatterns:xNe,defaultParseWidth:"any"})},Bp={code:"zh-CN",formatDistance:G_e,formatLong:Z_e,formatRelative:J_e,localize:sNe,match:bNe,options:{weekStartsOn:1,firstWeekContainsDate:4}};function wNe(){const[e,t]=y.useState([]),[n,r]=y.useState(""),[a,i]=y.useState("all"),[l,u]=y.useState("all"),[d,f]=y.useState(void 0),[m,p]=y.useState(void 0),[g,x]=y.useState(!0),[j,b]=y.useState(!1),w=y.useRef(null),N=y.useRef(null);y.useEffect(()=>{const D=Pc.getAllLogs();t(D);const U=Pc.onLog(()=>{t(Pc.getAllLogs())}),V=Pc.onConnectionChange(H=>{b(H)});return()=>{U(),V()}},[]),y.useEffect(()=>{g&&N.current&&N.current.scrollIntoView({behavior:"smooth",block:"end"})},[e,g]);const O=y.useMemo(()=>{const D=new Set(e.map(U=>U.module));return Array.from(D).sort()},[e]),C=D=>{switch(D){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},A=D=>{switch(D){case"DEBUG":return"bg-secondary/50";case"INFO":return"bg-blue-500/10 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-500/10 dark:bg-yellow-500/20";case"ERROR":return"bg-red-500/10 dark:bg-red-500/20";case"CRITICAL":return"bg-red-600/20 dark:bg-red-600/30";default:return"bg-muted/50"}},E=()=>{window.location.reload()},k=()=>{Pc.clearLogs(),t([])},T=()=>{const D=F.map(G=>`${G.timestamp} [${G.level.padEnd(8)}] [${G.module}] ${G.message}`).join(` -`),U=new Blob([D],{type:"text/plain;charset=utf-8"}),V=URL.createObjectURL(U),H=document.createElement("a");H.href=V,H.download=`logs-${rv(new Date,"yyyy-MM-dd-HHmmss")}.txt`,H.click(),URL.revokeObjectURL(V)},P=()=>{x(!g)},$=()=>{f(void 0),p(void 0)},F=y.useMemo(()=>e.filter(D=>{const U=n===""||D.message.toLowerCase().includes(n.toLowerCase())||D.module.toLowerCase().includes(n.toLowerCase()),V=a==="all"||D.level===a,H=l==="all"||D.module===l;let G=!0;if(d||m){const L=new Date(D.timestamp);if(d){const R=new Date(d);R.setHours(0,0,0,0),G=G&&L>=R}if(m){const R=new Date(m);R.setHours(23,59,59,999),G=G&&L<=R}}return U&&V&&H&&G}),[e,n,a,l,d,m]);return s.jsx(Kt,{className:"h-full",children:s.jsxs("div",{className:"space-y-4 p-3 sm:p-4 lg:p-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),s.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:ue("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",j?"bg-green-500 animate-pulse":"bg-red-500")}),s.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:j?"已连接":"未连接"})]})]}),s.jsx(ct,{className:"p-3 sm:p-4",children:s.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[s.jsxs("div",{className:"flex-1 relative",children:[s.jsx(kr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Oe,{placeholder:"搜索日志...",value:n,onChange:D=>r(D.target.value),className:"pl-9 h-9 text-sm"})]}),s.jsxs(Nt,{value:a,onValueChange:i,children:[s.jsxs(xt,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[s.jsx(UN,{className:"h-4 w-4 mr-2"}),s.jsx(Ot,{placeholder:"级别"})]}),s.jsxs(bt,{children:[s.jsx(Pe,{value:"all",children:"全部级别"}),s.jsx(Pe,{value:"DEBUG",children:"DEBUG"}),s.jsx(Pe,{value:"INFO",children:"INFO"}),s.jsx(Pe,{value:"WARNING",children:"WARNING"}),s.jsx(Pe,{value:"ERROR",children:"ERROR"}),s.jsx(Pe,{value:"CRITICAL",children:"CRITICAL"})]})]}),s.jsxs(Nt,{value:l,onValueChange:u,children:[s.jsxs(xt,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[s.jsx(UN,{className:"h-4 w-4 mr-2"}),s.jsx(Ot,{placeholder:"模块"})]}),s.jsxs(bt,{children:[s.jsx(Pe,{value:"all",children:"全部模块"}),O.map(D=>s.jsx(Pe,{value:D,children:D},D))]})]})]}),s.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[s.jsxs(Zo,{children:[s.jsx(Qo,{asChild:!0,children:s.jsxs(me,{variant:"outline",size:"sm",className:ue("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!d&&"text-muted-foreground"),children:[s.jsx(RL,{className:"mr-2 h-4 w-4"}),s.jsx("span",{className:"text-xs sm:text-sm",children:d?rv(d,"PPP",{locale:Bp}):"开始日期"})]})}),s.jsx(ao,{className:"w-auto p-0",align:"start",children:s.jsx(O3,{mode:"single",selected:d,onSelect:f,initialFocus:!0,locale:Bp})})]}),s.jsxs(Zo,{children:[s.jsx(Qo,{asChild:!0,children:s.jsxs(me,{variant:"outline",size:"sm",className:ue("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!m&&"text-muted-foreground"),children:[s.jsx(RL,{className:"mr-2 h-4 w-4"}),s.jsx("span",{className:"text-xs sm:text-sm",children:m?rv(m,"PPP",{locale:Bp}):"结束日期"})]})}),s.jsx(ao,{className:"w-auto p-0",align:"start",children:s.jsx(O3,{mode:"single",selected:m,onSelect:p,initialFocus:!0,locale:Bp})})]}),(d||m)&&s.jsxs(me,{variant:"outline",size:"sm",onClick:$,className:"w-full sm:w-auto h-9",children:[s.jsx(_y,{className:"h-4 w-4 sm:mr-2"}),s.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),s.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),s.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[s.jsxs("div",{className:"flex gap-2 flex-wrap",children:[s.jsxs(me,{variant:g?"default":"outline",size:"sm",onClick:P,className:"flex-1 sm:flex-none h-9",children:[g?s.jsx($ve,{className:"h-4 w-4"}):s.jsx(Bve,{className:"h-4 w-4"}),s.jsx("span",{className:"ml-2 text-sm",children:g?"自动滚动":"已暂停"})]}),s.jsxs(me,{variant:"outline",size:"sm",onClick:E,className:"flex-1 sm:flex-none h-9",children:[s.jsx(tl,{className:"h-4 w-4"}),s.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),s.jsxs(me,{variant:"outline",size:"sm",onClick:k,className:"flex-1 sm:flex-none h-9",children:[s.jsx(zt,{className:"h-4 w-4"}),s.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),s.jsxs(me,{variant:"outline",size:"sm",onClick:T,className:"flex-1 sm:flex-none h-9",children:[s.jsx(qN,{className:"h-4 w-4"}),s.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),s.jsx("div",{className:"flex-1 hidden sm:block"}),s.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[s.jsxs("span",{className:"font-mono",children:[F.length," / ",e.length]}),s.jsx("span",{className:"ml-1",children:"条日志"})]})]})]})}),s.jsx(ct,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900",children:s.jsx(Kt,{className:"h-[calc(100vh-280px)] sm:h-[calc(100vh-320px)] lg:h-[calc(100vh-400px)]",children:s.jsxs("div",{ref:w,className:"p-2 sm:p-3 lg:p-4 font-mono text-xs sm:text-sm space-y-1",children:[F.length===0?s.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):F.map(D=>s.jsxs("div",{className:ue("py-2 px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",A(D.level)),children:[s.jsxs("div",{className:"flex flex-col gap-1 sm:hidden",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-gray-500 dark:text-gray-600 text-xs",children:D.timestamp}),s.jsxs("span",{className:ue("text-xs font-semibold",C(D.level)),children:["[",D.level,"]"]})]}),s.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 text-xs truncate",children:D.module}),s.jsx("div",{className:"text-gray-300 dark:text-gray-400 text-xs break-all",children:D.message})]}),s.jsxs("div",{className:"hidden sm:flex gap-3 items-start",children:[s.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[140px] lg:w-[180px] text-xs lg:text-sm",children:D.timestamp}),s.jsxs("span",{className:ue("flex-shrink-0 w-[70px] lg:w-[80px] font-semibold text-xs lg:text-sm",C(D.level)),children:["[",D.level,"]"]}),s.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[120px] lg:w-[150px] truncate text-xs lg:text-sm",children:D.module}),s.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 break-all text-xs lg:text-sm",children:D.message})]})]},D.id)),s.jsx("div",{ref:N,className:"h-4"})]})})})]})})}function jNe(){return s.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"统计信息"}),s.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"查看详细的统计数据和分析"})]}),s.jsx("div",{className:"rounded-lg border bg-card p-6",children:s.jsx("p",{className:"text-muted-foreground",children:"功能开发中..."})})]})}const SNe="Mai-with-u",_Ne="plugin-repo",NNe="main",ONe="plugin_details.json";async function CNe(){try{const e=localStorage.getItem("access-token"),t=await fetch("/api/webui/plugins/fetch-raw",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({owner:SNe,repo:_Ne,branch:NNe,file_path:ONe})});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const n=await t.json();if(!n.success||!n.data)throw new Error(n.error||"获取插件列表失败");return JSON.parse(n.data).filter(i=>!i?.id||!i?.manifest?(console.warn("跳过无效插件数据:",i),!1):!i.manifest.name||!i.manifest.version?(console.warn("跳过缺少必需字段的插件:",i.id),!1):!0).map(i=>({id:i.id,manifest:{manifest_version:i.manifest.manifest_version||1,name:i.manifest.name,version:i.manifest.version,description:i.manifest.description||"",author:i.manifest.author||{name:"Unknown"},license:i.manifest.license||"Unknown",host_application:i.manifest.host_application||{min_version:"0.0.0"},homepage_url:i.manifest.homepage_url,repository_url:i.manifest.repository_url,keywords:i.manifest.keywords||[],categories:i.manifest.categories||[],default_locale:i.manifest.default_locale||"zh-CN",locales_path:i.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(e){throw console.error("Failed to fetch plugin list:",e),e}}async function ENe(){try{const e=await fetch("/api/webui/plugins/git-status");if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch(e){return console.error("Failed to check Git status:",e),{installed:!1,error:"无法检测 Git 安装状态"}}}async function ANe(){try{const e=await fetch("/api/webui/plugins/version");if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch(e){return console.error("Failed to get Maimai version:",e),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function TNe(e,t,n){const r=e.split(".").map(u=>parseInt(u)||0),a=r[0]||0,i=r[1]||0,l=r[2]||0;if(n.version_majorparseInt(p)||0),d=u[0]||0,f=u[1]||0,m=u[2]||0;if(n.version_major>d||n.version_major===d&&n.version_minor>f||n.version_major===d&&n.version_minor===f&&n.version_patch>m)return!1}return!0}function kNe(e,t){const n=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host,a=new WebSocket(`${n}//${r}/api/webui/ws/plugin-progress`);return a.onopen=()=>{console.log("Plugin progress WebSocket connected");const i=setInterval(()=>{a.readyState===WebSocket.OPEN?a.send("ping"):clearInterval(i)},3e4)},a.onmessage=i=>{try{if(i.data==="pong")return;const l=JSON.parse(i.data);e(l)}catch(l){console.error("Failed to parse progress data:",l)}},a.onerror=i=>{console.error("Plugin progress WebSocket error:",i),t?.(i)},a.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},a}async function zp(){try{const e=localStorage.getItem("access-token"),t=await fetch("/api/webui/plugins/installed",{headers:{Authorization:`Bearer ${e}`}});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const n=await t.json();if(!n.success)throw new Error(n.message||"获取已安装插件列表失败");return n.plugins||[]}catch(e){return console.error("Failed to get installed plugins:",e),[]}}function qp(e,t){return t.some(n=>n.id===e)}function Fp(e,t){const n=t.find(r=>r.id===e);if(n)return n.manifest?.version||n.version}async function PNe(e,t,n="main"){const r=localStorage.getItem("access-token"),a=await fetch("/api/webui/plugins/install",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({plugin_id:e,repository_url:t,branch:n})});if(!a.ok){const i=await a.json();throw new Error(i.detail||"安装失败")}return await a.json()}async function MNe(e){const t=localStorage.getItem("access-token"),n=await fetch("/api/webui/plugins/uninstall",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({plugin_id:e})});if(!n.ok){const r=await n.json();throw new Error(r.detail||"卸载失败")}return await n.json()}async function RNe(e,t,n="main"){const r=localStorage.getItem("access-token"),a=await fetch("/api/webui/plugins/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({plugin_id:e,repository_url:t,branch:n})});if(!a.ok){const i=await a.json();throw new Error(i.detail||"更新失败")}return await a.json()}function DNe(e,t=[]){let n=[];function r(i,l){const u=y.createContext(l);u.displayName=i+"Context";const d=n.length;n=[...n,l];const f=p=>{const{scope:g,children:x,...j}=p,b=g?.[e]?.[d]||u,w=y.useMemo(()=>j,Object.values(j));return s.jsx(b.Provider,{value:w,children:x})};f.displayName=i+"Provider";function m(p,g){const x=g?.[e]?.[d]||u,j=y.useContext(x);if(j)return j;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[f,m]}const a=()=>{const i=n.map(l=>y.createContext(l));return function(u){const d=u?.[e]||i;return y.useMemo(()=>({[`__scope${e}`]:{...u,[e]:d}}),[u,d])}};return a.scopeName=e,[r,$Ne(a,...t)]}function $Ne(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const l=r.reduce((u,{useScope:d,scopeName:f})=>{const p=d(i)[`__scope${f}`];return{...u,...p}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}var INe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],MH=INe.reduce((e,t)=>{const n=Ny(`Primitive.${t}`),r=y.forwardRef((a,i)=>{const{asChild:l,...u}=a,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(d,{...u,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),jE="Progress",SE=100,[LNe]=DNe(jE),[BNe,zNe]=LNe(jE),RH=y.forwardRef((e,t)=>{const{__scopeProgress:n,value:r=null,max:a,getValueLabel:i=qNe,...l}=e;(a||a===0)&&!E3(a)&&console.error(FNe(`${a}`,"Progress"));const u=E3(a)?a:SE;r!==null&&!A3(r,u)&&console.error(UNe(`${r}`,"Progress"));const d=A3(r,u)?r:null,f=Og(d)?i(d,u):void 0;return s.jsx(BNe,{scope:n,value:d,max:u,children:s.jsx(MH.div,{"aria-valuemax":u,"aria-valuemin":0,"aria-valuenow":Og(d)?d:void 0,"aria-valuetext":f,role:"progressbar","data-state":IH(d,u),"data-value":d??void 0,"data-max":u,...l,ref:t})})});RH.displayName=jE;var DH="ProgressIndicator",$H=y.forwardRef((e,t)=>{const{__scopeProgress:n,...r}=e,a=zNe(DH,n);return s.jsx(MH.div,{"data-state":IH(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...r,ref:t})});$H.displayName=DH;function qNe(e,t){return`${Math.round(e/t*100)}%`}function IH(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Og(e){return typeof e=="number"}function E3(e){return Og(e)&&!isNaN(e)&&e>0}function A3(e,t){return Og(e)&&!isNaN(e)&&e<=t&&e>=0}function FNe(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${SE}\`.`}function UNe(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: - - a positive number - - less than the value passed to \`max\` (or ${SE} if no \`max\` prop is set) - - \`null\` or \`undefined\` if the progress is indeterminate. - -Defaulting to \`null\`.`}var LH=RH,HNe=$H;const BH=y.forwardRef(({className:e,value:t,...n},r)=>s.jsx(LH,{ref:r,className:ue("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...n,children:s.jsx(HNe,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));BH.displayName=LH.displayName;function WNe(){const e=qa(),[t,n]=y.useState(null),[r,a]=y.useState(""),[i,l]=y.useState("all"),[u,d]=y.useState("all"),[f,m]=y.useState(!1),[p,g]=y.useState([]),[x,j]=y.useState(!0),[b,w]=y.useState(null),[N,O]=y.useState(null),[C,A]=y.useState(null),[E,k]=y.useState(null),[,T]=y.useState([]),{toast:P}=Dr();y.useEffect(()=>{let R=null,q=!1;return(async()=>{if(R=kNe(ee=>{q||(A(ee),ee.stage==="success"?setTimeout(()=>{q||A(null)},2e3):ee.stage==="error"&&(j(!1),w(ee.error||"加载失败")))},ee=>{console.error("WebSocket error:",ee),q||P({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(ee=>{if(!R){ee();return}const I=()=>{R&&R.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),ee()):R&&R.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),ee()):setTimeout(I,100)};I()}),!q){const ee=await ENe();O(ee),ee.installed||P({title:"Git 未安装",description:ee.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!q){const ee=await ANe();k(ee)}if(!q)try{j(!0),w(null);const ee=await CNe();if(!q){const I=await zp();T(I);const B=ee.map(Y=>{const te=qp(Y.id,I),oe=Fp(Y.id,I);return{...Y,installed:te,installed_version:oe}});for(const Y of I)!B.some(oe=>oe.id===Y.id)&&Y.manifest&&B.push({id:Y.id,manifest:{manifest_version:Y.manifest.manifest_version||1,name:Y.manifest.name,version:Y.manifest.version,description:Y.manifest.description||"",author:Y.manifest.author,license:Y.manifest.license||"Unknown",host_application:Y.manifest.host_application,homepage_url:Y.manifest.homepage_url,repository_url:Y.manifest.repository_url,keywords:Y.manifest.keywords||[],categories:Y.manifest.categories||[],default_locale:Y.manifest.default_locale||"zh-CN",locales_path:Y.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:Y.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});g(B)}}catch(ee){if(!q){const I=ee instanceof Error?ee.message:"加载插件列表失败";w(I),P({title:"加载失败",description:I,variant:"destructive"})}}finally{q||j(!1)}})(),()=>{q=!0,R&&R.close()}},[P]);const $=R=>{if(!R.installed&&E&&!F(R))return s.jsxs(tn,{variant:"destructive",className:"gap-1",children:[s.jsx(hg,{className:"h-3 w-3"}),"不兼容"]});if(R.installed){const q=R.installed_version?.trim(),K=R.manifest.version?.trim();if(q!==K){const ee=q?.split(".").map(Number)||[0,0,0],I=K?.split(".").map(Number)||[0,0,0];for(let B=0;B<3;B++){if((I[B]||0)>(ee[B]||0))return s.jsxs(tn,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[s.jsx(hg,{className:"h-3 w-3"}),"可更新"]});if((I[B]||0)<(ee[B]||0))break}}return s.jsxs(tn,{variant:"default",className:"gap-1",children:[s.jsx(mg,{className:"h-3 w-3"}),"已安装"]})}return null},F=R=>!E||!R.manifest?.host_application?!0:TNe(R.manifest.host_application.min_version,R.manifest.host_application.max_version,E),D=R=>{if(!R.installed||!R.installed_version||!R.manifest?.version)return!1;const q=R.installed_version.trim(),K=R.manifest.version.trim();if(q===K)return!1;const ee=q.split(".").map(Number),I=K.split(".").map(Number);for(let B=0;B<3;B++){if((I[B]||0)>(ee[B]||0))return!0;if((I[B]||0)<(ee[B]||0))return!1}return!1},U=p.filter(R=>{if(!R.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",R.id),!1;const q=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(B=>B.toLowerCase().includes(r.toLowerCase())),K=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i);let ee=!0;u==="installed"?ee=R.installed===!0:u==="updates"&&(ee=R.installed===!0&&D(R));const I=!f||!E||F(R);return q&&K&&ee&&I}),V=()=>{n(null)},H=async R=>{if(!N?.installed){P({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(E&&!F(R)){P({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await PNe(R.id,R.manifest.repository_url||"","main"),P({title:"安装成功",description:`${R.manifest.name} 已成功安装`});const q=await zp();T(q),g(K=>K.map(ee=>{if(ee.id===R.id){const I=qp(ee.id,q),B=Fp(ee.id,q);return{...ee,installed:I,installed_version:B}}return ee}))}catch(q){P({title:"安装失败",description:q instanceof Error?q.message:"未知错误",variant:"destructive"})}},G=async R=>{try{await MNe(R.id),P({title:"卸载成功",description:`${R.manifest.name} 已成功卸载`});const q=await zp();T(q),g(K=>K.map(ee=>{if(ee.id===R.id){const I=qp(ee.id,q),B=Fp(ee.id,q);return{...ee,installed:I,installed_version:B}}return ee}))}catch(q){P({title:"卸载失败",description:q instanceof Error?q.message:"未知错误",variant:"destructive"})}},L=async R=>{if(!N?.installed){P({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const q=await RNe(R.id,R.manifest.repository_url||"","main");P({title:"更新成功",description:`${R.manifest.name} 已从 ${q.old_version} 更新到 ${q.new_version}`});const K=await zp();T(K),g(ee=>ee.map(I=>{if(I.id===R.id){const B=qp(I.id,K),Y=Fp(I.id,K);return{...I,installed:B,installed_version:Y}}return I}))}catch(q){P({title:"更新失败",description:q instanceof Error?q.message:"未知错误",variant:"destructive"})}};return s.jsx(Kt,{className:"h-full",children:s.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),s.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),s.jsxs(me,{onClick:()=>e({to:"/plugin-mirrors"}),children:[s.jsx(Yve,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),N&&!N.installed&&s.jsxs(ct,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[s.jsx(Ut,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Fc,{className:"h-5 w-5 text-orange-600"}),s.jsxs("div",{children:[s.jsx(Ht,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),s.jsx(Xn,{className:"text-orange-800 dark:text-orange-200",children:N.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),s.jsx(un,{children:s.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",s.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),s.jsx(ct,{className:"p-4",children:s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[s.jsxs("div",{className:"flex-1 relative",children:[s.jsx(kr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Oe,{placeholder:"搜索插件...",value:r,onChange:R=>a(R.target.value),className:"pl-9"})]}),s.jsxs(Nt,{value:i,onValueChange:l,children:[s.jsx(xt,{className:"w-full sm:w-[200px]",children:s.jsx(Ot,{placeholder:"选择分类"})}),s.jsxs(bt,{children:[s.jsx(Pe,{value:"all",children:"全部分类"}),s.jsx(Pe,{value:"Developer Tools",children:"开发工具"}),s.jsx(Pe,{value:"AI Enhancement",children:"AI 增强"}),s.jsx(Pe,{value:"Utility",children:"工具类"}),s.jsx(Pe,{value:"Entertainment",children:"娱乐"}),s.jsx(Pe,{value:"Integration",children:"集成"}),s.jsx(Pe,{value:"Data Analysis",children:"数据分析"}),s.jsx(Pe,{value:"Automation",children:"自动化"}),s.jsx(Pe,{value:"Other",children:"其他"})]})]})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Cu,{id:"compatible-only",checked:f,onCheckedChange:R=>m(R===!0)}),s.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),s.jsx(al,{value:u,onValueChange:d,className:"w-full",children:s.jsxs(Yo,{className:"grid w-full grid-cols-3",children:[s.jsxs(Tt,{value:"all",children:["全部插件 (",p.length,")"]}),s.jsxs(Tt,{value:"installed",children:["已安装 (",p.filter(R=>R.installed).length,")"]}),s.jsxs(Tt,{value:"updates",children:["可更新 (",p.filter(R=>R.installed&&D(R)).length,")"]})]})}),C&&C.stage==="loading"&&s.jsx(ct,{className:"p-4",children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(HN,{className:"h-4 w-4 animate-spin"}),s.jsxs("span",{className:"text-sm font-medium",children:[C.operation==="fetch"&&"加载插件列表",C.operation==="install"&&`安装插件${C.plugin_id?`: ${C.plugin_id}`:""}`,C.operation==="uninstall"&&`卸载插件${C.plugin_id?`: ${C.plugin_id}`:""}`,C.operation==="update"&&`更新插件${C.plugin_id?`: ${C.plugin_id}`:""}`]})]}),s.jsxs("span",{className:"text-sm font-medium",children:[C.progress,"%"]})]}),s.jsx(BH,{value:C.progress,className:"h-2"}),s.jsx("div",{className:"text-xs text-muted-foreground",children:C.message}),C.operation==="fetch"&&C.total_plugins>0&&s.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",C.loaded_plugins," / ",C.total_plugins," 个插件"]})]})}),C&&C.stage==="error"&&C.error&&s.jsx(ct,{className:"border-destructive bg-destructive/10",children:s.jsx(Ut,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Fc,{className:"h-5 w-5 text-destructive"}),s.jsxs("div",{children:[s.jsx(Ht,{className:"text-lg text-destructive",children:"加载失败"}),s.jsx(Xn,{className:"text-destructive/80",children:C.error})]})]})})}),x?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(HN,{className:"h-8 w-8 animate-spin text-muted-foreground"}),s.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):b?s.jsx(ct,{className:"p-6",children:s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[s.jsx(Fc,{className:"h-12 w-12 text-destructive mb-4"}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:b}),s.jsx(me,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):U.length===0?s.jsx(ct,{className:"p-6",children:s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[s.jsx(kr,{className:"h-12 w-12 text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:r||i!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:U.map(R=>s.jsxs(ct,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[s.jsxs(Ut,{children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsx(Ht,{className:"text-xl",children:R.manifest?.name||R.id}),s.jsxs("div",{className:"flex flex-col gap-1",children:[R.manifest?.categories&&R.manifest.categories[0]&&s.jsx(tn,{variant:"secondary",className:"text-xs whitespace-nowrap",children:R.manifest.categories[0]}),$(R)]})]}),s.jsx(Xn,{className:"line-clamp-2",children:R.manifest?.description||"无描述"})]}),s.jsx(un,{className:"flex-1",children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(qN,{className:"h-4 w-4"}),s.jsx("span",{children:R.downloads.toLocaleString()})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(IL,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),s.jsx("span",{children:R.rating.toFixed(1)})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[R.manifest?.keywords&&R.manifest.keywords.slice(0,3).map(q=>s.jsx(tn,{variant:"outline",className:"text-xs",children:q},q)),R.manifest?.keywords&&R.manifest.keywords.length>3&&s.jsxs(tn,{variant:"outline",className:"text-xs",children:["+",R.manifest.keywords.length-3]})]}),s.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[s.jsxs("div",{children:["v",R.manifest?.version||"unknown"," · ",R.manifest?.author?.name||"Unknown"]}),R.manifest?.host_application&&s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{children:"支持:"}),s.jsxs("span",{className:"font-medium",children:[R.manifest.host_application.min_version,R.manifest.host_application.max_version?` - ${R.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),s.jsx(M5,{className:"pt-4",children:s.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[s.jsx(me,{variant:"outline",size:"sm",onClick:()=>n(R),children:"查看详情"}),R.installed?D(R)?s.jsxs(me,{size:"sm",disabled:!N?.installed,title:N?.installed?void 0:"Git 未安装",onClick:()=>L(R),children:[s.jsx(tl,{className:"h-4 w-4 mr-1"}),"更新"]}):s.jsxs(me,{variant:"destructive",size:"sm",disabled:!N?.installed,title:N?.installed?void 0:"Git 未安装",onClick:()=>G(R),children:[s.jsx(zt,{className:"h-4 w-4 mr-1"}),"卸载"]}):s.jsxs(me,{size:"sm",disabled:!N?.installed||C?.operation==="install"||E!==null&&!F(R),title:N?.installed?E!==null&&!F(R)?`不兼容当前版本 (需要 ${R.manifest?.host_application?.min_version||"未知"}${R.manifest?.host_application?.max_version?` - ${R.manifest.host_application.max_version}`:"+"},当前 ${E?.version})`:void 0:"Git 未安装",onClick:()=>H(R),children:[s.jsx(qN,{className:"h-4 w-4 mr-1"}),C?.operation==="install"&&C?.plugin_id===R.id?"安装中...":"安装"]})]})})]},R.id))}),s.jsx(Jn,{open:t!==null,onOpenChange:V,children:t&&t.manifest&&s.jsxs(zn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsx(qn,{children:s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"space-y-2 flex-1",children:[s.jsx(Fn,{className:"text-2xl",children:t.manifest.name}),s.jsxs(lr,{children:["作者: ",t.manifest.author?.name||"Unknown",t.manifest.author?.url&&s.jsx("a",{href:t.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:s.jsx(Zp,{className:"h-3 w-3 inline"})})]})]}),s.jsxs("div",{className:"flex flex-col gap-2",children:[t.manifest.categories&&t.manifest.categories[0]&&s.jsx(tn,{variant:"secondary",children:t.manifest.categories[0]}),$(t)]})]})}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:"版本"}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",t.manifest?.version||"unknown"]}),t.installed&&t.installed_version&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",t.installed_version]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:"下载量"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:t.downloads.toLocaleString()})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:"评分"}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(IL,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),s.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.rating.toFixed(1)," (",t.review_count,")"]})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:"许可证"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:t.manifest.license||"Unknown"})]}),s.jsxs("div",{className:"col-span-2",children:[s.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.manifest.host_application?.min_version||"未知",t.manifest.host_application?.max_version?` - ${t.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:t.manifest.keywords&&t.manifest.keywords.map(R=>s.jsx(tn,{variant:"outline",children:R},R))})]}),t.detailed_description&&s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),s.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:t.detailed_description})]}),!t.detailed_description&&s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:t.manifest.description||"无描述"})]}),s.jsxs("div",{className:"space-y-2",children:[t.manifest.homepage_url&&s.jsxs("div",{className:"text-sm",children:[s.jsx("span",{className:"font-medium",children:"主页: "}),s.jsx("a",{href:t.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:t.manifest.homepage_url})]}),t.manifest.repository_url&&s.jsxs("div",{className:"text-sm",children:[s.jsx("span",{className:"font-medium",children:"仓库: "}),s.jsx("a",{href:t.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:t.manifest.repository_url})]})]})]}),s.jsxs(Pr,{children:[t.manifest.homepage_url&&s.jsxs(me,{onClick:()=>window.open(t.manifest.homepage_url,"_blank"),children:[s.jsx(Zp,{className:"h-4 w-4 mr-2"}),"访问主页"]}),t.manifest.repository_url&&s.jsxs(me,{variant:"outline",onClick:()=>window.open(t.manifest.repository_url,"_blank"),children:[s.jsx(Zp,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function VNe(){const e=qa(),{toast:t}=Dr(),[n,r]=y.useState([]),[a,i]=y.useState(!0),[l,u]=y.useState(null),[d,f]=y.useState(null),[m,p]=y.useState(!1),[g,x]=y.useState(!1),[j,b]=y.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),w=y.useCallback(async()=>{try{i(!0),u(null);const T=localStorage.getItem("access-token"),P=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${T}`}});if(!P.ok)throw new Error("获取镜像源列表失败");const $=await P.json();r($.mirrors||[])}catch(T){const P=T instanceof Error?T.message:"加载镜像源失败";u(P),t({title:"加载失败",description:P,variant:"destructive"})}finally{i(!1)}},[t]);y.useEffect(()=>{w()},[w]);const N=async()=>{try{const T=localStorage.getItem("access-token"),P=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${T}`,"Content-Type":"application/json"},body:JSON.stringify(j)});if(!P.ok){const $=await P.json();throw new Error($.detail||"添加镜像源失败")}t({title:"添加成功",description:"镜像源已添加"}),p(!1),b({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),w()}catch(T){t({title:"添加失败",description:T instanceof Error?T.message:"未知错误",variant:"destructive"})}},O=async()=>{if(d)try{const T=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${d.id}`,{method:"PUT",headers:{Authorization:`Bearer ${T}`,"Content-Type":"application/json"},body:JSON.stringify({name:j.name,raw_prefix:j.raw_prefix,clone_prefix:j.clone_prefix,enabled:j.enabled,priority:j.priority})})).ok)throw new Error("更新镜像源失败");t({title:"更新成功",description:"镜像源已更新"}),x(!1),f(null),w()}catch(T){t({title:"更新失败",description:T instanceof Error?T.message:"未知错误",variant:"destructive"})}},C=async T=>{if(confirm("确定要删除这个镜像源吗?"))try{const P=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${T}`,{method:"DELETE",headers:{Authorization:`Bearer ${P}`}})).ok)throw new Error("删除镜像源失败");t({title:"删除成功",description:"镜像源已删除"}),w()}catch(P){t({title:"删除失败",description:P instanceof Error?P.message:"未知错误",variant:"destructive"})}},A=async T=>{try{const P=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${T.id}`,{method:"PUT",headers:{Authorization:`Bearer ${P}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!T.enabled})})).ok)throw new Error("更新状态失败");w()}catch(P){t({title:"更新失败",description:P instanceof Error?P.message:"未知错误",variant:"destructive"})}},E=T=>{f(T),b({id:T.id,name:T.name,raw_prefix:T.raw_prefix,clone_prefix:T.clone_prefix,enabled:T.enabled,priority:T.priority}),x(!0)},k=async(T,P)=>{const $=P==="up"?T.priority-1:T.priority+1;if(!($<1))try{const F=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${T.id}`,{method:"PUT",headers:{Authorization:`Bearer ${F}`,"Content-Type":"application/json"},body:JSON.stringify({priority:$})})).ok)throw new Error("更新优先级失败");w()}catch(F){t({title:"更新失败",description:F instanceof Error?F.message:"未知错误",variant:"destructive"})}};return s.jsx(Kt,{className:"h-full",children:s.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(me,{variant:"ghost",size:"icon",onClick:()=>e({to:"/plugins"}),children:s.jsx(Lq,{className:"h-5 w-5"})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),s.jsxs(me,{onClick:()=>p(!0),children:[s.jsx(Zn,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),a?s.jsx(ct,{className:"p-6",children:s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(HN,{className:"h-8 w-8 animate-spin text-primary"})})}):l?s.jsx(ct,{className:"p-6",children:s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[s.jsx(Fc,{className:"h-12 w-12 text-destructive mb-4"}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:l}),s.jsx(me,{onClick:w,children:"重新加载"})]})}):s.jsxs(ct,{children:[s.jsx("div",{className:"hidden md:block",children:s.jsxs(Sl,{children:[s.jsx(_l,{children:s.jsxs(hn,{children:[s.jsx(Qe,{children:"状态"}),s.jsx(Qe,{children:"名称"}),s.jsx(Qe,{children:"ID"}),s.jsx(Qe,{children:"优先级"}),s.jsx(Qe,{className:"text-right",children:"操作"})]})}),s.jsx(Nl,{children:n.map(T=>s.jsxs(hn,{children:[s.jsx(Ue,{children:s.jsx(ht,{checked:T.enabled,onCheckedChange:()=>A(T)})}),s.jsx(Ue,{children:s.jsxs("div",{children:[s.jsx("div",{className:"font-medium",children:T.name}),s.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",T.raw_prefix]})]})}),s.jsx(Ue,{children:s.jsx(tn,{variant:"outline",children:T.id})}),s.jsx(Ue,{children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-mono",children:T.priority}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx(me,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>k(T,"up"),disabled:T.priority===1,children:s.jsx(BN,{className:"h-3 w-3"})}),s.jsx(me,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>k(T,"down"),children:s.jsx(sh,{className:"h-3 w-3"})})]})]})}),s.jsx(Ue,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx(me,{variant:"ghost",size:"icon",onClick:()=>E(T),children:s.jsx(_u,{className:"h-4 w-4"})}),s.jsx(me,{variant:"ghost",size:"icon",onClick:()=>C(T.id),children:s.jsx(zt,{className:"h-4 w-4 text-destructive"})})]})})]},T.id))})]})}),s.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(T=>s.jsx(ct,{className:"p-4",children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h3",{className:"font-semibold",children:T.name}),T.enabled&&s.jsx(tn,{variant:"default",className:"text-xs",children:"启用"})]}),s.jsx(tn,{variant:"outline",className:"mt-1 text-xs",children:T.id})]}),s.jsx(ht,{checked:T.enabled,onCheckedChange:()=>A(T)})]}),s.jsxs("div",{className:"text-sm space-y-1",children:[s.jsxs("div",{className:"text-muted-foreground",children:[s.jsx("span",{className:"font-medium",children:"Raw: "}),s.jsx("span",{className:"break-all",children:T.raw_prefix})]}),s.jsxs("div",{className:"text-muted-foreground",children:[s.jsx("span",{className:"font-medium",children:"优先级: "}),s.jsx("span",{className:"font-mono",children:T.priority})]})]}),s.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[s.jsxs(me,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>E(T),children:[s.jsx(_u,{className:"h-4 w-4 mr-1"}),"编辑"]}),s.jsx(me,{variant:"outline",size:"sm",onClick:()=>k(T,"up"),disabled:T.priority===1,children:s.jsx(BN,{className:"h-4 w-4"})}),s.jsx(me,{variant:"outline",size:"sm",onClick:()=>k(T,"down"),children:s.jsx(sh,{className:"h-4 w-4"})}),s.jsx(me,{variant:"destructive",size:"sm",onClick:()=>C(T.id),children:s.jsx(zt,{className:"h-4 w-4"})})]})]})},T.id))})]}),s.jsx(Jn,{open:m,onOpenChange:p,children:s.jsxs(zn,{className:"max-w-lg",children:[s.jsxs(qn,{children:[s.jsx(Fn,{children:"添加镜像源"}),s.jsx(lr,{children:"添加新的 Git 镜像源配置"})]}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"add-id",children:"镜像源 ID *"}),s.jsx(Oe,{id:"add-id",placeholder:"例如: my-mirror",value:j.id,onChange:T=>b({...j,id:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"add-name",children:"名称 *"}),s.jsx(Oe,{id:"add-name",placeholder:"例如: 我的镜像源",value:j.name,onChange:T=>b({...j,name:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),s.jsx(Oe,{id:"add-raw",placeholder:"https://example.com/raw",value:j.raw_prefix,onChange:T=>b({...j,raw_prefix:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"add-clone",children:"克隆前缀 *"}),s.jsx(Oe,{id:"add-clone",placeholder:"https://example.com/clone",value:j.clone_prefix,onChange:T=>b({...j,clone_prefix:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"add-priority",children:"优先级"}),s.jsx(Oe,{id:"add-priority",type:"number",min:"1",value:j.priority,onChange:T=>b({...j,priority:parseInt(T.target.value)||1})}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(ht,{id:"add-enabled",checked:j.enabled,onCheckedChange:T=>b({...j,enabled:T})}),s.jsx(re,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),s.jsxs(Pr,{children:[s.jsx(me,{variant:"outline",onClick:()=>p(!1),children:"取消"}),s.jsx(me,{onClick:N,children:"添加"})]})]})}),s.jsx(Jn,{open:g,onOpenChange:x,children:s.jsxs(zn,{className:"max-w-lg",children:[s.jsxs(qn,{children:[s.jsx(Fn,{children:"编辑镜像源"}),s.jsx(lr,{children:"修改镜像源配置"})]}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{children:"镜像源 ID"}),s.jsx(Oe,{value:j.id,disabled:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"edit-name",children:"名称 *"}),s.jsx(Oe,{id:"edit-name",value:j.name,onChange:T=>b({...j,name:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),s.jsx(Oe,{id:"edit-raw",value:j.raw_prefix,onChange:T=>b({...j,raw_prefix:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"edit-clone",children:"克隆前缀 *"}),s.jsx(Oe,{id:"edit-clone",value:j.clone_prefix,onChange:T=>b({...j,clone_prefix:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(re,{htmlFor:"edit-priority",children:"优先级"}),s.jsx(Oe,{id:"edit-priority",type:"number",min:"1",value:j.priority,onChange:T=>b({...j,priority:parseInt(T.target.value)||1})}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(ht,{id:"edit-enabled",checked:j.enabled,onCheckedChange:T=>b({...j,enabled:T})}),s.jsx(re,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),s.jsxs(Pr,{children:[s.jsx(me,{variant:"outline",onClick:()=>x(!1),children:"取消"}),s.jsx(me,{onClick:O,children:"保存"})]})]})})]})})}const GNe=Rh("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),zH=y.forwardRef(({className:e,size:t,abbrTitle:n,children:r,...a},i)=>s.jsx("kbd",{className:ue(GNe({size:t,className:e})),ref:i,...a,children:n?s.jsx("abbr",{title:n,children:r}):r}));zH.displayName="Kbd";const YNe=[{icon:gg,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:WC,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:Wq,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:Bq,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:Vq,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Mh,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:qq,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:zq,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:Hq,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:pg,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:Sf,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function KNe({open:e,onOpenChange:t}){const[n,r]=y.useState(""),[a,i]=y.useState(0),l=qa(),u=YNe.filter(m=>m.title.toLowerCase().includes(n.toLowerCase())||m.description.toLowerCase().includes(n.toLowerCase())||m.category.toLowerCase().includes(n.toLowerCase()));y.useEffect(()=>{e&&(r(""),i(0))},[e]);const d=y.useCallback(m=>{l({to:m}),t(!1)},[l,t]),f=y.useCallback(m=>{m.key==="ArrowDown"?(m.preventDefault(),i(p=>(p+1)%u.length)):m.key==="ArrowUp"?(m.preventDefault(),i(p=>(p-1+u.length)%u.length)):m.key==="Enter"&&u[a]&&(m.preventDefault(),d(u[a].path))},[u,a,d]);return s.jsx(Jn,{open:e,onOpenChange:t,children:s.jsxs(zn,{className:"max-w-2xl p-0 gap-0",children:[s.jsxs(qn,{className:"px-4 pt-4 pb-0",children:[s.jsx(Fn,{className:"sr-only",children:"搜索"}),s.jsxs("div",{className:"relative",children:[s.jsx(kr,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),s.jsx(Oe,{value:n,onChange:m=>{r(m.target.value),i(0)},onKeyDown:f,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),s.jsx("div",{className:"border-t",children:s.jsx(Kt,{className:"h-[400px]",children:u.length>0?s.jsx("div",{className:"p-2",children:u.map((m,p)=>{const g=m.icon;return s.jsxs("button",{onClick:()=>d(m.path),onMouseEnter:()=>i(p),className:ue("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",p===a?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[s.jsx(g,{className:"h-5 w-5 flex-shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"font-medium text-sm",children:m.title}),s.jsx("div",{className:"text-xs text-muted-foreground truncate",children:m.description})]}),s.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:m.category})]},m.path)})}):s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(kr,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),s.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),s.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function XNe(e){const t=ZNe(e),n=y.forwardRef((r,a)=>{const{children:i,...l}=r,u=y.Children.toArray(i),d=u.find(JNe);if(d){const f=d.props.children,m=u.map(p=>p===d?y.Children.count(f)>1?y.Children.only(null):y.isValidElement(f)?f.props.children:null:p);return s.jsx(t,{...l,ref:a,children:y.isValidElement(f)?y.cloneElement(f,void 0,m):null})}return s.jsx(t,{...l,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}function ZNe(e){const t=y.forwardRef((n,r)=>{const{children:a,...i}=n;if(y.isValidElement(a)){const l=tOe(a),u=eOe(i,a.props);return a.type!==y.Fragment&&(u.ref=r?Tr(r,l):l),y.cloneElement(a,u)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var QNe=Symbol("radix.slottable");function JNe(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===QNe}function eOe(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...u)=>{const d=i(...u);return a(...u),d}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function tOe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var dO=["Enter"," "],nOe=["ArrowDown","PageUp","Home"],qH=["ArrowUp","PageDown","End"],rOe=[...nOe,...qH],aOe={ltr:[...dO,"ArrowRight"],rtl:[...dO,"ArrowLeft"]},iOe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Gh="Menu",[hh,oOe,sOe]=wh(Gh),[Al,FH]=ur(Gh,[sOe,is,Ig]),Yh=is(),UH=Ig(),[HH,us]=Al(Gh),[lOe,Kh]=Al(Gh),WH=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:i,modal:l=!0}=e,u=Yh(t),[d,f]=y.useState(null),m=y.useRef(!1),p=Xt(i),g=Mu(a);return y.useEffect(()=>{const x=()=>{m.current=!0,document.addEventListener("pointerdown",j,{capture:!0,once:!0}),document.addEventListener("pointermove",j,{capture:!0,once:!0})},j=()=>m.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",j,{capture:!0}),document.removeEventListener("pointermove",j,{capture:!0})}},[]),s.jsx(Lh,{...u,children:s.jsx(HH,{scope:t,open:n,onOpenChange:p,content:d,onContentChange:f,children:s.jsx(lOe,{scope:t,onClose:y.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:m,dir:g,modal:l,children:r})})})};WH.displayName=Gh;var cOe="MenuAnchor",_E=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=Yh(n);return s.jsx(Bh,{...a,...r,ref:t})});_E.displayName=cOe;var NE="MenuPortal",[uOe,VH]=Al(NE,{forceMount:void 0}),GH=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:a}=e,i=us(NE,t);return s.jsx(uOe,{scope:t,forceMount:n,children:s.jsx(Sn,{present:n||i.open,children:s.jsx(jl,{asChild:!0,container:a,children:r})})})};GH.displayName=NE;var ba="MenuContent",[dOe,OE]=Al(ba),YH=y.forwardRef((e,t)=>{const n=VH(ba,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,i=us(ba,e.__scopeMenu),l=Kh(ba,e.__scopeMenu);return s.jsx(hh.Provider,{scope:e.__scopeMenu,children:s.jsx(Sn,{present:r||i.open,children:s.jsx(hh.Slot,{scope:e.__scopeMenu,children:l.modal?s.jsx(fOe,{...a,ref:t}):s.jsx(hOe,{...a,ref:t})})})})}),fOe=y.forwardRef((e,t)=>{const n=us(ba,e.__scopeMenu),r=y.useRef(null),a=qe(t,r);return y.useEffect(()=>{const i=r.current;if(i)return ky(i)},[]),s.jsx(CE,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Se(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),hOe=y.forwardRef((e,t)=>{const n=us(ba,e.__scopeMenu);return s.jsx(CE,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),mOe=XNe("MenuContent.ScrollLock"),CE=y.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEntryFocus:d,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:g,onDismiss:x,disableOutsideScroll:j,...b}=e,w=us(ba,n),N=Kh(ba,n),O=Yh(n),C=UH(n),A=oOe(n),[E,k]=y.useState(null),T=y.useRef(null),P=qe(t,T,w.onContentChange),$=y.useRef(0),F=y.useRef(""),D=y.useRef(0),U=y.useRef(null),V=y.useRef("right"),H=y.useRef(0),G=j?$h:y.Fragment,L=j?{as:mOe,allowPinchZoom:!0}:void 0,R=K=>{const ee=F.current+K,I=A().filter(J=>!J.disabled),B=document.activeElement,Y=I.find(J=>J.ref.current===B)?.textValue,te=I.map(J=>J.textValue),oe=OOe(te,ee,Y),xe=I.find(J=>J.textValue===oe)?.ref.current;(function J(ae){F.current=ae,window.clearTimeout($.current),ae!==""&&($.current=window.setTimeout(()=>J(""),1e3))})(ee),xe&&setTimeout(()=>xe.focus())};y.useEffect(()=>()=>window.clearTimeout($.current),[]),Ay();const q=y.useCallback(K=>V.current===U.current?.side&&EOe(K,U.current?.area),[]);return s.jsx(dOe,{scope:n,searchRef:F,onItemEnter:y.useCallback(K=>{q(K)&&K.preventDefault()},[q]),onItemLeave:y.useCallback(K=>{q(K)||(T.current?.focus(),k(null))},[q]),onTriggerLeave:y.useCallback(K=>{q(K)&&K.preventDefault()},[q]),pointerGraceTimerRef:D,onPointerGraceIntentChange:y.useCallback(K=>{U.current=K},[]),children:s.jsx(G,{...L,children:s.jsx(Dh,{asChild:!0,trapped:a,onMountAutoFocus:Se(i,K=>{K.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:s.jsx(wl,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:g,onDismiss:x,children:s.jsx(B5,{asChild:!0,...C,dir:N.dir,orientation:"vertical",loop:r,currentTabStopId:E,onCurrentTabStopIdChange:k,onEntryFocus:Se(d,K=>{N.isUsingKeyboardRef.current||K.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(zy,{role:"menu","aria-orientation":"vertical","data-state":d9(w.open),"data-radix-menu-content":"",dir:N.dir,...O,...b,ref:P,style:{outline:"none",...b.style},onKeyDown:Se(b.onKeyDown,K=>{const I=K.target.closest("[data-radix-menu-content]")===K.currentTarget,B=K.ctrlKey||K.altKey||K.metaKey,Y=K.key.length===1;I&&(K.key==="Tab"&&K.preventDefault(),!B&&Y&&R(K.key));const te=T.current;if(K.target!==te||!rOe.includes(K.key))return;K.preventDefault();const xe=A().filter(J=>!J.disabled).map(J=>J.ref.current);qH.includes(K.key)&&xe.reverse(),_Oe(xe)}),onBlur:Se(e.onBlur,K=>{K.currentTarget.contains(K.target)||(window.clearTimeout($.current),F.current="")}),onPointerMove:Se(e.onPointerMove,mh(K=>{const ee=K.target,I=H.current!==K.clientX;if(K.currentTarget.contains(ee)&&I){const B=K.clientX>H.current?"right":"left";V.current=B,H.current=K.clientX}}))})})})})})})});YH.displayName=ba;var pOe="MenuGroup",EE=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return s.jsx(Me.div,{role:"group",...r,ref:t})});EE.displayName=pOe;var vOe="MenuLabel",KH=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return s.jsx(Me.div,{...r,ref:t})});KH.displayName=vOe;var Cg="MenuItem",T3="menu.itemSelect",Xy=y.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...a}=e,i=y.useRef(null),l=Kh(Cg,e.__scopeMenu),u=OE(Cg,e.__scopeMenu),d=qe(t,i),f=y.useRef(!1),m=()=>{const p=i.current;if(!n&&p){const g=new CustomEvent(T3,{bubbles:!0,cancelable:!0});p.addEventListener(T3,x=>r?.(x),{once:!0}),MO(p,g),g.defaultPrevented?f.current=!1:l.onClose()}};return s.jsx(XH,{...a,ref:d,disabled:n,onClick:Se(e.onClick,m),onPointerDown:p=>{e.onPointerDown?.(p),f.current=!0},onPointerUp:Se(e.onPointerUp,p=>{f.current||p.currentTarget?.click()}),onKeyDown:Se(e.onKeyDown,p=>{const g=u.searchRef.current!=="";n||g&&p.key===" "||dO.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Xy.displayName=Cg;var XH=y.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...i}=e,l=OE(Cg,n),u=UH(n),d=y.useRef(null),f=qe(t,d),[m,p]=y.useState(!1),[g,x]=y.useState("");return y.useEffect(()=>{const j=d.current;j&&x((j.textContent??"").trim())},[i.children]),s.jsx(hh.ItemSlot,{scope:n,disabled:r,textValue:a??g,children:s.jsx(z5,{asChild:!0,...u,focusable:!r,children:s.jsx(Me.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:f,onPointerMove:Se(e.onPointerMove,mh(j=>{r?l.onItemLeave(j):(l.onItemEnter(j),j.defaultPrevented||j.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Se(e.onPointerLeave,mh(j=>l.onItemLeave(j))),onFocus:Se(e.onFocus,()=>p(!0)),onBlur:Se(e.onBlur,()=>p(!1))})})})}),gOe="MenuCheckboxItem",ZH=y.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...a}=e;return s.jsx(n9,{scope:e.__scopeMenu,checked:n,children:s.jsx(Xy,{role:"menuitemcheckbox","aria-checked":Eg(n)?"mixed":n,...a,ref:t,"data-state":kE(n),onSelect:Se(a.onSelect,()=>r?.(Eg(n)?!0:!n),{checkForDefaultPrevented:!1})})})});ZH.displayName=gOe;var QH="MenuRadioGroup",[yOe,xOe]=Al(QH,{value:void 0,onValueChange:()=>{}}),JH=y.forwardRef((e,t)=>{const{value:n,onValueChange:r,...a}=e,i=Xt(r);return s.jsx(yOe,{scope:e.__scopeMenu,value:n,onValueChange:i,children:s.jsx(EE,{...a,ref:t})})});JH.displayName=QH;var e9="MenuRadioItem",t9=y.forwardRef((e,t)=>{const{value:n,...r}=e,a=xOe(e9,e.__scopeMenu),i=n===a.value;return s.jsx(n9,{scope:e.__scopeMenu,checked:i,children:s.jsx(Xy,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":kE(i),onSelect:Se(r.onSelect,()=>a.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});t9.displayName=e9;var AE="MenuItemIndicator",[n9,bOe]=Al(AE,{checked:!1}),r9=y.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...a}=e,i=bOe(AE,n);return s.jsx(Sn,{present:r||Eg(i.checked)||i.checked===!0,children:s.jsx(Me.span,{...a,ref:t,"data-state":kE(i.checked)})})});r9.displayName=AE;var wOe="MenuSeparator",a9=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return s.jsx(Me.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});a9.displayName=wOe;var jOe="MenuArrow",i9=y.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=Yh(n);return s.jsx(qy,{...a,...r,ref:t})});i9.displayName=jOe;var TE="MenuSub",[SOe,o9]=Al(TE),s9=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:a}=e,i=us(TE,t),l=Yh(t),[u,d]=y.useState(null),[f,m]=y.useState(null),p=Xt(a);return y.useEffect(()=>(i.open===!1&&p(!1),()=>p(!1)),[i.open,p]),s.jsx(Lh,{...l,children:s.jsx(HH,{scope:t,open:r,onOpenChange:p,content:f,onContentChange:m,children:s.jsx(SOe,{scope:t,contentId:kn(),triggerId:kn(),trigger:u,onTriggerChange:d,children:n})})})};s9.displayName=TE;var df="MenuSubTrigger",l9=y.forwardRef((e,t)=>{const n=us(df,e.__scopeMenu),r=Kh(df,e.__scopeMenu),a=o9(df,e.__scopeMenu),i=OE(df,e.__scopeMenu),l=y.useRef(null),{pointerGraceTimerRef:u,onPointerGraceIntentChange:d}=i,f={__scopeMenu:e.__scopeMenu},m=y.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return y.useEffect(()=>m,[m]),y.useEffect(()=>{const p=u.current;return()=>{window.clearTimeout(p),d(null)}},[u,d]),s.jsx(_E,{asChild:!0,...f,children:s.jsx(XH,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":d9(n.open),...e,ref:Tr(t,a.onTriggerChange),onClick:p=>{e.onClick?.(p),!(e.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Se(e.onPointerMove,mh(p=>{i.onItemEnter(p),!p.defaultPrevented&&!e.disabled&&!n.open&&!l.current&&(i.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:Se(e.onPointerLeave,mh(p=>{m();const g=n.content?.getBoundingClientRect();if(g){const x=n.content?.dataset.side,j=x==="right",b=j?-5:5,w=g[j?"left":"right"],N=g[j?"right":"left"];i.onPointerGraceIntentChange({area:[{x:p.clientX+b,y:p.clientY},{x:w,y:g.top},{x:N,y:g.top},{x:N,y:g.bottom},{x:w,y:g.bottom}],side:x}),window.clearTimeout(u.current),u.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(p),p.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Se(e.onKeyDown,p=>{const g=i.searchRef.current!=="";e.disabled||g&&p.key===" "||aOe[r.dir].includes(p.key)&&(n.onOpenChange(!0),n.content?.focus(),p.preventDefault())})})})});l9.displayName=df;var c9="MenuSubContent",u9=y.forwardRef((e,t)=>{const n=VH(ba,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,i=us(ba,e.__scopeMenu),l=Kh(ba,e.__scopeMenu),u=o9(c9,e.__scopeMenu),d=y.useRef(null),f=qe(t,d);return s.jsx(hh.Provider,{scope:e.__scopeMenu,children:s.jsx(Sn,{present:r||i.open,children:s.jsx(hh.Slot,{scope:e.__scopeMenu,children:s.jsx(CE,{id:u.contentId,"aria-labelledby":u.triggerId,...a,ref:f,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{l.isUsingKeyboardRef.current&&d.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:Se(e.onFocusOutside,m=>{m.target!==u.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Se(e.onEscapeKeyDown,m=>{l.onClose(),m.preventDefault()}),onKeyDown:Se(e.onKeyDown,m=>{const p=m.currentTarget.contains(m.target),g=iOe[l.dir].includes(m.key);p&&g&&(i.onOpenChange(!1),u.trigger?.focus(),m.preventDefault())})})})})})});u9.displayName=c9;function d9(e){return e?"open":"closed"}function Eg(e){return e==="indeterminate"}function kE(e){return Eg(e)?"indeterminate":e?"checked":"unchecked"}function _Oe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function NOe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function OOe(e,t,n){const a=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let l=NOe(e,Math.max(i,0));a.length===1&&(l=l.filter(f=>f!==n));const d=l.find(f=>f.toLowerCase().startsWith(a.toLowerCase()));return d!==n?d:void 0}function COe(e,t){const{x:n,y:r}=e;let a=!1;for(let i=0,l=t.length-1;ir!=g>r&&n<(p-f)*(r-m)/(g-m)+f&&(a=!a)}return a}function EOe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return COe(n,t)}function mh(e){return t=>t.pointerType==="mouse"?e(t):void 0}var AOe=WH,TOe=_E,kOe=GH,POe=YH,MOe=EE,ROe=KH,DOe=Xy,$Oe=ZH,IOe=JH,LOe=t9,BOe=r9,zOe=a9,qOe=i9,FOe=s9,UOe=l9,HOe=u9,PE="ContextMenu",[WOe]=ur(PE,[FH]),dr=FH(),[VOe,f9]=WOe(PE),h9=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:a,modal:i=!0}=e,[l,u]=y.useState(!1),d=dr(t),f=Xt(r),m=y.useCallback(p=>{u(p),f(p)},[f]);return s.jsx(VOe,{scope:t,open:l,onOpenChange:m,modal:i,children:s.jsx(AOe,{...d,dir:a,open:l,onOpenChange:m,modal:i,children:n})})};h9.displayName=PE;var m9="ContextMenuTrigger",p9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...a}=e,i=f9(m9,n),l=dr(n),u=y.useRef({x:0,y:0}),d=y.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...u.current})}),f=y.useRef(0),m=y.useCallback(()=>window.clearTimeout(f.current),[]),p=g=>{u.current={x:g.clientX,y:g.clientY},i.onOpenChange(!0)};return y.useEffect(()=>m,[m]),y.useEffect(()=>void(r&&m()),[r,m]),s.jsxs(s.Fragment,{children:[s.jsx(TOe,{...l,virtualRef:d}),s.jsx(Me.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...a,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:Se(e.onContextMenu,g=>{m(),p(g),g.preventDefault()}),onPointerDown:r?e.onPointerDown:Se(e.onPointerDown,Up(g=>{m(),f.current=window.setTimeout(()=>p(g),700)})),onPointerMove:r?e.onPointerMove:Se(e.onPointerMove,Up(m)),onPointerCancel:r?e.onPointerCancel:Se(e.onPointerCancel,Up(m)),onPointerUp:r?e.onPointerUp:Se(e.onPointerUp,Up(m))})]})});p9.displayName=m9;var GOe="ContextMenuPortal",v9=e=>{const{__scopeContextMenu:t,...n}=e,r=dr(t);return s.jsx(kOe,{...r,...n})};v9.displayName=GOe;var g9="ContextMenuContent",y9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=f9(g9,n),i=dr(n),l=y.useRef(!1);return s.jsx(POe,{...i,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:u=>{e.onCloseAutoFocus?.(u),!u.defaultPrevented&&l.current&&u.preventDefault(),l.current=!1},onInteractOutside:u=>{e.onInteractOutside?.(u),!u.defaultPrevented&&!a.modal&&(l.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});y9.displayName=g9;var YOe="ContextMenuGroup",KOe=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=dr(n);return s.jsx(MOe,{...a,...r,ref:t})});KOe.displayName=YOe;var XOe="ContextMenuLabel",x9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=dr(n);return s.jsx(ROe,{...a,...r,ref:t})});x9.displayName=XOe;var ZOe="ContextMenuItem",b9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=dr(n);return s.jsx(DOe,{...a,...r,ref:t})});b9.displayName=ZOe;var QOe="ContextMenuCheckboxItem",w9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=dr(n);return s.jsx($Oe,{...a,...r,ref:t})});w9.displayName=QOe;var JOe="ContextMenuRadioGroup",eCe=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=dr(n);return s.jsx(IOe,{...a,...r,ref:t})});eCe.displayName=JOe;var tCe="ContextMenuRadioItem",j9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=dr(n);return s.jsx(LOe,{...a,...r,ref:t})});j9.displayName=tCe;var nCe="ContextMenuItemIndicator",S9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=dr(n);return s.jsx(BOe,{...a,...r,ref:t})});S9.displayName=nCe;var rCe="ContextMenuSeparator",_9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=dr(n);return s.jsx(zOe,{...a,...r,ref:t})});_9.displayName=rCe;var aCe="ContextMenuArrow",iCe=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=dr(n);return s.jsx(qOe,{...a,...r,ref:t})});iCe.displayName=aCe;var N9="ContextMenuSub",O9=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,open:a,defaultOpen:i}=e,l=dr(t),[u,d]=wa({prop:a,defaultProp:i??!1,onChange:r,caller:N9});return s.jsx(FOe,{...l,open:u,onOpenChange:d,children:n})};O9.displayName=N9;var oCe="ContextMenuSubTrigger",C9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=dr(n);return s.jsx(UOe,{...a,...r,ref:t})});C9.displayName=oCe;var sCe="ContextMenuSubContent",E9=y.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,a=dr(n);return s.jsx(HOe,{...a,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});E9.displayName=sCe;function Up(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var lCe=h9,cCe=p9,uCe=v9,A9=y9,T9=x9,k9=b9,P9=w9,M9=j9,R9=S9,D9=_9,dCe=O9,$9=C9,I9=E9;const fCe=lCe,hCe=cCe,mCe=dCe,L9=y.forwardRef(({className:e,inset:t,children:n,...r},a)=>s.jsxs($9,{ref:a,className:ue("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...r,children:[n,s.jsx(HC,{className:"ml-auto h-4 w-4"})]}));L9.displayName=$9.displayName;const B9=y.forwardRef(({className:e,...t},n)=>s.jsx(I9,{ref:n,className:ue("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",e),...t}));B9.displayName=I9.displayName;const z9=y.forwardRef(({className:e,...t},n)=>s.jsx(uCe,{children:s.jsx(A9,{ref:n,className:ue("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",e),...t})}));z9.displayName=A9.displayName;const Ta=y.forwardRef(({className:e,inset:t,...n},r)=>s.jsx(k9,{ref:r,className:ue("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Ta.displayName=k9.displayName;const pCe=y.forwardRef(({className:e,children:t,checked:n,...r},a)=>s.jsxs(P9,{ref:a,className:ue("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(R9,{children:s.jsx(Js,{className:"h-4 w-4"})})}),t]}));pCe.displayName=P9.displayName;const vCe=y.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(M9,{ref:r,className:ue("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(R9,{children:s.jsx(ave,{className:"h-2 w-2 fill-current"})})}),t]}));vCe.displayName=M9.displayName;const gCe=y.forwardRef(({className:e,inset:t,...n},r)=>s.jsx(T9,{ref:r,className:ue("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...n}));gCe.displayName=T9.displayName;const ff=y.forwardRef(({className:e,...t},n)=>s.jsx(D9,{ref:n,className:ue("-mx-1 my-1 h-px bg-border",e),...t}));ff.displayName=D9.displayName;const Mc=({className:e,...t})=>s.jsx("span",{className:ue("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});Mc.displayName="ContextMenuShortcut";var yCe=Symbol("radix.slottable");function xCe(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=yCe,t}var[Zy]=ur("Tooltip",[is]),Qy=is(),q9="TooltipProvider",bCe=700,fO="tooltip.open",[wCe,ME]=Zy(q9),F9=e=>{const{__scopeTooltip:t,delayDuration:n=bCe,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:i}=e,l=y.useRef(!0),u=y.useRef(!1),d=y.useRef(0);return y.useEffect(()=>{const f=d.current;return()=>window.clearTimeout(f)},[]),s.jsx(wCe,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:y.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:y.useCallback(f=>{u.current=f},[]),disableHoverableContent:a,children:i})};F9.displayName=q9;var ph="Tooltip",[jCe,Xh]=Zy(ph),U9=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:a,onOpenChange:i,disableHoverableContent:l,delayDuration:u}=e,d=ME(ph,e.__scopeTooltip),f=Qy(t),[m,p]=y.useState(null),g=kn(),x=y.useRef(0),j=l??d.disableHoverableContent,b=u??d.delayDuration,w=y.useRef(!1),[N,O]=wa({prop:r,defaultProp:a??!1,onChange:T=>{T?(d.onOpen(),document.dispatchEvent(new CustomEvent(fO))):d.onClose(),i?.(T)},caller:ph}),C=y.useMemo(()=>N?w.current?"delayed-open":"instant-open":"closed",[N]),A=y.useCallback(()=>{window.clearTimeout(x.current),x.current=0,w.current=!1,O(!0)},[O]),E=y.useCallback(()=>{window.clearTimeout(x.current),x.current=0,O(!1)},[O]),k=y.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{w.current=!0,O(!0),x.current=0},b)},[b,O]);return y.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),s.jsx(Lh,{...f,children:s.jsx(jCe,{scope:t,contentId:g,open:N,stateAttribute:C,trigger:m,onTriggerChange:p,onTriggerEnter:y.useCallback(()=>{d.isOpenDelayedRef.current?k():A()},[d.isOpenDelayedRef,k,A]),onTriggerLeave:y.useCallback(()=>{j?E():(window.clearTimeout(x.current),x.current=0)},[E,j]),onOpen:A,onClose:E,disableHoverableContent:j,children:n})})};U9.displayName=ph;var hO="TooltipTrigger",H9=y.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=Xh(hO,n),i=ME(hO,n),l=Qy(n),u=y.useRef(null),d=qe(t,u,a.onTriggerChange),f=y.useRef(!1),m=y.useRef(!1),p=y.useCallback(()=>f.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),s.jsx(Bh,{asChild:!0,...l,children:s.jsx(Me.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:d,onPointerMove:Se(e.onPointerMove,g=>{g.pointerType!=="touch"&&!m.current&&!i.isPointerInTransitRef.current&&(a.onTriggerEnter(),m.current=!0)}),onPointerLeave:Se(e.onPointerLeave,()=>{a.onTriggerLeave(),m.current=!1}),onPointerDown:Se(e.onPointerDown,()=>{a.open&&a.onClose(),f.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Se(e.onFocus,()=>{f.current||a.onOpen()}),onBlur:Se(e.onBlur,a.onClose),onClick:Se(e.onClick,a.onClose)})})});H9.displayName=hO;var RE="TooltipPortal",[SCe,_Ce]=Zy(RE,{forceMount:void 0}),W9=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:a}=e,i=Xh(RE,t);return s.jsx(SCe,{scope:t,forceMount:n,children:s.jsx(Sn,{present:n||i.open,children:s.jsx(jl,{asChild:!0,container:a,children:r})})})};W9.displayName=RE;var Eu="TooltipContent",V9=y.forwardRef((e,t)=>{const n=_Ce(Eu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...i}=e,l=Xh(Eu,e.__scopeTooltip);return s.jsx(Sn,{present:r||l.open,children:l.disableHoverableContent?s.jsx(G9,{side:a,...i,ref:t}):s.jsx(NCe,{side:a,...i,ref:t})})}),NCe=y.forwardRef((e,t)=>{const n=Xh(Eu,e.__scopeTooltip),r=ME(Eu,e.__scopeTooltip),a=y.useRef(null),i=qe(t,a),[l,u]=y.useState(null),{trigger:d,onClose:f}=n,m=a.current,{onPointerInTransitChange:p}=r,g=y.useCallback(()=>{u(null),p(!1)},[p]),x=y.useCallback((j,b)=>{const w=j.currentTarget,N={x:j.clientX,y:j.clientY},O=TCe(N,w.getBoundingClientRect()),C=kCe(N,O),A=PCe(b.getBoundingClientRect()),E=RCe([...C,...A]);u(E),p(!0)},[p]);return y.useEffect(()=>()=>g(),[g]),y.useEffect(()=>{if(d&&m){const j=w=>x(w,m),b=w=>x(w,d);return d.addEventListener("pointerleave",j),m.addEventListener("pointerleave",b),()=>{d.removeEventListener("pointerleave",j),m.removeEventListener("pointerleave",b)}}},[d,m,x,g]),y.useEffect(()=>{if(l){const j=b=>{const w=b.target,N={x:b.clientX,y:b.clientY},O=d?.contains(w)||m?.contains(w),C=!MCe(N,l);O?g():C&&(g(),f())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[d,m,l,f,g]),s.jsx(G9,{...e,ref:i})}),[OCe,CCe]=Zy(ph,{isInside:!1}),ECe=xCe("TooltipContent"),G9=y.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:i,onPointerDownOutside:l,...u}=e,d=Xh(Eu,n),f=Qy(n),{onClose:m}=d;return y.useEffect(()=>(document.addEventListener(fO,m),()=>document.removeEventListener(fO,m)),[m]),y.useEffect(()=>{if(d.trigger){const p=g=>{g.target?.contains(d.trigger)&&m()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[d.trigger,m]),s.jsx(wl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:p=>p.preventDefault(),onDismiss:m,children:s.jsxs(zy,{"data-state":d.stateAttribute,...f,...u,ref:t,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[s.jsx(ECe,{children:r}),s.jsx(OCe,{scope:n,isInside:!0,children:s.jsx(b0e,{id:d.contentId,role:"tooltip",children:a||r})})]})})});V9.displayName=Eu;var Y9="TooltipArrow",ACe=y.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=Qy(n);return CCe(Y9,n).isInside?null:s.jsx(qy,{...a,...r,ref:t})});ACe.displayName=Y9;function TCe(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,a,i)){case i:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function kCe(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function PCe(e){const{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}function MCe(e,t){const{x:n,y:r}=e;let a=!1;for(let i=0,l=t.length-1;ir!=g>r&&n<(p-f)*(r-m)/(g-m)+f&&(a=!a)}return a}function RCe(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),DCe(t)}function DCe(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const i=t[t.length-1],l=t[t.length-2];if((i.x-l.x)*(a.y-l.y)>=(i.y-l.y)*(a.x-l.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const a=e[r];for(;n.length>=2;){const i=n[n.length-1],l=n[n.length-2];if((i.x-l.x)*(a.y-l.y)>=(i.y-l.y)*(a.x-l.x))n.pop();else break}n.push(a)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var $Ce=F9,ICe=U9,LCe=H9,BCe=W9,K9=V9;const zCe=$Ce,qCe=ICe,FCe=LCe,X9=y.forwardRef(({className:e,sideOffset:t=4,...n},r)=>s.jsx(BCe,{children:s.jsx(K9,{ref:r,sideOffset:t,className:ue("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...n})}));X9.displayName=K9.displayName;function UCe({children:e}){Axe();const[t,n]=y.useState(!0),[r,a]=y.useState(!1),[i,l]=y.useState(!1),{theme:u,setTheme:d}=YC(),f=AY(),m=qa();y.useEffect(()=>{const b=w=>{(w.metaKey||w.ctrlKey)&&w.key==="k"&&(w.preventDefault(),l(!0))};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[]);const p=[{title:"概览",items:[{icon:gg,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:WC,label:"麦麦主程序配置",path:"/config/bot"},{icon:Wq,label:"麦麦模型提供商配置",path:"/config/modelProvider"},{icon:Bq,label:"麦麦模型配置",path:"/config/model"}]},{title:"麦麦资源管理",items:[{icon:Vq,label:"表情包管理",path:"/resource/emoji"},{icon:Mh,label:"表达方式管理",path:"/resource/expression"},{icon:qq,label:"人物信息管理",path:"/resource/person"}]},{title:"扩展与监控",items:[{icon:zq,label:"统计信息",path:"/statistics"},{icon:Hq,label:"插件市场",path:"/plugins"},{icon:pg,label:"日志查看器",path:"/logs"}]},{title:"系统",items:[{icon:Sf,label:"系统设置",path:"/settings"}]}],x=u==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":u,j=()=>{localStorage.removeItem("access-token"),m({to:"/auth"})};return s.jsx(zCe,{delayDuration:300,children:s.jsxs("div",{className:"flex h-screen overflow-hidden",children:[s.jsxs("aside",{className:ue("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",t?"lg:w-64":"lg:w-16",r?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[s.jsx("div",{className:"flex h-16 items-center border-b px-4",children:s.jsxs("div",{className:ue("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!t&&"lg:flex-none lg:w-8"),children:[s.jsxs("div",{className:ue("flex items-baseline gap-2",!t&&"lg:hidden"),children:[s.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),s.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:Fge()})]}),!t&&s.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),s.jsx("nav",{className:"flex-1 overflow-y-auto p-4",children:s.jsx("ul",{className:ue("space-y-6",!t&&"lg:space-y-3"),children:p.map((b,w)=>s.jsxs("li",{children:[s.jsx("div",{className:ue("px-3 h-[1.25rem]","mb-2",!t&&"lg:mb-1 lg:invisible"),children:s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:b.title})}),!t&&w>0&&s.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),s.jsx("ul",{className:"space-y-1",children:b.items.map(N=>{const O=f({to:N.path}),C=N.icon,A=s.jsxs(s.Fragment,{children:[O&&s.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),s.jsxs("div",{className:ue("flex items-center transition-all duration-300",t?"gap-3":"lg:gap-0"),children:[s.jsx(C,{className:ue("h-5 w-5 flex-shrink-0",O&&"text-primary"),strokeWidth:2,fill:"none"}),s.jsx("span",{className:ue("text-sm font-medium whitespace-nowrap transition-all duration-300",O&&"font-semibold",t?"opacity-100 max-w-[200px]":"lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:N.label})]})]});return s.jsx("li",{className:"relative",children:s.jsxs(qCe,{children:[s.jsx(FCe,{asChild:!0,children:s.jsx(OO,{to:N.path,className:ue("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",O?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",t?"px-3":"lg:px-0 lg:justify-center"),onClick:()=>a(!1),children:A})}),!t&&s.jsx(X9,{side:"right",className:"hidden lg:block",children:s.jsx("p",{children:N.label})})]})},N.path)})})]},b.title))})})]}),r&&s.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>a(!1)}),s.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[s.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("button",{onClick:()=>a(!r),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:s.jsx(Ave,{className:"h-5 w-5"})}),s.jsx("button",{onClick:()=>n(!t),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:t?"收起侧边栏":"展开侧边栏",children:s.jsx(UC,{className:ue("h-5 w-5 transition-transform",!t&&"rotate-180")})})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{onClick:()=>l(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[s.jsx(kr,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),s.jsxs(zH,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[s.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),s.jsx(KNe,{open:i,onOpenChange:l}),s.jsxs(me,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[s.jsx(zpe,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),s.jsx("button",{onClick:b=>{_ge(x==="dark"?"light":"dark",d,b)},className:"rounded-lg p-2 hover:bg-accent",title:x==="dark"?"切换到浅色模式":"切换到深色模式",children:x==="dark"?s.jsx(VN,{className:"h-5 w-5"}):s.jsx(WN,{className:"h-5 w-5"})}),s.jsx("div",{className:"h-6 w-px bg-border"}),s.jsxs(me,{variant:"ghost",size:"sm",onClick:j,className:"gap-2",title:"登出系统",children:[s.jsx($L,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),s.jsxs(fCe,{children:[s.jsx(hCe,{asChild:!0,children:s.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:e})}),s.jsxs(z9,{className:"w-64",children:[s.jsxs(Ta,{onClick:()=>m({to:"/"}),children:[s.jsx(gg,{className:"mr-2 h-4 w-4"}),"首页"]}),s.jsxs(Ta,{onClick:()=>m({to:"/settings"}),children:[s.jsx(Sf,{className:"mr-2 h-4 w-4"}),"系统设置"]}),s.jsxs(Ta,{onClick:()=>m({to:"/logs"}),children:[s.jsx(pg,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),s.jsx(ff,{}),s.jsxs(mCe,{children:[s.jsxs(L9,{children:[s.jsx(Rve,{className:"mr-2 h-4 w-4"}),"切换主题"]}),s.jsxs(B9,{className:"w-48",children:[s.jsxs(Ta,{onClick:()=>d("light"),disabled:u==="light",children:[s.jsx(VN,{className:"mr-2 h-4 w-4"}),"浅色",u==="light"&&s.jsx(Mc,{children:"✓"})]}),s.jsxs(Ta,{onClick:()=>d("dark"),disabled:u==="dark",children:[s.jsx(WN,{className:"mr-2 h-4 w-4"}),"深色",u==="dark"&&s.jsx(Mc,{children:"✓"})]}),s.jsxs(Ta,{onClick:()=>d("system"),disabled:u==="system",children:[s.jsx(Sf,{className:"mr-2 h-4 w-4"}),"跟随系统",u==="system"&&s.jsx(Mc,{children:"✓"})]})]})]}),s.jsx(ff,{}),s.jsxs(Ta,{onClick:()=>window.location.reload(),children:[s.jsx(Uve,{className:"mr-2 h-4 w-4"}),"刷新页面",s.jsx(Mc,{children:"⌘R"})]}),s.jsxs(Ta,{onClick:()=>l(!0),children:[s.jsx(kr,{className:"mr-2 h-4 w-4"}),"搜索",s.jsx(Mc,{children:"⌘K"})]}),s.jsx(ff,{}),s.jsxs(Ta,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[s.jsx(Zp,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),s.jsx(ff,{}),s.jsxs(Ta,{onClick:j,className:"text-destructive focus:text-destructive",children:[s.jsx($L,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}const Jy=bY({component:()=>s.jsxs(s.Fragment,{children:[s.jsx(CO,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!a8())throw $3({to:"/auth"})}}),HCe=cr({getParentRoute:()=>Jy,path:"/auth",component:Txe}),na=cr({getParentRoute:()=>Jy,id:"protected",component:()=>s.jsx(UCe,{children:s.jsx(CO,{})})}),WCe=cr({getParentRoute:()=>na,path:"/",component:jge}),VCe=cr({getParentRoute:()=>na,path:"/config/bot",component:xwe}),GCe=cr({getParentRoute:()=>na,path:"/config/modelProvider",component:Bwe}),YCe=cr({getParentRoute:()=>na,path:"/config/model",component:m1e}),KCe=cr({getParentRoute:()=>na,path:"/resource/emoji",component:j1e}),XCe=cr({getParentRoute:()=>na,path:"/resource/expression",component:k1e}),ZCe=cr({getParentRoute:()=>na,path:"/resource/person",component:z1e}),QCe=cr({getParentRoute:()=>na,path:"/logs",component:wNe}),JCe=cr({getParentRoute:()=>na,path:"/statistics",component:jNe}),eEe=cr({getParentRoute:()=>na,path:"/plugins",component:WNe}),tEe=cr({getParentRoute:()=>na,path:"/plugin-mirrors",component:VNe}),nEe=cr({getParentRoute:()=>na,path:"/settings",component:Sxe}),rEe=cr({getParentRoute:()=>Jy,path:"*",component:i8}),aEe=Jy.addChildren([HCe,na.addChildren([WCe,VCe,GCe,YCe,KCe,XCe,ZCe,JCe,eEe,tEe,QCe,nEe]),rEe]),iEe=TY({routeTree:aEe,defaultNotFoundComponent:i8});function oEe({children:e,defaultTheme:t="system",storageKey:n="ui-theme",...r}){const[a,i]=y.useState(()=>localStorage.getItem(n)||t);y.useEffect(()=>{const u=window.document.documentElement;if(u.classList.remove("light","dark"),a==="system"){const d=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";u.classList.add(d);return}u.classList.add(a)},[a]),y.useEffect(()=>{const u=localStorage.getItem("accent-color");if(u){const d=document.documentElement,m={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%"},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%"},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%"},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%"},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%"}}[u];m&&d.style.setProperty("--primary",m.hsl)}},[]);const l={theme:a,setTheme:u=>{localStorage.setItem(n,u),i(u)}};return s.jsx(Yq.Provider,{...r,value:l,children:e})}function sEe({children:e,defaultEnabled:t=!0,defaultWavesEnabled:n=!0,storageKey:r="enable-animations",wavesStorageKey:a="enable-waves-background"}){const[i,l]=y.useState(()=>{const m=localStorage.getItem(r);return m!==null?m==="true":t}),[u,d]=y.useState(()=>{const m=localStorage.getItem(a);return m!==null?m==="true":n});y.useEffect(()=>{const m=document.documentElement;i?m.classList.remove("no-animations"):m.classList.add("no-animations"),localStorage.setItem(r,String(i))},[i,r]),y.useEffect(()=>{localStorage.setItem(a,String(u))},[u,a]);const f={enableAnimations:i,setEnableAnimations:l,enableWavesBackground:u,setEnableWavesBackground:d};return s.jsx(Kq.Provider,{value:f,children:e})}var DE="ToastProvider",[$E,lEe,cEe]=wh("Toast"),[Z9]=ur("Toast",[cEe]),[uEe,ex]=Z9(DE),Q9=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:a="right",swipeThreshold:i=50,children:l}=e,[u,d]=y.useState(null),[f,m]=y.useState(0),p=y.useRef(!1),g=y.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${DE}\`. Expected non-empty \`string\`.`),s.jsx($E.Provider,{scope:t,children:s.jsx(uEe,{scope:t,label:n,duration:r,swipeDirection:a,swipeThreshold:i,toastCount:f,viewport:u,onViewportChange:d,onToastAdd:y.useCallback(()=>m(x=>x+1),[]),onToastRemove:y.useCallback(()=>m(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:g,children:l})})};Q9.displayName=DE;var J9="ToastViewport",dEe=["F8"],mO="toast.viewportPause",pO="toast.viewportResume",eW=y.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=dEe,label:a="Notifications ({hotkey})",...i}=e,l=ex(J9,n),u=lEe(n),d=y.useRef(null),f=y.useRef(null),m=y.useRef(null),p=y.useRef(null),g=qe(t,p,l.onViewportChange),x=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),j=l.toastCount>0;y.useEffect(()=>{const w=N=>{r.length!==0&&r.every(C=>N[C]||N.code===C)&&p.current?.focus()};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[r]),y.useEffect(()=>{const w=d.current,N=p.current;if(j&&w&&N){const O=()=>{if(!l.isClosePausedRef.current){const k=new CustomEvent(mO);N.dispatchEvent(k),l.isClosePausedRef.current=!0}},C=()=>{if(l.isClosePausedRef.current){const k=new CustomEvent(pO);N.dispatchEvent(k),l.isClosePausedRef.current=!1}},A=k=>{!w.contains(k.relatedTarget)&&C()},E=()=>{w.contains(document.activeElement)||C()};return w.addEventListener("focusin",O),w.addEventListener("focusout",A),w.addEventListener("pointermove",O),w.addEventListener("pointerleave",E),window.addEventListener("blur",O),window.addEventListener("focus",C),()=>{w.removeEventListener("focusin",O),w.removeEventListener("focusout",A),w.removeEventListener("pointermove",O),w.removeEventListener("pointerleave",E),window.removeEventListener("blur",O),window.removeEventListener("focus",C)}}},[j,l.isClosePausedRef]);const b=y.useCallback(({tabbingDirection:w})=>{const O=u().map(C=>{const A=C.ref.current,E=[A,..._Ee(A)];return w==="forwards"?E:E.reverse()});return(w==="forwards"?O.reverse():O).flat()},[u]);return y.useEffect(()=>{const w=p.current;if(w){const N=O=>{const C=O.altKey||O.ctrlKey||O.metaKey;if(O.key==="Tab"&&!C){const E=document.activeElement,k=O.shiftKey;if(O.target===w&&k){f.current?.focus();return}const $=b({tabbingDirection:k?"backwards":"forwards"}),F=$.findIndex(D=>D===E);i_($.slice(F+1))?O.preventDefault():k?f.current?.focus():m.current?.focus()}};return w.addEventListener("keydown",N),()=>w.removeEventListener("keydown",N)}},[u,b]),s.jsxs(Zge,{ref:d,role:"region","aria-label":a.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:j?void 0:"none"},children:[j&&s.jsx(vO,{ref:f,onFocusFromOutsideViewport:()=>{const w=b({tabbingDirection:"forwards"});i_(w)}}),s.jsx($E.Slot,{scope:n,children:s.jsx(Me.ol,{tabIndex:-1,...i,ref:g})}),j&&s.jsx(vO,{ref:m,onFocusFromOutsideViewport:()=>{const w=b({tabbingDirection:"backwards"});i_(w)}})]})});eW.displayName=J9;var tW="ToastFocusProxy",vO=y.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...a}=e,i=ex(tW,n);return s.jsx(Fy,{tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:l=>{const u=l.relatedTarget;!i.viewport?.contains(u)&&r()}})});vO.displayName=tW;var Zh="Toast",fEe="toast.swipeStart",hEe="toast.swipeMove",mEe="toast.swipeCancel",pEe="toast.swipeEnd",nW=y.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:a,onOpenChange:i,...l}=e,[u,d]=wa({prop:r,defaultProp:a??!0,onChange:i,caller:Zh});return s.jsx(Sn,{present:n||u,children:s.jsx(yEe,{open:u,...l,ref:t,onClose:()=>d(!1),onPause:Xt(e.onPause),onResume:Xt(e.onResume),onSwipeStart:Se(e.onSwipeStart,f=>{f.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Se(e.onSwipeMove,f=>{const{x:m,y:p}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","move"),f.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${m}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:Se(e.onSwipeCancel,f=>{f.currentTarget.setAttribute("data-swipe","cancel"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Se(e.onSwipeEnd,f=>{const{x:m,y:p}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","end"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${m}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),d(!1)})})})});nW.displayName=Zh;var[vEe,gEe]=Z9(Zh,{onClose(){}}),yEe=y.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:a,open:i,onClose:l,onEscapeKeyDown:u,onPause:d,onResume:f,onSwipeStart:m,onSwipeMove:p,onSwipeCancel:g,onSwipeEnd:x,...j}=e,b=ex(Zh,n),[w,N]=y.useState(null),O=qe(t,H=>N(H)),C=y.useRef(null),A=y.useRef(null),E=a||b.duration,k=y.useRef(0),T=y.useRef(E),P=y.useRef(0),{onToastAdd:$,onToastRemove:F}=b,D=Xt(()=>{w?.contains(document.activeElement)&&b.viewport?.focus(),l()}),U=y.useCallback(H=>{!H||H===1/0||(window.clearTimeout(P.current),k.current=new Date().getTime(),P.current=window.setTimeout(D,H))},[D]);y.useEffect(()=>{const H=b.viewport;if(H){const G=()=>{U(T.current),f?.()},L=()=>{const R=new Date().getTime()-k.current;T.current=T.current-R,window.clearTimeout(P.current),d?.()};return H.addEventListener(mO,L),H.addEventListener(pO,G),()=>{H.removeEventListener(mO,L),H.removeEventListener(pO,G)}}},[b.viewport,E,d,f,U]),y.useEffect(()=>{i&&!b.isClosePausedRef.current&&U(E)},[i,E,b.isClosePausedRef,U]),y.useEffect(()=>($(),()=>F()),[$,F]);const V=y.useMemo(()=>w?cW(w):null,[w]);return b.viewport?s.jsxs(s.Fragment,{children:[V&&s.jsx(xEe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:V}),s.jsx(vEe,{scope:n,onClose:D,children:pl.createPortal(s.jsx($E.ItemSlot,{scope:n,children:s.jsx(Xge,{asChild:!0,onEscapeKeyDown:Se(u,()=>{b.isFocusedToastEscapeKeyDownRef.current||D(),b.isFocusedToastEscapeKeyDownRef.current=!1}),children:s.jsx(Me.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":b.swipeDirection,...j,ref:O,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Se(e.onKeyDown,H=>{H.key==="Escape"&&(u?.(H.nativeEvent),H.nativeEvent.defaultPrevented||(b.isFocusedToastEscapeKeyDownRef.current=!0,D()))}),onPointerDown:Se(e.onPointerDown,H=>{H.button===0&&(C.current={x:H.clientX,y:H.clientY})}),onPointerMove:Se(e.onPointerMove,H=>{if(!C.current)return;const G=H.clientX-C.current.x,L=H.clientY-C.current.y,R=!!A.current,q=["left","right"].includes(b.swipeDirection),K=["left","up"].includes(b.swipeDirection)?Math.min:Math.max,ee=q?K(0,G):0,I=q?0:K(0,L),B=H.pointerType==="touch"?10:2,Y={x:ee,y:I},te={originalEvent:H,delta:Y};R?(A.current=Y,Hp(hEe,p,te,{discrete:!1})):k3(Y,b.swipeDirection,B)?(A.current=Y,Hp(fEe,m,te,{discrete:!1}),H.target.setPointerCapture(H.pointerId)):(Math.abs(G)>B||Math.abs(L)>B)&&(C.current=null)}),onPointerUp:Se(e.onPointerUp,H=>{const G=A.current,L=H.target;if(L.hasPointerCapture(H.pointerId)&&L.releasePointerCapture(H.pointerId),A.current=null,C.current=null,G){const R=H.currentTarget,q={originalEvent:H,delta:G};k3(G,b.swipeDirection,b.swipeThreshold)?Hp(pEe,x,q,{discrete:!0}):Hp(mEe,g,q,{discrete:!0}),R.addEventListener("click",K=>K.preventDefault(),{once:!0})}})})})}),b.viewport)})]}):null}),xEe=e=>{const{__scopeToast:t,children:n,...r}=e,a=ex(Zh,t),[i,l]=y.useState(!1),[u,d]=y.useState(!1);return jEe(()=>l(!0)),y.useEffect(()=>{const f=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(f)},[]),u?null:s.jsx(jl,{asChild:!0,children:s.jsx(Fy,{...r,children:i&&s.jsxs(s.Fragment,{children:[a.label," ",n]})})})},bEe="ToastTitle",rW=y.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return s.jsx(Me.div,{...r,ref:t})});rW.displayName=bEe;var wEe="ToastDescription",aW=y.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return s.jsx(Me.div,{...r,ref:t})});aW.displayName=wEe;var iW="ToastAction",oW=y.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?s.jsx(lW,{altText:n,asChild:!0,children:s.jsx(IE,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${iW}\`. Expected non-empty \`string\`.`),null)});oW.displayName=iW;var sW="ToastClose",IE=y.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,a=gEe(sW,n);return s.jsx(lW,{asChild:!0,children:s.jsx(Me.button,{type:"button",...r,ref:t,onClick:Se(e.onClick,a.onClose)})})});IE.displayName=sW;var lW=y.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...a}=e;return s.jsx(Me.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...a,ref:t})});function cW(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),SEe(r)){const a=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!a)if(i){const l=r.dataset.radixToastAnnounceAlt;l&&t.push(l)}else t.push(...cW(r))}}),t}function Hp(e,t,n,{discrete:r}){const a=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?MO(a,i):a.dispatchEvent(i)}var k3=(e,t,n=0)=>{const r=Math.abs(e.x),a=Math.abs(e.y),i=r>a;return t==="left"||t==="right"?i&&r>n:!i&&a>n};function jEe(e=()=>{}){const t=Xt(e);Bn(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function SEe(e){return e.nodeType===e.ELEMENT_NODE}function _Ee(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function i_(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var NEe=Q9,uW=eW,dW=nW,fW=rW,hW=aW,mW=oW,pW=IE;const OEe=NEe,vW=y.forwardRef(({className:e,...t},n)=>s.jsx(uW,{ref:n,className:ue("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));vW.displayName=uW.displayName;const CEe=Rh("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),gW=y.forwardRef(({className:e,variant:t,...n},r)=>s.jsx(dW,{ref:r,className:ue(CEe({variant:t}),e),...n}));gW.displayName=dW.displayName;const EEe=y.forwardRef(({className:e,...t},n)=>s.jsx(mW,{ref:n,className:ue("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));EEe.displayName=mW.displayName;const yW=y.forwardRef(({className:e,...t},n)=>s.jsx(pW,{ref:n,className:ue("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:s.jsx(_y,{className:"h-4 w-4"})}));yW.displayName=pW.displayName;const xW=y.forwardRef(({className:e,...t},n)=>s.jsx(fW,{ref:n,className:ue("text-sm font-semibold [&+div]:text-xs",e),...t}));xW.displayName=fW.displayName;const bW=y.forwardRef(({className:e,...t},n)=>s.jsx(hW,{ref:n,className:ue("text-sm opacity-90",e),...t}));bW.displayName=hW.displayName;function AEe(){const{toasts:e}=Dr();return s.jsxs(OEe,{children:[e.map(function({id:t,title:n,description:r,action:a,...i}){return s.jsxs(gW,{...i,children:[s.jsxs("div",{className:"grid gap-1",children:[n&&s.jsx(xW,{children:n}),r&&s.jsx(bW,{children:r})]}),a,s.jsx(yW,{})]},t)}),s.jsx(vW,{})]})}FV.createRoot(document.getElementById("root")).render(s.jsx(y.StrictMode,{children:s.jsx(oEe,{defaultTheme:"system",children:s.jsxs(sEe,{children:[s.jsx(MY,{router:iEe}),s.jsx(AEe,{})]})})})); diff --git a/webui/dist/assets/react-vendor-Dtc2IqVY.js b/webui/dist/assets/react-vendor-Dtc2IqVY.js new file mode 100644 index 00000000..087b3f14 --- /dev/null +++ b/webui/dist/assets/react-vendor-Dtc2IqVY.js @@ -0,0 +1 @@ +var ce=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ae(_){return _&&_.__esModule&&Object.prototype.hasOwnProperty.call(_,"default")?_.default:_}var $={exports:{}},P={};var W;function oe(){if(W)return P;W=1;var _=Symbol.for("react.transitional.element"),O=Symbol.for("react.fragment");function v(y,E,g){var R=null;if(g!==void 0&&(R=""+g),E.key!==void 0&&(R=""+E.key),"key"in E){g={};for(var m in E)m!=="key"&&(g[m]=E[m])}else g=E;return E=g.ref,{$$typeof:_,type:y,key:R,ref:E!==void 0?E:null,props:g}}return P.Fragment=O,P.jsx=v,P.jsxs=v,P}var X;function le(){return X||(X=1,$.exports=oe()),$.exports}var k={exports:{}},n={};var F;function ie(){if(F)return n;F=1;var _=Symbol.for("react.transitional.element"),O=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),g=Symbol.for("react.consumer"),R=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),t=Symbol.for("react.memo"),c=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),h=Symbol.iterator;function w(e){return e===null||typeof e!="object"?null:(e=h&&e[h]||e["@@iterator"],typeof e=="function"?e:null)}var Y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},U=Object.assign,q={};function C(e,r,o){this.props=e,this.context=r,this.refs=q,this.updater=o||Y}C.prototype.isReactComponent={},C.prototype.setState=function(e,r){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,r,"setState")},C.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function b(){}b.prototype=C.prototype;function N(e,r,o){this.props=e,this.context=r,this.refs=q,this.updater=o||Y}var j=N.prototype=new b;j.constructor=N,U(j,C.prototype),j.isPureReactComponent=!0;var G=Array.isArray;function D(){}var a={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function L(e,r,o){var u=o.ref;return{$$typeof:_,type:e,key:r,ref:u!==void 0?u:null,props:o}}function V(e,r){return L(e.type,r,e.props)}function x(e){return typeof e=="object"&&e!==null&&e.$$typeof===_}function ee(e){var r={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(o){return r[o]})}var B=/\/+/g;function M(e,r){return typeof e=="object"&&e!==null&&e.key!=null?ee(""+e.key):r.toString(36)}function te(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(D,D):(e.status="pending",e.then(function(r){e.status==="pending"&&(e.status="fulfilled",e.value=r)},function(r){e.status==="pending"&&(e.status="rejected",e.reason=r)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function A(e,r,o,u,s){var f=typeof e;(f==="undefined"||f==="boolean")&&(e=null);var l=!1;if(e===null)l=!0;else switch(f){case"bigint":case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case _:case O:l=!0;break;case c:return l=e._init,A(l(e._payload),r,o,u,s)}}if(l)return s=s(e),l=u===""?"."+M(e,0):u,G(s)?(o="",l!=null&&(o=l.replace(B,"$&/")+"/"),A(s,r,o,"",function(ue){return ue})):s!=null&&(x(s)&&(s=V(s,o+(s.key==null||e&&e.key===s.key?"":(""+s.key).replace(B,"$&/")+"/")+l)),r.push(s)),1;l=0;var T=u===""?".":u+":";if(G(e))for(var d=0;d"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(_)}catch(O){console.error(O)}}return _(),I.exports=fe(),I.exports}export{se as a,ye as b,ce as c,ae as g,le as r}; diff --git a/webui/dist/assets/router-BWgTyY51.js b/webui/dist/assets/router-BWgTyY51.js new file mode 100644 index 00000000..78a82272 --- /dev/null +++ b/webui/dist/assets/router-BWgTyY51.js @@ -0,0 +1,2 @@ +import{r as fo,a as ee,g as Ne,b as po}from"./react-vendor-Dtc2IqVY.js";function mo(t,o){for(var e=0;es[n]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var g=fo(),R=ee();const rt=Ne(R),hn=mo({__proto__:null,default:rt},[R]),Yt=new WeakMap,go=new WeakMap,bt={current:[]};let Nt=!1,mt=0;const pt=new Set,Pt=new Map;function Ue(t){for(const o of t){if(bt.current.includes(o))continue;bt.current.push(o),o.recompute();const e=go.get(o);if(e)for(const s of e){const n=Yt.get(s);n?.length&&Ue(n)}}}function yo(t){const o={prevVal:t.prevState,currentVal:t.state};for(const e of t.listeners)e(o)}function vo(t){const o={prevVal:t.prevState,currentVal:t.state};for(const e of t.listeners)e(o)}function Ve(t){if(mt>0&&!Pt.has(t)&&Pt.set(t,t.prevState),pt.add(t),!(mt>0)&&!Nt)try{for(Nt=!0;pt.size>0;){const o=Array.from(pt);pt.clear();for(const e of o){const s=Pt.get(e)??e.prevState;e.prevState=s,yo(e)}for(const e of o){const s=Yt.get(e);s&&(bt.current.push(e),Ue(s))}for(const e of o){const s=Yt.get(e);if(s)for(const n of s)vo(n)}}}finally{Nt=!1,bt.current=[],Pt.clear()}}function gt(t){mt++;try{t()}finally{if(mt--,mt===0){const o=pt.values().next().value;o&&Ve(o)}}}function So(t){return typeof t=="function"}class _o{constructor(o,e){this.listeners=new Set,this.subscribe=s=>{var n,r;this.listeners.add(s);const i=(r=(n=this.options)==null?void 0:n.onSubscribe)==null?void 0:r.call(n,s,this);return()=>{this.listeners.delete(s),i?.()}},this.prevState=o,this.state=o,this.options=e}setState(o){var e,s,n;this.prevState=this.state,(e=this.options)!=null&&e.updateFn?this.state=this.options.updateFn(this.prevState)(o):So(o)?this.state=o(this.prevState):this.state=o,(n=(s=this.options)==null?void 0:s.onUpdate)==null||n.call(s),Ve(this)}}const G="__TSR_index",ve="popstate",Se="beforeunload";function Ro(t){let o=t.getLocation();const e=new Set,s=i=>{o=t.getLocation(),e.forEach(c=>c({location:o,action:i}))},n=i=>{t.notifyOnIndexChange??!0?s(i):o=t.getLocation()},r=async({task:i,navigateOpts:c,...a})=>{if(c?.ignoreBlocker??!1){i();return}const u=t.getBlockers?.()??[],h=a.type==="PUSH"||a.type==="REPLACE";if(typeof document<"u"&&u.length&&h)for(const f of u){const d=Et(a.path,a.state);if(await f.blockerFn({currentLocation:o,nextLocation:d,action:a.type})){t.onBlocked?.();return}}i()};return{get location(){return o},get length(){return t.getLength()},subscribers:e,subscribe:i=>(e.add(i),()=>{e.delete(i)}),push:(i,c,a)=>{const l=o.state[G];c=_e(l+1,c),r({task:()=>{t.pushState(i,c),s({type:"PUSH"})},navigateOpts:a,type:"PUSH",path:i,state:c})},replace:(i,c,a)=>{const l=o.state[G];c=_e(l,c),r({task:()=>{t.replaceState(i,c),s({type:"REPLACE"})},navigateOpts:a,type:"REPLACE",path:i,state:c})},go:(i,c)=>{r({task:()=>{t.go(i),n({type:"GO",index:i})},navigateOpts:c,type:"GO"})},back:i=>{r({task:()=>{t.back(i?.ignoreBlocker??!1),n({type:"BACK"})},navigateOpts:i,type:"BACK"})},forward:i=>{r({task:()=>{t.forward(i?.ignoreBlocker??!1),n({type:"FORWARD"})},navigateOpts:i,type:"FORWARD"})},canGoBack:()=>o.state[G]!==0,createHref:i=>t.createHref(i),block:i=>{if(!t.setBlockers)return()=>{};const c=t.getBlockers?.()??[];return t.setBlockers([...c,i]),()=>{const a=t.getBlockers?.()??[];t.setBlockers?.(a.filter(l=>l!==i))}},flush:()=>t.flush?.(),destroy:()=>t.destroy?.(),notify:s}}function _e(t,o){o||(o={});const e=oe();return{...o,key:e,__TSR_key:e,[G]:t}}function Po(t){const o=typeof document<"u"?window:void 0,e=o.history.pushState,s=o.history.replaceState;let n=[];const r=()=>n,i=v=>n=v,c=(v=>v),a=(()=>Et(`${o.location.pathname}${o.location.search}${o.location.hash}`,o.history.state));if(!o.history.state?.__TSR_key&&!o.history.state?.key){const v=oe();o.history.replaceState({[G]:0,key:v,__TSR_key:v},"")}let l=a(),u,h=!1,f=!1,d=!1,p=!1;const m=()=>l;let y,_;const x=()=>{y&&(S._ignoreSubscribers=!0,(y.isPush?o.history.pushState:o.history.replaceState)(y.state,"",y.href),S._ignoreSubscribers=!1,y=void 0,_=void 0,u=void 0)},P=(v,C,M)=>{const T=c(C);_||(u=l),l=Et(C,M),y={href:T,state:M,isPush:y?.isPush||v==="push"},_||(_=Promise.resolve().then(()=>x()))},L=v=>{l=a(),S.notify({type:v})},E=async()=>{if(f){f=!1;return}const v=a(),C=v.state[G]-l.state[G],M=C===1,T=C===-1,I=!M&&!T||h;h=!1;const Y=I?"GO":T?"BACK":"FORWARD",D=I?{type:"GO",index:C}:{type:T?"BACK":"FORWARD"};if(d)d=!1;else{const X=r();if(typeof document<"u"&&X.length){for(const he of X)if(await he.blockerFn({currentLocation:l,nextLocation:v,action:Y})){f=!0,o.history.go(1),S.notify(D);return}}}l=a(),S.notify(D)},w=v=>{if(p){p=!1;return}let C=!1;const M=r();if(typeof document<"u"&&M.length)for(const T of M){const I=T.enableBeforeUnload??!0;if(I===!0){C=!0;break}if(typeof I=="function"&&I()===!0){C=!0;break}}if(C)return v.preventDefault(),v.returnValue=""},S=Ro({getLocation:m,getLength:()=>o.history.length,pushState:(v,C)=>P("push",v,C),replaceState:(v,C)=>P("replace",v,C),back:v=>(v&&(d=!0),p=!0,o.history.back()),forward:v=>{v&&(d=!0),p=!0,o.history.forward()},go:v=>{h=!0,o.history.go(v)},createHref:v=>c(v),flush:x,destroy:()=>{o.history.pushState=e,o.history.replaceState=s,o.removeEventListener(Se,w,{capture:!0}),o.removeEventListener(ve,E)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:r,setBlockers:i,notifyOnIndexChange:!1});return o.addEventListener(Se,w,{capture:!0}),o.addEventListener(ve,E),o.history.pushState=function(...v){const C=e.apply(o.history,v);return S._ignoreSubscribers||L("PUSH"),C},o.history.replaceState=function(...v){const C=s.apply(o.history,v);return S._ignoreSubscribers||L("REPLACE"),C},S}function Et(t,o){const e=t.indexOf("#"),s=t.indexOf("?"),n=oe();return{href:t,pathname:t.substring(0,e>0?s>0?Math.min(e,s):e:s>0?s:t.length),hash:e>-1?t.substring(e):"",search:s>-1?t.slice(s,e===-1?void 0:e):"",state:o||{[G]:0,key:n,__TSR_key:n}}}function oe(){return(Math.random()+1).toString(36).substring(7)}function Xt(t){return t[t.length-1]}function wo(t){return typeof t=="function"}function Q(t,o){return wo(t)?t(o):t}const xo=Object.prototype.hasOwnProperty;function B(t,o){if(t===o)return t;const e=o,s=we(t)&&we(e);if(!s&&!(Tt(t)&&Tt(e)))return e;const n=s?t:Re(t);if(!n)return e;const r=s?e:Re(e);if(!r)return e;const i=n.length,c=r.length,a=s?new Array(c):{};let l=0;for(let u=0;u"u")return!0;const e=o.prototype;return!(!Pe(e)||!e.hasOwnProperty("isPrototypeOf"))}function Pe(t){return Object.prototype.toString.call(t)==="[object Object]"}function we(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function tt(t,o,e){if(t===o)return!0;if(typeof t!=typeof o)return!1;if(Array.isArray(t)&&Array.isArray(o)){if(t.length!==o.length)return!1;for(let s=0,n=t.length;sn||!tt(t[i],o[i],e)))return!1;return n===r}return!1}function it(t){let o,e;const s=new Promise((n,r)=>{o=n,e=r});return s.status="pending",s.resolve=n=>{s.status="resolved",s.value=n,o(n),t?.(n)},s.reject=n=>{s.status="rejected",e(n)},s}function q(t){return!!(t&&typeof t=="object"&&typeof t.then=="function")}const Lo=Array.from(new Map([["%","%25"],["\\","%5C"]]).values());function xe(t,o=Lo){function e(n,r,i=0){for(let c=i;c{try{return decodeURI(c)}catch{return c}})}}if(t===""||!/%[0-9A-Fa-f]{2}/g.test(t))return t;const s=t.replaceAll(/%[0-9a-f]{2}/g,n=>n.toUpperCase());return e(s,o)}var Co="Invariant failed";function K(t,o){if(!t)throw new Error(Co)}const U=0,ot=1,at=2,ct=3;function z(t){return se(t.filter(o=>o!==void 0).join("/"))}function se(t){return t.replace(/\/{2,}/g,"/")}function ne(t){return t==="/"?t:t.replace(/^\/{1,}/,"")}function J(t){return t==="/"?t:t.replace(/\/{1,}$/,"")}function Ct(t){return J(ne(t))}function It(t,o){return t?.endsWith("/")&&t!=="/"&&t!==`${o}/`?t.slice(0,-1):t}function Mo(t,o,e){return It(t,e)===It(o,e)}function bo(t){const{type:o,value:e}=t;if(o===U)return e;const{prefixSegment:s,suffixSegment:n}=t;if(o===ot){const r=e.substring(1);if(s&&n)return`${s}{$${r}}${n}`;if(s)return`${s}{$${r}}`;if(n)return`{$${r}}${n}`}if(o===ct){const r=e.substring(1);return s&&n?`${s}{-$${r}}${n}`:s?`${s}{-$${r}}`:n?`{-$${r}}${n}`:`{-$${r}}`}if(o===at){if(s&&n)return`${s}{$}${n}`;if(s)return`${s}{$}`;if(n)return`{$}${n}`}return e}function Eo({base:t,to:o,trailingSlash:e="never",parseCache:s}){let n=ut(t,s).slice();const r=ut(o,s);n.length>1&&Xt(n)?.value==="/"&&n.pop();for(let a=0,l=r.length;a1&&(Xt(n).value==="/"?e==="never"&&n.pop():e==="always"&&n.push({type:U,value:"/"}));const i=n.map(bo);return z(i)}const ut=(t,o)=>{if(!t)return[];const e=o?.get(t);if(e)return e;const s=Ao(t);return o?.set(t,s),s},To=/^\$.{1,}$/,Io=/^(.*?)\{(\$[a-zA-Z_$][a-zA-Z0-9_$]*)\}(.*)$/,ko=/^(.*?)\{-(\$[a-zA-Z_$][a-zA-Z0-9_$]*)\}(.*)$/,Oo=/^\$$/,Fo=/^(.*?)\{\$\}(.*)$/;function Ao(t){t=se(t);const o=[];if(t.slice(0,1)==="/"&&(t=t.substring(1),o.push({type:U,value:"/"})),!t)return o;const e=t.split("/").filter(Boolean);return o.push(...e.map(s=>{const n=s.match(Fo);if(n){const c=n[1],a=n[2];return{type:at,value:"$",prefixSegment:c||void 0,suffixSegment:a||void 0}}const r=s.match(ko);if(r){const c=r[1],a=r[2],l=r[3];return{type:ct,value:a,prefixSegment:c||void 0,suffixSegment:l||void 0}}const i=s.match(Io);if(i){const c=i[1],a=i[2],l=i[3];return{type:ot,value:""+a,prefixSegment:c||void 0,suffixSegment:l||void 0}}if(To.test(s)){const c=s.substring(1);return{type:ot,value:"$"+c,prefixSegment:void 0,suffixSegment:void 0}}return Oo.test(s)?{type:at,value:"$",prefixSegment:void 0,suffixSegment:void 0}:{type:U,value:s}})),t.slice(-1)==="/"&&(t=t.substring(1),o.push({type:U,value:"/"})),o}function Ut({path:t,params:o,decodeCharMap:e,parseCache:s}){const n=ut(t,s);function r(l){const u=o[l],h=typeof u=="string";return l==="*"||l==="_splat"?h?encodeURI(u):u:h?Bo(u,e):u}let i=!1;const c={},a=z(n.map(l=>{if(l.type===U)return l.value;if(l.type===at){c._splat=o._splat,c["*"]=o._splat;const u=l.prefixSegment||"",h=l.suffixSegment||"";if(!o._splat)return i=!0,u||h?`${u}${h}`:void 0;const f=r("_splat");return`${u}${f}${h}`}if(l.type===ot){const u=l.value.substring(1);!i&&!(u in o)&&(i=!0),c[u]=o[u];const h=l.prefixSegment||"",f=l.suffixSegment||"";return`${h}${r(u)??"undefined"}${f}`}if(l.type===ct){const u=l.value.substring(1),h=l.prefixSegment||"",f=l.suffixSegment||"";return!(u in o)||o[u]==null?h||f?`${h}${f}`:void 0:(c[u]=o[u],`${h}${r(u)??""}${f}`)}return l.value}));return{usedParams:c,interpolatedPath:a,isMissingParams:i}}function Bo(t,o){let e=encodeURIComponent(t);if(o)for(const[s,n]of o)e=e.replaceAll(s,n);return e}function Zt(t,o,e){const s=Do(t,o,e);if(!(o.to&&!s))return s??{}}function Do(t,{to:o,fuzzy:e,caseSensitive:s},n){const r=o,i=ut(t.startsWith("/")?t:`/${t}`,n),c=ut(r.startsWith("/")?r:`/${r}`,n),a={};return $o(i,c,a,e,s)?a:void 0}function $o(t,o,e,s,n){let r=0,i=0;for(;rm.value)));h&&p.startsWith(h)&&(p=p.slice(h.length)),f&&p.endsWith(f)&&(p=p.slice(0,p.length-f.length)),u=p}else u=decodeURI(z(l.map(h=>h.value)));return e["*"]=u,e._splat=u,!0}if(a.type===U){if(a.value==="/"&&!c?.value){i++;continue}if(c){if(n){if(a.value!==c.value)return!1}else if(a.value.toLowerCase()!==c.value.toLowerCase())return!1;r++,i++;continue}else return!1}if(a.type===ot){if(!c||c.value==="/")return!1;let l="",u=!1;if(a.prefixSegment||a.suffixSegment){const h=a.prefixSegment||"",f=a.suffixSegment||"",d=c.value;if(h&&!d.startsWith(h)||f&&!d.endsWith(f))return!1;let p=d;h&&p.startsWith(h)&&(p=p.slice(h.length)),f&&p.endsWith(f)&&(p=p.slice(0,p.length-f.length)),l=decodeURIComponent(p),u=!0}else l=decodeURIComponent(c.value),u=!0;u&&(e[a.value.substring(1)]=l,r++),i++;continue}if(a.type===ct){if(!c){i++;continue}if(c.value==="/"){i++;continue}let l="",u=!1;if(a.prefixSegment||a.suffixSegment){const h=a.prefixSegment||"",f=a.suffixSegment||"",d=c.value;if((!h||d.startsWith(h))&&(!f||d.endsWith(f))){let p=d;h&&p.startsWith(h)&&(p=p.slice(h.length)),f&&p.endsWith(f)&&(p=p.slice(0,p.length-f.length)),l=decodeURIComponent(p),u=!0}}else{let h=!0;for(let f=i+1;f=o.length)return e["**"]=z(t.slice(r).map(l=>l.value)),!!s&&o[o.length-1]?.value!=="/";if(i=t.length){for(let l=i;l{if(s.isRoot||!s.path)return;const r=ne(s.fullPath);let i=ut(r),c=0;for(;i.length>c+1&&i[c]?.value==="/";)c++;c>0&&(i=i.slice(c));let a=0,l=!1;const u=i.map((h,f)=>{if(h.value==="/")return jo;if(h.type===U)return No;let d;h.type===ot?d=Uo:h.type===ct?(d=Vo,a++):d=Wo;for(let p=f+1;p{const r=Math.min(s.scores.length,n.scores.length);for(let i=0;in.parsed[i].value?1:-1;return s.index-n.index}).map((s,n)=>(s.child.rank=n,s.child))}function Jo({routeTree:t,initRoute:o}){const e={},s={},n=i=>{i.forEach((c,a)=>{o?.(c,a);const l=e[c.id];if(K(!l,`Duplicate routes found with id: ${String(c.id)}`),e[c.id]=c,!c.isRoot&&c.path){const h=J(c.fullPath);(!s[h]||c.fullPath.endsWith("/"))&&(s[h]=c)}const u=c.children;u?.length&&n(u)})};n([t]);const r=qo(Object.values(e));return{routesById:e,routesByPath:s,flatRoutes:r}}function j(t){return!!t?.isNotFound}function Yo(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}const kt="tsr-scroll-restoration-v1_3",Xo=(t,o)=>{let e;return(...s)=>{e||(e=setTimeout(()=>{t(...s),e=null},o))}};function Zo(){const t=Yo();if(!t)return null;const o=t.getItem(kt);let e=o?JSON.parse(o):{};return{state:e,set:s=>(e=Q(s,e)||e,t.setItem(kt,JSON.stringify(e)))}}const wt=Zo(),Qt=t=>t.state.__TSR_key||t.href;function Qo(t){const o=[];let e;for(;e=t.parentNode;)o.push(`${t.tagName}:nth-child(${Array.prototype.indexOf.call(e.children,t)+1})`),t=e;return`${o.reverse().join(" > ")}`.toLowerCase()}let Ot=!1;function We({storageKey:t,key:o,behavior:e,shouldScrollRestoration:s,scrollToTopSelectors:n,location:r}){let i;try{i=JSON.parse(sessionStorage.getItem(t)||"{}")}catch(l){console.error(l);return}const c=o||window.history.state?.__TSR_key,a=i[c];Ot=!0;t:{if(s&&a&&Object.keys(a).length>0){for(const h in a){const f=a[h];if(h==="window")window.scrollTo({top:f.scrollY,left:f.scrollX,behavior:e});else if(h){const d=document.querySelector(h);d&&(d.scrollLeft=f.scrollX,d.scrollTop=f.scrollY)}}break t}const l=(r??window.location).hash.split("#",2)[1];if(l){const h=window.history.state?.__hashScrollIntoViewOptions??!0;if(h){const f=document.getElementById(l);f&&f.scrollIntoView(h)}break t}const u={top:0,left:0,behavior:e};if(window.scrollTo(u),n)for(const h of n){if(h==="window")continue;const f=typeof h=="function"?h():document.querySelector(h);f&&f.scrollTo(u)}}Ot=!1}function ts(t,o){if(!wt&&!t.isServer||((t.options.scrollRestoration??!1)&&(t.isScrollRestoring=!0),t.isServer||t.isScrollRestorationSetup||!wt))return;t.isScrollRestorationSetup=!0,Ot=!1;const s=t.options.getScrollRestorationKey||Qt;window.history.scrollRestoration="manual";const n=r=>{if(Ot||!t.isScrollRestoring)return;let i="";if(r.target===document||r.target===window)i="window";else{const a=r.target.getAttribute("data-scroll-restoration-id");a?i=`[data-scroll-restoration-id="${a}"]`:i=Qo(r.target)}const c=s(t.state.location);wt.set(a=>{const l=a[c]||={},u=l[i]||={};if(i==="window")u.scrollX=window.scrollX||0,u.scrollY=window.scrollY||0;else if(i){const h=document.querySelector(i);h&&(u.scrollX=h.scrollLeft||0,u.scrollY=h.scrollTop||0)}return a})};typeof document<"u"&&document.addEventListener("scroll",Xo(n,100),!0),t.subscribe("onRendered",r=>{const i=s(r.toLocation);if(!t.resetNextScroll){t.resetNextScroll=!0;return}typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation})||(We({storageKey:kt,key:i,behavior:t.options.scrollRestorationBehavior,shouldScrollRestoration:t.isScrollRestoring,scrollToTopSelectors:t.options.scrollToTopSelectors,location:t.history.location}),t.isScrollRestoring&&wt.set(c=>(c[i]||={},c)))})}function es(t){if(typeof document<"u"&&document.querySelector){const o=t.state.location.state.__hashScrollIntoViewOptions??!0;if(o&&t.state.location.hash!==""){const e=document.getElementById(t.state.location.hash);e&&e.scrollIntoView(o)}}}function os(t,o=String){const e=new URLSearchParams;for(const s in t){const n=t[s];n!==void 0&&e.set(s,o(n))}return e.toString()}function Vt(t){return t?t==="false"?!1:t==="true"?!0:+t*0===0&&+t+""===t?+t:t:""}function ss(t){const o=new URLSearchParams(t),e={};for(const[s,n]of o.entries()){const r=e[s];r==null?e[s]=Vt(n):Array.isArray(r)?r.push(Vt(n)):e[s]=[r,Vt(n)]}return e}const ns=is(JSON.parse),rs=as(JSON.stringify,JSON.parse);function is(t){return o=>{o[0]==="?"&&(o=o.substring(1));const e=ss(o);for(const s in e){const n=e[s];if(typeof n=="string")try{e[s]=t(n)}catch{}}return e}}function as(t,o){const e=typeof o=="function";function s(n){if(typeof n=="object"&&n!==null)try{return t(n)}catch{}else if(e&&typeof n=="string")try{return o(n),t(n)}catch{}return n}return n=>{const r=os(n,s);return r?`?${r}`:""}}const A="__root__";function cs(t){if(t.statusCode=t.statusCode||t.code||307,!t.reloadDocument&&typeof t.href=="string")try{new URL(t.href),t.reloadDocument=!0}catch{}const o=new Headers(t.headers);t.href&&o.get("Location")===null&&o.set("Location",t.href);const e=new Response(null,{status:t.statusCode,headers:o});if(e.options=t,t.throw)throw e;return e}function N(t){return t instanceof Response&&!!t.options}function us(t){const o=new Map;let e,s;const n=r=>{r.next&&(r.prev?(r.prev.next=r.next,r.next.prev=r.prev,r.next=void 0,s&&(s.next=r,r.prev=s)):(r.next.prev=void 0,e=r.next,r.next=void 0,s&&(r.prev=s,s.next=r)),s=r)};return{get(r){const i=o.get(r);if(i)return n(i),i.value},set(r,i){if(o.size>=t&&e){const a=e;o.delete(a.key),a.next&&(e=a.next,a.next.prev=void 0),a===s&&(s=void 0)}const c=o.get(r);if(c)c.value=i,n(c);else{const a={key:r,value:i,prev:s};s&&(s.next=a),s=a,e||(e=a),o.set(r,a)}}}}const Mt=t=>{if(!t.rendered)return t.rendered=!0,t.onReady?.()},At=(t,o)=>!!(t.preload&&!t.router.state.matches.some(e=>e.id===o)),ze=(t,o)=>{const e=t.router.routesById[o.routeId??""]??t.router.routeTree;!e.options.notFoundComponent&&t.router.options?.defaultNotFoundComponent&&(e.options.notFoundComponent=t.router.options.defaultNotFoundComponent),K(e.options.notFoundComponent);const s=t.matches.find(n=>n.routeId===e.id);K(s,"Could not find match for route: "+e.id),t.updateMatch(s.id,n=>({...n,status:"notFound",error:o,isFetching:!1})),o.routerCode==="BEFORE_LOAD"&&e.parentRoute&&(o.routeId=e.parentRoute.id,ze(t,o))},H=(t,o,e)=>{if(!(!N(e)&&!j(e))){if(N(e)&&e.redirectHandled&&!e.options.reloadDocument)throw e;if(o){o._nonReactive.beforeLoadPromise?.resolve(),o._nonReactive.loaderPromise?.resolve(),o._nonReactive.beforeLoadPromise=void 0,o._nonReactive.loaderPromise=void 0;const s=N(e)?"redirected":"notFound";o._nonReactive.error=e,t.updateMatch(o.id,n=>({...n,status:s,isFetching:!1,error:e})),j(e)&&!e.routeId&&(e.routeId=o.routeId),o._nonReactive.loadPromise?.resolve()}throw N(e)?(t.rendered=!0,e.options._fromLocation=t.location,e.redirectHandled=!0,e=t.router.resolveRedirect(e),e):(ze(t,e),e)}},Ke=(t,o)=>{const e=t.router.getMatch(o);return!!(!t.router.isServer&&e._nonReactive.dehydrated||t.router.isServer&&e.ssr===!1)},ht=(t,o,e,s)=>{const{id:n,routeId:r}=t.matches[o],i=t.router.looseRoutesById[r];if(e instanceof Promise)throw e;e.routerCode=s,t.firstBadMatchIndex??=o,H(t,t.router.getMatch(n),e);try{i.options.onError?.(e)}catch(c){e=c,H(t,t.router.getMatch(n),e)}t.updateMatch(n,c=>(c._nonReactive.beforeLoadPromise?.resolve(),c._nonReactive.beforeLoadPromise=void 0,c._nonReactive.loadPromise?.resolve(),{...c,error:e,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}))},ls=(t,o,e,s)=>{const n=t.router.getMatch(o),r=t.matches[e-1]?.id,i=r?t.router.getMatch(r):void 0;if(t.router.isShell()){n.ssr=s.id===A;return}if(i?.ssr===!1){n.ssr=!1;return}const c=d=>d===!0&&i?.ssr==="data-only"?"data-only":d,a=t.router.options.defaultSsr??!0;if(s.options.ssr===void 0){n.ssr=c(a);return}if(typeof s.options.ssr!="function"){n.ssr=c(s.options.ssr);return}const{search:l,params:u}=n,h={search:xt(l,n.searchError),params:xt(u,n.paramsError),location:t.location,matches:t.matches.map(d=>({index:d.index,pathname:d.pathname,fullPath:d.fullPath,staticData:d.staticData,id:d.id,routeId:d.routeId,search:xt(d.search,d.searchError),params:xt(d.params,d.paramsError),ssr:d.ssr}))},f=s.options.ssr(h);if(q(f))return f.then(d=>{n.ssr=c(d??a)});n.ssr=c(f??a)},He=(t,o,e,s)=>{if(s._nonReactive.pendingTimeout!==void 0)return;const n=e.options.pendingMs??t.router.options.defaultPendingMs;if(!!(t.onReady&&!t.router.isServer&&!At(t,o)&&(e.options.loader||e.options.beforeLoad||Je(e))&&typeof n=="number"&&n!==1/0&&(e.options.pendingComponent??t.router.options?.defaultPendingComponent))){const i=setTimeout(()=>{Mt(t)},n);s._nonReactive.pendingTimeout=i}},hs=(t,o,e)=>{const s=t.router.getMatch(o);if(!s._nonReactive.beforeLoadPromise&&!s._nonReactive.loaderPromise)return;He(t,o,e,s);const n=()=>{const r=t.router.getMatch(o);r.preload&&(r.status==="redirected"||r.status==="notFound")&&H(t,r,r.error)};return s._nonReactive.beforeLoadPromise?s._nonReactive.beforeLoadPromise.then(n):n()},fs=(t,o,e,s)=>{const n=t.router.getMatch(o),r=n._nonReactive.loadPromise;n._nonReactive.loadPromise=it(()=>{r?.resolve()});const{paramsError:i,searchError:c}=n;i&&ht(t,e,i,"PARSE_PARAMS"),c&&ht(t,e,c,"VALIDATE_SEARCH"),He(t,o,s,n);const a=new AbortController,l=t.matches[e-1]?.id,f={...(l?t.router.getMatch(l):void 0)?.context??t.router.options.context??void 0,...n.__routeContext};let d=!1;const p=()=>{d||(d=!0,t.updateMatch(o,S=>({...S,isFetching:"beforeLoad",fetchCount:S.fetchCount+1,abortController:a,context:f})))},m=()=>{n._nonReactive.beforeLoadPromise?.resolve(),n._nonReactive.beforeLoadPromise=void 0,t.updateMatch(o,S=>({...S,isFetching:!1}))};if(!s.options.beforeLoad){gt(()=>{p(),m()});return}n._nonReactive.beforeLoadPromise=it();const{search:y,params:_,cause:x}=n,P=At(t,o),L={search:y,abortController:a,params:_,preload:P,context:f,location:t.location,navigate:S=>t.router.navigate({...S,_fromLocation:t.location}),buildLocation:t.router.buildLocation,cause:P?"preload":x,matches:t.matches,...t.router.options.additionalContext},E=S=>{if(S===void 0){gt(()=>{p(),m()});return}(N(S)||j(S))&&(p(),ht(t,e,S,"BEFORE_LOAD")),gt(()=>{p(),t.updateMatch(o,v=>({...v,__beforeLoadContext:S,context:{...v.context,...S}})),m()})};let w;try{if(w=s.options.beforeLoad(L),q(w))return p(),w.catch(S=>{ht(t,e,S,"BEFORE_LOAD")}).then(E)}catch(S){p(),ht(t,e,S,"BEFORE_LOAD")}E(w)},ds=(t,o)=>{const{id:e,routeId:s}=t.matches[o],n=t.router.looseRoutesById[s],r=()=>{if(t.router.isServer){const a=ls(t,e,o,n);if(q(a))return a.then(c)}return c()},i=()=>fs(t,e,o,n),c=()=>{if(Ke(t,e))return;const a=hs(t,e,n);return q(a)?a.then(i):i()};return r()},yt=(t,o,e)=>{const s=t.router.getMatch(o);if(!s||!e.options.head&&!e.options.scripts&&!e.options.headers)return;const n={matches:t.matches,match:s,params:s.params,loaderData:s.loaderData};return Promise.all([e.options.head?.(n),e.options.scripts?.(n),e.options.headers?.(n)]).then(([r,i,c])=>{const a=r?.meta,l=r?.links,u=r?.scripts,h=r?.styles;return{meta:a,links:l,headScripts:u,headers:c,scripts:i,styles:h}})},Ge=(t,o,e,s)=>{const n=t.matchPromises[e-1],{params:r,loaderDeps:i,abortController:c,cause:a}=t.router.getMatch(o);let l=t.router.options.context??{};for(let h=0;h<=e;h++){const f=t.matches[h];if(!f)continue;const d=t.router.getMatch(f.id);d&&(l={...l,...d.__routeContext??{},...d.__beforeLoadContext??{}})}const u=At(t,o);return{params:r,deps:i,preload:!!u,parentMatchPromise:n,abortController:c,context:l,location:t.location,navigate:h=>t.router.navigate({...h,_fromLocation:t.location}),cause:u?"preload":a,route:s,...t.router.options.additionalContext}},be=async(t,o,e,s)=>{try{const n=t.router.getMatch(o);try{(!t.router.isServer||n.ssr===!0)&&qe(s);const r=s.options.loader?.(Ge(t,o,e,s)),i=s.options.loader&&q(r);if(!!(i||s._lazyPromise||s._componentsPromise||s.options.head||s.options.scripts||s.options.headers||n._nonReactive.minPendingPromise)&&t.updateMatch(o,h=>({...h,isFetching:"loader"})),s.options.loader){const h=i?await r:r;H(t,t.router.getMatch(o),h),h!==void 0&&t.updateMatch(o,f=>({...f,loaderData:h}))}s._lazyPromise&&await s._lazyPromise;const a=yt(t,o,s),l=a?await a:void 0,u=n._nonReactive.minPendingPromise;u&&await u,s._componentsPromise&&await s._componentsPromise,t.updateMatch(o,h=>({...h,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),...l}))}catch(r){let i=r;const c=n._nonReactive.minPendingPromise;c&&await c,j(r)&&await s.options.notFoundComponent?.preload?.(),H(t,t.router.getMatch(o),r);try{s.options.onError?.(r)}catch(u){i=u,H(t,t.router.getMatch(o),u)}const a=yt(t,o,s),l=a?await a:void 0;t.updateMatch(o,u=>({...u,error:i,status:"error",isFetching:!1,...l}))}}catch(n){const r=t.router.getMatch(o);if(r){const i=yt(t,o,s);if(i){const c=await i;t.updateMatch(o,a=>({...a,...c}))}r._nonReactive.loaderPromise=void 0}H(t,r,n)}},ps=async(t,o)=>{const{id:e,routeId:s}=t.matches[o];let n=!1,r=!1;const i=t.router.looseRoutesById[s];if(Ke(t,e)){if(t.router.isServer){const l=yt(t,e,i);if(l){const u=await l;t.updateMatch(e,h=>({...h,...u}))}return t.router.getMatch(e)}}else{const l=t.router.getMatch(e);if(l._nonReactive.loaderPromise){if(l.status==="success"&&!t.sync&&!l.preload)return l;await l._nonReactive.loaderPromise;const u=t.router.getMatch(e),h=u._nonReactive.error||u.error;h&&H(t,u,h)}else{const u=Date.now()-l.updatedAt,h=At(t,e),f=h?i.options.preloadStaleTime??t.router.options.defaultPreloadStaleTime??3e4:i.options.staleTime??t.router.options.defaultStaleTime??0,d=i.options.shouldReload,p=typeof d=="function"?d(Ge(t,e,o,i)):d,m=!!h&&!t.router.state.matches.some(P=>P.id===e),y=t.router.getMatch(e);y._nonReactive.loaderPromise=it(),m!==y.preload&&t.updateMatch(e,P=>({...P,preload:m}));const{status:_,invalid:x}=y;if(n=_==="success"&&(x||(p??u>f)),!(h&&i.options.preload===!1))if(n&&!t.sync)r=!0,(async()=>{try{await be(t,e,o,i);const P=t.router.getMatch(e);P._nonReactive.loaderPromise?.resolve(),P._nonReactive.loadPromise?.resolve(),P._nonReactive.loaderPromise=void 0}catch(P){N(P)&&await t.router.navigate(P.options)}})();else if(_!=="success"||n&&t.sync)await be(t,e,o,i);else{const P=yt(t,e,i);if(P){const L=await P;t.updateMatch(e,E=>({...E,...L}))}}}}const c=t.router.getMatch(e);r||(c._nonReactive.loaderPromise?.resolve(),c._nonReactive.loadPromise?.resolve()),clearTimeout(c._nonReactive.pendingTimeout),c._nonReactive.pendingTimeout=void 0,r||(c._nonReactive.loaderPromise=void 0),c._nonReactive.dehydrated=void 0;const a=r?c.isFetching:!1;return a!==c.isFetching||c.invalid!==!1?(t.updateMatch(e,l=>({...l,isFetching:a,invalid:!1})),t.router.getMatch(e)):c};async function Ee(t){const o=Object.assign(t,{matchPromises:[]});!o.router.isServer&&o.router.state.matches.some(e=>e._forcePending)&&Mt(o);try{for(let n=0;n{const{id:e,...s}=o.options;Object.assign(t.options,s),t._lazyLoaded=!0,t._lazyPromise=void 0}):t._lazyLoaded=!0),!t._componentsLoaded&&t._componentsPromise===void 0){const o=()=>{const e=[];for(const s of Ye){const n=t.options[s]?.preload;n&&e.push(n())}if(e.length)return Promise.all(e).then(()=>{t._componentsLoaded=!0,t._componentsPromise=void 0});t._componentsLoaded=!0,t._componentsPromise=void 0};t._componentsPromise=t._lazyPromise?t._lazyPromise.then(o):o()}return t._componentsPromise}function xt(t,o){return o?{status:"error",error:o}:{status:"success",value:t}}function Je(t){for(const o of Ye)if(t.options[o]?.preload)return!0;return!1}const Ye=["component","errorComponent","pendingComponent","notFoundComponent"];function ms(t){return{input:({url:o})=>{for(const e of t)o=Xe(e,o);return o},output:({url:o})=>{for(let e=t.length-1;e>=0;e--)o=Ze(t[e],o);return o}}}function gs(t){const o=Ct(t.basepath),e=`/${o}`,s=`${e}/`,n=t.caseSensitive?e:e.toLowerCase(),r=t.caseSensitive?s:s.toLowerCase();return{input:({url:i})=>{const c=t.caseSensitive?i.pathname:i.pathname.toLowerCase();return c===n?i.pathname="/":c.startsWith(r)&&(i.pathname=i.pathname.slice(e.length)),i},output:({url:i})=>(i.pathname=z(["/",o,i.pathname]),i)}}function Xe(t,o){const e=t?.input?.({url:o});if(e){if(typeof e=="string")return new URL(e);if(e instanceof URL)return e}return o}function Ze(t,o){const e=t?.output?.({url:o});if(e){if(typeof e=="string")return new URL(e);if(e instanceof URL)return e}return o}function et(t){const o=t.resolvedLocation,e=t.location,s=o?.pathname!==e.pathname,n=o?.href!==e.href,r=o?.hash!==e.hash;return{fromLocation:o,toLocation:e,pathChanged:s,hrefChanged:n,hashChanged:r}}class ys{constructor(o){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=e=>e(),this.update=e=>{e.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const s=this.options,n=this.basepath??s?.basepath??"/",r=this.basepath===void 0,i=s?.rewrite;this.options={...s,...e},this.isServer=this.options.isServer??typeof document>"u",this.pathParamsDecodeCharMap=this.options.pathParamsAllowedCharacters?new Map(this.options.pathParamsAllowedCharacters.map(f=>[encodeURIComponent(f),f])):void 0,(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.isServer||(this.history=Po())),this.origin=this.options.origin,this.origin||(!this.isServer&&window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),!this.__store&&this.latestLocation&&(this.__store=new _o(Ss(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(f=>!["redirected"].includes(f.status))}}}),ts(this));let c=!1;const a=this.options.basepath??"/",l=this.options.rewrite;if(r||n!==a||i!==l){this.basepath=a;const f=[];Ct(a)!==""&&f.push(gs({basepath:a})),l&&f.push(l),this.rewrite=f.length===0?void 0:f.length===1?f[0]:ms(f),this.history&&this.updateLatestLocation(),c=!0}c&&this.__store&&(this.__store.state={...this.state,location:this.latestLocation}),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const{routesById:e,routesByPath:s,flatRoutes:n}=Jo({routeTree:this.routeTree,initRoute:(i,c)=>{i.init({originalIndex:c})}});this.routesById=e,this.routesByPath=s,this.flatRoutes=n;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)},this.subscribe=(e,s)=>{const n={eventType:e,fn:s};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(s=>{s.eventType===e.type&&s.fn(e)})},this.parseLocation=(e,s)=>{const n=({href:a,state:l})=>{const u=new URL(a,this.origin),h=Xe(this.rewrite,u),f=this.options.parseSearch(h.search),d=this.options.stringifySearch(f);h.search=d;const p=h.href.replace(h.origin,""),{pathname:m,hash:y}=h;return{href:p,publicHref:a,url:h.href,pathname:xe(m),searchStr:d,search:B(s?.search,f),hash:y.split("#").reverse()[0]??"",state:B(s?.state,l)}},r=n(e),{__tempLocation:i,__tempKey:c}=r.state;if(i&&(!c||c===this.tempLocationKey)){const a=n(i);return a.state.key=r.state.key,a.state.__TSR_key=r.state.__TSR_key,delete a.state.__tempLocation,{...a,maskedLocation:r}}return r},this.resolvePathWithBase=(e,s)=>Eo({base:e,to:se(s),trailingSlash:this.options.trailingSlash,parseCache:this.parsePathnameCache}),this.matchRoutes=(e,s,n)=>typeof e=="string"?this.matchRoutesInternal({pathname:e,search:s},n):this.matchRoutesInternal(e,s),this.parsePathnameCache=us(1e3),this.getMatchedRoutes=(e,s)=>_s({pathname:e,routePathname:s,caseSensitive:this.options.caseSensitive,routesByPath:this.routesByPath,routesById:this.routesById,flatRoutes:this.flatRoutes,parseCache:this.parsePathnameCache}),this.cancelMatch=e=>{const s=this.getMatch(e);s&&(s.abortController.abort(),clearTimeout(s._nonReactive.pendingTimeout),s._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const e=this.state.matches.filter(r=>r.status==="pending"),s=this.state.matches.filter(r=>r.isFetching==="loader");new Set([...this.state.pendingMatches??[],...e,...s]).forEach(r=>{this.cancelMatch(r.id)})},this.buildLocation=e=>{const s=(r={})=>{const i=r._fromLocation||this.pendingBuiltLocation||this.latestLocation,c=this.matchRoutes(i,{_buildLocation:!0}),a=Xt(c);r.from;const l=r.unsafeRelative==="path"?i.pathname:r.from??a.fullPath,u=this.resolvePathWithBase(l,"."),h=a.search,f={...a.params},d=r.to?this.resolvePathWithBase(u,`${r.to}`):this.resolvePathWithBase(u,"."),p=r.params===!1||r.params===null?{}:(r.params??!0)===!0?f:Object.assign(f,Q(r.params,f)),m=Ut({path:d,params:p,parseCache:this.parsePathnameCache}).interpolatedPath,y=this.matchRoutes(m,void 0,{_buildLocation:!0}).map(M=>this.looseRoutesById[M.routeId]);if(Object.keys(p).length>0)for(const M of y){const T=M.options.params?.stringify??M.options.stringifyParams;T&&Object.assign(p,T(p))}const _=e.leaveParams?d:xe(Ut({path:d,params:p,decodeCharMap:this.pathParamsDecodeCharMap,parseCache:this.parsePathnameCache}).interpolatedPath);let x=h;if(e._includeValidateSearch&&this.options.search?.strict){const M={};y.forEach(T=>{if(T.options.validateSearch)try{Object.assign(M,te(T.options.validateSearch,{...M,...x}))}catch{}}),x=M}x=Rs({search:x,dest:r,destRoutes:y,_includeValidateSearch:e._includeValidateSearch}),x=B(h,x);const P=this.options.stringifySearch(x),L=r.hash===!0?i.hash:r.hash?Q(r.hash,i.hash):void 0,E=L?`#${L}`:"";let w=r.state===!0?i.state:r.state?Q(r.state,i.state):{};w=B(i.state,w);const S=`${_}${P}${E}`,v=new URL(S,this.origin),C=Ze(this.rewrite,v);return{publicHref:C.pathname+C.search+C.hash,href:S,url:C.href,pathname:_,search:x,searchStr:P,state:w,hash:L??"",unmaskOnReload:r.unmaskOnReload}},n=(r={},i)=>{const c=s(r);let a=i?s(i):void 0;if(!a){let l={};const u=this.options.routeMasks?.find(h=>{const f=Zt(c.pathname,{to:h.from,caseSensitive:!1,fuzzy:!1},this.parsePathnameCache);return f?(l=f,!0):!1});if(u){const{from:h,...f}=u;i={from:e.from,...f,params:l},a=s(i)}}return a&&(c.maskedLocation=a),c};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=({viewTransition:e,ignoreBlocker:s,...n})=>{const r=()=>{const a=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];a.forEach(u=>{n.state[u]=this.latestLocation.state[u]});const l=tt(n.state,this.latestLocation.state);return a.forEach(u=>{delete n.state[u]}),l},i=J(this.latestLocation.href)===J(n.href),c=this.commitLocationPromise;if(this.commitLocationPromise=it(()=>{c?.resolve()}),i&&r())this.load();else{let{maskedLocation:a,hashScrollIntoView:l,...u}=n;a&&(u={...a,state:{...a.state,__tempKey:void 0,__tempLocation:{...u,search:u.searchStr,state:{...u.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(u.unmaskOnReload??this.options.unmaskOnReload??!1)&&(u.state.__tempKey=this.tempLocationKey)),u.state.__hashScrollIntoViewOptions=l??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,this.history[n.replace?"replace":"push"](u.publicHref,u.state,{ignoreBlocker:s})}return this.resetNextScroll=n.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:s,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:c,...a}={})=>{if(c){const h=this.history.location.state.__TSR_index,f=Et(c,{__TSR_index:e?h:h+1});a.to=f.pathname,a.search=this.options.parseSearch(f.search),a.hash=f.hash.slice(1)}const l=this.buildLocation({...a,_includeValidateSearch:!0});this.pendingBuiltLocation=l;const u=this.commitLocation({...l,viewTransition:r,replace:e,resetScroll:s,hashScrollIntoView:n,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===l&&(this.pendingBuiltLocation=void 0)}),u},this.navigate=({to:e,reloadDocument:s,href:n,...r})=>{if(!s&&n)try{new URL(`${n}`),s=!0}catch{}return s?(n||(n=this.buildLocation({to:e,...r}).url),r.replace?window.location.replace(n):window.location.href=n,Promise.resolve()):this.buildAndCommitLocation({...r,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{if(this.cancelMatches(),this.updateLatestLocation(),this.isServer){const s=this.buildLocation({to:this.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0}),n=r=>{try{return encodeURI(decodeURI(r))}catch{return r}};if(Ct(n(this.latestLocation.href))!==Ct(n(s.href))){let r=s.url;throw this.origin&&r.startsWith(this.origin)&&(r=r.replace(this.origin,"")||"/"),cs({href:r})}}const e=this.matchRoutes(this.latestLocation);this.__store.setState(s=>({...s,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:e,cachedMatches:s.cachedMatches.filter(n=>!e.some(r=>r.id===n.id))}))},this.load=async e=>{let s,n,r;for(r=new Promise(c=>{this.startTransition(async()=>{try{this.beforeLoad();const a=this.latestLocation,l=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...et({resolvedLocation:l,location:a})}),this.emit({type:"onBeforeLoad",...et({resolvedLocation:l,location:a})}),await Ee({router:this,sync:e?.sync,matches:this.state.pendingMatches,location:a,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let u=[],h=[],f=[];gt(()=>{this.__store.setState(d=>{const p=d.matches,m=d.pendingMatches||d.matches;return u=p.filter(y=>!m.some(_=>_.id===y.id)),h=m.filter(y=>!p.some(_=>_.id===y.id)),f=m.filter(y=>p.some(_=>_.id===y.id)),{...d,isLoading:!1,loadedAt:Date.now(),matches:m,pendingMatches:void 0,cachedMatches:[...d.cachedMatches,...u.filter(y=>y.status!=="error")]}}),this.clearExpiredCache()}),[[u,"onLeave"],[h,"onEnter"],[f,"onStay"]].forEach(([d,p])=>{d.forEach(m=>{this.looseRoutesById[m.routeId].options[p]?.(m)})})})})}})}catch(a){N(a)?(s=a,this.isServer||this.navigate({...s.options,replace:!0,ignoreBlocker:!0})):j(a)&&(n=a),this.__store.setState(l=>({...l,statusCode:s?s.status:n?404:l.matches.some(u=>u.status==="error")?500:200,redirect:s}))}this.latestLoadPromise===r&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),c()})}),this.latestLoadPromise=r,await r;this.latestLoadPromise&&r!==this.latestLoadPromise;)await this.latestLoadPromise;let i;this.hasNotFoundMatch()?i=404:this.__store.state.matches.some(c=>c.status==="error")&&(i=500),i!==void 0&&this.__store.setState(c=>({...c,statusCode:i}))},this.startViewTransition=e=>{const s=this.shouldViewTransition??this.options.defaultViewTransition;if(delete this.shouldViewTransition,s&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let n;if(typeof s=="object"&&this.isViewTransitionTypesSupported){const r=this.latestLocation,i=this.state.resolvedLocation,c=typeof s.types=="function"?s.types(et({resolvedLocation:i,location:r})):s.types;if(c===!1){e();return}n={update:e,types:c}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,s)=>{this.startTransition(()=>{const n=this.state.pendingMatches?.some(r=>r.id===e)?"pendingMatches":this.state.matches.some(r=>r.id===e)?"matches":this.state.cachedMatches.some(r=>r.id===e)?"cachedMatches":"";n&&this.__store.setState(r=>({...r,[n]:r[n]?.map(i=>i.id===e?s(i):i)}))})},this.getMatch=e=>{const s=n=>n.id===e;return this.state.cachedMatches.find(s)??this.state.pendingMatches?.find(s)??this.state.matches.find(s)},this.invalidate=e=>{const s=n=>e?.filter?.(n)??!0?{...n,invalid:!0,...e?.forcePending||n.status==="error"?{status:"pending",error:void 0}:void 0}:n;return this.__store.setState(n=>({...n,matches:n.matches.map(s),cachedMatches:n.cachedMatches.map(s),pendingMatches:n.pendingMatches?.map(s)})),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{if(!e.options.href){const s=this.buildLocation(e.options);let n=s.url;this.origin&&n.startsWith(this.origin)&&(n=n.replace(this.origin,"")||"/"),e.options.href=s.href,e.headers.set("Location",n)}return e.headers.get("Location")||e.headers.set("Location",e.options.href),e},this.clearCache=e=>{const s=e?.filter;s!==void 0?this.__store.setState(n=>({...n,cachedMatches:n.cachedMatches.filter(r=>!s(r))})):this.__store.setState(n=>({...n,cachedMatches:[]}))},this.clearExpiredCache=()=>{const e=s=>{const n=this.looseRoutesById[s.routeId];if(!n.options.loader)return!0;const r=(s.preload?n.options.preloadGcTime??this.options.defaultPreloadGcTime:n.options.gcTime??this.options.defaultGcTime)??300*1e3;return s.status==="error"?!0:Date.now()-s.updatedAt>=r};this.clearCache({filter:e})},this.loadRouteChunk=qe,this.preloadRoute=async e=>{const s=this.buildLocation(e);let n=this.matchRoutes(s,{throwOnError:!0,preload:!0,dest:e});const r=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(c=>c.id)),i=new Set([...r,...this.state.cachedMatches.map(c=>c.id)]);gt(()=>{n.forEach(c=>{i.has(c.id)||this.__store.setState(a=>({...a,cachedMatches:[...a.cachedMatches,c]}))})});try{return n=await Ee({router:this,matches:n,location:s,preload:!0,updateMatch:(c,a)=>{r.has(c)?n=n.map(l=>l.id===c?a(l):l):this.updateMatch(c,a)}}),n}catch(c){if(N(c))return c.options.reloadDocument?void 0:await this.preloadRoute({...c.options,_fromLocation:s});j(c)||console.error(c);return}},this.matchRoute=(e,s)=>{const n={...e,to:e.to?this.resolvePathWithBase(e.from||"",e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(s?.pending&&this.state.status!=="pending")return!1;const c=(s?.pending===void 0?!this.state.isLoading:s.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,a=Zt(c.pathname,{...s,to:r.pathname},this.parsePathnameCache);return!a||e.params&&!tt(a,e.params,{partial:!0})?!1:a&&(s?.includeSearch??!0)?tt(c.search,r.search,{partial:!0})?a:!1:a},this.hasNotFoundMatch=()=>this.__store.state.matches.some(e=>e.status==="notFound"||e.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...o,caseSensitive:o.caseSensitive??!1,notFoundMode:o.notFoundMode??"fuzzy",stringifySearch:o.stringifySearch??rs,parseSearch:o.parseSearch??ns}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}get looseRoutesById(){return this.routesById}matchRoutesInternal(o,e){const{foundRoute:s,matchedRoutes:n,routeParams:r}=this.getMatchedRoutes(o.pathname,e?.dest?.to);let i=!1;(s?s.path!=="/"&&r["**"]:J(o.pathname))&&(this.options.notFoundRoute?n.push(this.options.notFoundRoute):i=!0);const c=(()=>{if(i){if(this.options.notFoundMode!=="root")for(let u=n.length-1;u>=0;u--){const h=n[u];if(h.children)return h.id}return A}})(),a=[],l=u=>u?.id?u.context??this.options.context??void 0:this.options.context??void 0;return n.forEach((u,h)=>{const f=a[h-1],[d,p,m]=(()=>{const I=f?.search??o.search,Y=f?._strictSearch??void 0;try{const D=te(u.options.validateSearch,{...I})??void 0;return[{...I,...D},{...Y,...D},void 0]}catch(D){let X=D;if(D instanceof Ft||(X=new Ft(D.message,{cause:D})),e?.throwOnError)throw X;return[I,{},X]}})(),y=u.options.loaderDeps?.({search:d})??"",_=y?JSON.stringify(y):"",{interpolatedPath:x,usedParams:P}=Ut({path:u.fullPath,params:r,decodeCharMap:this.pathParamsDecodeCharMap}),L=u.id+x+_,E=this.getMatch(L),w=this.state.matches.find(I=>I.routeId===u.id),S=E?._strictParams??P;let v;if(!E){const I=u.options.params?.parse??u.options.parseParams;if(I)try{Object.assign(S,I(S))}catch(Y){if(v=new vs(Y.message,{cause:Y}),e?.throwOnError)throw v}}Object.assign(r,S);const C=w?"stay":"enter";let M;if(E)M={...E,cause:C,params:w?B(w.params,r):r,_strictParams:S,search:B(w?w.search:E.search,d),_strictSearch:p};else{const I=u.options.loader||u.options.beforeLoad||u.lazyFn||Je(u)?"pending":"success";M={id:L,index:h,routeId:u.id,params:w?B(w.params,r):r,_strictParams:S,pathname:x,updatedAt:Date.now(),search:w?B(w.search,d):d,_strictSearch:p,searchError:void 0,status:I,isFetching:!1,error:void 0,paramsError:v,__routeContext:void 0,_nonReactive:{loadPromise:it()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:C,loaderDeps:w?B(w.loaderDeps,y):y,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:u.options.staticData||{},fullPath:u.fullPath}}e?.preload||(M.globalNotFound=c===u.id),M.searchError=m;const T=l(f);M.context={...T,...M.__routeContext,...M.__beforeLoadContext},a.push(M)}),a.forEach((u,h)=>{const f=this.looseRoutesById[u.routeId];if(!this.getMatch(u.id)&&e?._buildLocation!==!0){const p=a[h-1],m=l(p);if(f.options.context){const y={deps:u.loaderDeps,params:u.params,context:m??{},location:o,navigate:_=>this.navigate({..._,_fromLocation:o}),buildLocation:this.buildLocation,cause:u.cause,abortController:u.abortController,preload:!!u.preload,matches:a};u.__routeContext=f.options.context(y)??void 0}u.context={...m,...u.__routeContext,...u.__beforeLoadContext}}}),a}}class Ft extends Error{}class vs extends Error{}function Ss(t){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:t,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function te(t,o){if(t==null)return{};if("~standard"in t){const e=t["~standard"].validate(o);if(e instanceof Promise)throw new Ft("Async validation not supported");if(e.issues)throw new Ft(JSON.stringify(e.issues,void 0,2),{cause:e});return e.value}return"parse"in t?t.parse(o):typeof t=="function"?t(o):{}}function _s({pathname:t,routePathname:o,caseSensitive:e,routesByPath:s,routesById:n,flatRoutes:r,parseCache:i}){let c={};const a=J(t),l=d=>Zt(a,{to:d.fullPath,caseSensitive:d.options?.caseSensitive??e,fuzzy:!0},i);let u=o!==void 0?s[o]:void 0;if(u)c=l(u);else{let d;for(const p of r){const m=l(p);if(m)if(p.path!=="/"&&m["**"])d||(d={foundRoute:p,routeParams:m});else{u=p,c=m;break}}!u&&d&&(u=d.foundRoute,c=d.routeParams)}let h=u||n[A];const f=[h];for(;h.parentRoute;)h=h.parentRoute,f.push(h);return f.reverse(),{matchedRoutes:f,routeParams:c,foundRoute:u}}function Rs({search:t,dest:o,destRoutes:e,_includeValidateSearch:s}){const n=e.reduce((c,a)=>{const l=[];if("search"in a.options)a.options.search?.middlewares&&l.push(...a.options.search.middlewares);else if(a.options.preSearchFilters||a.options.postSearchFilters){const u=({search:h,next:f})=>{let d=h;"preSearchFilters"in a.options&&a.options.preSearchFilters&&(d=a.options.preSearchFilters.reduce((m,y)=>y(m),h));const p=f(d);return"postSearchFilters"in a.options&&a.options.postSearchFilters?a.options.postSearchFilters.reduce((m,y)=>y(m),p):p};l.push(u)}if(s&&a.options.validateSearch){const u=({search:h,next:f})=>{const d=f(h);try{return{...d,...te(a.options.validateSearch,d)??void 0}}catch{return d}};l.push(u)}return c.concat(l)},[])??[],r=({search:c})=>o.search?o.search===!0?c:Q(o.search,c):{};n.push(r);const i=(c,a)=>{if(c>=n.length)return a;const l=n[c];return l({search:a,next:h=>i(c+1,h)})};return i(0,t)}const Ps="Error preloading route! ☝️";class Qe{constructor(o){if(this.init=e=>{this.originalIndex=e.originalIndex;const s=this.options,n=!s?.path&&!s?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=A:this.parentRoute||K(!1);let r=n?A:s?.path;r&&r!=="/"&&(r=ne(r));const i=s?.id||r;let c=n?A:z([this.parentRoute.id===A?"":this.parentRoute.id,i]);r===A&&(r="/"),c!==A&&(c=z(["/",c]));const a=c===A?"/":z([this.parentRoute.fullPath,r]);this._path=r,this._id=c,this._fullPath=a,this._to=a},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e=="object"&&e!==null&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.options=o||{},this.isRoot=!o?.getParentRoute,o?.id&&o?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class ws extends Qe{constructor(o){super(o)}}function re(t){const o=t.errorComponent??Bt;return g.jsx(xs,{getResetKey:t.getResetKey,onCatch:t.onCatch,children:({error:e,reset:s})=>e?R.createElement(o,{error:e,reset:s}):t.children})}class xs extends R.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(o){return{resetKey:o.getResetKey()}}static getDerivedStateFromError(o){return{error:o}}reset(){this.setState({error:null})}componentDidUpdate(o,e){e.error&&e.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(o,e){this.props.onCatch&&this.props.onCatch(o,e)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function Bt({error:t}){const[o,e]=R.useState(!1);return g.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[g.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),g.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>e(s=>!s),children:o?"Hide Error":"Show Error"})]}),g.jsx("div",{style:{height:".25rem"}}),o?g.jsx("div",{children:g.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:t.message?g.jsx("code",{children:t.message}):null})}):null]})}function Ls({children:t,fallback:o=null}){return Cs()?g.jsx(rt.Fragment,{children:t}):g.jsx(rt.Fragment,{children:o})}function Cs(){return rt.useSyncExternalStore(Ms,()=>!0,()=>!1)}function Ms(){return()=>{}}var Wt={exports:{}},zt={},Kt={exports:{}},Ht={};var Te;function bs(){if(Te)return Ht;Te=1;var t=ee();function o(h,f){return h===f&&(h!==0||1/h===1/f)||h!==h&&f!==f}var e=typeof Object.is=="function"?Object.is:o,s=t.useState,n=t.useEffect,r=t.useLayoutEffect,i=t.useDebugValue;function c(h,f){var d=f(),p=s({inst:{value:d,getSnapshot:f}}),m=p[0].inst,y=p[1];return r(function(){m.value=d,m.getSnapshot=f,a(m)&&y({inst:m})},[h,d,f]),n(function(){return a(m)&&y({inst:m}),h(function(){a(m)&&y({inst:m})})},[h]),i(d),d}function a(h){var f=h.getSnapshot;h=h.value;try{var d=f();return!e(h,d)}catch{return!0}}function l(h,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:c;return Ht.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,Ht}var Ie;function Es(){return Ie||(Ie=1,Kt.exports=bs()),Kt.exports}var ke;function Ts(){if(ke)return zt;ke=1;var t=ee(),o=Es();function e(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var s=typeof Object.is=="function"?Object.is:e,n=o.useSyncExternalStore,r=t.useRef,i=t.useEffect,c=t.useMemo,a=t.useDebugValue;return zt.useSyncExternalStoreWithSelector=function(l,u,h,f,d){var p=r(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=c(function(){function _(w){if(!x){if(x=!0,P=w,w=f(w),d!==void 0&&m.hasValue){var S=m.value;if(d(S,w))return L=S}return L=w}if(S=L,s(P,w))return S;var v=f(w);return d!==void 0&&d(S,v)?(P=w,S):(P=w,L=v)}var x=!1,P,L,E=h===void 0?null:h;return[function(){return _(u())},E===null?void 0:function(){return _(E())}]},[u,h,f,d]);var y=n(l,p[0],p[1]);return i(function(){m.hasValue=!0,m.value=y},[y]),a(y),y},zt}var Oe;function Is(){return Oe||(Oe=1,Wt.exports=Ts()),Wt.exports}var ks=Is();function Os(t,o=s=>s,e={}){const s=e.equal??Fs;return ks.useSyncExternalStoreWithSelector(t.subscribe,()=>t.state,()=>t.state,o,s)}function Fs(t,o){if(Object.is(t,o))return!0;if(typeof t!="object"||t===null||typeof o!="object"||o===null)return!1;if(t instanceof Map&&o instanceof Map){if(t.size!==o.size)return!1;for(const[s,n]of t)if(!o.has(s)||!Object.is(n,o.get(s)))return!1;return!0}if(t instanceof Set&&o instanceof Set){if(t.size!==o.size)return!1;for(const s of t)if(!o.has(s))return!1;return!0}if(t instanceof Date&&o instanceof Date)return t.getTime()===o.getTime();const e=Fe(t);if(e.length!==Fe(o).length)return!1;for(let s=0;s"u"?Gt:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=Gt,Gt)}function F(t){const o=R.useContext(to());return t?.warn,o}function O(t){const o=F({warn:t?.router===void 0}),e=t?.router||o,s=R.useRef(void 0);return Os(e.__store,n=>{if(t?.select){if(t.structuralSharing??e.options.defaultStructuralSharing){const r=B(s.current,t.select(n));return s.current=r,r}return t.select(n)}return n})}const Dt=R.createContext(void 0),As=R.createContext(void 0);function V(t){const o=R.useContext(t.from?As:Dt);return O({select:s=>{const n=s.matches.find(r=>t.from?t.from===r.routeId:r.id===o);if(K(!((t.shouldThrow??!0)&&!n),`Could not find ${t.from?`an active match from "${t.from}"`:"a nearest match!"}`),n!==void 0)return t.select?t.select(n):n},structuralSharing:t.structuralSharing})}function ie(t){return V({from:t.from,strict:t.strict,structuralSharing:t.structuralSharing,select:o=>t.select?t.select(o.loaderData):o.loaderData})}function ae(t){const{select:o,...e}=t;return V({...e,select:s=>o?o(s.loaderDeps):s.loaderDeps})}function ce(t){return V({from:t.from,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,strict:t.strict,select:o=>{const e=t.strict===!1?o.params:o._strictParams;return t.select?t.select(e):e}})}function ue(t){return V({from:t.from,strict:t.strict,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,select:o=>t.select?t.select(o.search):o.search})}function le(t){const o=F();return R.useCallback(e=>o.navigate({...e,from:e.from??t?.from}),[t?.from,o])}var eo=po();const fn=Ne(eo),Lt=typeof window<"u"?R.useLayoutEffect:R.useEffect;function qt(t){const o=R.useRef({value:t,prev:null}),e=o.current.value;return t!==e&&(o.current={value:t,prev:e}),o.current.prev}function Bs(t,o,e={},s={}){R.useEffect(()=>{if(!t.current||s.disabled||typeof IntersectionObserver!="function")return;const n=new IntersectionObserver(([r])=>{o(r)},e);return n.observe(t.current),()=>{n.disconnect()}},[o,e,s.disabled,t])}function Ds(t){const o=R.useRef(null);return R.useImperativeHandle(t,()=>o.current,[]),o}function $s(t,o){const e=F(),[s,n]=R.useState(!1),r=R.useRef(!1),i=Ds(o),{activeProps:c,inactiveProps:a,activeOptions:l,to:u,preload:h,preloadDelay:f,hashScrollIntoView:d,replace:p,startTransition:m,resetScroll:y,viewTransition:_,children:x,target:P,disabled:L,style:E,className:w,onClick:S,onFocus:v,onMouseEnter:C,onMouseLeave:M,onTouchStart:T,ignoreBlocker:I,params:Y,search:D,hash:X,state:he,mask:ro,reloadDocument:rn,unsafeRelative:an,from:cn,_fromLocation:un,...fe}=t,io=O({select:b=>b.location.search,structuralSharing:!0}),de=t.from,lt=R.useMemo(()=>({...t,from:de}),[e,io,de,t._fromLocation,t.hash,t.to,t.search,t.params,t.state,t.mask,t.unsafeRelative]),W=R.useMemo(()=>e.buildLocation({...lt}),[e,lt]),vt=R.useMemo(()=>{if(L)return;let b=W.maskedLocation?W.maskedLocation.url:W.url,k=!1;return e.origin&&(b.startsWith(e.origin)?b=e.history.createHref(b.replace(e.origin,""))||"/":k=!0),{href:b,external:k}},[L,W.maskedLocation,W.url,e.origin,e.history]),St=R.useMemo(()=>{if(vt?.external)return vt.href;try{return new URL(u),u}catch{}},[u,vt]),st=t.reloadDocument||St?!1:h??e.options.defaultPreload,$t=f??e.options.defaultPreloadDelay??0,jt=O({select:b=>{if(St)return!1;if(l?.exact){if(!Mo(b.location.pathname,W.pathname,e.basepath))return!1}else{const k=It(b.location.pathname,e.basepath),$=It(W.pathname,e.basepath);if(!(k.startsWith($)&&(k.length===$.length||k[$.length]==="/")))return!1}return(l?.includeSearch??!0)&&!tt(b.location.search,W.search,{partial:!l?.exact,ignoreUndefined:!l?.explicitUndefined})?!1:l?.includeHash?b.location.hash===W.hash:!0}}),Z=R.useCallback(()=>{e.preloadRoute({...lt}).catch(b=>{console.warn(b),console.warn(Ps)})},[e,lt]),ao=R.useCallback(b=>{b?.isIntersecting&&Z()},[Z]);Bs(i,ao,Ws,{disabled:!!L||st!=="viewport"}),R.useEffect(()=>{r.current||!L&&st==="render"&&(Z(),r.current=!0)},[L,Z,st]);const co=b=>{const k=b.currentTarget.getAttribute("target"),$=P!==void 0?P:k;if(!L&&!zs(b)&&!b.defaultPrevented&&(!$||$==="_self")&&b.button===0){b.preventDefault(),eo.flushSync(()=>{n(!0)});const ye=e.subscribe("onResolved",()=>{ye(),n(!1)});e.navigate({...lt,replace:p,resetScroll:y,hashScrollIntoView:d,startTransition:m,viewTransition:_,ignoreBlocker:I})}};if(St)return{...fe,ref:i,href:St,...x&&{children:x},...P&&{target:P},...L&&{disabled:L},...E&&{style:E},...w&&{className:w},...S&&{onClick:S},...v&&{onFocus:v},...C&&{onMouseEnter:C},...M&&{onMouseLeave:M},...T&&{onTouchStart:T}};const pe=b=>{L||st&&Z()},uo=pe,lo=b=>{if(!(L||!st))if(!$t)Z();else{const k=b.target;if(ft.has(k))return;const $=setTimeout(()=>{ft.delete(k),Z()},$t);ft.set(k,$)}},ho=b=>{if(L||!st||!$t)return;const k=b.target,$=ft.get(k);$&&(clearTimeout($),ft.delete(k))},_t=jt?Q(c,{})??js:Jt,Rt=jt?Jt:Q(a,{})??Jt,me=[w,_t.className,Rt.className].filter(Boolean).join(" "),ge=(E||_t.style||Rt.style)&&{...E,..._t.style,...Rt.style};return{...fe,..._t,...Rt,href:vt?.href,ref:i,onClick:dt([S,co]),onFocus:dt([v,pe]),onMouseEnter:dt([C,lo]),onMouseLeave:dt([M,ho]),onTouchStart:dt([T,uo]),disabled:!!L,target:P,...ge&&{style:ge},...me&&{className:me},...L&&Ns,...jt&&Us,...s&&Vs}}const Jt={},js={className:"active"},Ns={role:"link","aria-disabled":!0},Us={"data-status":"active","aria-current":"page"},Vs={"data-transitioning":"transitioning"},ft=new WeakMap,Ws={rootMargin:"100px"},dt=t=>o=>{for(const e of t)if(e){if(o.defaultPrevented)return;e(o)}},oo=R.forwardRef((t,o)=>{const{_asChild:e,...s}=t,{type:n,ref:r,...i}=$s(s,o),c=typeof s.children=="function"?s.children({isActive:i["data-status"]==="active"}):s.children;return e===void 0&&delete i.disabled,R.createElement(e||"a",{...i,ref:r},c)});function zs(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}class Ks extends Qe{constructor(o){super(o),this.useMatch=e=>V({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>V({...e,from:this.id,select:s=>e?.select?e.select(s.context):s.context}),this.useSearch=e=>ue({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ce({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>ae({...e,from:this.id}),this.useLoaderData=e=>ie({...e,from:this.id}),this.useNavigate=()=>le({from:this.fullPath}),this.Link=rt.forwardRef((e,s)=>g.jsx(oo,{ref:s,from:this.fullPath,...e})),this.$$typeof=Symbol.for("react.memo")}}function Hs(t){return new Ks(t)}class Gs extends ws{constructor(o){super(o),this.useMatch=e=>V({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>V({...e,from:this.id,select:s=>e?.select?e.select(s.context):s.context}),this.useSearch=e=>ue({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ce({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>ae({...e,from:this.id}),this.useLoaderData=e=>ie({...e,from:this.id}),this.useNavigate=()=>le({from:this.fullPath}),this.Link=rt.forwardRef((e,s)=>g.jsx(oo,{ref:s,from:this.fullPath,...e})),this.$$typeof=Symbol.for("react.memo")}}function dn(t){return new Gs(t)}function Ae(t){return typeof t=="object"?new Be(t,{silent:!0}).createRoute(t):new Be(t,{silent:!0}).createRoute}class Be{constructor(o,e){this.path=o,this.createRoute=s=>{this.silent;const n=Hs(s);return n.isRoot=!1,n},this.silent=e?.silent}}class De{constructor(o){this.useMatch=e=>V({select:e?.select,from:this.options.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>V({from:this.options.id,select:s=>e?.select?e.select(s.context):s.context}),this.useSearch=e=>ue({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useParams=e=>ce({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useLoaderDeps=e=>ae({...e,from:this.options.id}),this.useLoaderData=e=>ie({...e,from:this.options.id}),this.useNavigate=()=>{const e=F();return le({from:e.routesById[this.options.id].fullPath})},this.options=o,this.$$typeof=Symbol.for("react.memo")}}function $e(t){return typeof t=="object"?new De(t):o=>new De({id:t,...o})}function qs(){const t=F(),o=R.useRef({router:t,mounted:!1}),[e,s]=R.useState(!1),{hasPendingMatches:n,isLoading:r}=O({select:h=>({isLoading:h.isLoading,hasPendingMatches:h.matches.some(f=>f.status==="pending")}),structuralSharing:!0}),i=qt(r),c=r||e||n,a=qt(c),l=r||n,u=qt(l);return t.startTransition=h=>{s(!0),R.startTransition(()=>{h(),s(!1)})},R.useEffect(()=>{const h=t.history.subscribe(t.load),f=t.buildLocation({to:t.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return J(t.latestLocation.href)!==J(f.href)&&t.commitLocation({...f,replace:!0}),()=>{h()}},[t,t.history]),Lt(()=>{if(typeof window<"u"&&t.ssr||o.current.router===t&&o.current.mounted)return;o.current={router:t,mounted:!0},(async()=>{try{await t.load()}catch(f){console.error(f)}})()},[t]),Lt(()=>{i&&!r&&t.emit({type:"onLoad",...et(t.state)})},[i,t,r]),Lt(()=>{u&&!l&&t.emit({type:"onBeforeRouteMount",...et(t.state)})},[l,u,t]),Lt(()=>{a&&!c&&(t.emit({type:"onResolved",...et(t.state)}),t.__store.setState(h=>({...h,status:"idle",resolvedLocation:h.location})),es(t))},[c,a,t]),null}function Js(t){const o=O({select:e=>`not-found-${e.location.pathname}-${e.status}`});return g.jsx(re,{getResetKey:()=>o,onCatch:(e,s)=>{if(j(e))t.onCatch?.(e,s);else throw e},errorComponent:({error:e})=>{if(j(e))return t.fallback?.(e);throw e},children:t.children})}function Ys(){return g.jsx("p",{children:"Not Found"})}function nt(t){return g.jsx(g.Fragment,{children:t.children})}function so(t,o,e){return o.options.notFoundComponent?g.jsx(o.options.notFoundComponent,{data:e}):t.options.defaultNotFoundComponent?g.jsx(t.options.defaultNotFoundComponent,{data:e}):g.jsx(Ys,{})}function Xs({children:t}){const o=F();return o.isServer?g.jsx("script",{nonce:o.options.ssr?.nonce,className:"$tsr",dangerouslySetInnerHTML:{__html:[t].filter(Boolean).join(` +`)+";$_TSR.c()"}}):null}function Zs(){const t=F();if(!t.isScrollRestoring||!t.isServer||typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation}))return null;const e=(t.options.getScrollRestorationKey||Qt)(t.latestLocation),s=e!==Qt(t.latestLocation)?e:void 0,n={storageKey:kt,shouldScrollRestoration:!0};return s&&(n.key=s),g.jsx(Xs,{children:`(${We.toString()})(${JSON.stringify(n)})`})}const no=R.memo(function({matchId:o}){const e=F(),s=O({select:_=>{const x=_.matches.find(P=>P.id===o);return K(x),{routeId:x.routeId,ssr:x.ssr,_displayPending:x._displayPending}},structuralSharing:!0}),n=e.routesById[s.routeId],r=n.options.pendingComponent??e.options.defaultPendingComponent,i=r?g.jsx(r,{}):null,c=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,l=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,u=s.ssr===!1||s.ssr==="data-only",h=(!n.isRoot||n.options.wrapInSuspense||u)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||u))?R.Suspense:nt,f=c?re:nt,d=l?Js:nt,p=O({select:_=>_.loadedAt}),m=O({select:_=>{const x=_.matches.findIndex(P=>P.id===o);return _.matches[x-1]?.routeId}}),y=n.isRoot?n.options.shellComponent??nt:nt;return g.jsxs(y,{children:[g.jsx(Dt.Provider,{value:o,children:g.jsx(h,{fallback:i,children:g.jsx(f,{getResetKey:()=>p,errorComponent:c||Bt,onCatch:(_,x)=>{if(j(_))throw _;a?.(_,x)},children:g.jsx(d,{fallback:_=>{if(!l||_.routeId&&_.routeId!==s.routeId||!_.routeId&&!n.isRoot)throw _;return R.createElement(l,_)},children:u||s._displayPending?g.jsx(Ls,{fallback:i,children:g.jsx(je,{matchId:o})}):g.jsx(je,{matchId:o})})})})}),m===A&&e.options.scrollRestoration?g.jsxs(g.Fragment,{children:[g.jsx(Qs,{}),g.jsx(Zs,{})]}):null]})});function Qs(){const t=F(),o=R.useRef(void 0);return g.jsx("script",{suppressHydrationWarning:!0,ref:e=>{e&&(o.current===void 0||o.current.href!==t.latestLocation.href)&&(t.emit({type:"onRendered",...et(t.state)}),o.current=t.latestLocation)}},t.latestLocation.state.__TSR_key)}const je=R.memo(function({matchId:o}){const e=F(),{match:s,key:n,routeId:r}=O({select:a=>{const l=a.matches.find(p=>p.id===o),u=l.routeId,f=(e.routesById[u].options.remountDeps??e.options.defaultRemountDeps)?.({routeId:u,loaderDeps:l.loaderDeps,params:l._strictParams,search:l._strictSearch});return{key:f?JSON.stringify(f):void 0,routeId:u,match:{id:l.id,status:l.status,error:l.error,_forcePending:l._forcePending,_displayPending:l._displayPending}}},structuralSharing:!0}),i=e.routesById[r],c=R.useMemo(()=>{const a=i.options.component??e.options.defaultComponent;return a?g.jsx(a,{},n):g.jsx(tn,{})},[n,i.options.component,e.options.defaultComponent]);if(s._displayPending)throw e.getMatch(s.id)?._nonReactive.displayPendingPromise;if(s._forcePending)throw e.getMatch(s.id)?._nonReactive.minPendingPromise;if(s.status==="pending"){const a=i.options.pendingMinMs??e.options.defaultPendingMinMs;if(a){const l=e.getMatch(s.id);if(l&&!l._nonReactive.minPendingPromise&&!e.isServer){const u=it();l._nonReactive.minPendingPromise=u,setTimeout(()=>{u.resolve(),l._nonReactive.minPendingPromise=void 0},a)}}throw e.getMatch(s.id)?._nonReactive.loadPromise}if(s.status==="notFound")return K(j(s.error)),so(e,i,s.error);if(s.status==="redirected")throw K(N(s.error)),e.getMatch(s.id)?._nonReactive.loadPromise;if(s.status==="error"){if(e.isServer){const a=(i.options.errorComponent??e.options.defaultErrorComponent)||Bt;return g.jsx(a,{error:s.error,reset:void 0,info:{componentStack:""}})}throw s.error}return c}),tn=R.memo(function(){const o=F(),e=R.useContext(Dt),s=O({select:l=>l.matches.find(u=>u.id===e)?.routeId}),n=o.routesById[s],r=O({select:l=>{const h=l.matches.find(f=>f.id===e);return K(h),h.globalNotFound}}),i=O({select:l=>{const u=l.matches,h=u.findIndex(f=>f.id===e);return u[h+1]?.id}}),c=o.options.defaultPendingComponent?g.jsx(o.options.defaultPendingComponent,{}):null;if(r)return so(o,n,void 0);if(!i)return null;const a=g.jsx(no,{matchId:i});return s===A?g.jsx(R.Suspense,{fallback:c,children:a}):a});function en(){const t=F(),e=t.routesById[A].options.pendingComponent??t.options.defaultPendingComponent,s=e?g.jsx(e,{}):null,n=t.isServer||typeof document<"u"&&t.ssr?nt:R.Suspense,r=g.jsxs(n,{fallback:s,children:[!t.isServer&&g.jsx(qs,{}),g.jsx(on,{})]});return t.options.InnerWrap?g.jsx(t.options.InnerWrap,{children:r}):r}function on(){const t=F(),o=O({select:n=>n.matches[0]?.id}),e=O({select:n=>n.loadedAt}),s=o?g.jsx(no,{matchId:o}):null;return g.jsx(Dt.Provider,{value:o,children:t.options.disableGlobalCatchBoundary?s:g.jsx(re,{getResetKey:()=>e,errorComponent:Bt,onCatch:n=>{n.message||n.toString()},children:s})})}function pn(){const t=F();return O({select:o=>[o.location.href,o.resolvedLocation?.href,o.status],structuralSharing:!0}),R.useCallback(o=>{const{pending:e,caseSensitive:s,fuzzy:n,includeSearch:r,...i}=o;return t.matchRoute(i,{pending:e,caseSensitive:s,fuzzy:n,includeSearch:r})},[t])}const mn=t=>new sn(t);class sn extends ys{constructor(o){super(o)}}typeof globalThis<"u"?(globalThis.createFileRoute=Ae,globalThis.createLazyFileRoute=$e):typeof window<"u"&&(window.createFileRoute=Ae,window.createLazyFileRoute=$e);function nn({router:t,children:o,...e}){Object.keys(e).length>0&&t.update({...t.options,...e,context:{...t.options.context,...e.context}});const s=to(),n=g.jsx(s.Provider,{value:t,children:o});return t.options.Wrap?g.jsx(t.options.Wrap,{children:n}):n}function gn({router:t,...o}){return g.jsx(nn,{router:t,...o,children:g.jsx(en,{})})}export{oo as L,tn as O,rt as R,hn as a,eo as b,fn as c,pn as d,dn as e,Hs as f,mn as g,cs as h,K as i,g as j,gn as k,R as r,le as u}; diff --git a/webui/dist/assets/ui-vendor-nTGLnMlb.js b/webui/dist/assets/ui-vendor-nTGLnMlb.js new file mode 100644 index 00000000..0fcce437 --- /dev/null +++ b/webui/dist/assets/ui-vendor-nTGLnMlb.js @@ -0,0 +1,45 @@ +import{r as a,j as x,R as we,a as Vt,b as at,c as yr}from"./router-BWgTyY51.js";function k(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function wr(e,t){const n=a.createContext(t),o=i=>{const{children:c,...s}=i,l=a.useMemo(()=>s,Object.values(s));return x.jsx(n.Provider,{value:l,children:c})};o.displayName=e+"Provider";function r(i){const c=a.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[o,r]}function Ve(e,t=[]){let n=[];function o(i,c){const s=a.createContext(c),l=n.length;n=[...n,c];const u=p=>{const{scope:h,children:m,...w}=p,f=h?.[e]?.[l]||s,g=a.useMemo(()=>w,Object.values(w));return x.jsx(f.Provider,{value:g,children:m})};u.displayName=i+"Provider";function d(p,h){const m=h?.[e]?.[l]||s,w=a.useContext(m);if(w)return w;if(c!==void 0)return c;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[u,d]}const r=()=>{const i=n.map(c=>a.createContext(c));return function(s){const l=s?.[e]||i;return a.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return r.scopeName=e,[o,xr(r,...t)]}function xr(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(i){const c=o.reduce((s,{useScope:l,scopeName:u})=>{const p=l(i)[`__scope${u}`];return{...s,...p}},{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}function sn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function _e(...e){return t=>{let n=!1;const o=e.map(r=>{const i=sn(r,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let r=0;r{const{children:i,...c}=o,s=a.Children.toArray(i),l=s.find(Cr);if(l){const u=l.props.children,d=s.map(p=>p===l?a.Children.count(u)>1?a.Children.only(null):a.isValidElement(u)?u.props.children:null:p);return x.jsx(t,{...c,ref:r,children:a.isValidElement(u)?a.cloneElement(u,void 0,d):null})}return x.jsx(t,{...c,ref:r,children:i})});return n.displayName=`${e}.Slot`,n}function Sr(e){const t=a.forwardRef((n,o)=>{const{children:r,...i}=n;if(a.isValidElement(r)){const c=Rr(r),s=Er(i,r.props);return r.type!==a.Fragment&&(s.ref=o?_e(o,c):c),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var br=Symbol("radix.slottable");function Cr(e){return a.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===br}function Er(e,t){const n={...t};for(const o in t){const r=e[o],i=t[o];/^on[A-Z]/.test(o)?r&&i?n[o]=(...s)=>{const l=i(...s);return r(...s),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...i}:o==="className"&&(n[o]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function Rr(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Pr(e){const t=e+"CollectionProvider",[n,o]=Ve(t),[r,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=f=>{const{scope:g,children:y}=f,v=we.useRef(null),S=we.useRef(new Map).current;return x.jsx(r,{scope:g,itemMap:S,collectionRef:v,children:y})};c.displayName=t;const s=e+"CollectionSlot",l=cn(s),u=we.forwardRef((f,g)=>{const{scope:y,children:v}=f,S=i(s,y),b=H(g,S.collectionRef);return x.jsx(l,{ref:b,children:v})});u.displayName=s;const d=e+"CollectionItemSlot",p="data-radix-collection-item",h=cn(d),m=we.forwardRef((f,g)=>{const{scope:y,children:v,...S}=f,b=we.useRef(null),C=H(g,b),R=i(d,y);return we.useEffect(()=>(R.itemMap.set(b,{ref:b,...S}),()=>void R.itemMap.delete(b))),x.jsx(h,{[p]:"",ref:C,children:v})});m.displayName=d;function w(f){const g=i(e+"CollectionConsumer",f);return we.useCallback(()=>{const v=g.collectionRef.current;if(!v)return[];const S=Array.from(v.querySelectorAll(`[${p}]`));return Array.from(g.itemMap.values()).sort((R,E)=>S.indexOf(R.ref.current)-S.indexOf(E.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:c,Slot:u,ItemSlot:m},w,o]}var K=globalThis?.document?a.useLayoutEffect:()=>{},Ar=Vt[" useId ".trim().toString()]||(()=>{}),Or=0;function Te(e){const[t,n]=a.useState(Ar());return K(()=>{n(o=>o??String(Or++))},[e]),t?`radix-${t}`:""}function Tr(e){const t=Nr(e),n=a.forwardRef((o,r)=>{const{children:i,...c}=o,s=a.Children.toArray(i),l=s.find(Dr);if(l){const u=l.props.children,d=s.map(p=>p===l?a.Children.count(u)>1?a.Children.only(null):a.isValidElement(u)?u.props.children:null:p);return x.jsx(t,{...c,ref:r,children:a.isValidElement(u)?a.cloneElement(u,void 0,d):null})}return x.jsx(t,{...c,ref:r,children:i})});return n.displayName=`${e}.Slot`,n}function Nr(e){const t=a.forwardRef((n,o)=>{const{children:r,...i}=n;if(a.isValidElement(r)){const c=Mr(r),s=_r(i,r.props);return r.type!==a.Fragment&&(s.ref=o?_e(o,c):c),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ir=Symbol("radix.slottable");function Dr(e){return a.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ir}function _r(e,t){const n={...t};for(const o in t){const r=e[o],i=t[o];/^on[A-Z]/.test(o)?r&&i?n[o]=(...s)=>{const l=i(...s);return r(...s),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...i}:o==="className"&&(n[o]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function Mr(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Lr=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],M=Lr.reduce((e,t)=>{const n=Tr(`Primitive.${t}`),o=a.forwardRef((r,i)=>{const{asChild:c,...s}=r,l=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(l,{...s,ref:i})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function kr(e,t){e&&at.flushSync(()=>e.dispatchEvent(t))}function xe(e){const t=a.useRef(e);return a.useEffect(()=>{t.current=e}),a.useMemo(()=>(...n)=>t.current?.(...n),[])}var jr=Vt[" useInsertionEffect ".trim().toString()]||K;function et({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[r,i,c]=Fr({defaultProp:t,onChange:n}),s=e!==void 0,l=s?e:r;{const d=a.useRef(e!==void 0);a.useEffect(()=>{const p=d.current;p!==s&&console.warn(`${o} is changing from ${p?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=s},[s,o])}const u=a.useCallback(d=>{if(s){const p=Wr(d)?d(e):d;p!==e&&c.current?.(p)}else i(d)},[s,e,i,c]);return[l,u]}function Fr({defaultProp:e,onChange:t}){const[n,o]=a.useState(e),r=a.useRef(n),i=a.useRef(t);return jr(()=>{i.current=t},[t]),a.useEffect(()=>{r.current!==n&&(i.current?.(n),r.current=n)},[n,r]),[n,o,i]}function Wr(e){return typeof e=="function"}var $r=a.createContext(void 0);function Br(e){const t=a.useContext($r);return e||t||"ltr"}function Vr(e,t){return a.useReducer((n,o)=>t[n][o]??n,e)}var He=e=>{const{present:t,children:n}=e,o=Hr(t),r=typeof n=="function"?n({present:o.isPresent}):a.Children.only(n),i=H(o.ref,Ur(r));return typeof n=="function"||o.isPresent?a.cloneElement(r,{ref:i}):null};He.displayName="Presence";function Hr(e){const[t,n]=a.useState(),o=a.useRef(null),r=a.useRef(e),i=a.useRef("none"),c=e?"mounted":"unmounted",[s,l]=Vr(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.useEffect(()=>{const u=ze(o.current);i.current=s==="mounted"?u:"none"},[s]),K(()=>{const u=o.current,d=r.current;if(d!==e){const h=i.current,m=ze(u);e?l("MOUNT"):m==="none"||u?.display==="none"?l("UNMOUNT"):l(d&&h!==m?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,l]),K(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,p=m=>{const f=ze(o.current).includes(CSS.escape(m.animationName));if(m.target===t&&f&&(l("ANIMATION_END"),!r.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},h=m=>{m.target===t&&(i.current=ze(o.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:a.useCallback(u=>{o.current=u?getComputedStyle(u):null,n(u)},[])}}function ze(e){return e?.animationName||"none"}function Ur(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function an(e,[t,n]){return Math.min(n,Math.max(t,e))}var zr=Symbol.for("react.lazy"),tt=Vt[" use ".trim().toString()];function Kr(e){return typeof e=="object"&&e!==null&&"then"in e}function Dn(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===zr&&"_payload"in e&&Kr(e._payload)}function _n(e){const t=Yr(e),n=a.forwardRef((o,r)=>{let{children:i,...c}=o;Dn(i)&&typeof tt=="function"&&(i=tt(i._payload));const s=a.Children.toArray(i),l=s.find(Gr);if(l){const u=l.props.children,d=s.map(p=>p===l?a.Children.count(u)>1?a.Children.only(null):a.isValidElement(u)?u.props.children:null:p);return x.jsx(t,{...c,ref:r,children:a.isValidElement(u)?a.cloneElement(u,void 0,d):null})}return x.jsx(t,{...c,ref:r,children:i})});return n.displayName=`${e}.Slot`,n}var wa=_n("Slot");function Yr(e){const t=a.forwardRef((n,o)=>{let{children:r,...i}=n;if(Dn(r)&&typeof tt=="function"&&(r=tt(r._payload)),a.isValidElement(r)){const c=Zr(r),s=qr(i,r.props);return r.type!==a.Fragment&&(s.ref=o?_e(o,c):c),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Xr=Symbol("radix.slottable");function Gr(e){return a.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Xr}function qr(e,t){const n={...t};for(const o in t){const r=e[o],i=t[o];/^on[A-Z]/.test(o)?r&&i?n[o]=(...s)=>{const l=i(...s);return r(...s),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...i}:o==="className"&&(n[o]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function Zr(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Mn(e){const t=a.useRef({value:e,previous:e});return a.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Ln(e){const[t,n]=a.useState(void 0);return K(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const i=r[0];let c,s;if("borderBoxSize"in i){const l=i.borderBoxSize,u=Array.isArray(l)?l[0]:l;c=u.inlineSize,s=u.blockSize}else c=e.offsetWidth,s=e.offsetHeight;n({width:c,height:s})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var Qr=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Jr=Qr.reduce((e,t)=>{const n=_n(`Primitive.${t}`),o=a.forwardRef((r,i)=>{const{asChild:c,...s}=r,l=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(l,{...s,ref:i})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),ei="Label",kn=a.forwardRef((e,t)=>x.jsx(Jr.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));kn.displayName=ei;var xa=kn;function ti(e,t=globalThis?.document){const n=xe(e);a.useEffect(()=>{const o=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var ni="DismissableLayer",Dt="dismissableLayer.update",oi="dismissableLayer.pointerDownOutside",ri="dismissableLayer.focusOutside",ln,jn=a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),lt=a.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:i,onInteractOutside:c,onDismiss:s,...l}=e,u=a.useContext(jn),[d,p]=a.useState(null),h=d?.ownerDocument??globalThis?.document,[,m]=a.useState({}),w=H(t,E=>p(E)),f=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=f.indexOf(g),v=d?f.indexOf(d):-1,S=u.layersWithOutsidePointerEventsDisabled.size>0,b=v>=y,C=si(E=>{const O=E.target,_=[...u.branches].some(I=>I.contains(O));!b||_||(r?.(E),c?.(E),E.defaultPrevented||s?.())},h),R=ci(E=>{const O=E.target;[...u.branches].some(I=>I.contains(O))||(i?.(E),c?.(E),E.defaultPrevented||s?.())},h);return ti(E=>{v===u.layers.size-1&&(o?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},h),a.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(ln=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),un(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=ln)}},[d,h,n,u]),a.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),un())},[d,u]),a.useEffect(()=>{const E=()=>m({});return document.addEventListener(Dt,E),()=>document.removeEventListener(Dt,E)},[]),x.jsx(M.div,{...l,ref:w,style:{pointerEvents:S?b?"auto":"none":void 0,...e.style},onFocusCapture:k(e.onFocusCapture,R.onFocusCapture),onBlurCapture:k(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:k(e.onPointerDownCapture,C.onPointerDownCapture)})});lt.displayName=ni;var ii="DismissableLayerBranch",Fn=a.forwardRef((e,t)=>{const n=a.useContext(jn),o=a.useRef(null),r=H(t,o);return a.useEffect(()=>{const i=o.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),x.jsx(M.div,{...e,ref:r})});Fn.displayName=ii;function si(e,t=globalThis?.document){const n=xe(e),o=a.useRef(!1),r=a.useRef(()=>{});return a.useEffect(()=>{const i=s=>{if(s.target&&!o.current){let l=function(){Wn(oi,n,u,{discrete:!0})};const u={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=l,t.addEventListener("click",r.current,{once:!0})):l()}else t.removeEventListener("click",r.current);o.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",i),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function ci(e,t=globalThis?.document){const n=xe(e),o=a.useRef(!1);return a.useEffect(()=>{const r=i=>{i.target&&!o.current&&Wn(ri,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function un(){const e=new CustomEvent(Dt);document.dispatchEvent(e)}function Wn(e,t,n,{discrete:o}){const r=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?kr(r,i):r.dispatchEvent(i)}var Sa=lt,ba=Fn,Ct="focusScope.autoFocusOnMount",Et="focusScope.autoFocusOnUnmount",fn={bubbles:!1,cancelable:!0},ai="FocusScope",Ht=a.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:i,...c}=e,[s,l]=a.useState(null),u=xe(r),d=xe(i),p=a.useRef(null),h=H(t,f=>l(f)),m=a.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;a.useEffect(()=>{if(o){let f=function(S){if(m.paused||!s)return;const b=S.target;s.contains(b)?p.current=b:ue(p.current,{select:!0})},g=function(S){if(m.paused||!s)return;const b=S.relatedTarget;b!==null&&(s.contains(b)||ue(p.current,{select:!0}))},y=function(S){if(document.activeElement===document.body)for(const C of S)C.removedNodes.length>0&&ue(s)};document.addEventListener("focusin",f),document.addEventListener("focusout",g);const v=new MutationObserver(y);return s&&v.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",g),v.disconnect()}}},[o,s,m.paused]),a.useEffect(()=>{if(s){pn.add(m);const f=document.activeElement;if(!s.contains(f)){const y=new CustomEvent(Ct,fn);s.addEventListener(Ct,u),s.dispatchEvent(y),y.defaultPrevented||(li(mi($n(s)),{select:!0}),document.activeElement===f&&ue(s))}return()=>{s.removeEventListener(Ct,u),setTimeout(()=>{const y=new CustomEvent(Et,fn);s.addEventListener(Et,d),s.dispatchEvent(y),y.defaultPrevented||ue(f??document.body,{select:!0}),s.removeEventListener(Et,d),pn.remove(m)},0)}}},[s,u,d,m]);const w=a.useCallback(f=>{if(!n&&!o||m.paused)return;const g=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,y=document.activeElement;if(g&&y){const v=f.currentTarget,[S,b]=ui(v);S&&b?!f.shiftKey&&y===b?(f.preventDefault(),n&&ue(S,{select:!0})):f.shiftKey&&y===S&&(f.preventDefault(),n&&ue(b,{select:!0})):y===v&&f.preventDefault()}},[n,o,m.paused]);return x.jsx(M.div,{tabIndex:-1,...c,ref:h,onKeyDown:w})});Ht.displayName=ai;function li(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(ue(o,{select:t}),document.activeElement!==n)return}function ui(e){const t=$n(e),n=dn(t,e),o=dn(t.reverse(),e);return[n,o]}function $n(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function dn(e,t){for(const n of e)if(!fi(n,{upTo:t}))return n}function fi(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function di(e){return e instanceof HTMLInputElement&&"select"in e}function ue(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&di(e)&&t&&e.select()}}var pn=pi();function pi(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=mn(e,t),e.unshift(t)},remove(t){e=mn(e,t),e[0]?.resume()}}}function mn(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function mi(e){return e.filter(t=>t.tagName!=="A")}var hi="Portal",Ut=a.forwardRef((e,t)=>{const{container:n,...o}=e,[r,i]=a.useState(!1);K(()=>i(!0),[]);const c=n||r&&globalThis?.document?.body;return c?yr.createPortal(x.jsx(M.div,{...o,ref:t}),c):null});Ut.displayName=hi;var Rt=0;function Bn(){a.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??hn()),document.body.insertAdjacentElement("beforeend",e[1]??hn()),Rt++,()=>{Rt===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Rt--}},[])}function hn(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ne=function(){return ne=Object.assign||function(t){for(var n,o=1,r=arguments.length;o"u")return Di;var t=_i(e),n=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-n+t[2]-t[0])}},Li=zn(),Ne="data-scroll-locked",ki=function(e,t,n,o){var r=e.left,i=e.top,c=e.right,s=e.gap;return n===void 0&&(n="margin"),` + .`.concat(vi,` { + overflow: hidden `).concat(o,`; + padding-right: `).concat(s,"px ").concat(o,`; + } + body[`).concat(Ne,`] { + overflow: hidden `).concat(o,`; + overscroll-behavior: contain; + `).concat([t&&"position: relative ".concat(o,";"),n==="margin"&&` + padding-left: `.concat(r,`px; + padding-top: `).concat(i,`px; + padding-right: `).concat(c,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(s,"px ").concat(o,`; + `),n==="padding"&&"padding-right: ".concat(s,"px ").concat(o,";")].filter(Boolean).join(""),` + } + + .`).concat(Ze,` { + right: `).concat(s,"px ").concat(o,`; + } + + .`).concat(Qe,` { + margin-right: `).concat(s,"px ").concat(o,`; + } + + .`).concat(Ze," .").concat(Ze,` { + right: 0 `).concat(o,`; + } + + .`).concat(Qe," .").concat(Qe,` { + margin-right: 0 `).concat(o,`; + } + + body[`).concat(Ne,`] { + `).concat(yi,": ").concat(s,`px; + } +`)},vn=function(){var e=parseInt(document.body.getAttribute(Ne)||"0",10);return isFinite(e)?e:0},ji=function(){a.useEffect(function(){return document.body.setAttribute(Ne,(vn()+1).toString()),function(){var e=vn()-1;e<=0?document.body.removeAttribute(Ne):document.body.setAttribute(Ne,e.toString())}},[])},Fi=function(e){var t=e.noRelative,n=e.noImportant,o=e.gapMode,r=o===void 0?"margin":o;ji();var i=a.useMemo(function(){return Mi(r)},[r]);return a.createElement(Li,{styles:ki(i,!t,r,n?"":"!important")})},_t=!1;if(typeof window<"u")try{var Ke=Object.defineProperty({},"passive",{get:function(){return _t=!0,!0}});window.addEventListener("test",Ke,Ke),window.removeEventListener("test",Ke,Ke)}catch{_t=!1}var Pe=_t?{passive:!1}:!1,Wi=function(e){return e.tagName==="TEXTAREA"},Kn=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Wi(e)&&n[t]==="visible")},$i=function(e){return Kn(e,"overflowY")},Bi=function(e){return Kn(e,"overflowX")},yn=function(e,t){var n=t.ownerDocument,o=t;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var r=Yn(e,o);if(r){var i=Xn(e,o),c=i[1],s=i[2];if(c>s)return!0}o=o.parentNode}while(o&&o!==n.body);return!1},Vi=function(e){var t=e.scrollTop,n=e.scrollHeight,o=e.clientHeight;return[t,n,o]},Hi=function(e){var t=e.scrollLeft,n=e.scrollWidth,o=e.clientWidth;return[t,n,o]},Yn=function(e,t){return e==="v"?$i(t):Bi(t)},Xn=function(e,t){return e==="v"?Vi(t):Hi(t)},Ui=function(e,t){return e==="h"&&t==="rtl"?-1:1},zi=function(e,t,n,o,r){var i=Ui(e,window.getComputedStyle(t).direction),c=i*o,s=n.target,l=t.contains(s),u=!1,d=c>0,p=0,h=0;do{if(!s)break;var m=Xn(e,s),w=m[0],f=m[1],g=m[2],y=f-g-i*w;(w||y)&&Yn(e,s)&&(p+=y,h+=w);var v=s.parentNode;s=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(d&&Math.abs(p)<1||!d&&Math.abs(h)<1)&&(u=!0),u},Ye=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},wn=function(e){return[e.deltaX,e.deltaY]},xn=function(e){return e&&"current"in e?e.current:e},Ki=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Yi=function(e){return` + .block-interactivity-`.concat(e,` {pointer-events: none;} + .allow-interactivity-`).concat(e,` {pointer-events: all;} +`)},Xi=0,Ae=[];function Gi(e){var t=a.useRef([]),n=a.useRef([0,0]),o=a.useRef(),r=a.useState(Xi++)[0],i=a.useState(zn)[0],c=a.useRef(e);a.useEffect(function(){c.current=e},[e]),a.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var f=gi([e.lockRef.current],(e.shards||[]).map(xn),!0).filter(Boolean);return f.forEach(function(g){return g.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),f.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var s=a.useCallback(function(f,g){if("touches"in f&&f.touches.length===2||f.type==="wheel"&&f.ctrlKey)return!c.current.allowPinchZoom;var y=Ye(f),v=n.current,S="deltaX"in f?f.deltaX:v[0]-y[0],b="deltaY"in f?f.deltaY:v[1]-y[1],C,R=f.target,E=Math.abs(S)>Math.abs(b)?"h":"v";if("touches"in f&&E==="h"&&R.type==="range")return!1;var O=yn(E,R);if(!O)return!0;if(O?C=E:(C=E==="v"?"h":"v",O=yn(E,R)),!O)return!1;if(!o.current&&"changedTouches"in f&&(S||b)&&(o.current=C),!C)return!0;var _=o.current||C;return zi(_,g,f,_==="h"?S:b)},[]),l=a.useCallback(function(f){var g=f;if(!(!Ae.length||Ae[Ae.length-1]!==i)){var y="deltaY"in g?wn(g):Ye(g),v=t.current.filter(function(C){return C.name===g.type&&(C.target===g.target||g.target===C.shadowParent)&&Ki(C.delta,y)})[0];if(v&&v.should){g.cancelable&&g.preventDefault();return}if(!v){var S=(c.current.shards||[]).map(xn).filter(Boolean).filter(function(C){return C.contains(g.target)}),b=S.length>0?s(g,S[0]):!c.current.noIsolation;b&&g.cancelable&&g.preventDefault()}}},[]),u=a.useCallback(function(f,g,y,v){var S={name:f,delta:g,target:y,should:v,shadowParent:qi(y)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(b){return b!==S})},1)},[]),d=a.useCallback(function(f){n.current=Ye(f),o.current=void 0},[]),p=a.useCallback(function(f){u(f.type,wn(f),f.target,s(f,e.lockRef.current))},[]),h=a.useCallback(function(f){u(f.type,Ye(f),f.target,s(f,e.lockRef.current))},[]);a.useEffect(function(){return Ae.push(i),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:h}),document.addEventListener("wheel",l,Pe),document.addEventListener("touchmove",l,Pe),document.addEventListener("touchstart",d,Pe),function(){Ae=Ae.filter(function(f){return f!==i}),document.removeEventListener("wheel",l,Pe),document.removeEventListener("touchmove",l,Pe),document.removeEventListener("touchstart",d,Pe)}},[]);var m=e.removeScrollBar,w=e.inert;return a.createElement(a.Fragment,null,w?a.createElement(i,{styles:Yi(r)}):null,m?a.createElement(Fi,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function qi(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Zi=Ri(Un,Gi);var zt=a.forwardRef(function(e,t){return a.createElement(ut,ne({},e,{ref:t,sideCar:Zi}))});zt.classNames=ut.classNames;var Qi=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Oe=new WeakMap,Xe=new WeakMap,Ge={},Tt=0,Gn=function(e){return e&&(e.host||Gn(e.parentNode))},Ji=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=Gn(n);return o&&e.contains(o)?o:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},es=function(e,t,n,o){var r=Ji(t,Array.isArray(e)?e:[e]);Ge[n]||(Ge[n]=new WeakMap);var i=Ge[n],c=[],s=new Set,l=new Set(r),u=function(p){!p||s.has(p)||(s.add(p),u(p.parentNode))};r.forEach(u);var d=function(p){!p||l.has(p)||Array.prototype.forEach.call(p.children,function(h){if(s.has(h))d(h);else try{var m=h.getAttribute(o),w=m!==null&&m!=="false",f=(Oe.get(h)||0)+1,g=(i.get(h)||0)+1;Oe.set(h,f),i.set(h,g),c.push(h),f===1&&w&&Xe.set(h,!0),g===1&&h.setAttribute(n,"true"),w||h.setAttribute(o,"true")}catch(y){console.error("aria-hidden: cannot operate on ",h,y)}})};return d(t),s.clear(),Tt++,function(){c.forEach(function(p){var h=Oe.get(p)-1,m=i.get(p)-1;Oe.set(p,h),i.set(p,m),h||(Xe.has(p)||p.removeAttribute(o),Xe.delete(p)),m||p.removeAttribute(n)}),Tt--,Tt||(Oe=new WeakMap,Oe=new WeakMap,Xe=new WeakMap,Ge={})}},qn=function(e,t,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),r=Qi(e);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),es(o,r,n,"aria-hidden")):function(){return null}};function ts(e){const t=ns(e),n=a.forwardRef((o,r)=>{const{children:i,...c}=o,s=a.Children.toArray(i),l=s.find(rs);if(l){const u=l.props.children,d=s.map(p=>p===l?a.Children.count(u)>1?a.Children.only(null):a.isValidElement(u)?u.props.children:null:p);return x.jsx(t,{...c,ref:r,children:a.isValidElement(u)?a.cloneElement(u,void 0,d):null})}return x.jsx(t,{...c,ref:r,children:i})});return n.displayName=`${e}.Slot`,n}function ns(e){const t=a.forwardRef((n,o)=>{const{children:r,...i}=n;if(a.isValidElement(r)){const c=ss(r),s=is(i,r.props);return r.type!==a.Fragment&&(s.ref=o?_e(o,c):c),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var os=Symbol("radix.slottable");function rs(e){return a.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===os}function is(e,t){const n={...t};for(const o in t){const r=e[o],i=t[o];/^on[A-Z]/.test(o)?r&&i?n[o]=(...s)=>{const l=i(...s);return r(...s),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...i}:o==="className"&&(n[o]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function ss(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ft="Dialog",[Zn,Ca]=Ve(ft),[cs,te]=Zn(ft),Qn=e=>{const{__scopeDialog:t,children:n,open:o,defaultOpen:r,onOpenChange:i,modal:c=!0}=e,s=a.useRef(null),l=a.useRef(null),[u,d]=et({prop:o,defaultProp:r??!1,onChange:i,caller:ft});return x.jsx(cs,{scope:t,triggerRef:s,contentRef:l,contentId:Te(),titleId:Te(),descriptionId:Te(),open:u,onOpenChange:d,onOpenToggle:a.useCallback(()=>d(p=>!p),[d]),modal:c,children:n})};Qn.displayName=ft;var Jn="DialogTrigger",eo=a.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=te(Jn,n),i=H(t,r.triggerRef);return x.jsx(M.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Xt(r.open),...o,ref:i,onClick:k(e.onClick,r.onOpenToggle)})});eo.displayName=Jn;var Kt="DialogPortal",[as,to]=Zn(Kt,{forceMount:void 0}),no=e=>{const{__scopeDialog:t,forceMount:n,children:o,container:r}=e,i=te(Kt,t);return x.jsx(as,{scope:t,forceMount:n,children:a.Children.map(o,c=>x.jsx(He,{present:n||i.open,children:x.jsx(Ut,{asChild:!0,container:r,children:c})}))})};no.displayName=Kt;var nt="DialogOverlay",oo=a.forwardRef((e,t)=>{const n=to(nt,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,i=te(nt,e.__scopeDialog);return i.modal?x.jsx(He,{present:o||i.open,children:x.jsx(us,{...r,ref:t})}):null});oo.displayName=nt;var ls=ts("DialogOverlay.RemoveScroll"),us=a.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=te(nt,n);return x.jsx(zt,{as:ls,allowPinchZoom:!0,shards:[r.contentRef],children:x.jsx(M.div,{"data-state":Xt(r.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),Se="DialogContent",ro=a.forwardRef((e,t)=>{const n=to(Se,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,i=te(Se,e.__scopeDialog);return x.jsx(He,{present:o||i.open,children:i.modal?x.jsx(fs,{...r,ref:t}):x.jsx(ds,{...r,ref:t})})});ro.displayName=Se;var fs=a.forwardRef((e,t)=>{const n=te(Se,e.__scopeDialog),o=a.useRef(null),r=H(t,n.contentRef,o);return a.useEffect(()=>{const i=o.current;if(i)return qn(i)},[]),x.jsx(io,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:k(e.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:k(e.onPointerDownOutside,i=>{const c=i.detail.originalEvent,s=c.button===0&&c.ctrlKey===!0;(c.button===2||s)&&i.preventDefault()}),onFocusOutside:k(e.onFocusOutside,i=>i.preventDefault())})}),ds=a.forwardRef((e,t)=>{const n=te(Se,e.__scopeDialog),o=a.useRef(!1),r=a.useRef(!1);return x.jsx(io,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(o.current||n.triggerRef.current?.focus(),i.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(o.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const c=i.target;n.triggerRef.current?.contains(c)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),io=a.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:i,...c}=e,s=te(Se,n),l=a.useRef(null),u=H(t,l);return Bn(),x.jsxs(x.Fragment,{children:[x.jsx(Ht,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:i,children:x.jsx(lt,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Xt(s.open),...c,ref:u,onDismiss:()=>s.onOpenChange(!1)})}),x.jsxs(x.Fragment,{children:[x.jsx(ps,{titleId:s.titleId}),x.jsx(hs,{contentRef:l,descriptionId:s.descriptionId})]})]})}),Yt="DialogTitle",so=a.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=te(Yt,n);return x.jsx(M.h2,{id:r.titleId,...o,ref:t})});so.displayName=Yt;var co="DialogDescription",ao=a.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=te(co,n);return x.jsx(M.p,{id:r.descriptionId,...o,ref:t})});ao.displayName=co;var lo="DialogClose",uo=a.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=te(lo,n);return x.jsx(M.button,{type:"button",...o,ref:t,onClick:k(e.onClick,()=>r.onOpenChange(!1))})});uo.displayName=lo;function Xt(e){return e?"open":"closed"}var fo="DialogTitleWarning",[Ea,po]=wr(fo,{contentName:Se,titleName:Yt,docsSlug:"dialog"}),ps=({titleId:e})=>{const t=po(fo),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return a.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},ms="DialogDescriptionWarning",hs=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${po(ms).contentName}}.`;return a.useEffect(()=>{const r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},Ra=Qn,Pa=eo,Aa=no,Oa=oo,Ta=ro,Na=so,Ia=ao,Da=uo;const gs=["top","right","bottom","left"],de=Math.min,G=Math.max,ot=Math.round,qe=Math.floor,re=e=>({x:e,y:e}),vs={left:"right",right:"left",bottom:"top",top:"bottom"},ys={start:"end",end:"start"};function Mt(e,t,n){return G(e,de(t,n))}function ce(e,t){return typeof e=="function"?e(t):e}function ae(e){return e.split("-")[0]}function Me(e){return e.split("-")[1]}function Gt(e){return e==="x"?"y":"x"}function qt(e){return e==="y"?"height":"width"}const ws=new Set(["top","bottom"]);function oe(e){return ws.has(ae(e))?"y":"x"}function Zt(e){return Gt(oe(e))}function xs(e,t,n){n===void 0&&(n=!1);const o=Me(e),r=Zt(e),i=qt(r);let c=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(c=rt(c)),[c,rt(c)]}function Ss(e){const t=rt(e);return[Lt(e),t,Lt(t)]}function Lt(e){return e.replace(/start|end/g,t=>ys[t])}const Sn=["left","right"],bn=["right","left"],bs=["top","bottom"],Cs=["bottom","top"];function Es(e,t,n){switch(e){case"top":case"bottom":return n?t?bn:Sn:t?Sn:bn;case"left":case"right":return t?bs:Cs;default:return[]}}function Rs(e,t,n,o){const r=Me(e);let i=Es(ae(e),n==="start",o);return r&&(i=i.map(c=>c+"-"+r),t&&(i=i.concat(i.map(Lt)))),i}function rt(e){return e.replace(/left|right|bottom|top/g,t=>vs[t])}function Ps(e){return{top:0,right:0,bottom:0,left:0,...e}}function mo(e){return typeof e!="number"?Ps(e):{top:e,right:e,bottom:e,left:e}}function it(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function Cn(e,t,n){let{reference:o,floating:r}=e;const i=oe(t),c=Zt(t),s=qt(c),l=ae(t),u=i==="y",d=o.x+o.width/2-r.width/2,p=o.y+o.height/2-r.height/2,h=o[s]/2-r[s]/2;let m;switch(l){case"top":m={x:d,y:o.y-r.height};break;case"bottom":m={x:d,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:p};break;case"left":m={x:o.x-r.width,y:p};break;default:m={x:o.x,y:o.y}}switch(Me(t)){case"start":m[c]-=h*(n&&u?-1:1);break;case"end":m[c]+=h*(n&&u?-1:1);break}return m}const As=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:c}=n,s=i.filter(Boolean),l=await(c.isRTL==null?void 0:c.isRTL(t));let u=await c.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:p}=Cn(u,o,l),h=o,m={},w=0;for(let f=0;f({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:i,platform:c,elements:s,middlewareData:l}=t,{element:u,padding:d=0}=ce(e,t)||{};if(u==null)return{};const p=mo(d),h={x:n,y:o},m=Zt(r),w=qt(m),f=await c.getDimensions(u),g=m==="y",y=g?"top":"left",v=g?"bottom":"right",S=g?"clientHeight":"clientWidth",b=i.reference[w]+i.reference[m]-h[m]-i.floating[w],C=h[m]-i.reference[m],R=await(c.getOffsetParent==null?void 0:c.getOffsetParent(u));let E=R?R[S]:0;(!E||!await(c.isElement==null?void 0:c.isElement(R)))&&(E=s.floating[S]||i.floating[w]);const O=b/2-C/2,_=E/2-f[w]/2-1,I=de(p[y],_),j=de(p[v],_),F=I,L=E-f[w]-j,N=E/2-f[w]/2+O,V=Mt(F,N,L),T=!l.arrow&&Me(r)!=null&&N!==V&&i.reference[w]/2-(NN<=0)){var j,F;const N=(((j=i.flip)==null?void 0:j.index)||0)+1,V=E[N];if(V&&(!(p==="alignment"?v!==oe(V):!1)||I.every(A=>oe(A.placement)===v?A.overflows[0]>0:!0)))return{data:{index:N,overflows:I},reset:{placement:V}};let T=(F=I.filter(D=>D.overflows[0]<=0).sort((D,A)=>D.overflows[1]-A.overflows[1])[0])==null?void 0:F.placement;if(!T)switch(m){case"bestFit":{var L;const D=(L=I.filter(A=>{if(R){const W=oe(A.placement);return W===v||W==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(W=>W>0).reduce((W,X)=>W+X,0)]).sort((A,W)=>A[1]-W[1])[0])==null?void 0:L[0];D&&(T=D);break}case"initialPlacement":T=s;break}if(r!==T)return{reset:{placement:T}}}return{}}}};function En(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Rn(e){return gs.some(t=>e[t]>=0)}const Ns=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:o="referenceHidden",...r}=ce(e,t);switch(o){case"referenceHidden":{const i=await $e(t,{...r,elementContext:"reference"}),c=En(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Rn(c)}}}case"escaped":{const i=await $e(t,{...r,altBoundary:!0}),c=En(i,n.floating);return{data:{escapedOffsets:c,escaped:Rn(c)}}}default:return{}}}}},ho=new Set(["left","top"]);async function Is(e,t){const{placement:n,platform:o,elements:r}=e,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),c=ae(n),s=Me(n),l=oe(n)==="y",u=ho.has(c)?-1:1,d=i&&l?-1:1,p=ce(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:w}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return s&&typeof w=="number"&&(m=s==="end"?w*-1:w),l?{x:m*d,y:h*u}:{x:h*u,y:m*d}}const Ds=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:i,placement:c,middlewareData:s}=t,l=await Is(t,e);return c===((n=s.offset)==null?void 0:n.placement)&&(o=s.arrow)!=null&&o.alignmentOffset?{}:{x:r+l.x,y:i+l.y,data:{...l,placement:c}}}}},_s=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:s={fn:g=>{let{x:y,y:v}=g;return{x:y,y:v}}},...l}=ce(e,t),u={x:n,y:o},d=await $e(t,l),p=oe(ae(r)),h=Gt(p);let m=u[h],w=u[p];if(i){const g=h==="y"?"top":"left",y=h==="y"?"bottom":"right",v=m+d[g],S=m-d[y];m=Mt(v,m,S)}if(c){const g=p==="y"?"top":"left",y=p==="y"?"bottom":"right",v=w+d[g],S=w-d[y];w=Mt(v,w,S)}const f=s.fn({...t,[h]:m,[p]:w});return{...f,data:{x:f.x-n,y:f.y-o,enabled:{[h]:i,[p]:c}}}}}},Ms=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:i,middlewareData:c}=t,{offset:s=0,mainAxis:l=!0,crossAxis:u=!0}=ce(e,t),d={x:n,y:o},p=oe(r),h=Gt(p);let m=d[h],w=d[p];const f=ce(s,t),g=typeof f=="number"?{mainAxis:f,crossAxis:0}:{mainAxis:0,crossAxis:0,...f};if(l){const S=h==="y"?"height":"width",b=i.reference[h]-i.floating[S]+g.mainAxis,C=i.reference[h]+i.reference[S]-g.mainAxis;mC&&(m=C)}if(u){var y,v;const S=h==="y"?"width":"height",b=ho.has(ae(r)),C=i.reference[p]-i.floating[S]+(b&&((y=c.offset)==null?void 0:y[p])||0)+(b?0:g.crossAxis),R=i.reference[p]+i.reference[S]+(b?0:((v=c.offset)==null?void 0:v[p])||0)-(b?g.crossAxis:0);wR&&(w=R)}return{[h]:m,[p]:w}}}},Ls=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:i,platform:c,elements:s}=t,{apply:l=()=>{},...u}=ce(e,t),d=await $e(t,u),p=ae(r),h=Me(r),m=oe(r)==="y",{width:w,height:f}=i.floating;let g,y;p==="top"||p==="bottom"?(g=p,y=h===(await(c.isRTL==null?void 0:c.isRTL(s.floating))?"start":"end")?"left":"right"):(y=p,g=h==="end"?"top":"bottom");const v=f-d.top-d.bottom,S=w-d.left-d.right,b=de(f-d[g],v),C=de(w-d[y],S),R=!t.middlewareData.shift;let E=b,O=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=S),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(E=v),R&&!h){const I=G(d.left,0),j=G(d.right,0),F=G(d.top,0),L=G(d.bottom,0);m?O=w-2*(I!==0||j!==0?I+j:G(d.left,d.right)):E=f-2*(F!==0||L!==0?F+L:G(d.top,d.bottom))}await l({...t,availableWidth:O,availableHeight:E});const _=await c.getDimensions(s.floating);return w!==_.width||f!==_.height?{reset:{rects:!0}}:{}}}};function dt(){return typeof window<"u"}function Le(e){return go(e)?(e.nodeName||"").toLowerCase():"#document"}function q(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function se(e){var t;return(t=(go(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function go(e){return dt()?e instanceof Node||e instanceof q(e).Node:!1}function J(e){return dt()?e instanceof Element||e instanceof q(e).Element:!1}function ie(e){return dt()?e instanceof HTMLElement||e instanceof q(e).HTMLElement:!1}function Pn(e){return!dt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof q(e).ShadowRoot}const ks=new Set(["inline","contents"]);function Ue(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=ee(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!ks.has(r)}const js=new Set(["table","td","th"]);function Fs(e){return js.has(Le(e))}const Ws=[":popover-open",":modal"];function pt(e){return Ws.some(t=>{try{return e.matches(t)}catch{return!1}})}const $s=["transform","translate","scale","rotate","perspective"],Bs=["transform","translate","scale","rotate","perspective","filter"],Vs=["paint","layout","strict","content"];function Qt(e){const t=Jt(),n=J(e)?ee(e):e;return $s.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Bs.some(o=>(n.willChange||"").includes(o))||Vs.some(o=>(n.contain||"").includes(o))}function Hs(e){let t=pe(e);for(;ie(t)&&!De(t);){if(Qt(t))return t;if(pt(t))return null;t=pe(t)}return null}function Jt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Us=new Set(["html","body","#document"]);function De(e){return Us.has(Le(e))}function ee(e){return q(e).getComputedStyle(e)}function mt(e){return J(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function pe(e){if(Le(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Pn(e)&&e.host||se(e);return Pn(t)?t.host:t}function vo(e){const t=pe(e);return De(t)?e.ownerDocument?e.ownerDocument.body:e.body:ie(t)&&Ue(t)?t:vo(t)}function Be(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=vo(e),i=r===((o=e.ownerDocument)==null?void 0:o.body),c=q(r);if(i){const s=kt(c);return t.concat(c,c.visualViewport||[],Ue(r)?r:[],s&&n?Be(s):[])}return t.concat(r,Be(r,[],n))}function kt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function yo(e){const t=ee(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=ie(e),i=r?e.offsetWidth:n,c=r?e.offsetHeight:o,s=ot(n)!==i||ot(o)!==c;return s&&(n=i,o=c),{width:n,height:o,$:s}}function en(e){return J(e)?e:e.contextElement}function Ie(e){const t=en(e);if(!ie(t))return re(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=yo(t);let c=(i?ot(n.width):n.width)/o,s=(i?ot(n.height):n.height)/r;return(!c||!Number.isFinite(c))&&(c=1),(!s||!Number.isFinite(s))&&(s=1),{x:c,y:s}}const zs=re(0);function wo(e){const t=q(e);return!Jt()||!t.visualViewport?zs:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ks(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==q(e)?!1:t}function be(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=en(e);let c=re(1);t&&(o?J(o)&&(c=Ie(o)):c=Ie(e));const s=Ks(i,n,o)?wo(i):re(0);let l=(r.left+s.x)/c.x,u=(r.top+s.y)/c.y,d=r.width/c.x,p=r.height/c.y;if(i){const h=q(i),m=o&&J(o)?q(o):o;let w=h,f=kt(w);for(;f&&o&&m!==w;){const g=Ie(f),y=f.getBoundingClientRect(),v=ee(f),S=y.left+(f.clientLeft+parseFloat(v.paddingLeft))*g.x,b=y.top+(f.clientTop+parseFloat(v.paddingTop))*g.y;l*=g.x,u*=g.y,d*=g.x,p*=g.y,l+=S,u+=b,w=q(f),f=kt(w)}}return it({width:d,height:p,x:l,y:u})}function ht(e,t){const n=mt(e).scrollLeft;return t?t.left+n:be(se(e)).left+n}function xo(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-ht(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function Ys(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i=r==="fixed",c=se(o),s=t?pt(t.floating):!1;if(o===c||s&&i)return n;let l={scrollLeft:0,scrollTop:0},u=re(1);const d=re(0),p=ie(o);if((p||!p&&!i)&&((Le(o)!=="body"||Ue(c))&&(l=mt(o)),ie(o))){const m=be(o);u=Ie(o),d.x=m.x+o.clientLeft,d.y=m.y+o.clientTop}const h=c&&!p&&!i?xo(c,l):re(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+h.x,y:n.y*u.y-l.scrollTop*u.y+d.y+h.y}}function Xs(e){return Array.from(e.getClientRects())}function Gs(e){const t=se(e),n=mt(e),o=e.ownerDocument.body,r=G(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=G(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let c=-n.scrollLeft+ht(e);const s=-n.scrollTop;return ee(o).direction==="rtl"&&(c+=G(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:c,y:s}}const An=25;function qs(e,t){const n=q(e),o=se(e),r=n.visualViewport;let i=o.clientWidth,c=o.clientHeight,s=0,l=0;if(r){i=r.width,c=r.height;const d=Jt();(!d||d&&t==="fixed")&&(s=r.offsetLeft,l=r.offsetTop)}const u=ht(o);if(u<=0){const d=o.ownerDocument,p=d.body,h=getComputedStyle(p),m=d.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,w=Math.abs(o.clientWidth-p.clientWidth-m);w<=An&&(i-=w)}else u<=An&&(i+=u);return{width:i,height:c,x:s,y:l}}const Zs=new Set(["absolute","fixed"]);function Qs(e,t){const n=be(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=ie(e)?Ie(e):re(1),c=e.clientWidth*i.x,s=e.clientHeight*i.y,l=r*i.x,u=o*i.y;return{width:c,height:s,x:l,y:u}}function On(e,t,n){let o;if(t==="viewport")o=qs(e,n);else if(t==="document")o=Gs(se(e));else if(J(t))o=Qs(t,n);else{const r=wo(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return it(o)}function So(e,t){const n=pe(e);return n===t||!J(n)||De(n)?!1:ee(n).position==="fixed"||So(n,t)}function Js(e,t){const n=t.get(e);if(n)return n;let o=Be(e,[],!1).filter(s=>J(s)&&Le(s)!=="body"),r=null;const i=ee(e).position==="fixed";let c=i?pe(e):e;for(;J(c)&&!De(c);){const s=ee(c),l=Qt(c);!l&&s.position==="fixed"&&(r=null),(i?!l&&!r:!l&&s.position==="static"&&!!r&&Zs.has(r.position)||Ue(c)&&!l&&So(e,c))?o=o.filter(d=>d!==c):r=s,c=pe(c)}return t.set(e,o),o}function ec(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const c=[...n==="clippingAncestors"?pt(t)?[]:Js(t,this._c):[].concat(n),o],s=c[0],l=c.reduce((u,d)=>{const p=On(t,d,r);return u.top=G(p.top,u.top),u.right=de(p.right,u.right),u.bottom=de(p.bottom,u.bottom),u.left=G(p.left,u.left),u},On(t,s,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function tc(e){const{width:t,height:n}=yo(e);return{width:t,height:n}}function nc(e,t,n){const o=ie(t),r=se(t),i=n==="fixed",c=be(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=re(0);function u(){l.x=ht(r)}if(o||!o&&!i)if((Le(t)!=="body"||Ue(r))&&(s=mt(t)),o){const m=be(t,!0,i,t);l.x=m.x+t.clientLeft,l.y=m.y+t.clientTop}else r&&u();i&&!o&&r&&u();const d=r&&!o&&!i?xo(r,s):re(0),p=c.left+s.scrollLeft-l.x-d.x,h=c.top+s.scrollTop-l.y-d.y;return{x:p,y:h,width:c.width,height:c.height}}function Nt(e){return ee(e).position==="static"}function Tn(e,t){if(!ie(e)||ee(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return se(e)===n&&(n=n.ownerDocument.body),n}function bo(e,t){const n=q(e);if(pt(e))return n;if(!ie(e)){let r=pe(e);for(;r&&!De(r);){if(J(r)&&!Nt(r))return r;r=pe(r)}return n}let o=Tn(e,t);for(;o&&Fs(o)&&Nt(o);)o=Tn(o,t);return o&&De(o)&&Nt(o)&&!Qt(o)?n:o||Hs(e)||n}const oc=async function(e){const t=this.getOffsetParent||bo,n=this.getDimensions,o=await n(e.floating);return{reference:nc(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function rc(e){return ee(e).direction==="rtl"}const ic={convertOffsetParentRelativeRectToViewportRelativeRect:Ys,getDocumentElement:se,getClippingRect:ec,getOffsetParent:bo,getElementRects:oc,getClientRects:Xs,getDimensions:tc,getScale:Ie,isElement:J,isRTL:rc};function Co(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function sc(e,t){let n=null,o;const r=se(e);function i(){var s;clearTimeout(o),(s=n)==null||s.disconnect(),n=null}function c(s,l){s===void 0&&(s=!1),l===void 0&&(l=1),i();const u=e.getBoundingClientRect(),{left:d,top:p,width:h,height:m}=u;if(s||t(),!h||!m)return;const w=qe(p),f=qe(r.clientWidth-(d+h)),g=qe(r.clientHeight-(p+m)),y=qe(d),S={rootMargin:-w+"px "+-f+"px "+-g+"px "+-y+"px",threshold:G(0,de(1,l))||1};let b=!0;function C(R){const E=R[0].intersectionRatio;if(E!==l){if(!b)return c();E?c(!1,E):o=setTimeout(()=>{c(!1,1e-7)},1e3)}E===1&&!Co(u,e.getBoundingClientRect())&&c(),b=!1}try{n=new IntersectionObserver(C,{...S,root:r.ownerDocument})}catch{n=new IntersectionObserver(C,S)}n.observe(e)}return c(!0),i}function cc(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,u=en(e),d=r||i?[...u?Be(u):[],...Be(t)]:[];d.forEach(y=>{r&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const p=u&&s?sc(u,n):null;let h=-1,m=null;c&&(m=new ResizeObserver(y=>{let[v]=y;v&&v.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var S;(S=m)==null||S.observe(t)})),n()}),u&&!l&&m.observe(u),m.observe(t));let w,f=l?be(e):null;l&&g();function g(){const y=be(e);f&&!Co(f,y)&&n(),f=y,w=requestAnimationFrame(g)}return n(),()=>{var y;d.forEach(v=>{r&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),p?.(),(y=m)==null||y.disconnect(),m=null,l&&cancelAnimationFrame(w)}}const ac=Ds,lc=_s,uc=Ts,fc=Ls,dc=Ns,Nn=Os,pc=Ms,mc=(e,t,n)=>{const o=new Map,r={platform:ic,...n},i={...r.platform,_c:o};return As(e,t,{...r,platform:i})};var hc=typeof document<"u",gc=function(){},Je=hc?a.useLayoutEffect:gc;function st(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!st(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const i=r[o];if(!(i==="_owner"&&e.$$typeof)&&!st(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Eo(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function In(e,t){const n=Eo(e);return Math.round(t*n)/n}function It(e){const t=a.useRef(e);return Je(()=>{t.current=e}),t}function vc(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:i,floating:c}={},transform:s=!0,whileElementsMounted:l,open:u}=e,[d,p]=a.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=a.useState(o);st(h,o)||m(o);const[w,f]=a.useState(null),[g,y]=a.useState(null),v=a.useCallback(A=>{A!==R.current&&(R.current=A,f(A))},[]),S=a.useCallback(A=>{A!==E.current&&(E.current=A,y(A))},[]),b=i||w,C=c||g,R=a.useRef(null),E=a.useRef(null),O=a.useRef(d),_=l!=null,I=It(l),j=It(r),F=It(u),L=a.useCallback(()=>{if(!R.current||!E.current)return;const A={placement:t,strategy:n,middleware:h};j.current&&(A.platform=j.current),mc(R.current,E.current,A).then(W=>{const X={...W,isPositioned:F.current!==!1};N.current&&!st(O.current,X)&&(O.current=X,at.flushSync(()=>{p(X)}))})},[h,t,n,j,F]);Je(()=>{u===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,p(A=>({...A,isPositioned:!1})))},[u]);const N=a.useRef(!1);Je(()=>(N.current=!0,()=>{N.current=!1}),[]),Je(()=>{if(b&&(R.current=b),C&&(E.current=C),b&&C){if(I.current)return I.current(b,C,L);L()}},[b,C,L,I,_]);const V=a.useMemo(()=>({reference:R,floating:E,setReference:v,setFloating:S}),[v,S]),T=a.useMemo(()=>({reference:b,floating:C}),[b,C]),D=a.useMemo(()=>{const A={position:n,left:0,top:0};if(!T.floating)return A;const W=In(T.floating,d.x),X=In(T.floating,d.y);return s?{...A,transform:"translate("+W+"px, "+X+"px)",...Eo(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:X}},[n,s,T.floating,d.x,d.y]);return a.useMemo(()=>({...d,update:L,refs:V,elements:T,floatingStyles:D}),[d,L,V,T,D])}const yc=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:r}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?Nn({element:o.current,padding:r}).fn(n):{}:o?Nn({element:o,padding:r}).fn(n):{}}}},wc=(e,t)=>({...ac(e),options:[e,t]}),xc=(e,t)=>({...lc(e),options:[e,t]}),Sc=(e,t)=>({...pc(e),options:[e,t]}),bc=(e,t)=>({...uc(e),options:[e,t]}),Cc=(e,t)=>({...fc(e),options:[e,t]}),Ec=(e,t)=>({...dc(e),options:[e,t]}),Rc=(e,t)=>({...yc(e),options:[e,t]});var Pc="Arrow",Ro=a.forwardRef((e,t)=>{const{children:n,width:o=10,height:r=5,...i}=e;return x.jsx(M.svg,{...i,ref:t,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:x.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ro.displayName=Pc;var Ac=Ro,tn="Popper",[Po,Ao]=Ve(tn),[Oc,Oo]=Po(tn),To=e=>{const{__scopePopper:t,children:n}=e,[o,r]=a.useState(null);return x.jsx(Oc,{scope:t,anchor:o,onAnchorChange:r,children:n})};To.displayName=tn;var No="PopperAnchor",Io=a.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...r}=e,i=Oo(No,n),c=a.useRef(null),s=H(t,c),l=a.useRef(null);return a.useEffect(()=>{const u=l.current;l.current=o?.current||c.current,u!==l.current&&i.onAnchorChange(l.current)}),o?null:x.jsx(M.div,{...r,ref:s})});Io.displayName=No;var nn="PopperContent",[Tc,Nc]=Po(nn),Do=a.forwardRef((e,t)=>{const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:i="center",alignOffset:c=0,arrowPadding:s=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:p="partial",hideWhenDetached:h=!1,updatePositionStrategy:m="optimized",onPlaced:w,...f}=e,g=Oo(nn,n),[y,v]=a.useState(null),S=H(t,P=>v(P)),[b,C]=a.useState(null),R=Ln(b),E=R?.width??0,O=R?.height??0,_=o+(i!=="center"?"-"+i:""),I=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},j=Array.isArray(u)?u:[u],F=j.length>0,L={padding:I,boundary:j.filter(Dc),altBoundary:F},{refs:N,floatingStyles:V,placement:T,isPositioned:D,middlewareData:A}=vc({strategy:"fixed",placement:_,whileElementsMounted:(...P)=>cc(...P,{animationFrame:m==="always"}),elements:{reference:g.anchor},middleware:[wc({mainAxis:r+O,alignmentAxis:c}),l&&xc({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?Sc():void 0,...L}),l&&bc({...L}),Cc({...L,apply:({elements:P,rects:U,availableWidth:Y,availableHeight:$})=>{const{width:B,height:z}=U.reference,Z=P.floating.style;Z.setProperty("--radix-popper-available-width",`${Y}px`),Z.setProperty("--radix-popper-available-height",`${$}px`),Z.setProperty("--radix-popper-anchor-width",`${B}px`),Z.setProperty("--radix-popper-anchor-height",`${z}px`)}}),b&&Rc({element:b,padding:s}),_c({arrowWidth:E,arrowHeight:O}),h&&Ec({strategy:"referenceHidden",...L})]}),[W,X]=Lo(T),ge=xe(w);K(()=>{D&&ge?.()},[D,ge]);const je=A.arrow?.x,Fe=A.arrow?.y,le=A.arrow?.centerOffset!==0,[Re,ve]=a.useState();return K(()=>{y&&ve(window.getComputedStyle(y).zIndex)},[y]),x.jsx("div",{ref:N.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:D?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Re,"--radix-popper-transform-origin":[A.transformOrigin?.x,A.transformOrigin?.y].join(" "),...A.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:x.jsx(Tc,{scope:n,placedSide:W,onArrowChange:C,arrowX:je,arrowY:Fe,shouldHideArrow:le,children:x.jsx(M.div,{"data-side":W,"data-align":X,...f,ref:S,style:{...f.style,animation:D?void 0:"none"}})})})});Do.displayName=nn;var _o="PopperArrow",Ic={top:"bottom",right:"left",bottom:"top",left:"right"},Mo=a.forwardRef(function(t,n){const{__scopePopper:o,...r}=t,i=Nc(_o,o),c=Ic[i.placedSide];return x.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:x.jsx(Ac,{...r,ref:n,style:{...r.style,display:"block"}})})});Mo.displayName=_o;function Dc(e){return e!==null}var _c=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:o,middlewareData:r}=t,c=r.arrow?.centerOffset!==0,s=c?0:e.arrowWidth,l=c?0:e.arrowHeight,[u,d]=Lo(n),p={start:"0%",center:"50%",end:"100%"}[d],h=(r.arrow?.x??0)+s/2,m=(r.arrow?.y??0)+l/2;let w="",f="";return u==="bottom"?(w=c?p:`${h}px`,f=`${-l}px`):u==="top"?(w=c?p:`${h}px`,f=`${o.floating.height+l}px`):u==="right"?(w=`${-l}px`,f=c?p:`${m}px`):u==="left"&&(w=`${o.floating.width+l}px`,f=c?p:`${m}px`),{data:{x:w,y:f}}}});function Lo(e){const[t,n="center"]=e.split("-");return[t,n]}var Mc=To,Lc=Io,kc=Do,jc=Mo;function Fc(e){const t=Wc(e),n=a.forwardRef((o,r)=>{const{children:i,...c}=o,s=a.Children.toArray(i),l=s.find(Bc);if(l){const u=l.props.children,d=s.map(p=>p===l?a.Children.count(u)>1?a.Children.only(null):a.isValidElement(u)?u.props.children:null:p);return x.jsx(t,{...c,ref:r,children:a.isValidElement(u)?a.cloneElement(u,void 0,d):null})}return x.jsx(t,{...c,ref:r,children:i})});return n.displayName=`${e}.Slot`,n}function Wc(e){const t=a.forwardRef((n,o)=>{const{children:r,...i}=n;if(a.isValidElement(r)){const c=Hc(r),s=Vc(i,r.props);return r.type!==a.Fragment&&(s.ref=o?_e(o,c):c),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $c=Symbol("radix.slottable");function Bc(e){return a.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$c}function Vc(e,t){const n={...t};for(const o in t){const r=e[o],i=t[o];/^on[A-Z]/.test(o)?r&&i?n[o]=(...s)=>{const l=i(...s);return r(...s),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...i}:o==="className"&&(n[o]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function Hc(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ko=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Uc="VisuallyHidden",jo=a.forwardRef((e,t)=>x.jsx(M.span,{...e,ref:t,style:{...ko,...e.style}}));jo.displayName=Uc;var _a=jo,zc=[" ","Enter","ArrowUp","ArrowDown"],Kc=[" ","Enter"],Ce="Select",[gt,vt,Yc]=Pr(Ce),[ke]=Ve(Ce,[Yc,Ao]),yt=Ao(),[Xc,me]=ke(Ce),[Gc,qc]=ke(Ce),Fo=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:r,onOpenChange:i,value:c,defaultValue:s,onValueChange:l,dir:u,name:d,autoComplete:p,disabled:h,required:m,form:w}=e,f=yt(t),[g,y]=a.useState(null),[v,S]=a.useState(null),[b,C]=a.useState(!1),R=Br(u),[E,O]=et({prop:o,defaultProp:r??!1,onChange:i,caller:Ce}),[_,I]=et({prop:c,defaultProp:s,onChange:l,caller:Ce}),j=a.useRef(null),F=g?w||!!g.closest("form"):!0,[L,N]=a.useState(new Set),V=Array.from(L).map(T=>T.props.value).join(";");return x.jsx(Mc,{...f,children:x.jsxs(Xc,{required:m,scope:t,trigger:g,onTriggerChange:y,valueNode:v,onValueNodeChange:S,valueNodeHasChildren:b,onValueNodeHasChildrenChange:C,contentId:Te(),value:_,onValueChange:I,open:E,onOpenChange:O,dir:R,triggerPointerDownPosRef:j,disabled:h,children:[x.jsx(gt.Provider,{scope:t,children:x.jsx(Gc,{scope:e.__scopeSelect,onNativeOptionAdd:a.useCallback(T=>{N(D=>new Set(D).add(T))},[]),onNativeOptionRemove:a.useCallback(T=>{N(D=>{const A=new Set(D);return A.delete(T),A})},[]),children:n})}),F?x.jsxs(ar,{"aria-hidden":!0,required:m,tabIndex:-1,name:d,autoComplete:p,value:_,onChange:T=>I(T.target.value),disabled:h,form:w,children:[_===void 0?x.jsx("option",{value:""}):null,Array.from(L)]},V):null]})})};Fo.displayName=Ce;var Wo="SelectTrigger",$o=a.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...r}=e,i=yt(n),c=me(Wo,n),s=c.disabled||o,l=H(t,c.onTriggerChange),u=vt(n),d=a.useRef("touch"),[p,h,m]=ur(f=>{const g=u().filter(S=>!S.disabled),y=g.find(S=>S.value===c.value),v=fr(g,f,y);v!==void 0&&c.onValueChange(v.value)}),w=f=>{s||(c.onOpenChange(!0),m()),f&&(c.triggerPointerDownPosRef.current={x:Math.round(f.pageX),y:Math.round(f.pageY)})};return x.jsx(Lc,{asChild:!0,...i,children:x.jsx(M.button,{type:"button",role:"combobox","aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":lr(c.value)?"":void 0,...r,ref:l,onClick:k(r.onClick,f=>{f.currentTarget.focus(),d.current!=="mouse"&&w(f)}),onPointerDown:k(r.onPointerDown,f=>{d.current=f.pointerType;const g=f.target;g.hasPointerCapture(f.pointerId)&&g.releasePointerCapture(f.pointerId),f.button===0&&f.ctrlKey===!1&&f.pointerType==="mouse"&&(w(f),f.preventDefault())}),onKeyDown:k(r.onKeyDown,f=>{const g=p.current!=="";!(f.ctrlKey||f.altKey||f.metaKey)&&f.key.length===1&&h(f.key),!(g&&f.key===" ")&&zc.includes(f.key)&&(w(),f.preventDefault())})})})});$o.displayName=Wo;var Bo="SelectValue",Vo=a.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,children:i,placeholder:c="",...s}=e,l=me(Bo,n),{onValueNodeHasChildrenChange:u}=l,d=i!==void 0,p=H(t,l.onValueNodeChange);return K(()=>{u(d)},[u,d]),x.jsx(M.span,{...s,ref:p,style:{pointerEvents:"none"},children:lr(l.value)?x.jsx(x.Fragment,{children:c}):i})});Vo.displayName=Bo;var Zc="SelectIcon",Ho=a.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...r}=e;return x.jsx(M.span,{"aria-hidden":!0,...r,ref:t,children:o||"▼"})});Ho.displayName=Zc;var Qc="SelectPortal",Uo=e=>x.jsx(Ut,{asChild:!0,...e});Uo.displayName=Qc;var Ee="SelectContent",zo=a.forwardRef((e,t)=>{const n=me(Ee,e.__scopeSelect),[o,r]=a.useState();if(K(()=>{r(new DocumentFragment)},[]),!n.open){const i=o;return i?at.createPortal(x.jsx(Ko,{scope:e.__scopeSelect,children:x.jsx(gt.Slot,{scope:e.__scopeSelect,children:x.jsx("div",{children:e.children})})}),i):null}return x.jsx(Yo,{...e,ref:t})});zo.displayName=Ee;var Q=10,[Ko,he]=ke(Ee),Jc="SelectContentImpl",ea=Fc("SelectContent.RemoveScroll"),Yo=a.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:i,onPointerDownOutside:c,side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:h,collisionPadding:m,sticky:w,hideWhenDetached:f,avoidCollisions:g,...y}=e,v=me(Ee,n),[S,b]=a.useState(null),[C,R]=a.useState(null),E=H(t,P=>b(P)),[O,_]=a.useState(null),[I,j]=a.useState(null),F=vt(n),[L,N]=a.useState(!1),V=a.useRef(!1);a.useEffect(()=>{if(S)return qn(S)},[S]),Bn();const T=a.useCallback(P=>{const[U,...Y]=F().map(z=>z.ref.current),[$]=Y.slice(-1),B=document.activeElement;for(const z of P)if(z===B||(z?.scrollIntoView({block:"nearest"}),z===U&&C&&(C.scrollTop=0),z===$&&C&&(C.scrollTop=C.scrollHeight),z?.focus(),document.activeElement!==B))return},[F,C]),D=a.useCallback(()=>T([O,S]),[T,O,S]);a.useEffect(()=>{L&&D()},[L,D]);const{onOpenChange:A,triggerPointerDownPosRef:W}=v;a.useEffect(()=>{if(S){let P={x:0,y:0};const U=$=>{P={x:Math.abs(Math.round($.pageX)-(W.current?.x??0)),y:Math.abs(Math.round($.pageY)-(W.current?.y??0))}},Y=$=>{P.x<=10&&P.y<=10?$.preventDefault():S.contains($.target)||A(!1),document.removeEventListener("pointermove",U),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",U),document.addEventListener("pointerup",Y,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",U),document.removeEventListener("pointerup",Y,{capture:!0})}}},[S,A,W]),a.useEffect(()=>{const P=()=>A(!1);return window.addEventListener("blur",P),window.addEventListener("resize",P),()=>{window.removeEventListener("blur",P),window.removeEventListener("resize",P)}},[A]);const[X,ge]=ur(P=>{const U=F().filter(B=>!B.disabled),Y=U.find(B=>B.ref.current===document.activeElement),$=fr(U,P,Y);$&&setTimeout(()=>$.ref.current.focus())}),je=a.useCallback((P,U,Y)=>{const $=!V.current&&!Y;(v.value!==void 0&&v.value===U||$)&&(_(P),$&&(V.current=!0))},[v.value]),Fe=a.useCallback(()=>S?.focus(),[S]),le=a.useCallback((P,U,Y)=>{const $=!V.current&&!Y;(v.value!==void 0&&v.value===U||$)&&j(P)},[v.value]),Re=o==="popper"?jt:Xo,ve=Re===jt?{side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:h,collisionPadding:m,sticky:w,hideWhenDetached:f,avoidCollisions:g}:{};return x.jsx(Ko,{scope:n,content:S,viewport:C,onViewportChange:R,itemRefCallback:je,selectedItem:O,onItemLeave:Fe,itemTextRefCallback:le,focusSelectedItem:D,selectedItemText:I,position:o,isPositioned:L,searchRef:X,children:x.jsx(zt,{as:ea,allowPinchZoom:!0,children:x.jsx(Ht,{asChild:!0,trapped:v.open,onMountAutoFocus:P=>{P.preventDefault()},onUnmountAutoFocus:k(r,P=>{v.trigger?.focus({preventScroll:!0}),P.preventDefault()}),children:x.jsx(lt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:P=>P.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:x.jsx(Re,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:P=>P.preventDefault(),...y,...ve,onPlaced:()=>N(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:k(y.onKeyDown,P=>{const U=P.ctrlKey||P.altKey||P.metaKey;if(P.key==="Tab"&&P.preventDefault(),!U&&P.key.length===1&&ge(P.key),["ArrowUp","ArrowDown","Home","End"].includes(P.key)){let $=F().filter(B=>!B.disabled).map(B=>B.ref.current);if(["ArrowUp","End"].includes(P.key)&&($=$.slice().reverse()),["ArrowUp","ArrowDown"].includes(P.key)){const B=P.target,z=$.indexOf(B);$=$.slice(z+1)}setTimeout(()=>T($)),P.preventDefault()}})})})})})})});Yo.displayName=Jc;var ta="SelectItemAlignedPosition",Xo=a.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...r}=e,i=me(Ee,n),c=he(Ee,n),[s,l]=a.useState(null),[u,d]=a.useState(null),p=H(t,E=>d(E)),h=vt(n),m=a.useRef(!1),w=a.useRef(!0),{viewport:f,selectedItem:g,selectedItemText:y,focusSelectedItem:v}=c,S=a.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&u&&f&&g&&y){const E=i.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),_=i.valueNode.getBoundingClientRect(),I=y.getBoundingClientRect();if(i.dir!=="rtl"){const B=I.left-O.left,z=_.left-B,Z=E.left-z,ye=E.width+Z,xt=Math.max(ye,O.width),St=window.innerWidth-Q,bt=an(z,[Q,Math.max(Q,St-xt)]);s.style.minWidth=ye+"px",s.style.left=bt+"px"}else{const B=O.right-I.right,z=window.innerWidth-_.right-B,Z=window.innerWidth-E.right-z,ye=E.width+Z,xt=Math.max(ye,O.width),St=window.innerWidth-Q,bt=an(z,[Q,Math.max(Q,St-xt)]);s.style.minWidth=ye+"px",s.style.right=bt+"px"}const j=h(),F=window.innerHeight-Q*2,L=f.scrollHeight,N=window.getComputedStyle(u),V=parseInt(N.borderTopWidth,10),T=parseInt(N.paddingTop,10),D=parseInt(N.borderBottomWidth,10),A=parseInt(N.paddingBottom,10),W=V+T+L+A+D,X=Math.min(g.offsetHeight*5,W),ge=window.getComputedStyle(f),je=parseInt(ge.paddingTop,10),Fe=parseInt(ge.paddingBottom,10),le=E.top+E.height/2-Q,Re=F-le,ve=g.offsetHeight/2,P=g.offsetTop+ve,U=V+T+P,Y=W-U;if(U<=le){const B=j.length>0&&g===j[j.length-1].ref.current;s.style.bottom="0px";const z=u.clientHeight-f.offsetTop-f.offsetHeight,Z=Math.max(Re,ve+(B?Fe:0)+z+D),ye=U+Z;s.style.height=ye+"px"}else{const B=j.length>0&&g===j[0].ref.current;s.style.top="0px";const Z=Math.max(le,V+f.offsetTop+(B?je:0)+ve)+Y;s.style.height=Z+"px",f.scrollTop=U-le+f.offsetTop}s.style.margin=`${Q}px 0`,s.style.minHeight=X+"px",s.style.maxHeight=F+"px",o?.(),requestAnimationFrame(()=>m.current=!0)}},[h,i.trigger,i.valueNode,s,u,f,g,y,i.dir,o]);K(()=>S(),[S]);const[b,C]=a.useState();K(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const R=a.useCallback(E=>{E&&w.current===!0&&(S(),v?.(),w.current=!1)},[S,v]);return x.jsx(oa,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:m,onScrollButtonChange:R,children:x.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:b},children:x.jsx(M.div,{...r,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});Xo.displayName=ta;var na="SelectPopperPosition",jt=a.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:r=Q,...i}=e,c=yt(n);return x.jsx(kc,{...c,...i,ref:t,align:o,collisionPadding:r,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});jt.displayName=na;var[oa,on]=ke(Ee,{}),Ft="SelectViewport",Go=a.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...r}=e,i=he(Ft,n),c=on(Ft,n),s=H(t,i.onViewportChange),l=a.useRef(0);return x.jsxs(x.Fragment,{children:[x.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),x.jsx(gt.Slot,{scope:n,children:x.jsx(M.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:k(r.onScroll,u=>{const d=u.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:h}=c;if(h?.current&&p){const m=Math.abs(l.current-d.scrollTop);if(m>0){const w=window.innerHeight-Q*2,f=parseFloat(p.style.minHeight),g=parseFloat(p.style.height),y=Math.max(f,g);if(y0?b:0,p.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});Go.displayName=Ft;var qo="SelectGroup",[ra,ia]=ke(qo),sa=a.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Te();return x.jsx(ra,{scope:n,id:r,children:x.jsx(M.div,{role:"group","aria-labelledby":r,...o,ref:t})})});sa.displayName=qo;var Zo="SelectLabel",Qo=a.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=ia(Zo,n);return x.jsx(M.div,{id:r.id,...o,ref:t})});Qo.displayName=Zo;var ct="SelectItem",[ca,Jo]=ke(ct),er=a.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:r=!1,textValue:i,...c}=e,s=me(ct,n),l=he(ct,n),u=s.value===o,[d,p]=a.useState(i??""),[h,m]=a.useState(!1),w=H(t,v=>l.itemRefCallback?.(v,o,r)),f=Te(),g=a.useRef("touch"),y=()=>{r||(s.onValueChange(o),s.onOpenChange(!1))};if(o==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return x.jsx(ca,{scope:n,value:o,disabled:r,textId:f,isSelected:u,onItemTextChange:a.useCallback(v=>{p(S=>S||(v?.textContent??"").trim())},[]),children:x.jsx(gt.ItemSlot,{scope:n,value:o,disabled:r,textValue:d,children:x.jsx(M.div,{role:"option","aria-labelledby":f,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...c,ref:w,onFocus:k(c.onFocus,()=>m(!0)),onBlur:k(c.onBlur,()=>m(!1)),onClick:k(c.onClick,()=>{g.current!=="mouse"&&y()}),onPointerUp:k(c.onPointerUp,()=>{g.current==="mouse"&&y()}),onPointerDown:k(c.onPointerDown,v=>{g.current=v.pointerType}),onPointerMove:k(c.onPointerMove,v=>{g.current=v.pointerType,r?l.onItemLeave?.():g.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:k(c.onPointerLeave,v=>{v.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:k(c.onKeyDown,v=>{l.searchRef?.current!==""&&v.key===" "||(Kc.includes(v.key)&&y(),v.key===" "&&v.preventDefault())})})})})});er.displayName=ct;var We="SelectItemText",tr=a.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,...i}=e,c=me(We,n),s=he(We,n),l=Jo(We,n),u=qc(We,n),[d,p]=a.useState(null),h=H(t,y=>p(y),l.onItemTextChange,y=>s.itemTextRefCallback?.(y,l.value,l.disabled)),m=d?.textContent,w=a.useMemo(()=>x.jsx("option",{value:l.value,disabled:l.disabled,children:m},l.value),[l.disabled,l.value,m]),{onNativeOptionAdd:f,onNativeOptionRemove:g}=u;return K(()=>(f(w),()=>g(w)),[f,g,w]),x.jsxs(x.Fragment,{children:[x.jsx(M.span,{id:l.textId,...i,ref:h}),l.isSelected&&c.valueNode&&!c.valueNodeHasChildren?at.createPortal(i.children,c.valueNode):null]})});tr.displayName=We;var nr="SelectItemIndicator",or=a.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return Jo(nr,n).isSelected?x.jsx(M.span,{"aria-hidden":!0,...o,ref:t}):null});or.displayName=nr;var Wt="SelectScrollUpButton",rr=a.forwardRef((e,t)=>{const n=he(Wt,e.__scopeSelect),o=on(Wt,e.__scopeSelect),[r,i]=a.useState(!1),c=H(t,o.onScrollButtonChange);return K(()=>{if(n.viewport&&n.isPositioned){let s=function(){const u=l.scrollTop>0;i(u)};const l=n.viewport;return s(),l.addEventListener("scroll",s),()=>l.removeEventListener("scroll",s)}},[n.viewport,n.isPositioned]),r?x.jsx(sr,{...e,ref:c,onAutoScroll:()=>{const{viewport:s,selectedItem:l}=n;s&&l&&(s.scrollTop=s.scrollTop-l.offsetHeight)}}):null});rr.displayName=Wt;var $t="SelectScrollDownButton",ir=a.forwardRef((e,t)=>{const n=he($t,e.__scopeSelect),o=on($t,e.__scopeSelect),[r,i]=a.useState(!1),c=H(t,o.onScrollButtonChange);return K(()=>{if(n.viewport&&n.isPositioned){let s=function(){const u=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)l.removeEventListener("scroll",s)}},[n.viewport,n.isPositioned]),r?x.jsx(sr,{...e,ref:c,onAutoScroll:()=>{const{viewport:s,selectedItem:l}=n;s&&l&&(s.scrollTop=s.scrollTop+l.offsetHeight)}}):null});ir.displayName=$t;var sr=a.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...r}=e,i=he("SelectScrollButton",n),c=a.useRef(null),s=vt(n),l=a.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return a.useEffect(()=>()=>l(),[l]),K(()=>{s().find(d=>d.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),x.jsx(M.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:k(r.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(o,50))}),onPointerMove:k(r.onPointerMove,()=>{i.onItemLeave?.(),c.current===null&&(c.current=window.setInterval(o,50))}),onPointerLeave:k(r.onPointerLeave,()=>{l()})})}),aa="SelectSeparator",cr=a.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return x.jsx(M.div,{"aria-hidden":!0,...o,ref:t})});cr.displayName=aa;var Bt="SelectArrow",la=a.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=yt(n),i=me(Bt,n),c=he(Bt,n);return i.open&&c.position==="popper"?x.jsx(jc,{...r,...o,ref:t}):null});la.displayName=Bt;var ua="SelectBubbleInput",ar=a.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const r=a.useRef(null),i=H(o,r),c=Mn(t);return a.useEffect(()=>{const s=r.current;if(!s)return;const l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(c!==t&&d){const p=new Event("change",{bubbles:!0});d.call(s,t),s.dispatchEvent(p)}},[c,t]),x.jsx(M.select,{...n,style:{...ko,...n.style},ref:i,defaultValue:t})});ar.displayName=ua;function lr(e){return e===""||e===void 0}function ur(e){const t=xe(e),n=a.useRef(""),o=a.useRef(0),r=a.useCallback(c=>{const s=n.current+c;t(s),(function l(u){n.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>l(""),1e3))})(s)},[t]),i=a.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return a.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,r,i]}function fr(e,t,n){const r=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let c=fa(e,Math.max(i,0));r.length===1&&(c=c.filter(u=>u!==n));const l=c.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}function fa(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Ma=Fo,La=$o,ka=Vo,ja=Ho,Fa=Uo,Wa=zo,$a=Go,Ba=Qo,Va=er,Ha=tr,Ua=or,za=rr,Ka=ir,Ya=cr,wt="Checkbox",[da]=Ve(wt),[pa,rn]=da(wt);function ma(e){const{__scopeCheckbox:t,checked:n,children:o,defaultChecked:r,disabled:i,form:c,name:s,onCheckedChange:l,required:u,value:d="on",internal_do_not_use_render:p}=e,[h,m]=et({prop:n,defaultProp:r??!1,onChange:l,caller:wt}),[w,f]=a.useState(null),[g,y]=a.useState(null),v=a.useRef(!1),S=w?!!c||!!w.closest("form"):!0,b={checked:h,disabled:i,setChecked:m,control:w,setControl:f,name:s,form:c,value:d,hasConsumerStoppedPropagationRef:v,required:u,defaultChecked:fe(r)?!1:r,isFormControl:S,bubbleInput:g,setBubbleInput:y};return x.jsx(pa,{scope:t,...b,children:va(p)?p(b):o})}var dr="CheckboxTrigger",pr=a.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...o},r)=>{const{control:i,value:c,disabled:s,checked:l,required:u,setControl:d,setChecked:p,hasConsumerStoppedPropagationRef:h,isFormControl:m,bubbleInput:w}=rn(dr,e),f=H(r,d),g=a.useRef(l);return a.useEffect(()=>{const y=i?.form;if(y){const v=()=>p(g.current);return y.addEventListener("reset",v),()=>y.removeEventListener("reset",v)}},[i,p]),x.jsx(M.button,{type:"button",role:"checkbox","aria-checked":fe(l)?"mixed":l,"aria-required":u,"data-state":vr(l),"data-disabled":s?"":void 0,disabled:s,value:c,...o,ref:f,onKeyDown:k(t,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:k(n,y=>{p(v=>fe(v)?!0:!v),w&&m&&(h.current=y.isPropagationStopped(),h.current||y.stopPropagation())})})});pr.displayName=dr;var ha=a.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:o,checked:r,defaultChecked:i,required:c,disabled:s,value:l,onCheckedChange:u,form:d,...p}=e;return x.jsx(ma,{__scopeCheckbox:n,checked:r,defaultChecked:i,disabled:s,required:c,onCheckedChange:u,name:o,form:d,value:l,internal_do_not_use_render:({isFormControl:h})=>x.jsxs(x.Fragment,{children:[x.jsx(pr,{...p,ref:t,__scopeCheckbox:n}),h&&x.jsx(gr,{__scopeCheckbox:n})]})})});ha.displayName=wt;var mr="CheckboxIndicator",ga=a.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:o,...r}=e,i=rn(mr,n);return x.jsx(He,{present:o||fe(i.checked)||i.checked===!0,children:x.jsx(M.span,{"data-state":vr(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t,style:{pointerEvents:"none",...e.style}})})});ga.displayName=mr;var hr="CheckboxBubbleInput",gr=a.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:o,hasConsumerStoppedPropagationRef:r,checked:i,defaultChecked:c,required:s,disabled:l,name:u,value:d,form:p,bubbleInput:h,setBubbleInput:m}=rn(hr,e),w=H(n,m),f=Mn(i),g=Ln(o);a.useEffect(()=>{const v=h;if(!v)return;const S=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(S,"checked").set,R=!r.current;if(f!==i&&C){const E=new Event("click",{bubbles:R});v.indeterminate=fe(i),C.call(v,fe(i)?!1:i),v.dispatchEvent(E)}},[h,f,i,r]);const y=a.useRef(fe(i)?!1:i);return x.jsx(M.input,{type:"checkbox","aria-hidden":!0,defaultChecked:c??y.current,required:s,disabled:l,name:u,value:d,form:p,...t,tabIndex:-1,ref:w,style:{...t.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});gr.displayName=hr;function va(e){return typeof e=="function"}function fe(e){return e==="indeterminate"}function vr(e){return fe(e)?"indeterminate":e?"checked":"unchecked"}export{ha as $,Ha as A,Ya as B,Ta as C,Ia as D,Ma as E,ka as F,_e as G,Ut as H,ja as I,Ao as J,qn as K,Ba as L,zt as M,Bn as N,Oa as O,M as P,Ht as Q,xa as R,wa as S,Na as T,lt as U,$a as V,Ea as W,kc as X,Mc as Y,Lc as Z,jc as _,Pr as a,ga as a0,kr as a1,_a as a2,ba as a3,jo as a4,Sa as a5,k as b,Ve as c,H as d,Br as e,et as f,xe as g,He as h,K as i,an as j,_n as k,Mn as l,Ln as m,Aa as n,Da as o,Ra as p,Pa as q,Ca as r,La as s,za as t,Te as u,Ka as v,Fa as w,Wa as x,Va as y,Ua as z}; diff --git a/webui/dist/index.html b/webui/dist/index.html index 8f73a47e..494a8c93 100644 --- a/webui/dist/index.html +++ b/webui/dist/index.html @@ -5,8 +5,13 @@ MaiBot Dashboard - - + + + + + + +